Patchwork D9219: grep: levarage cmdutil.check_incompatible_arguments()

login
register
mail settings
Submitter phabricator
Date Oct. 16, 2020, 6:03 a.m.
Message ID <differential-rev-PHID-DREV-rkvypfe5eqdla5gktj4n-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47477/
State Superseded
Headers show

Comments

phabricator - Oct. 16, 2020, 6:03 a.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9219

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3364,11 +3364,10 @@ 
     Returns 0 if a match is found, 1 otherwise.
 
     """
+    cmdutil.check_incompatible_arguments(opts, 'all_files', ['all', 'diff'])
     opts = pycompat.byteskwargs(opts)
     diff = opts.get(b'all') or opts.get(b'diff')
     follow = opts.get(b'follow')
-    if diff and opts.get(b'all_files'):
-        raise error.Abort(_(b'--diff and --all-files are mutually exclusive'))
     if opts.get(b'all_files') is None and not diff:
         opts[b'all_files'] = True
     plaingrep = (