convert: svn: use revmap to parse only new revisions in incremental conversions
authorBrendan Cully <brendan@kublai.com>
Thu, 05 Jul 2007 12:41:58 -0700
changeset 4813 1fcdf2fe3d7c
parent 4812 a5209b0487e0
child 4814 744371157212
convert: svn: use revmap to parse only new revisions in incremental conversions
hgext/convert/common.py
hgext/convert/subversion.py
--- a/hgext/convert/common.py	Thu Jul 05 12:24:26 2007 -0700
+++ b/hgext/convert/common.py	Thu Jul 05 12:41:58 2007 -0700
@@ -22,11 +22,10 @@
         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"""
--- a/hgext/convert/subversion.py	Thu Jul 05 12:24:26 2007 -0700
+++ b/hgext/convert/subversion.py	Thu Jul 05 12:41:58 2007 -0700
@@ -87,6 +87,8 @@
             raise NoRepo(msg)
 
         self.encoding = locale.getpreferredencoding()
+        self.lastrevs = {}
+
         latest = None
         if rev:
             try:
@@ -455,13 +457,21 @@
                            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 @@
             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):