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

login
register
mail settings
Submitter phabricator
Date Jan. 17, 2019, 4:49 p.m.
Message ID <c01ee0323257cf967adc7883b86e969f@localhost.localdomain>
Download mbox | patch
Permalink /patch/37865/
State Not Applicable
Headers show

Comments

phabricator - Jan. 17, 2019, 4:49 p.m.
martinvonz updated this revision to Diff 13317.

REPOSITORY
  rHG Mercurial

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

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,13 +2945,15 @@ 
                 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
+            copy = None
+            if follow:
+                try:
+                    copied = flog.renamed(fnode)
+                except error.WdirUnsupported:
+                    copied = ctx[fn].renamed()
+                copy = copied and copied[0]
+                if copy:
+                    copies.setdefault(rev, {})[fn] = copy
             if fn in skip:
                 if copy:
                     skip[copy] = True