Patchwork D5620: grep: don't look up copy info unless --follow is given

login
register
mail settings
Submitter phabricator
Date Jan. 18, 2019, 7:11 p.m.
Message ID <16ed0cd0f66e43181cc9a7321b741108@localhost.localdomain>
Download mbox | patch
Permalink /patch/37880/
State Not Applicable
Headers show

Comments

phabricator - Jan. 18, 2019, 7:11 p.m.
martinvonz updated this revision to Diff 13325.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5620?vs=13317&id=13325

REVISION DETAIL
  https://phab.mercurial-scm.org/D5620

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2945,17 +2945,18 @@ 
                 fnode = ctx.filenode(fn)
             except error.LookupError:
                 continue
-            try:
-                copied = flog.renamed(fnode)
-            except error.WdirUnsupported:
-                copied = ctx[fn].renamed()
-            copy = follow and copied and copied[0]
-            if copy:
-                copies.setdefault(rev, {})[fn] = copy
-            if fn in skip:
+            copy = None
+            if follow:
+                try:
+                    copied = flog.renamed(fnode)
+                except error.WdirUnsupported:
+                    copied = ctx[fn].renamed()
+                copy = copied and copied[0]
                 if copy:
-                    skip[copy] = True
-                continue
+                    copies.setdefault(rev, {})[fn] = copy
+                    if fn in skip:
+                        skip[copy] = True
+                        continue
             files.append(fn)
 
             if fn not in matches[rev]: