[Updated] D8544: grep: stop computing information for --diff when unnecessary
valentin.gatienbaron (Valentin Gatien-Baron)
phabricator at mercurial-scm.org
Mon May 18 17:11:58 UTC 2020
Closed by commit rHG8d552701806d: grep: stop computing information for --diff when unnecessary (authored by valentin.gatienbaron).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8544?vs=21408&id=21422
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8544/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8544
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
@@ -3594,9 +3594,10 @@
def prep(ctx, fns):
rev = ctx.rev()
pctx = ctx.p1()
- parent = pctx.rev()
matches.setdefault(rev, {})
- matches.setdefault(parent, {})
+ if diff:
+ parent = pctx.rev()
+ matches.setdefault(parent, {})
files = revfiles.setdefault(rev, [])
for fn in fns:
flog = getfile(fn)
@@ -3620,14 +3621,17 @@
content = get_file_content(fn, flog, fnode, ctx, rev)
grepbody(fn, rev, content)
- pfn = copy or fn
- if pfn not in matches[parent]:
- try:
- pfnode = pctx.filenode(pfn)
- pcontent = get_file_content(pfn, flog, pfnode, pctx, parent)
- grepbody(pfn, parent, pcontent)
- except error.LookupError:
- pass
+ if diff:
+ pfn = copy or fn
+ if pfn not in matches[parent]:
+ try:
+ pfnode = pctx.filenode(pfn)
+ pcontent = get_file_content(
+ pfn, flog, pfnode, pctx, parent
+ )
+ grepbody(pfn, parent, pcontent)
+ except error.LookupError:
+ pass
ui.pager(b'grep')
fm = ui.formatter(b'grep', opts)
To: valentin.gatienbaron, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200518/7fa6fcb9/attachment-0002.html>
More information about the Mercurial-patches
mailing list