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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Jan 18 14:11:40 EST 2019


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

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]:



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


More information about the Mercurial-devel mailing list