branch: don't warn about branches if repository has multiple branches already
authorMatt Mackall <mpm@selenic.com>
Fri, 22 May 2015 17:08:59 -0500
changeset 25295 701df761aa94
parent 25293 ab618e52788a
child 25296 260fb5968de0
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.
mercurial/commands.py
tests/test-backout.t
tests/test-bheads.t
tests/test-branch-option.t
tests/test-branches.t
tests/test-clone-update-order.t
tests/test-clone.t
tests/test-commit-amend.t
tests/test-commit-multiple.t
tests/test-convert-clonebranches.t
tests/test-convert-datesort.t
tests/test-encoding-align.t
tests/test-fetch.t
tests/test-hgweb-commands.t
tests/test-newbranch.t
tests/test-pull-branch.t
tests/test-push-warn.t
tests/test-rebase-cache.t
tests/test-rebase-collapse.t
tests/test-rebase-named-branches.t
tests/test-revset.t
--- 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()
 
--- a/tests/test-backout.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-backout.t	Fri May 22 17:08:59 2015 -0500
@@ -389,7 +389,6 @@
   adding file1
   $ hg branch branch2
   marked working directory as branch branch2
-  (branches are permanent and global, did you want a bookmark?)
   $ echo branch2 > file2
   $ hg ci -d '2 0' -Am file2
   adding file2
--- a/tests/test-bheads.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-bheads.t	Fri May 22 17:08:59 2015 -0500
@@ -37,7 +37,6 @@
   $ hg add b
   $ hg branch b
   marked working directory as branch b
-  (branches are permanent and global, did you want a bookmark?)
   $ hg commit -m "Adding b branch"
   $ heads
   2: Adding b branch (b)
@@ -119,7 +118,6 @@
   $ hg add c
   $ hg branch c
   marked working directory as branch c
-  (branches are permanent and global, did you want a bookmark?)
   $ hg commit -m "Adding c branch"
   $ heads
   7: Adding c branch (c)
@@ -302,7 +300,6 @@
   $ hg up -q null
   $ hg branch -f b
   marked working directory as branch b
-  (branches are permanent and global, did you want a bookmark?)
   $ echo 1 > bb
   $ hg ci -Am "b4 (NN): new topo root for branch b"
   adding bb
@@ -317,7 +314,6 @@
 
   $ hg branch -f default
   marked working directory as branch default
-  (branches are permanent and global, did you want a bookmark?)
   $ echo 1 > aa
   $ hg ci -Am "a6 (BN): new branch root"
   adding aa
@@ -337,7 +333,6 @@
   $ hg merge -q 3
   $ hg branch -f default
   marked working directory as branch default
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -m "a8 (BB): weird new branch root"
   created new head
 
--- a/tests/test-branch-option.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-branch-option.t	Fri May 22 17:08:59 2015 -0500
@@ -14,7 +14,6 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg branch c
   marked working directory as branch c
-  (branches are permanent and global, did you want a bookmark?)
   $ echo c > foo
   $ hg ci -d '0 0' -mc
   $ hg tag -l z
@@ -31,21 +30,18 @@
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg branch b
   marked working directory as branch b
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b > foo
   $ hg ci -d '0 0' -mb
   $ hg up 0
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg --encoding utf-8 branch æ
   marked working directory as branch \xc3\xa6 (esc)
-  (branches are permanent and global, did you want a bookmark?)
   $ echo ae1 > foo
   $ hg ci -d '0 0' -mae1
   $ hg up 0
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg --encoding utf-8 branch -f æ
   marked working directory as branch \xc3\xa6 (esc)
-  (branches are permanent and global, did you want a bookmark?)
   $ echo ae2 > foo
   $ hg ci -d '0 0' -mae2
   created new head
@@ -53,7 +49,6 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg branch -f b
   marked working directory as branch b
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b2 > foo
   $ hg ci -d '0 0' -mb2
   created new head
--- a/tests/test-branches.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-branches.t	Fri May 22 17:08:59 2015 -0500
@@ -13,7 +13,6 @@
 
   $ hg branch q
   marked working directory as branch q
-  (branches are permanent and global, did you want a bookmark?)
   $ echo 'aa' >a
   $ hg branch -C
   reset working directory to branch a
@@ -25,7 +24,6 @@
   $ hg add b
   $ hg branch b
   marked working directory as branch b
