This is an archive of the discontinued Mercurial Phabricator instance.

grep: add `--diff` flag
ClosedPublic

Authored by sangeet259 on Jun 17 2018, 6:31 AM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Commits
rHG7fbb5d76c555: grep: add --diff flag
Summary

adds a diff flag, which works exactly same as all, infact since
-all searches diffs, there diff is a better name for it.
The all flag is still here for backward compatibility reasons.
Some major tests for all has been picked and added for diff.

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

sangeet259 created this revision.Jun 17 2018, 6:31 AM
pulkit added a subscriber: pulkit.Jun 18 2018, 4:14 PM
pulkit added inline comments.
mercurial/commands.py
2394

We definitely need better help text here to mention that it looks at the diff not all the content.

2424

To deprecate a flag, we need to add (DEPRECATED) after the help text of the flag. Look for DEPRECATED, EXPERIMENTAL, ADVANCED in commands.py, you will find examples.

Also, I suggest you to make a separate patch for deprecating the flag.

2533

nit: it will be better if we can initialize a variable and store opts.get('all') and opts.get('diff') in it and reuse that.

sangeet259 updated this revision to Diff 9217.Jun 19 2018, 4:42 AM
yuja added a subscriber: yuja.Jun 21 2018, 8:43 AM

Queued, thanks.

Can you send a follow-up to deprecate the --all option?
It doesn't make sense to provide both --all and --diff in user help.

[('0', 'print0', None, _('end fields with NUL')),
('', 'all', None, _('print all revisions that match')),

+ ('', 'diff', None, _('print all revisions when the term was introduced or removed')),

Next time, please make sure test-check-* pass.

This revision was automatically updated to reflect the committed changes.