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

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2018, 11:30 p.m.
Message ID <differential-rev-PHID-DREV-hme55rhnm2onitvapcik-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27186/
State Superseded
Headers show

Comments

phabricator - Feb. 1, 2018, 11:30 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 2, 2018, 12:24 p.m.
yuja added a comment.


  I'll drop this from hg-committed. Please make sure to touch your local revision
  before pulling.

INLINE COMMENTS

> commands.py:1674
>          editor = ui.geteditor()
>          ui.system("%s \"%s\"" % (editor, f),
>                    onerr=error.Abort, errprefix=_("edit failed"),

The variable `f` is used here.

REPOSITORY
  rHG Mercurial

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

To: martinvonz, #hg-reviewers, indygreg
Cc: yuja, mercurial-devel
phabricator - Feb. 2, 2018, 1:48 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> yuja wrote in commands.py:1674
> The variable `f` is used here.

Wow, good catch! Thanks for reading carefully.

REPOSITORY
  rHG Mercurial

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

To: martinvonz, #hg-reviewers, indygreg
Cc: yuja, 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'):