Re: [PATCH] Searching in log
Mirek Jezbera <[email protected]> Sun, 13 Jan 2013 18:59:06 +0100
| Newsgroups | gmane.comp.version-control.subversion.rapidsvn.devel |
|---|---|
| Message-ID | <20130113175906.GA15780@titan> |
------=_Part_2076_27497279.1358116320519
Content-Type: multipart/mixed;
boundary="----=_Part_2077_437784048.1358116320519"
Content-Disposition: inline
------=_Part_2077_437784048.1358116320519
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hello Alexander,
it is reasonable to separate migration of configuration from big piece of c=
ode,
that creates index and makes queries on it. IMHO configuration task is good=
,
but for the index stuff I think, that there might be some improvement.
I have tested RapidSVN in my work, where we have quite big repositories.
Showing log for trunk is really slow (about 60000 revisions) and indexing
doubled it for the first time. Searching is fast, database files are
reasonable. But when I reopen log dialog I have to wait again for log opera=
tion
to complete. In SvnX for MacOS it was somehow indexed, so searching was fas=
t
and opening log only retrieves new data. TortoiseSVN on Windows I think ope=
ns
only last log entries and user must click to load next log entries.
I think, that we should think about it. Using index file the SvnX approach =
can
be done, but probably database should contain more fields to hold all svn d=
ata.
Mirek
On So 12.led, Alexander Mueller wrote:
> Hello Mirek,
>=20
> thanks for the post. Sorry I found now time to check the patch and apply=
=20
> or comment it.
>=20
> My first feeling here is, it might be a good idea to split the patch up=
=20
> into several parts, like the migration to a .RapidSVN config directory=20
> into one patch and so on. This makes it easier for me to understand the=
=20
> intent and the implications of the patch in contrast to one monolithic=20
> big patch.
>=20
>=20
> Am 29.12.2012 09:21, schrieb Mirek Jezbera:
> > Hello,
> > I have implemented searching in log. You can search in comments, affect=
ed files
> > or by author. It is implemented using SQLite to index data from reposit=
ory.
> > For rapidsvn repository with 8263 revisions it tooks about 25 seconds t=
o
> > reindex and index file has 2 MB. Because index file is stored in same p=
lace as
> > config file, I have implemented migration code to move config file ~/.R=
apidSVN
> > to ~/.RapidSVN/config.ini.
> > Searching is IMHO quite fast. I have two TODOs in log_dlg.cpp - I don't=
know how
> > to log errors from log dialog.
> > Users without SQLite should compile rapidsvn, but this functionality wi=
ll be
> > hidden.
> > Feel free to comment the code.
------=_Part_2077_437784048.1358116320519
Content-Type: text/x-diff; charset=us-ascii; name=05_config_migration.diff
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=05_config_migration.diff
Index: librapidsvn/include/rapidsvn_config.hpp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- librapidsvn/include/rapidsvn_config.hpp=09(revision 0)
+++ librapidsvn/include/rapidsvn_config.hpp=09(revision 0)
@@ -0,0 +1,42 @@
+/*
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2002-2012 The RapidSVN Group. All rights reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (in the file GPL.txt.
+ * If not, see <http://www.gnu.org/licenses/>.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://rapidsvn.tigris.org/.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+#ifndef _RAPIDSVN_CONFIG_H_INCLUDED_
+#define _RAPIDSVN_CONFIG_H_INCLUDED_
+
+class Config
+{
+public:
+ Config();
+
+ wxConfigBase *GetConfig();
+private:
+ void Init();
+ void CreateDataDirectoryIfMissing();
+ void MigrateOldConfiguration();
+
+ wxString m_userDataDir;
+ wxString m_cacheDir;
+};
+
+#endif // _RAPIDSVN_CONFIG_H_INCLUDED_
Index: librapidsvn/src/main_frame.cpp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- librapidsvn/src/main_frame.cpp=09(revision 8263)
+++ librapidsvn/src/main_frame.cpp=09(working copy)
@@ -42,6 +42,7 @@
=20
// app
#include "rapidsvn_app.hpp"
+#include "rapidsvn_config.hpp"
#include "columns.hpp"
#include "config.hpp"
#include "destination_dlg.hpp"
@@ -664,7 +665,8 @@
// Retrieve a pointer to the application configuration object.
// If the object is not created, it will be created upon the first
// call to Get().
- wxConfigBase *cfg =3D wxConfigBase::Get();
+ Config rapidSvnConfig;
+ wxConfigBase *cfg =3D rapidSvnConfig.GetConfig();
=20
// Now set icons for the application
// (several sizes are available OS/windowing system
Index: librapidsvn/src/rapidsvn_config.cpp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- librapidsvn/src/rapidsvn_config.cpp=09(revision 0)
+++ librapidsvn/src/rapidsvn_config.cpp=09(revision 0)
@@ -0,0 +1,97 @@
+/*
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ * Copyright (c) 2002-2012 The RapidSVN Group. All rights reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (in the file GPL.txt.
+ * If not, see <http://www.gnu.org/licenses/>.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://rapidsvn.tigris.org/.
+ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+ */
+// wxWidgets
+#include "wx/wx.h"
+#include "wx/dir.h"
+#include "wx/file.h"
+#include "wx/fileconf.h"
+#include "wx/stdpaths.h"
+
+// app
+#include "rapidsvn_config.hpp"
+#include "version.hpp"
+#include "utils.hpp"
+
+#define APP_CONFIG wxT("config.ini")
+#define CACHE_DIR wxT("cache")
+
+Config::Config()
+{
+ Init();
+}
+
+wxConfigBase *
+Config::GetConfig()
+{
+ return wxConfigBase::Get();
+}
+
+void
+Config::Init()
+{
+ m_userDataDir =3D wxStandardPaths::Get().GetUserDataDir();
+ m_cacheDir =3D m_userDataDir + wxT("/") + CACHE_DIR;
+
+ CreateDataDirectoryIfMissing();
+#ifndef _WIN32
+ wxString configFileName =3D m_userDataDir + wxT("/") + APP_CONFIG;
+ wxConfigBase::Set(new wxFileConfig(APPLICATION_NAME, APPLICATION_NAME, c=
onfigFileName));
+#endif
+}
+
+void
+Config::CreateDataDirectoryIfMissing()
+{
+ if (!wxDir::Exists(m_userDataDir))
+ {
+ if (wxFile::Exists(m_userDataDir))
+ {
+ MigrateOldConfiguration();
+ }
+ else
+ {
+ wxMkdir(m_userDataDir);
+ }
+ }
+ if (!wxDir::Exists(m_cacheDir))
+ {
+ wxMkdir(m_cacheDir);
+ }
+}
+
+void
+Config::MigrateOldConfiguration()
+{
+ wxString configFileName =3D m_userDataDir + wxT("/") + APP_CONFIG;
+
+ wxRenameFile(m_userDataDir, m_userDataDir + wxT(".bak"));
+ wxMkdir(m_userDataDir);
+ wxRenameFile(m_userDataDir + wxT(".bak"), configFileName);
+}
+
+/* -----------------------------------------------------------------
+ * local variables:
+ * eval: (load-file "../rapidsvn-dev.el")
+ * end:
+ */
Index: librapidsvn/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- librapidsvn/Makefile.am=09(revision 8263)
+++ librapidsvn/Makefile.am=09(working copy)
@@ -79,6 +79,7 @@
=09include/property_action.hpp \
=09include/property_dlg.hpp \
=09include/rapidsvn_app.hpp \
+=09include/rapidsvn_config.hpp \
=09include/rapidsvn_drop_target.hpp \
=09include/rename_action.hpp \
=09include/report_dlg.hpp \
@@ -266,6 +267,7 @@
=09src/preferences_dlg.cpp \
=09src/property_action.cpp \
=09src/property_dlg.cpp \
+=09src/rapidsvn_config.cpp \
=09src/rapidsvn_drop_target.cpp \
=09src/rapidsvn_generated.cpp \
=09src/rename_action.cpp \
------=_Part_2077_437784048.1358116320519--
------=_Part_2076_27497279.1358116320519
Content-Type: application/pgp-signature; name=signature.asc
Content-Transfer-Encoding: 7bit
Content-Description: Digital signature
Content-Disposition: attachment; filename=signature.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlDy9eoACgkQqyAtJTO7yRLPNwCgh2ni7jRQumpXLJBZqkxreSsA
/SgAn0r29KMZ6SAViZc8Xi3TdSEdleps
=lPzm
-----END PGP SIGNATURE-----
------=_Part_2076_27497279.1358116320519--