convert: fetch less revisions when looking for a branch parent
authorPatrick Mezard <pmezard@gmail.com>
Thu, 17 Jan 2008 23:46:56 +0100
changeset 5875 f1504d3355bb
parent 5874 866aa7ae2612
child 5876 fb93c774dfff
convert: fetch less revisions when looking for a branch parent
hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Thu Jan 17 23:46:56 2008 +0100
+++ b/hgext/convert/subversion.py	Thu Jan 17 23:46:56 2008 +0100
@@ -292,7 +292,15 @@
             uuid, module, revnum = self.revsplit(rev)
             self.module = module
             self.reparent(module)
+            # We assume that:
+            # - requests for revisions after "stop" come from the
+            # revision graph backward traversal. Cache all of them
+            # down to stop, they will be used eventually.
+            # - requests for revisions before "stop" come to get
+            # isolated branches parents. Just fetch what is needed.
             stop = self.lastrevs.get(module, 0)
+            if revnum < stop:
+                stop = revnum + 1
             self._fetch_revisions(revnum, stop)
         commit = self.commits[rev]
         # caller caches the result, so free it here to release memory