changeset 35275:b4b328ea6175

dagop: put start fctx into visit dict of filectxancestors() Prepares for multiple start revisions/files.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 22 Sep 2016 18:18:56 +0900
parents 2b348dc3239a
children 205c3c6c1a51
files mercurial/dagop.py
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dagop.py	Thu Sep 22 18:11:37 2016 +0900
+++ b/mercurial/dagop.py	Thu Sep 22 18:18:56 2016 +0900
@@ -84,23 +84,20 @@
             visit[rev] = set()
         visit[rev].add(fctx)
 
-    c = fctx
     if followfirst:
         cut = 1
     else:
         cut = None
 
-    yield c
-    while True:
-        for parent in c.parents()[:cut]:
-            addvisit(parent)
-        if not visit:
-            break
+    addvisit(fctx)
+    while visit:
         rev = max(visit)
         c = visit[rev].pop()
         if not visit[rev]:
             del visit[rev]
         yield c
+        for parent in c.parents()[:cut]:
+            addvisit(parent)
 
 def _genrevancestors(repo, revs, followfirst, startdepth, stopdepth, cutfunc):
     if followfirst: