Commits

Nicolas Dumazet  committed 2405b4a

revlog: fix descendants() if nullrev is in revs

We were not returning the correct result if nullrev was in revs, as we
are checking parent(currentrev) != nullrev before yielding currentrev

test-convert-hg-startrev was wrong: if we start converting from rev -1 and
onwards, all the descendants of -1 (full repo) should be converted.

  • Participants
  • Parent commits 6878eaa
  • Branches stable

Comments (0)

Files changed (2)

File mercurial/revlog.py

         some rev in revs, i.e., each revision is *not* considered a
         descendant of itself.  Results are ordered by revision number (a
         topological sort)."""
+        first = min(revs)
+        if first == nullrev:
+            for i in self:
+                yield i
+            return
+
         seen = set(revs)
-        for i in xrange(min(revs) + 1, len(self)):
+        for i in xrange(first + 1, len(self)):
             for x in self.parentrevs(i):
                 if x != nullrev and x in seen:
                     seen.add(i)

File tests/test-convert-hg-startrev.t

 
 Convert from null revision
 
-  $ hg convert --config convert.hg.startrev=null source empty
-  initializing destination empty repository
+  $ hg convert --config convert.hg.startrev=null source full
+  initializing destination full repository
   scanning source...
   sorting...
   converting...
+  5 0: add a b
+  4 1: add c
+  3 2: copy e from a, change b
+  2 3: change a
+  1 4: merge 2 and 3, copy d from b
+  0 5: change a
 
-  $ glog empty
+  $ glog full
+  o  5 "5: change a" files: a
+  |
+  o    4 "4: merge 2 and 3, copy d from b" files: d e
+  |\
+  | o  3 "3: change a" files: a
+  | |
+  o |  2 "2: copy e from a, change b" files: b e
+  | |
+  o |  1 "1: add c" files: c
+  |/
+  o  0 "0: add a b" files: a b
+  
+  $ rm -Rf full
 
 Convert from zero revision