Mercurial > hg
changeset 41782:cecdf7418cf1
grep: reuse getrenamedfn() from scmutil
My motivation is to reduce uses of filectx.renamed(). Reusing
scmutil.getrenamedfn() also means that we get some caching of copy
information per file and revision. I don't think that matters for `hg
grep` (I doubt it speeds up significantly, and I doubt it wastes
significant memory), but I'm not sure.
Differential Revision: https://phab.mercurial-scm.org/D6022
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 18 Jan 2019 11:07:46 -0800 |
parents | e9b9ee9af4a9 |
children | 7b04b1154c15 |
files | mercurial/commands.py |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Feb 21 10:54:29 2019 -0800 +++ b/mercurial/commands.py Fri Jan 18 11:07:46 2019 -0800 @@ -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: