log: unroll loop that populates file paths for --patch --follow matcher
authorYuya Nishihara <yuya@tcha.org>
Sat, 24 Sep 2016 19:52:02 +0900
changeset 30015 96b2dd3b184d
parent 30014 d34cf260d15b
child 30016 2963fba2d18a
log: unroll loop that populates file paths for --patch --follow matcher We can't handle the first fctx in the same manner as its ancestors. Also, I think the original code was too tricky.
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Sun Sep 25 12:20:31 2016 -0700
+++ b/mercurial/cmdutil.py	Sat Sep 24 19:52:02 2016 +0900
@@ -1949,9 +1949,10 @@
 
     def populate():
         for fn in files:
-            for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)):
-                for c in i:
-                    fcache.setdefault(c.linkrev(), set()).add(c.path())
+            fctx = pctx[fn]
+            fcache.setdefault(fctx.linkrev(), set()).add(fctx.path())
+            for c in fctx.ancestors(followfirst=followfirst):
+                fcache.setdefault(c.linkrev(), set()).add(c.path())
 
     def filematcher(rev):
         if not fcacheready[0]: