Patchwork D8204: update: simplify slightly

login
register
mail settings
Submitter phabricator
Date March 3, 2020, 9:41 a.m.
Message ID <4647942b610c165fdcd3bf769e0fb520@localhost.localdomain>
Download mbox | patch
Permalink /patch/45424/
State Not Applicable
Headers show

Comments

phabricator - March 3, 2020, 9:41 a.m.
Closed by commit rHG1e508097f570: update: simplify slightly (authored by valentin.gatienbaron).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8204?vs=20416&id=20418

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8204/new/

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-update-branches.t

CHANGE DETAILS




To: valentin.gatienbaron, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -189,17 +189,17 @@ 
   parent=2
 
   $ revtest '-cC dirty linear'  dirty 1 2 -cC
-  abort: can only specify one of -C/--clean, -c/--check, or -m/--merge
+  abort: cannot specify both --clean and --check
   parent=1
   M foo
 
   $ revtest '-mc dirty linear'  dirty 1 2 -mc
-  abort: can only specify one of -C/--clean, -c/--check, or -m/--merge
+  abort: cannot specify both --check and --merge
   parent=1
   M foo
 
   $ revtest '-mC dirty linear'  dirty 1 2 -mC
-  abort: can only specify one of -C/--clean, -c/--check, or -m/--merge
+  abort: cannot specify both --clean and --merge
   parent=1
   M foo
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -7665,6 +7665,7 @@ 
 
     Returns 0 on success, 1 if there are unresolved files.
     """
+    cmdutil.check_at_most_one_arg(opts, b'clean', b'check', b'merge')
     rev = opts.get('rev')
     date = opts.get('date')
     clean = opts.get('clean')
@@ -7686,14 +7687,6 @@ 
     if date and rev is not None:
         raise error.Abort(_(b"you can't specify a revision and a date"))
 
-    if len([x for x in (clean, check, merge) if x]) > 1:
-        raise error.Abort(
-            _(
-                b"can only specify one of -C/--clean, -c/--check, "
-                b"or -m/--merge"
-            )
-        )
-
     updatecheck = None
     if check:
         updatecheck = b'abort'