##// END OF EJS Templates
Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein -
r4169:0182cb2e default
parent child Browse files
Show More
@@ -1,40 +1,65 b''
1 1 #!/bin/sh
2 2
3 3 hg init t
4 4 cd t
5 5 hg branches
6 6
7 7 echo foo > a
8 8 hg add a
9 9 hg ci -m "initial" -d "1000000 0"
10 10 hg branch foo
11 11 hg branch
12 12 hg ci -m "add branch name" -d "1000000 0"
13 13 hg branch bar
14 14 hg ci -m "change branch name" -d "1000000 0"
15 15 hg branch ""
16 16 hg ci -m "clear branch name" -d "1000000 0"
17 17
18 18 hg co foo
19 19 hg branch
20 20 echo bleah > a
21 21 hg ci -m "modify a branch" -d "1000000 0"
22 22
23 23 hg merge
24 24 hg branch
25 25 hg ci -m "merge" -d "1000000 0"
26 26 hg log
27 27
28 28 hg branches
29 29 hg branches -q
30 30
31 31 echo % test for invalid branch cache
32 32 hg rollback
33 33 cp .hg/branches.cache .hg/bc-invalid
34 34 hg log -r foo
35 35 cp .hg/bc-invalid .hg/branches.cache
36 36 hg --debug log -r foo
37 37 rm .hg/branches.cache
38 38 echo corrupted > .hg/branches.cache
39 39 hg log -qr foo
40 40 cat .hg/branches.cache
41
42 echo % test for different branch cache features
43 echo '4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4' > .hg/branches.cache
44 hg branches --debug
45 echo ' features: unnamed dummy foo bar' > .hg/branches.cache
46 hg branches --debug
47 echo ' features: dummy' > .hg/branches.cache
48 hg branches --debug
49
50 echo % test old hg reading branch cache with feature list
51 python << EOF
52 import binascii
53 f = file('.hg/branches.cache')
54 lines = f.read().split('\n')
55 f.close()
56 firstline = lines[0]
57 last, lrev = lines.pop(0).rstrip().split(" ", 1)
58 try:
59 last, lrev = binascii.unhexlify(last), int(lrev)
60 except ValueError, inst:
61 if str(inst) == "invalid literal for int():%s" % firstline:
62 print "ValueError raised correctly, good."
63 else:
64 print "ValueError: %s" % inst
65 EOF
@@ -1,81 +1,96 b''
1 1 foo
2 2 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
3 3 foo
4 4 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
5 5 (branch merge, don't forget to commit)
6 6 foo
7 7 changeset: 5:5f8fb06e083e
8 8 branch: foo
9 9 tag: tip
10 10 parent: 4:4909a3732169
11 11 parent: 3:bf1bc2f45e83
12 12 user: test
13 13 date: Mon Jan 12 13:46:40 1970 +0000
14 14 summary: merge
15 15
16 16 changeset: 4:4909a3732169
17 17 branch: foo
18 18 parent: 1:b699b1cec9c2
19 19 user: test
20 20 date: Mon Jan 12 13:46:40 1970 +0000
21 21 summary: modify a branch
22 22
23 23 changeset: 3:bf1bc2f45e83
24 24 user: test
25 25 date: Mon Jan 12 13:46:40 1970 +0000
26 26 summary: clear branch name
27 27
28 28 changeset: 2:67ec16bde7f1
29 29 branch: bar
30 30 user: test
31 31 date: Mon Jan 12 13:46:40 1970 +0000
32 32 summary: change branch name
33 33
34 34 changeset: 1:b699b1cec9c2
35 35 branch: foo
36 36 user: test
37 37 date: Mon Jan 12 13:46:40 1970 +0000
38 38 summary: add branch name
39 39
40 40 changeset: 0:be8523e69bf8
41 41 user: test
42 42 date: Mon Jan 12 13:46:40 1970 +0000
43 43 summary: initial
44 44
45 45 foo 5:5f8fb06e083e
46 46 3:bf1bc2f45e83
47 47 bar 2:67ec16bde7f1
48 48 foo
49 49
50 50 bar
51 51 % test for invalid branch cache
52 52 rolling back last transaction
53 53 changeset: 4:4909a3732169
54 54 branch: foo
55 55 tag: tip
56 56 parent: 1:b699b1cec9c2
57 57 user: test
58 58 date: Mon Jan 12 13:46:40 1970 +0000
59 59 summary: modify a branch
60 60
61 61 Invalid branch cache: unknown tip
62 62 changeset: 4:4909a3732169c0c20011c4f4b8fdff4e3d89b23f
63 63 branch: foo
64 64 tag: tip
65 65 parent: 1:b699b1cec9c2966b3700de4fef0dc123cd754c31
66 66 parent: -1:0000000000000000000000000000000000000000
67 67 manifest: 4:d01b250baaa05909152f7ae07d7a649deea0df9a
68 68 user: test
69 69 date: Mon Jan 12 13:46:40 1970 +0000
70 70 files: a
71 71 extra: branch=foo
72 72 description:
73 73 modify a branch
74 74
75 75
76 76 4:4909a3732169
77 77 features: unnamed
78 78 4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4
79 79 bf1bc2f45e834c75404d0ddab57d53beab56e2f8
80 80 4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo
81 81 67ec16bde7f1575d523313b9bca000f6a6f12dca bar
82 % test for different branch cache features
83 branch cache: no features specified
84 foo 4:4909a3732169c0c20011c4f4b8fdff4e3d89b23f
85 3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8
86 bar 2:67ec16bde7f1575d523313b9bca000f6a6f12dca
87 branch cache: unknown features: dummy, foo, bar
88 foo 4:4909a3732169c0c20011c4f4b8fdff4e3d89b23f
89 3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8
90 bar 2:67ec16bde7f1575d523313b9bca000f6a6f12dca
91 branch cache: missing features: unnamed
92 foo 4:4909a3732169c0c20011c4f4b8fdff4e3d89b23f
93 3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8
94 bar 2:67ec16bde7f1575d523313b9bca000f6a6f12dca
95 % test old hg reading branch cache with feature list
96 ValueError raised correctly, good.
General Comments 0
You need to be logged in to leave comments. Login now