[PATCH 1 of 2 STABLE] log: unroll loop that populates file paths for --patch --follow matcher

Yuya Nishihara yuya at tcha.org
Sat Sep 24 14:00:37 UTC 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1474714322 -32400
#      Sat Sep 24 19:52:02 2016 +0900
# Branch stable
# Node ID bf616dd17b4244d4d5fc92b0ada65404596fe4b2
# Parent  e7766022a61a66a7c4218526b647f96bd442a4ce
# EXP-Topic followmatcher
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.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1948,9 +1948,10 @@ def _makefollowlogfilematcher(repo, file
 
     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]:


More information about the Mercurial-devel mailing list