changeset 30015:96b2dd3b184d

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.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 24 Sep 2016 19:52:02 +0900
parents d34cf260d15b
children 2963fba2d18a
files mercurial/cmdutil.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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]: