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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Feb 1 18:50:58 EST 2018


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

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'):



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


More information about the Mercurial-devel mailing list