Patchwork D8658: commands: use any() instead of `if a or b or c`

login
register
mail settings
Submitter phabricator
Date June 25, 2020, 8:54 a.m.
Message ID <differential-rev-PHID-DREV-bx2h2dv45k67ayefbbsd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46563/
State New
Headers show

Comments

phabricator - June 25, 2020, 8:54 a.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Small cleanup for future when we have an option to show configs from shared rc.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: pulkit, #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
@@ -2184,7 +2184,8 @@ 
     """
 
     opts = pycompat.byteskwargs(opts)
-    if opts.get(b'edit') or opts.get(b'local') or opts.get(b'global'):
+    editopts = [b'edit', b'local', b'global']
+    if any(opts.get(o) for o in editopts):
         if opts.get(b'local') and opts.get(b'global'):
             raise error.Abort(_(b"can't use --local and --global together"))