Patchwork D6211: branch: return early if we find an open named branch apart from default

login
register
mail settings
Submitter phabricator
Date April 15, 2019, 11:42 p.m.
Message ID <cd2e98d7a355a0abba67d6a588e90956@localhost.localdomain>
Download mbox | patch
Permalink /patch/39624/
State Not Applicable
Headers show

Comments

phabricator - April 15, 2019, 11:42 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd6437f414437: branch: return early if we find an open named branch apart from default (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6211?vs=14742&id=14754

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1125,11 +1125,11 @@ 
             ui.status(_('marked working directory as branch %s\n') % label)
 
             # find any open named branches aside from default
-            others = [n for n, h, t, c in repo.branchmap().iterbranches()
-                      if n != "default" and not c]
-            if not others:
-                ui.status(_('(branches are permanent and global, '
-                            'did you want a bookmark?)\n'))
+            for n, h, t, c in repo.branchmap().iterbranches():
+                if n != "default" and not c:
+                    return 0
+            ui.status(_('(branches are permanent and global, '
+                        'did you want a bookmark?)\n'))
 
 @command('branches',
     [('a', 'active', False,