Patchwork D1994: config: replace a for-else by any()

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2018, 11:50 p.m.
Message ID <1edf3137bfa52abd58108d16d071f117@localhost.localdomain>
Download mbox | patch
Permalink /patch/27209/
State Not Applicable
Headers show

Comments

phabricator - Feb. 1, 2018, 11:50 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf1a0933ce59e: config: replace a for-else by any() (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1994?vs=5118&id=5141

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1657,10 +1657,7 @@ 
         else:
             paths = rcutil.userrcpath()
 
-        for f in paths:
-            if os.path.exists(f):
-                break
-        else:
+        if not any(os.path.exists(f) for f in paths):
             if opts.get('global'):
                 samplehgrc = uimod.samplehgrcs['global']
             elif opts.get('local'):