# HG changeset patch # User Brendan Cully # Date 2007-07-05 19:41:58 # Node ID 1fcdf2fe3d7ca064224114bfa474e12837ac18b2 # Parent a5209b0487e0781ae11548196dab1f3b93cdbcb8 convert: svn: use revmap to parse only new revisions in incremental conversions diff --git a/hgext/convert/common.py b/hgext/convert/common.py --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -22,11 +22,10 @@ class converter_source(object): self.rev = rev self.encoding = 'utf-8' - self.revmap = {} def setrevmap(self, revmap): """set the map of already-converted revisions""" - self.revmap = revmap + pass def getheads(self): """Return a list of this repository's heads""" diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -87,6 +87,8 @@ class convert_svn(converter_source): raise NoRepo(msg) self.encoding = locale.getpreferredencoding() + self.lastrevs = {} + latest = None if rev: try: @@ -455,13 +457,21 @@ class convert_svn(converter_source): receivelog) for entry in received: parselogentry(*entry) - self.last_revnum = to_revnum except SubversionException, (_, num): if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION: raise NoSuchRevision(branch=self, revision="Revision number %d" % to_revnum) raise + def setrevmap(self, revmap): + lastrevs = {} + for revid in revmap.keys(): + uuid, module, revnum = self.revsplit(revid) + lastrevnum = lastrevs.setdefault(module, revnum) + if revnum > lastrevnum: + lastrevs[module] = revnum + self.lastrevs = lastrevs + def getheads(self): # detect standard /branches, /tags, /trunk layout optrev = svn.core.svn_opt_revision_t() @@ -532,7 +542,8 @@ class convert_svn(converter_source): uuid, module, revnum = self.revsplit(rev) self.module = module self.reparent(module) - self._fetch_revisions(from_revnum=revnum, to_revnum=0) + stop = self.lastrevs.get(module, 0) + self._fetch_revisions(from_revnum=revnum, to_revnum=stop) return self.commits[rev] def gettags(self):