Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/test-newbranch @ 4198:aee3d312c32e
Add test for branch shadowing
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Mon, 12 Mar 2007 14:50:19 -0700 |
parents | fc12ac3755d5 |
children | dbc3846c09a1 |
rev | line source |
---|---|
3435
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 |
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
3 hg init t |
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
4 cd t |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3451
diff
changeset
|
5 hg branches |
3435
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
6 |
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
7 echo foo > a |
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
8 hg add a |
3760
aeafd80c1e78
small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3502
diff
changeset
|
9 hg ci -m "initial" -d "1000000 0" |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3451
diff
changeset
|
10 hg branch foo |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3451
diff
changeset
|
11 hg branch |
3760
aeafd80c1e78
small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3502
diff
changeset
|
12 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
|
13 hg branch bar |
3760
aeafd80c1e78
small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3502
diff
changeset
|
14 hg ci -m "change branch name" -d "1000000 0" |
4198
aee3d312c32e
Add test for branch shadowing
Brendan Cully <brendan@kublai.com>
parents:
4176
diff
changeset
|
15 echo % branch shadowing |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3451
diff
changeset
|
16 hg branch "" |
4198
aee3d312c32e
Add test for branch shadowing
Brendan Cully <brendan@kublai.com>
parents:
4176
diff
changeset
|
17 hg branch -f '' |
3760
aeafd80c1e78
small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3502
diff
changeset
|
18 hg ci -m "clear branch name" -d "1000000 0" |
3435
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
19 |
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
20 hg co foo |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3451
diff
changeset
|
21 hg branch |
3435
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
22 echo bleah > a |
3760
aeafd80c1e78
small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3502
diff
changeset
|
23 hg ci -m "modify a branch" -d "1000000 0" |
3435
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
24 |
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
25 hg merge |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3451
diff
changeset
|
26 hg branch |
3760
aeafd80c1e78
small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3502
diff
changeset
|
27 hg ci -m "merge" -d "1000000 0" |
3435
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
28 hg log |
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
29 |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3451
diff
changeset
|
30 hg branches |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3451
diff
changeset
|
31 hg branches -q |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3451
diff
changeset
|
32 |
3451
196baf20232b
Add test for invalid branch cache (fixed by 27ebe4efe98e)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3435
diff
changeset
|
33 echo % test for invalid branch cache |
196baf20232b
Add test for invalid branch cache (fixed by 27ebe4efe98e)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3435
diff
changeset
|
34 hg rollback |
3761
9433bdcaa9ae
Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3760
diff
changeset
|
35 cp .hg/branches.cache .hg/bc-invalid |
3760
aeafd80c1e78
small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3502
diff
changeset
|
36 hg log -r foo |
3761
9433bdcaa9ae
Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3760
diff
changeset
|
37 cp .hg/bc-invalid .hg/branches.cache |
9433bdcaa9ae
Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3760
diff
changeset
|
38 hg --debug log -r foo |
9433bdcaa9ae
Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3760
diff
changeset
|
39 rm .hg/branches.cache |
9433bdcaa9ae
Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3760
diff
changeset
|
40 echo corrupted > .hg/branches.cache |
9433bdcaa9ae
Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3760
diff
changeset
|
41 hg log -qr foo |
9433bdcaa9ae
Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3760
diff
changeset
|
42 cat .hg/branches.cache |
4169
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
43 |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
44 echo % test for different branch cache features |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
45 echo '4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4' > .hg/branches.cache |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
46 hg branches --debug |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
47 echo ' features: unnamed dummy foo bar' > .hg/branches.cache |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
48 hg branches --debug |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
49 echo ' features: dummy' > .hg/branches.cache |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
50 hg branches --debug |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
51 |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
52 echo % test old hg reading branch cache with feature list |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
53 python << EOF |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
54 import binascii |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
55 f = file('.hg/branches.cache') |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
56 lines = f.read().split('\n') |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
57 f.close() |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
58 firstline = lines[0] |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
59 last, lrev = lines.pop(0).rstrip().split(" ", 1) |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
60 try: |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
61 last, lrev = binascii.unhexlify(last), int(lrev) |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
62 except ValueError, inst: |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
63 if str(inst) == "invalid literal for int():%s" % firstline: |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
64 print "ValueError raised correctly, good." |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
65 else: |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
66 print "ValueError: %s" % inst |
0182cb2e4aac
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3761
diff
changeset
|
67 EOF |
4176
fc12ac3755d5
Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents:
4169
diff
changeset
|
68 |
fc12ac3755d5
Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents:
4169
diff
changeset
|
69 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
|
70 hg up -q -C 0 |
fc12ac3755d5
Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents:
4169
diff
changeset
|
71 hg up -q |
fc12ac3755d5
Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents:
4169
diff
changeset
|
72 hg id |
fc12ac3755d5
Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents:
4169
diff
changeset
|
73 hg up -q 1 |
fc12ac3755d5
Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents:
4169
diff
changeset
|
74 hg up -q |
fc12ac3755d5
Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents:
4169
diff
changeset
|
75 hg id |