-  (branches are permanent and global, did you want a bookmark?)
   $ hg commit -d '2 0' -m "Adding b branch"
 
   $ echo 'bh1' >bh1
@@ -42,7 +40,6 @@
   $ hg add c
   $ hg branch c
   marked working directory as branch c
-  (branches are permanent and global, did you want a bookmark?)
   $ hg commit -d '5 0' -m "Adding c branch"
 
 reserved names
@@ -101,7 +98,6 @@
   $ hg add d
   $ hg branch 'a branch name much longer than the default justification used by branches'
   marked working directory as branch a branch name much longer than the default justification used by branches
-  (branches are permanent and global, did you want a bookmark?)
   $ hg commit -d '6 0' -m "Adding d branch"
 
   $ hg branches
@@ -601,7 +597,6 @@
 cache is updated when committing
   $ hg branch i-will-regret-this
   marked working directory as branch i-will-regret-this
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -m regrets
   $ f --size .hg/cache/rbc-*
   .hg/cache/rbc-names-v1: size=106
--- a/tests/test-clone-update-order.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-clone-update-order.t	Fri May 22 17:08:59 2015 -0500
@@ -14,7 +14,6 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg branch other
   marked working directory as branch other
-  (branches are permanent and global, did you want a bookmark?)
   $ echo good > bye
   $ hg commit -Am other
   adding bye
--- a/tests/test-clone.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-clone.t	Fri May 22 17:08:59 2015 -0500
@@ -357,7 +357,6 @@
 
   $ hg -R ua branch @
   marked working directory as branch @
-  (branches are permanent and global, did you want a bookmark?)
   $ hg -R ua commit -m 'created branch @'
   $ hg clone ua atbranch
   updating to branch default
--- a/tests/test-commit-amend.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-commit-amend.t	Fri May 22 17:08:59 2015 -0500
@@ -373,7 +373,6 @@
   $ hg ci -m 'branch foo'
   $ hg branch default -f
   marked working directory as branch default
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci --amend -m 'back to default'
   saved backup bundle to $TESTTMP/.hg/strip-backup/8ac881fbf49d-fd962fef-amend-backup.hg (glob)
   $ hg branches
@@ -848,7 +847,6 @@
   $ hg up -q default
   $ hg branch closewithamend
   marked working directory as branch closewithamend
-  (branches are permanent and global, did you want a bookmark?)
   $ echo foo > foo
   $ hg add foo
   $ hg ci -m..
@@ -860,7 +858,6 @@
 
   $ hg branch silliness
   marked working directory as branch silliness
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b >> b
   $ hg ci --close-branch -m'open and close'
   abort: can only close branch heads
--- a/tests/test-commit-multiple.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-commit-multiple.t	Fri May 22 17:08:59 2015 -0500
@@ -52,7 +52,6 @@
   1 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg branch release
   marked working directory as branch release
-  (branches are permanent and global, did you want a bookmark?)
   $ hg transplant 2 3
   applying [0-9a-f]{12} (re)
   [0-9a-f]{12} transplanted to [0-9a-f]{12} (re)
--- a/tests/test-convert-clonebranches.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-convert-clonebranches.t	Fri May 22 17:08:59 2015 -0500
@@ -55,13 +55,11 @@
   $ cd source
   $ hg branch branch1
   marked working directory as branch branch1
-  (branches are permanent and global, did you want a bookmark?)
   $ echo a > file1
   $ hg ci -qAm c1
   $ hg up -qC mergeab
   $ hg branch branch2
   marked working directory as branch branch2
-  (branches are permanent and global, did you want a bookmark?)
   $ echo a > file2
   $ hg ci -qAm c2
   $ hg merge branch1
