# HG changeset patch # User Jun Wu # Date 1466007476 -3600 # Node ID 6bc2a2f619231364e12916f94f3d9ff76fb4a412 # Parent b6e2bc9625365c2dfc1487230369f9ed79a20924 svnmeta: add a config option to use sqlite revmap This patch adds a config option to choose the revmap implementation. It's "plain" by default and can be set to "sqlite". The sqlite implementation will migrate data from the plain revmap while the "plain" implementation will complain if it sees the sqlite revmap. A class variable is added for setting the default revmap implementation, which is useful for testing. diff --git a/hgsubversion/help/subversion.rst b/hgsubversion/help/subversion.rst --- a/hgsubversion/help/subversion.rst +++ b/hgsubversion/help/subversion.rst @@ -352,6 +352,16 @@ settings: Password stores are only supported with the SWIG bindings. + ``hgsubversion.revmapimpl`` + + Set the revision map implementation. ``plain`` which is simple and works + well for small repos. ``sqlite`` is a sqlite based implementation that + works better for large repos with a lot of revisions. The default is + ``plain``. + + If it is set to an implementation different from what the repo is using, + a migration will run automatically when the revision map is accessed. + ``hgsubversion.stupid`` Setting this boolean option to true will force using a slower method for pulling revisions from Subversion. This method is compatible with servers diff --git a/hgsubversion/svnmeta.py b/hgsubversion/svnmeta.py --- a/hgsubversion/svnmeta.py +++ b/hgsubversion/svnmeta.py @@ -345,7 +345,7 @@ class SVNMeta(object): @property def revmap(self): if self._revmap is None: - self._revmap = maps.RevMap( + self._revmap = self.revmapclass( self.revmap_file, os.path.join(self.metapath, 'lastpulled')) return self._revmap @@ -353,6 +353,20 @@ class SVNMeta(object): def revmapexists(self): return os.path.exists(self.revmap_file) + _defaultrevmapclass = maps.RevMap + + @property + def revmapclass(self): + impl = self.ui.config('hgsubversion', 'revmapimpl') + if impl == 'plain': + return maps.RevMap + elif impl == 'sqlite': + return maps.SqliteRevMap + elif impl is None: + return self._defaultrevmapclass + else: + raise hgutil.Abort('unknown revmapimpl: %s' % impl) + def fixdate(self, date): if date is not None: date = date.replace('T', ' ').replace('Z', '').split('.')[0]