# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1474534126 -32400
#      Thu Sep 22 17:48:46 2016 +0900
# Node ID 383d767942609ea0c7fe1a12abbdf0063d8f7f80
# Parent  79e2137e034bcd8d9707c2e09780f7d1901e4bf0
dagop: yield intro filectx by filectxancestors()

This is the convention of dagop.*ancestors() functions.

diff --git a/mercurial/dagop.py b/mercurial/dagop.py
--- a/mercurial/dagop.py
+++ b/mercurial/dagop.py
@@ -76,7 +76,7 @@ def _walkrevtree(pfunc, revs, startdepth
                     heapq.heappush(pendingheap, (heapsign * prev, pdepth))
 
 def filectxancestors(fctx, followfirst=False):
-    """Like filectx.ancestors()"""
+    """Like filectx.ancestors(), but includes the given fctx itself"""
     visit = {}
     c = fctx
     if followfirst:
@@ -84,6 +84,7 @@ def filectxancestors(fctx, followfirst=F
     else:
         cut = None
 
+    yield c
     while True:
         for parent in c.parents()[:cut]:
             visit[(parent.linkrev(), parent.filenode())] = parent
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -929,11 +929,9 @@ def _follow(repo, subset, x, name, follo
 
         s = set()
         for fname in files:
-            fctx = c[fname]
+            fctx = c[fname].introfilectx()
             a = dagop.filectxancestors(fctx, followfirst)
             s = s.union(set(c.rev() for c in a))
-            # include the revision responsible for the most recent version
-            s.add(fctx.introrev())
     else:
         s = dagop.revancestors(repo, baseset([c.rev()]), followfirst)
 
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to