If no --follow was given, then the "copy" variable will become
None. In that case we would still look up the copy information from
the filelog and then ignore it. Let's avoid even looking it up.
Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGb44f1703b28c: grep: don't look up copy info unless --follow is given
rHGbdb5fef5cff4: grep: don't look up copy info unless --follow is given
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Comment Actions
- if fn in skip:
+ copy = None
+ if follow:
+ try:
+ copied = flog.renamed(fnode)
+ except error.WdirUnsupported:
+ copied = ctx[fn].renamed()
+ copy = copied and copied[0]if copy:
- skip[copy] = True
- continue
+ copies.setdefault(rev, {})[fn] = copy
+ if fn in skip:
+ skip[copy] = True
+ continuefiles.append(fn)
Did you intentionally move if fn in skip: continue under if follow?
The skip dict has wider scope.
Comment Actions
Oops, nope, that wasn't on purpose. Thanks for catching that! Feel free to amend the following to the queued commit if it looks good to you:
diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2955,7 +2955,8 @@ def grep(ui, repo, pattern, *pats, **opt copies.setdefault(rev, {})[fn] = copy if fn in skip: skip[copy] = True - continue + if fn in skip: + continue files.append(fn) if fn not in matches[rev]:
Comment Actions
diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2955,7 +2955,8 @@ def grep(ui, repo, pattern, *pats, **opt copies.setdefault(rev, {})[fn] = copy if fn in skip: skip[copy] = True - continue + if fn in skip: + continue files.append(fn)
Applied this, thanks.