##// END OF EJS Templates
grep: stop computing information for --diff when unnecessary...
Valentin Gatien-Baron -
r45369:8d552701 default
parent child Browse files
Show More
@@ -3594,9 +3594,10 b' def grep(ui, repo, pattern, *pats, **opt'
3594 def prep(ctx, fns):
3594 def prep(ctx, fns):
3595 rev = ctx.rev()
3595 rev = ctx.rev()
3596 pctx = ctx.p1()
3596 pctx = ctx.p1()
3597 parent = pctx.rev()
3598 matches.setdefault(rev, {})
3597 matches.setdefault(rev, {})
3599 matches.setdefault(parent, {})
3598 if diff:
3599 parent = pctx.rev()
3600 matches.setdefault(parent, {})
3600 files = revfiles.setdefault(rev, [])
3601 files = revfiles.setdefault(rev, [])
3601 for fn in fns:
3602 for fn in fns:
3602 flog = getfile(fn)
3603 flog = getfile(fn)
@@ -3620,14 +3621,17 b' def grep(ui, repo, pattern, *pats, **opt'
3620 content = get_file_content(fn, flog, fnode, ctx, rev)
3621 content = get_file_content(fn, flog, fnode, ctx, rev)
3621 grepbody(fn, rev, content)
3622 grepbody(fn, rev, content)
3622
3623
3623 pfn = copy or fn
3624 if diff:
3624 if pfn not in matches[parent]:
3625 pfn = copy or fn
3625 try:
3626 if pfn not in matches[parent]:
3626 pfnode = pctx.filenode(pfn)
3627 try:
3627 pcontent = get_file_content(pfn, flog, pfnode, pctx, parent)
3628 pfnode = pctx.filenode(pfn)
3628 grepbody(pfn, parent, pcontent)
3629 pcontent = get_file_content(
3629 except error.LookupError:
3630 pfn, flog, pfnode, pctx, parent
3630 pass
3631 )
3632 grepbody(pfn, parent, pcontent)
3633 except error.LookupError:
3634 pass
3631
3635
3632 ui.pager(b'grep')
3636 ui.pager(b'grep')
3633 fm = ui.formatter(b'grep', opts)
3637 fm = ui.formatter(b'grep', opts)
General Comments 0
You need to be logged in to leave comments. Login now