tests/test-newbranch
author Matt Mackall <mpm@selenic.com>
Thu, 29 Apr 2010 18:25:45 -0500
changeset 11038 323557524006
parent 8954 e67e5b60e55f
child 12156 4c94b6d0fb1c
permissions -rwxr-xr-x
run-tests: add -l short option for --local
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3420
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     1
#!/bin/sh
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     2
7654
816b708f23af store all heads of a branch in the branch cache
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 6723
diff changeset
     3
branchcache=.hg/branchheads.cache
6160
3ee3bc5d06c5 tests: hide the name of the branch cache file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5988
diff changeset
     4
3420
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     5
hg init t
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     6
cd t
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
     7
hg branches
3420
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     8
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     9
echo foo > a
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    10
hg add a
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
    11
hg ci -m "initial" -d "1000000 0"
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
    12
hg branch foo
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
    13
hg branch
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
    14
hg ci -m "add branch name" -d "1000000 0"
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
    15
hg branch bar
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
    16
hg ci -m "change branch name" -d "1000000 0"
4203
aee3d312c32e Add test for branch shadowing
Brendan Cully <brendan@kublai.com>
parents: 4175
diff changeset
    17
echo % branch shadowing
4179
7e1c8a565a4f Move branch read/write to dirstate where it belongs
Matt Mackall <mpm@selenic.com>
parents: 4177
diff changeset
    18
hg branch default
4209
dbc3846c09a1 Merge with -stable, fix small test failure
Matt Mackall <mpm@selenic.com>
parents: 4203 4179
diff changeset
    19
hg branch -f default
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
    20
hg ci -m "clear branch name" -d "1000000 0"
3420
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    21
8954
e67e5b60e55f Branch heads should not include "heads" that are ancestors of other heads.
Brendan Cully <brendan@kublai.com>
parents: 7654
diff changeset
    22
echo % there should be only one default branch head
e67e5b60e55f Branch heads should not include "heads" that are ancestors of other heads.
Brendan Cully <brendan@kublai.com>
parents: 7654
diff changeset
    23
hg heads .
e67e5b60e55f Branch heads should not include "heads" that are ancestors of other heads.
Brendan Cully <brendan@kublai.com>
parents: 7654
diff changeset
    24
3420
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    25
hg co foo
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
    26
hg branch
3420
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    27
echo bleah > a
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
    28
hg ci -m "modify a branch" -d "1000000 0"
3420
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    29
6723
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    30
hg merge default
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
    31
hg branch
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
    32
hg ci -m "merge" -d "1000000 0"
3420
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    33
hg log
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    34
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
    35
hg branches
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
    36
hg branches -q
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
    37
3451
196baf20232b Add test for invalid branch cache (fixed by 27ebe4efe98e)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3420
diff changeset
    38
echo % test for invalid branch cache
196baf20232b Add test for invalid branch cache (fixed by 27ebe4efe98e)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3420
diff changeset
    39
hg rollback
6160
3ee3bc5d06c5 tests: hide the name of the branch cache file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5988
diff changeset
    40
cp $branchcache .hg/bc-invalid
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
    41
hg log -r foo
6160
3ee3bc5d06c5 tests: hide the name of the branch cache file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5988
diff changeset
    42
cp .hg/bc-invalid $branchcache
3761
9433bdcaa9ae Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3760
diff changeset
    43
hg --debug log -r foo
6160
3ee3bc5d06c5 tests: hide the name of the branch cache file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5988
diff changeset
    44
rm $branchcache
3ee3bc5d06c5 tests: hide the name of the branch cache file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5988
diff changeset
    45
echo corrupted > $branchcache
3761
9433bdcaa9ae Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3760
diff changeset
    46
hg log -qr foo
6160
3ee3bc5d06c5 tests: hide the name of the branch cache file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5988
diff changeset
    47
cat $branchcache
4175
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
    48
5988
ee317dbfb9d0 update the branch cache at the end of addchangegroup
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4410
diff changeset
    49
echo % push should update the branch cache
ee317dbfb9d0 update the branch cache at the end of addchangegroup
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4410
diff changeset
    50
hg init ../target
ee317dbfb9d0 update the branch cache at the end of addchangegroup
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4410
diff changeset
    51
echo % pushing just rev 0
ee317dbfb9d0 update the branch cache at the end of addchangegroup
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4410
diff changeset
    52
hg push -qr 0 ../target
6160
3ee3bc5d06c5 tests: hide the name of the branch cache file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5988
diff changeset
    53
cat ../target/$branchcache
5988
ee317dbfb9d0 update the branch cache at the end of addchangegroup
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4410
diff changeset
    54
echo % pushing everything
ee317dbfb9d0 update the branch cache at the end of addchangegroup
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4410
diff changeset
    55
hg push -qf ../target
6160
3ee3bc5d06c5 tests: hide the name of the branch cache file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5988
diff changeset
    56
cat ../target/$branchcache
5988
ee317dbfb9d0 update the branch cache at the end of addchangegroup
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4410
diff changeset
    57
4175
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
    58
echo % update with no arguments: tipmost revision of the current branch
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
    59
hg up -q -C 0
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
    60
hg up -q
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
    61
hg id
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
    62
hg up -q 1
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
    63
hg up -q
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
    64
hg id
4231
83153299aab5 avoid a traceback with hg branch newbranch; hg up
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4179
diff changeset
    65
hg branch foobar
83153299aab5 avoid a traceback with hg branch newbranch; hg up
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4179
diff changeset
    66
hg up
83153299aab5 avoid a traceback with hg branch newbranch; hg up
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4179
diff changeset
    67
4410
bbc97d419b16 Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents: 4232
diff changeset
    68
echo % fastforward merge
bbc97d419b16 Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents: 4232
diff changeset
    69
hg branch ff
bbc97d419b16 Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents: 4232
diff changeset
    70
echo ff > ff
bbc97d419b16 Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents: 4232
diff changeset
    71
hg ci -Am'fast forward' -d '1000000 0'
bbc97d419b16 Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents: 4232
diff changeset
    72
hg up foo
bbc97d419b16 Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents: 4232
diff changeset
    73
hg merge ff
bbc97d419b16 Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents: 4232
diff changeset
    74
hg branch
bbc97d419b16 Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents: 4232
diff changeset
    75
hg commit -m'Merge ff into foo' -d '1000000 0'
bbc97d419b16 Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents: 4232
diff changeset
    76
hg parents
bbc97d419b16 Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents: 4232
diff changeset
    77
hg manifest
bbc97d419b16 Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents: 4232
diff changeset
    78
6723
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    79
echo % test merging, add 3 default heads and one test head
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    80
cd ..
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    81
hg init merges
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    82
cd merges
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    83
echo a > a
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    84
hg ci -Ama
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    85
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    86
echo b > b
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    87
hg ci -Amb
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    88
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    89
hg up 0
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    90
echo c > c
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    91
hg ci -Amc
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    92
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    93
hg up 0
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    94
echo d > d
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    95
hg ci -Amd
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    96
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    97
hg up 0
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    98
hg branch test
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
    99
echo e >> e
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   100
hg ci -Ame
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   101
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   102
hg log
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   103
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   104
echo % implicit merge with test branch as parent
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   105
hg merge
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   106
hg up -C default
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   107
echo % implicit merge with default branch as parent
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   108
hg merge
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   109
echo % 3 branch heads, explicit merge required
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   110
hg merge 2
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   111
hg ci -m merge
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   112
echo % 2 branch heads, implicit merge works
1fe6f365df2e merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6160
diff changeset
   113
hg merge