@@ -69,7 +67,6 @@
   (branch merge, don't forget to commit)
   $ hg branch branch3
   marked working directory as branch branch3
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -qAm c3
   $ cd ..
 
--- a/tests/test-convert-datesort.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-convert-datesort.t	Fri May 22 17:08:59 2015 -0500
@@ -21,7 +21,6 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg branch branchb
   marked working directory as branch branchb
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b >> b
   $ hg ci -Am b0 -d '6 0'
   adding b
@@ -42,7 +41,6 @@
   $ echo c >> c
   $ hg branch branchc
   marked working directory as branch branchc
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -Am c0 -d '10 0'
   adding c
   $ hg up -C brancha
--- a/tests/test-encoding-align.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-encoding-align.t	Fri May 22 17:08:59 2015 -0500
@@ -119,12 +119,10 @@
   $ hg book -f $S
   $ hg branch $M
   marked working directory as branch MIDDLE_
-  (branches are permanent and global, did you want a bookmark?)
   $ hg tag $M
   $ hg book -f $M
   $ hg branch $L
   marked working directory as branch \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d (esc)
-  (branches are permanent and global, did you want a bookmark?)
   $ hg tag $L
   $ hg book -f $L
 
--- a/tests/test-fetch.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-fetch.t	Fri May 22 17:08:59 2015 -0500
@@ -168,7 +168,6 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg -R nbase branch b
   marked working directory as branch b
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b > nbase/b
   $ hg -R nbase ci -Am b
   adding b
@@ -363,7 +362,6 @@
   adding b
   $ hg --cwd ib1 branch -f default
   marked working directory as branch default
-  (branches are permanent and global, did you want a bookmark?)
   $ echo c > ib1/c
   $ hg --cwd ib1 ci -Am newdefault
   adding c
--- a/tests/test-hgweb-commands.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-hgweb-commands.t	Fri May 22 17:08:59 2015 -0500
@@ -26,7 +26,6 @@
   $ hg ci -Ambranch
   $ hg branch unstable
   marked working directory as branch unstable
-  (branches are permanent and global, did you want a bookmark?)
   >>> open('msg', 'wb').write('branch commit with null character: \0\n')
   $ hg ci -l msg
   $ rm msg
--- a/tests/test-newbranch.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-newbranch.t	Fri May 22 17:08:59 2015 -0500
@@ -25,7 +25,6 @@
   $ hg ci -m "add branch name"
   $ hg branch bar
   marked working directory as branch bar
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -m "change branch name"
 
 Branch shadowing:
@@ -37,7 +36,6 @@
 
   $ hg branch -f default
   marked working directory as branch default
-  (branches are permanent and global, did you want a bookmark?)
 
   $ hg ci -m "clear branch name"
   created new head
@@ -67,11 +65,9 @@
 
   $ hg branch -f bar
   marked working directory as branch bar
-  (branches are permanent and global, did you want a bookmark?)
 
   $ hg branch foo
   marked working directory as branch foo
-  (branches are permanent and global, did you want a bookmark?)
 
   $ echo bleah > a
   $ hg ci -m "modify a branch"
@@ -94,13 +90,11 @@
 
   $ hg branch default
   marked working directory as branch default
-  (branches are permanent and global, did you want a bookmark?)
 
  set (first) parent branch as branch name
 
   $ hg branch foo
   marked working directory as branch foo
-  (branches are permanent and global, did you want a bookmark?)
 
   $ hg ci -m "merge"
 
@@ -215,7 +209,6 @@
 
   $ hg branch foobar
   marked working directory as branch foobar
-  (branches are permanent and global, did you want a bookmark?)
 
   $ hg up
   abort: branch foobar not found
@@ -225,7 +218,6 @@
 
   $ hg branch ff
   marked working directory as branch ff
-  (branches are permanent and global, did you want a bookmark?)
 
   $ echo ff > ff
   $ hg ci -Am'fast forward'
--- a/tests/test-pull-branch.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-pull-branch.t	Fri May 22 17:08:59 2015 -0500
@@ -33,7 +33,6 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg branch branchB
   marked working directory as branch branchB
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b1 > foo
   $ hg ci -mb1 # 3
 
@@ -141,7 +140,6 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg branch branchC
   marked working directory as branch branchC
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b1 > bar
   $ hg ci -Am "commit on branchC on tt"
   adding bar
--- a/tests/test-push-warn.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-push-warn.t	Fri May 22 17:08:59 2015 -0500
@@ -462,7 +462,6 @@
   $ hg -R j ci -m a1
   $ hg -R k branch b
   marked working directory as branch b
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b > k/foo
   $ hg -R k ci -m b
   $ hg -R k up 0
@@ -532,7 +531,6 @@
   adding a
   $ hg branch B
   marked working directory as branch B
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b >b
   $ hg ci -Amb
   adding b
@@ -611,7 +609,6 @@
   adding a
   $ hg branch B
   marked working directory as branch B
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b >b
   $ hg ci -Amb
   adding b
@@ -703,7 +700,6 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg branch B
   marked working directory as branch B
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b0 >b
   $ hg ci -Amb0
   adding b
@@ -718,7 +714,6 @@
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg branch -f B
   marked working directory as branch B
-  (branches are permanent and global, did you want a bookmark?)
   $ echo a3 >a
   $ hg ci -ma3
   created new head
@@ -726,7 +721,6 @@
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg branch -f A
   marked working directory as branch A
-  (branches are permanent and global, did you want a bookmark?)
   $ echo b3 >b
   $ hg ci -mb3
   created new head
--- a/tests/test-rebase-cache.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-rebase-cache.t	Fri May 22 17:08:59 2015 -0500
@@ -31,7 +31,6 @@
 
   $ hg branch branch2
   marked working directory as branch branch2
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -m 'branch2'
 
   $ echo c > C
@@ -42,7 +41,6 @@
 
   $ hg branch -f branch2
   marked working directory as branch branch2
-  (branches are permanent and global, did you want a bookmark?)
   $ echo d > d
   $ hg ci -Am D
   adding d
@@ -57,7 +55,6 @@
 
   $ hg branch branch3
   marked working directory as branch branch3
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -m 'branch3'
 
   $ echo f > f
@@ -308,12 +305,10 @@
 
   $ hg branch branch2
   marked working directory as branch branch2
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -m 'branch2'
 
   $ hg branch -f branch1
   marked working directory as branch branch1
-  (branches are permanent and global, did you want a bookmark?)
 
   $ echo a > A
   $ hg ci -Am A
--- a/tests/test-rebase-collapse.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-rebase-collapse.t	Fri May 22 17:08:59 2015 -0500
@@ -571,7 +571,6 @@
 
   $ hg branch 'two'
   marked working directory as branch two
-  (branches are permanent and global, did you want a bookmark?)
   $ echo 'c' > c
   $ hg ci -Am 'C'
   adding c
--- a/tests/test-rebase-named-branches.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-rebase-named-branches.t	Fri May 22 17:08:59 2015 -0500
@@ -36,7 +36,6 @@
   2 files updated, 0 files merged, 3 files removed, 0 files unresolved
   $ hg branch dev-two
   marked working directory as branch dev-two
-  (branches are permanent and global, did you want a bookmark?)
 
   $ echo x > x
 
@@ -128,7 +127,6 @@
   3 files updated, 0 files merged, 3 files removed, 0 files unresolved
   $ hg branch dev-one
   marked working directory as branch dev-one
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -m 'dev-one named branch'
 
   $ hg tglog
--- a/tests/test-revset.t	Tue May 19 13:08:21 2015 -0700
+++ b/tests/test-revset.t	Fri May 22 17:08:59 2015 -0500
@@ -43,13 +43,11 @@
   $ echo b > b
   $ hg branch b
   marked working directory as branch b
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -Aqm1
 
   $ rm a
   $ hg branch a-b-c-
   marked working directory as branch a-b-c-
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -Aqm2 -u Bob
 
   $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n'
@@ -66,7 +64,6 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg branch +a+b+c+
   marked working directory as branch +a+b+c+
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -Aqm3
 
   $ hg co 2  # interleave
@@ -74,14 +71,12 @@
   $ echo bb > b
   $ hg branch -- -a-b-c-
   marked working directory as branch -a-b-c-
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -Aqm4 -d "May 12 2005"
 
   $ hg co 3
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg branch !a/b/c/
   marked working directory as branch !a/b/c/
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -Aqm"5 bug"
 
   $ hg merge 4
@@ -89,23 +84,19 @@
   (branch merge, don't forget to commit)
   $ hg branch _a_b_c_
   marked working directory as branch _a_b_c_
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -Aqm"6 issue619"
 
   $ hg branch .a.b.c.
   marked working directory as branch .a.b.c.
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -Aqm7
 
   $ hg branch all
   marked working directory as branch all
-  (branches are permanent and global, did you want a bookmark?)
 
   $ hg co 4
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg branch é
   marked working directory as branch \xc3\xa9 (esc)
-  (branches are permanent and global, did you want a bookmark?)
   $ hg ci -Aqm9
 
   $ hg tag -r6 1.0