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.
This commit is contained in:
Matt Mackall 2015-05-22 17:08:59 -05:00
parent 8714aec6c0
commit 1b6a04b2ec
21 changed files with 7 additions and 67 deletions

View File

@ -1107,8 +1107,13 @@ def branch(ui, repo, label=None, **opts):
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()

View File

@ -389,7 +389,6 @@ named branches
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

View File

@ -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 @@ Case NN: msg
$ 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 @@ Case BN: msg
$ 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 @@ Case BB: msg
$ 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

View File

@ -14,7 +14,6 @@ test branch selection options
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 @@ test branch selection options
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 @@ test branch selection options
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

View File

@ -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 @@ verify update will accept invalid legacy branch names
$ 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 @@ recovery from invalid cache file with some bad records
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

View File

@ -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

View File

@ -357,7 +357,6 @@ Test clone with a branch named "@" (issue3677)
$ 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

View File

@ -373,7 +373,6 @@ Moving branches:
$ 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 @@ This shouldn't be possible:
$ 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 @@ This silliness fails:
$ 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

View File

@ -52,7 +52,6 @@ transplant bug fixes onto release branch
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)

View File

@ -55,13 +55,11 @@ Add a merge with both parents and child in different branches
$ 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 @@ Add a merge with both parents and child in different branches
(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 ..

View File

@ -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

View File

@ -119,12 +119,10 @@ add branches/tags
$ 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

View File

@ -168,7 +168,6 @@ test fetch with named branches
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 @@ test fetch with inactive branches
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

View File

@ -26,7 +26,6 @@ Set up the repo
$ 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

View File

@ -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 @@ Branch shadowing:
$ 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 @@ Merging and branches
$ 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 @@ Merging and branches
$ 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 @@ Update with no arguments: tipmost revision of the current branch:
$ 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 @@ Fast-forward merge:
$ 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'

View File

@ -33,7 +33,6 @@ Create branch B:
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 @@ Make changes on new branch on tt
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

View File

@ -462,7 +462,6 @@ Check prepush logic with merged branches:
$ 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 @@ Check prepush with new branch head on former topo non-head:
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 @@ Check prepush with new branch head on former topo head:
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 @@ but child is on different branch:
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 @@ but child is on different branch:
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 @@ but child is on different branch:
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

View File

@ -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 @@ the same as branches remaining.
$ 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

View File

@ -571,7 +571,6 @@ Interactions between collapse and keepbranches
$ 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

View File

@ -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 @@ Branch name containing a dash (issue3181)
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

View File

@ -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