Mercurial > hg-stable
diff mercurial/commands.py @ 25295:701df761aa94
branch: don't warn about branches if repository has multiple branches already
This warning exists to prevent git users from prematurely polluting
their namespace when trying out Mercurial. But for repos that already
have multiple branches, understanding what branches are is not
optional so we should just shut up.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 22 May 2015 17:08:59 -0500 |
parents | ad1d2c952889 |
children | 9bc11716bc86 |
line wrap: on
line diff
--- a/mercurial/commands.py Tue May 19 13:08:21 2015 -0700 +++ b/mercurial/commands.py Fri May 22 17:08:59 2015 -0500 @@ -1107,8 +1107,13 @@ scmutil.checknewlabel(repo, label, 'branch') repo.dirstate.setbranch(label) ui.status(_('marked working directory as branch %s\n') % label) - ui.status(_('(branches are permanent and global, ' - 'did you want a bookmark?)\n')) + + # 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')) finally: wlock.release()