Mercurial > hgsubversion
diff hgsubversion/svnmeta.py @ 1471:6bc2a2f61923
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.
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 15 Jun 2016 17:17:56 +0100 |
parents | 32166f557518 |
children | 797c7b58a735 |
line wrap: on
line diff
--- 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]