Patchwork D6022: grep: reuse getrenamedfn() from scmutil

login
register
mail settings
Submitter phabricator
Date Feb. 24, 2019, 8:25 a.m.
Message ID <9658b3bafc0dff94a9a3d349a1e6d1ac@localhost.localdomain>
Download mbox | patch
Permalink /patch/38907/
State Not Applicable
Headers show

Comments

phabricator - Feb. 24, 2019, 8:25 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGcecdf7418cf1: grep: reuse getrenamedfn() from scmutil (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6022?vs=14210&id=14225

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

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
@@ -2940,6 +2940,7 @@ 
     found = False
     follow = opts.get('follow')
 
+    getrenamed = scmutil.getrenamedfn(repo)
     def prep(ctx, fns):
         rev = ctx.rev()
         pctx = ctx.p1()
@@ -2953,13 +2954,10 @@ 
                 fnode = ctx.filenode(fn)
             except error.LookupError:
                 continue
+
             copy = None
             if follow:
-                try:
-                    copied = flog.renamed(fnode)
-                except error.WdirUnsupported:
-                    copied = ctx[fn].renamed()
-                copy = copied and copied[0]
+                copy = getrenamed(fn, rev)
                 if copy:
                     copies.setdefault(rev, {})[fn] = copy
                     if fn in skip: