##// END OF EJS Templates
branch: add tests which shows branch can be closed from a non-branchhead cset...
Sushil khanchi -
r42387:258821f2 default
parent child Browse files
Show More
@@ -1,942 +1,977
1 $ hg init a
1 $ hg init a
2 $ cd a
2 $ cd a
3
3
4 Verify checking branch of nullrev before the cache is created doesnt crash
4 Verify checking branch of nullrev before the cache is created doesnt crash
5 $ hg log -r 'branch(.)' -T '{branch}\n'
5 $ hg log -r 'branch(.)' -T '{branch}\n'
6
6
7 Basic test
7 Basic test
8 $ echo 'root' >root
8 $ echo 'root' >root
9 $ hg add root
9 $ hg add root
10 $ hg commit -d '0 0' -m "Adding root node"
10 $ hg commit -d '0 0' -m "Adding root node"
11
11
12 $ echo 'a' >a
12 $ echo 'a' >a
13 $ hg add a
13 $ hg add a
14 $ hg branch a
14 $ hg branch a
15 marked working directory as branch a
15 marked working directory as branch a
16 (branches are permanent and global, did you want a bookmark?)
16 (branches are permanent and global, did you want a bookmark?)
17 $ hg commit -d '1 0' -m "Adding a branch"
17 $ hg commit -d '1 0' -m "Adding a branch"
18
18
19 $ hg branch q
19 $ hg branch q
20 marked working directory as branch q
20 marked working directory as branch q
21 $ echo 'aa' >a
21 $ echo 'aa' >a
22 $ hg branch -C
22 $ hg branch -C
23 reset working directory to branch a
23 reset working directory to branch a
24 $ hg commit -d '2 0' -m "Adding to a branch"
24 $ hg commit -d '2 0' -m "Adding to a branch"
25
25
26 $ hg update -C 0
26 $ hg update -C 0
27 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
27 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
28 $ echo 'b' >b
28 $ echo 'b' >b
29 $ hg add b
29 $ hg add b
30 $ hg branch b
30 $ hg branch b
31 marked working directory as branch b
31 marked working directory as branch b
32 $ hg commit -d '2 0' -m "Adding b branch"
32 $ hg commit -d '2 0' -m "Adding b branch"
33
33
34 $ echo 'bh1' >bh1
34 $ echo 'bh1' >bh1
35 $ hg add bh1
35 $ hg add bh1
36 $ hg commit -d '3 0' -m "Adding b branch head 1"
36 $ hg commit -d '3 0' -m "Adding b branch head 1"
37
37
38 $ hg update -C 2
38 $ hg update -C 2
39 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
39 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
40 $ echo 'bh2' >bh2
40 $ echo 'bh2' >bh2
41 $ hg add bh2
41 $ hg add bh2
42 $ hg commit -d '4 0' -m "Adding b branch head 2"
42 $ hg commit -d '4 0' -m "Adding b branch head 2"
43
43
44 $ echo 'c' >c
44 $ echo 'c' >c
45 $ hg add c
45 $ hg add c
46 $ hg branch c
46 $ hg branch c
47 marked working directory as branch c
47 marked working directory as branch c
48 $ hg commit -d '5 0' -m "Adding c branch"
48 $ hg commit -d '5 0' -m "Adding c branch"
49
49
50 reserved names
50 reserved names
51
51
52 $ hg branch tip
52 $ hg branch tip
53 abort: the name 'tip' is reserved
53 abort: the name 'tip' is reserved
54 [255]
54 [255]
55 $ hg branch null
55 $ hg branch null
56 abort: the name 'null' is reserved
56 abort: the name 'null' is reserved
57 [255]
57 [255]
58 $ hg branch .
58 $ hg branch .
59 abort: the name '.' is reserved
59 abort: the name '.' is reserved
60 [255]
60 [255]
61
61
62 invalid characters
62 invalid characters
63
63
64 $ hg branch 'foo:bar'
64 $ hg branch 'foo:bar'
65 abort: ':' cannot be used in a name
65 abort: ':' cannot be used in a name
66 [255]
66 [255]
67
67
68 $ hg branch 'foo
68 $ hg branch 'foo
69 > bar'
69 > bar'
70 abort: '\n' cannot be used in a name
70 abort: '\n' cannot be used in a name
71 [255]
71 [255]
72
72
73 trailing or leading spaces should be stripped before testing duplicates
73 trailing or leading spaces should be stripped before testing duplicates
74
74
75 $ hg branch 'b '
75 $ hg branch 'b '
76 abort: a branch of the same name already exists
76 abort: a branch of the same name already exists
77 (use 'hg update' to switch to it)
77 (use 'hg update' to switch to it)
78 [255]
78 [255]
79
79
80 $ hg branch ' b'
80 $ hg branch ' b'
81 abort: a branch of the same name already exists
81 abort: a branch of the same name already exists
82 (use 'hg update' to switch to it)
82 (use 'hg update' to switch to it)
83 [255]
83 [255]
84
84
85 verify update will accept invalid legacy branch names
85 verify update will accept invalid legacy branch names
86
86
87 $ hg init test-invalid-branch-name
87 $ hg init test-invalid-branch-name
88 $ cd test-invalid-branch-name
88 $ cd test-invalid-branch-name
89 $ hg unbundle -u "$TESTDIR"/bundles/test-invalid-branch-name.hg
89 $ hg unbundle -u "$TESTDIR"/bundles/test-invalid-branch-name.hg
90 adding changesets
90 adding changesets
91 adding manifests
91 adding manifests
92 adding file changes
92 adding file changes
93 added 3 changesets with 3 changes to 2 files
93 added 3 changesets with 3 changes to 2 files
94 new changesets f0e4c7f04036:33c2ceb9310b (3 drafts)
94 new changesets f0e4c7f04036:33c2ceb9310b (3 drafts)
95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
96
96
97 $ hg update '"colon:test"'
97 $ hg update '"colon:test"'
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 $ cd ..
99 $ cd ..
100
100
101 $ echo 'd' >d
101 $ echo 'd' >d
102 $ hg add d
102 $ hg add d
103 $ hg branch 'a branch name much longer than the default justification used by branches'
103 $ hg branch 'a branch name much longer than the default justification used by branches'
104 marked working directory as branch a branch name much longer than the default justification used by branches
104 marked working directory as branch a branch name much longer than the default justification used by branches
105 $ hg commit -d '6 0' -m "Adding d branch"
105 $ hg commit -d '6 0' -m "Adding d branch"
106
106
107 $ hg branches
107 $ hg branches
108 a branch name much longer than the default justification used by branches 7:10ff5895aa57
108 a branch name much longer than the default justification used by branches 7:10ff5895aa57
109 b 4:aee39cd168d0
109 b 4:aee39cd168d0
110 c 6:589736a22561 (inactive)
110 c 6:589736a22561 (inactive)
111 a 5:d8cbc61dbaa6 (inactive)
111 a 5:d8cbc61dbaa6 (inactive)
112 default 0:19709c5a4e75 (inactive)
112 default 0:19709c5a4e75 (inactive)
113
113
114 -------
114 -------
115
115
116 $ hg branches -a
116 $ hg branches -a
117 a branch name much longer than the default justification used by branches 7:10ff5895aa57
117 a branch name much longer than the default justification used by branches 7:10ff5895aa57
118 b 4:aee39cd168d0
118 b 4:aee39cd168d0
119
119
120 --- Branch a
120 --- Branch a
121
121
122 $ hg log -b a
122 $ hg log -b a
123 changeset: 5:d8cbc61dbaa6
123 changeset: 5:d8cbc61dbaa6
124 branch: a
124 branch: a
125 parent: 2:881fe2b92ad0
125 parent: 2:881fe2b92ad0
126 user: test
126 user: test
127 date: Thu Jan 01 00:00:04 1970 +0000
127 date: Thu Jan 01 00:00:04 1970 +0000
128 summary: Adding b branch head 2
128 summary: Adding b branch head 2
129
129
130 changeset: 2:881fe2b92ad0
130 changeset: 2:881fe2b92ad0
131 branch: a
131 branch: a
132 user: test
132 user: test
133 date: Thu Jan 01 00:00:02 1970 +0000
133 date: Thu Jan 01 00:00:02 1970 +0000
134 summary: Adding to a branch
134 summary: Adding to a branch
135
135
136 changeset: 1:dd6b440dd85a
136 changeset: 1:dd6b440dd85a
137 branch: a
137 branch: a
138 user: test
138 user: test
139 date: Thu Jan 01 00:00:01 1970 +0000
139 date: Thu Jan 01 00:00:01 1970 +0000
140 summary: Adding a branch
140 summary: Adding a branch
141
141
142
142
143 ---- Branch b
143 ---- Branch b
144
144
145 $ hg log -b b
145 $ hg log -b b
146 changeset: 4:aee39cd168d0
146 changeset: 4:aee39cd168d0
147 branch: b
147 branch: b
148 user: test
148 user: test
149 date: Thu Jan 01 00:00:03 1970 +0000
149 date: Thu Jan 01 00:00:03 1970 +0000
150 summary: Adding b branch head 1
150 summary: Adding b branch head 1
151
151
152 changeset: 3:ac22033332d1
152 changeset: 3:ac22033332d1
153 branch: b
153 branch: b
154 parent: 0:19709c5a4e75
154 parent: 0:19709c5a4e75
155 user: test
155 user: test
156 date: Thu Jan 01 00:00:02 1970 +0000
156 date: Thu Jan 01 00:00:02 1970 +0000
157 summary: Adding b branch
157 summary: Adding b branch
158
158
159
159
160 ---- going to test branch listing by rev
160 ---- going to test branch listing by rev
161 $ hg branches -r0
161 $ hg branches -r0
162 default 0:19709c5a4e75 (inactive)
162 default 0:19709c5a4e75 (inactive)
163 $ hg branches -qr0
163 $ hg branches -qr0
164 default
164 default
165 --- now more than one rev
165 --- now more than one rev
166 $ hg branches -r2:5
166 $ hg branches -r2:5
167 b 4:aee39cd168d0
167 b 4:aee39cd168d0
168 a 5:d8cbc61dbaa6 (inactive)
168 a 5:d8cbc61dbaa6 (inactive)
169 $ hg branches -qr2:5
169 $ hg branches -qr2:5
170 b
170 b
171 a
171 a
172 ---- going to test branch closing
172 ---- going to test branch closing
173
173
174 $ hg branches
174 $ hg branches
175 a branch name much longer than the default justification used by branches 7:10ff5895aa57
175 a branch name much longer than the default justification used by branches 7:10ff5895aa57
176 b 4:aee39cd168d0
176 b 4:aee39cd168d0
177 c 6:589736a22561 (inactive)
177 c 6:589736a22561 (inactive)
178 a 5:d8cbc61dbaa6 (inactive)
178 a 5:d8cbc61dbaa6 (inactive)
179 default 0:19709c5a4e75 (inactive)
179 default 0:19709c5a4e75 (inactive)
180 $ hg up -C b
180 $ hg up -C b
181 2 files updated, 0 files merged, 4 files removed, 0 files unresolved
181 2 files updated, 0 files merged, 4 files removed, 0 files unresolved
182 $ echo 'xxx1' >> b
182 $ echo 'xxx1' >> b
183 $ hg commit -d '7 0' -m 'adding cset to branch b'
183 $ hg commit -d '7 0' -m 'adding cset to branch b'
184 $ hg up -C aee39cd168d0
184 $ hg up -C aee39cd168d0
185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 $ echo 'xxx2' >> b
186 $ echo 'xxx2' >> b
187 $ hg commit -d '8 0' -m 'adding head to branch b'
187 $ hg commit -d '8 0' -m 'adding head to branch b'
188 created new head
188 created new head
189 $ echo 'xxx3' >> b
189 $ echo 'xxx3' >> b
190 $ hg commit -d '9 0' -m 'adding another cset to branch b'
190 $ hg commit -d '9 0' -m 'adding another cset to branch b'
191 $ hg branches
191 $ hg branches
192 b 10:bfbe841b666e
192 b 10:bfbe841b666e
193 a branch name much longer than the default justification used by branches 7:10ff5895aa57
193 a branch name much longer than the default justification used by branches 7:10ff5895aa57
194 c 6:589736a22561 (inactive)
194 c 6:589736a22561 (inactive)
195 a 5:d8cbc61dbaa6 (inactive)
195 a 5:d8cbc61dbaa6 (inactive)
196 default 0:19709c5a4e75 (inactive)
196 default 0:19709c5a4e75 (inactive)
197 $ hg heads --closed
197 $ hg heads --closed
198 changeset: 10:bfbe841b666e
198 changeset: 10:bfbe841b666e
199 branch: b
199 branch: b
200 tag: tip
200 tag: tip
201 user: test
201 user: test
202 date: Thu Jan 01 00:00:09 1970 +0000
202 date: Thu Jan 01 00:00:09 1970 +0000
203 summary: adding another cset to branch b
203 summary: adding another cset to branch b
204
204
205 changeset: 8:eebb944467c9
205 changeset: 8:eebb944467c9
206 branch: b
206 branch: b
207 parent: 4:aee39cd168d0
207 parent: 4:aee39cd168d0
208 user: test
208 user: test
209 date: Thu Jan 01 00:00:07 1970 +0000
209 date: Thu Jan 01 00:00:07 1970 +0000
210 summary: adding cset to branch b
210 summary: adding cset to branch b
211
211
212 changeset: 7:10ff5895aa57
212 changeset: 7:10ff5895aa57
213 branch: a branch name much longer than the default justification used by branches
213 branch: a branch name much longer than the default justification used by branches
214 user: test
214 user: test
215 date: Thu Jan 01 00:00:06 1970 +0000
215 date: Thu Jan 01 00:00:06 1970 +0000
216 summary: Adding d branch
216 summary: Adding d branch
217
217
218 changeset: 6:589736a22561
218 changeset: 6:589736a22561
219 branch: c
219 branch: c
220 user: test
220 user: test
221 date: Thu Jan 01 00:00:05 1970 +0000
221 date: Thu Jan 01 00:00:05 1970 +0000
222 summary: Adding c branch
222 summary: Adding c branch
223
223
224 changeset: 5:d8cbc61dbaa6
224 changeset: 5:d8cbc61dbaa6
225 branch: a
225 branch: a
226 parent: 2:881fe2b92ad0
226 parent: 2:881fe2b92ad0
227 user: test
227 user: test
228 date: Thu Jan 01 00:00:04 1970 +0000
228 date: Thu Jan 01 00:00:04 1970 +0000
229 summary: Adding b branch head 2
229 summary: Adding b branch head 2
230
230
231 changeset: 0:19709c5a4e75
231 changeset: 0:19709c5a4e75
232 user: test
232 user: test
233 date: Thu Jan 01 00:00:00 1970 +0000
233 date: Thu Jan 01 00:00:00 1970 +0000
234 summary: Adding root node
234 summary: Adding root node
235
235
236 $ hg heads
236 $ hg heads
237 changeset: 10:bfbe841b666e
237 changeset: 10:bfbe841b666e
238 branch: b
238 branch: b
239 tag: tip
239 tag: tip
240 user: test
240 user: test
241 date: Thu Jan 01 00:00:09 1970 +0000
241 date: Thu Jan 01 00:00:09 1970 +0000
242 summary: adding another cset to branch b
242 summary: adding another cset to branch b
243
243
244 changeset: 8:eebb944467c9
244 changeset: 8:eebb944467c9
245 branch: b
245 branch: b
246 parent: 4:aee39cd168d0
246 parent: 4:aee39cd168d0
247 user: test
247 user: test
248 date: Thu Jan 01 00:00:07 1970 +0000
248 date: Thu Jan 01 00:00:07 1970 +0000
249 summary: adding cset to branch b
249 summary: adding cset to branch b
250
250
251 changeset: 7:10ff5895aa57
251 changeset: 7:10ff5895aa57
252 branch: a branch name much longer than the default justification used by branches
252 branch: a branch name much longer than the default justification used by branches
253 user: test
253 user: test
254 date: Thu Jan 01 00:00:06 1970 +0000
254 date: Thu Jan 01 00:00:06 1970 +0000
255 summary: Adding d branch
255 summary: Adding d branch
256
256
257 changeset: 6:589736a22561
257 changeset: 6:589736a22561
258 branch: c
258 branch: c
259 user: test
259 user: test
260 date: Thu Jan 01 00:00:05 1970 +0000
260 date: Thu Jan 01 00:00:05 1970 +0000
261 summary: Adding c branch
261 summary: Adding c branch
262
262
263 changeset: 5:d8cbc61dbaa6
263 changeset: 5:d8cbc61dbaa6
264 branch: a
264 branch: a
265 parent: 2:881fe2b92ad0
265 parent: 2:881fe2b92ad0
266 user: test
266 user: test
267 date: Thu Jan 01 00:00:04 1970 +0000
267 date: Thu Jan 01 00:00:04 1970 +0000
268 summary: Adding b branch head 2
268 summary: Adding b branch head 2
269
269
270 changeset: 0:19709c5a4e75
270 changeset: 0:19709c5a4e75
271 user: test
271 user: test
272 date: Thu Jan 01 00:00:00 1970 +0000
272 date: Thu Jan 01 00:00:00 1970 +0000
273 summary: Adding root node
273 summary: Adding root node
274
274
275 $ hg commit -d '9 0' --close-branch -m 'prune bad branch'
275 $ hg commit -d '9 0' --close-branch -m 'prune bad branch'
276 $ hg branches -a
276 $ hg branches -a
277 b 8:eebb944467c9
277 b 8:eebb944467c9
278 a branch name much longer than the default justification used by branches 7:10ff5895aa57
278 a branch name much longer than the default justification used by branches 7:10ff5895aa57
279 $ hg up -C b
279 $ hg up -C b
280 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
280 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
281 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
282 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
282 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
283 abort: can only close branch heads
283 abort: can only close branch heads
284 [255]
284 [255]
285
285
286 $ hg log -r tip --debug
286 $ hg log -r tip --debug
287 changeset: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
287 changeset: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
288 branch: b
288 branch: b
289 tag: tip
289 tag: tip
290 phase: draft
290 phase: draft
291 parent: 8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1
291 parent: 8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1
292 parent: -1:0000000000000000000000000000000000000000
292 parent: -1:0000000000000000000000000000000000000000
293 manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
293 manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
294 user: test
294 user: test
295 date: Thu Jan 01 00:00:09 1970 +0000
295 date: Thu Jan 01 00:00:09 1970 +0000
296 extra: branch=b
296 extra: branch=b
297 extra: close=1
297 extra: close=1
298 description:
298 description:
299 close this part branch too
299 close this part branch too
300
300
301
301
302 --- b branch should be inactive
302 --- b branch should be inactive
303
303
304 $ hg branches
304 $ hg branches
305 a branch name much longer than the default justification used by branches 7:10ff5895aa57
305 a branch name much longer than the default justification used by branches 7:10ff5895aa57
306 c 6:589736a22561 (inactive)
306 c 6:589736a22561 (inactive)
307 a 5:d8cbc61dbaa6 (inactive)
307 a 5:d8cbc61dbaa6 (inactive)
308 default 0:19709c5a4e75 (inactive)
308 default 0:19709c5a4e75 (inactive)
309 $ hg branches -c
309 $ hg branches -c
310 a branch name much longer than the default justification used by branches 7:10ff5895aa57
310 a branch name much longer than the default justification used by branches 7:10ff5895aa57
311 b 12:e3d49c0575d8 (closed)
311 b 12:e3d49c0575d8 (closed)
312 c 6:589736a22561 (inactive)
312 c 6:589736a22561 (inactive)
313 a 5:d8cbc61dbaa6 (inactive)
313 a 5:d8cbc61dbaa6 (inactive)
314 default 0:19709c5a4e75 (inactive)
314 default 0:19709c5a4e75 (inactive)
315 $ hg branches -a
315 $ hg branches -a
316 a branch name much longer than the default justification used by branches 7:10ff5895aa57
316 a branch name much longer than the default justification used by branches 7:10ff5895aa57
317 $ hg branches -q
317 $ hg branches -q
318 a branch name much longer than the default justification used by branches
318 a branch name much longer than the default justification used by branches
319 c
319 c
320 a
320 a
321 default
321 default
322 $ hg heads b
322 $ hg heads b
323 no open branch heads found on branches b
323 no open branch heads found on branches b
324 [1]
324 [1]
325 $ hg heads --closed b
325 $ hg heads --closed b
326 changeset: 12:e3d49c0575d8
326 changeset: 12:e3d49c0575d8
327 branch: b
327 branch: b
328 tag: tip
328 tag: tip
329 parent: 8:eebb944467c9
329 parent: 8:eebb944467c9
330 user: test
330 user: test
331 date: Thu Jan 01 00:00:09 1970 +0000
331 date: Thu Jan 01 00:00:09 1970 +0000
332 summary: close this part branch too
332 summary: close this part branch too
333
333
334 changeset: 11:d3f163457ebf
334 changeset: 11:d3f163457ebf
335 branch: b
335 branch: b
336 user: test
336 user: test
337 date: Thu Jan 01 00:00:09 1970 +0000
337 date: Thu Jan 01 00:00:09 1970 +0000
338 summary: prune bad branch
338 summary: prune bad branch
339
339
340 $ echo 'xxx4' >> b
340 $ echo 'xxx4' >> b
341 $ hg commit -d '9 0' -m 'reopen branch with a change'
341 $ hg commit -d '9 0' -m 'reopen branch with a change'
342 reopening closed branch head 12
342 reopening closed branch head 12
343
343
344 --- branch b is back in action
344 --- branch b is back in action
345
345
346 $ hg branches -a
346 $ hg branches -a
347 b 13:e23b5505d1ad
347 b 13:e23b5505d1ad
348 a branch name much longer than the default justification used by branches 7:10ff5895aa57
348 a branch name much longer than the default justification used by branches 7:10ff5895aa57
349
349
350 ---- test heads listings
350 ---- test heads listings
351
351
352 $ hg heads
352 $ hg heads
353 changeset: 13:e23b5505d1ad
353 changeset: 13:e23b5505d1ad
354 branch: b
354 branch: b
355 tag: tip
355 tag: tip
356 user: test
356 user: test
357 date: Thu Jan 01 00:00:09 1970 +0000
357 date: Thu Jan 01 00:00:09 1970 +0000
358 summary: reopen branch with a change
358 summary: reopen branch with a change
359
359
360 changeset: 7:10ff5895aa57
360 changeset: 7:10ff5895aa57
361 branch: a branch name much longer than the default justification used by branches
361 branch: a branch name much longer than the default justification used by branches
362 user: test
362 user: test
363 date: Thu Jan 01 00:00:06 1970 +0000
363 date: Thu Jan 01 00:00:06 1970 +0000
364 summary: Adding d branch
364 summary: Adding d branch
365
365
366 changeset: 6:589736a22561
366 changeset: 6:589736a22561
367 branch: c
367 branch: c
368 user: test
368 user: test
369 date: Thu Jan 01 00:00:05 1970 +0000
369 date: Thu Jan 01 00:00:05 1970 +0000
370 summary: Adding c branch
370 summary: Adding c branch
371
371
372 changeset: 5:d8cbc61dbaa6
372 changeset: 5:d8cbc61dbaa6
373 branch: a
373 branch: a
374 parent: 2:881fe2b92ad0
374 parent: 2:881fe2b92ad0
375 user: test
375 user: test
376 date: Thu Jan 01 00:00:04 1970 +0000
376 date: Thu Jan 01 00:00:04 1970 +0000
377 summary: Adding b branch head 2
377 summary: Adding b branch head 2
378
378
379 changeset: 0:19709c5a4e75
379 changeset: 0:19709c5a4e75
380 user: test
380 user: test
381 date: Thu Jan 01 00:00:00 1970 +0000
381 date: Thu Jan 01 00:00:00 1970 +0000
382 summary: Adding root node
382 summary: Adding root node
383
383
384
384
385 branch default
385 branch default
386
386
387 $ hg heads default
387 $ hg heads default
388 changeset: 0:19709c5a4e75
388 changeset: 0:19709c5a4e75
389 user: test
389 user: test
390 date: Thu Jan 01 00:00:00 1970 +0000
390 date: Thu Jan 01 00:00:00 1970 +0000
391 summary: Adding root node
391 summary: Adding root node
392
392
393
393
394 branch a
394 branch a
395
395
396 $ hg heads a
396 $ hg heads a
397 changeset: 5:d8cbc61dbaa6
397 changeset: 5:d8cbc61dbaa6
398 branch: a
398 branch: a
399 parent: 2:881fe2b92ad0
399 parent: 2:881fe2b92ad0
400 user: test
400 user: test
401 date: Thu Jan 01 00:00:04 1970 +0000
401 date: Thu Jan 01 00:00:04 1970 +0000
402 summary: Adding b branch head 2
402 summary: Adding b branch head 2
403
403
404 $ hg heads --active a
404 $ hg heads --active a
405 no open branch heads found on branches a
405 no open branch heads found on branches a
406 [1]
406 [1]
407
407
408 branch b
408 branch b
409
409
410 $ hg heads b
410 $ hg heads b
411 changeset: 13:e23b5505d1ad
411 changeset: 13:e23b5505d1ad
412 branch: b
412 branch: b
413 tag: tip
413 tag: tip
414 user: test
414 user: test
415 date: Thu Jan 01 00:00:09 1970 +0000
415 date: Thu Jan 01 00:00:09 1970 +0000
416 summary: reopen branch with a change
416 summary: reopen branch with a change
417
417
418 $ hg heads --closed b
418 $ hg heads --closed b
419 changeset: 13:e23b5505d1ad
419 changeset: 13:e23b5505d1ad
420 branch: b
420 branch: b
421 tag: tip
421 tag: tip
422 user: test
422 user: test
423 date: Thu Jan 01 00:00:09 1970 +0000
423 date: Thu Jan 01 00:00:09 1970 +0000
424 summary: reopen branch with a change
424 summary: reopen branch with a change
425
425
426 changeset: 11:d3f163457ebf
426 changeset: 11:d3f163457ebf
427 branch: b
427 branch: b
428 user: test
428 user: test
429 date: Thu Jan 01 00:00:09 1970 +0000
429 date: Thu Jan 01 00:00:09 1970 +0000
430 summary: prune bad branch
430 summary: prune bad branch
431
431
432
432
433 reclose branch
433 reclose branch
434
434
435 $ hg up -C c
435 $ hg up -C c
436 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
436 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
437 $ hg commit -d '9 0' --close-branch -m 'reclosing this branch'
437 $ hg commit -d '9 0' --close-branch -m 'reclosing this branch'
438 $ hg branches
438 $ hg branches
439 b 13:e23b5505d1ad
439 b 13:e23b5505d1ad
440 a branch name much longer than the default justification used by branches 7:10ff5895aa57
440 a branch name much longer than the default justification used by branches 7:10ff5895aa57
441 a 5:d8cbc61dbaa6 (inactive)
441 a 5:d8cbc61dbaa6 (inactive)
442 default 0:19709c5a4e75 (inactive)
442 default 0:19709c5a4e75 (inactive)
443 $ hg branches --closed
443 $ hg branches --closed
444 b 13:e23b5505d1ad
444 b 13:e23b5505d1ad
445 a branch name much longer than the default justification used by branches 7:10ff5895aa57
445 a branch name much longer than the default justification used by branches 7:10ff5895aa57
446 c 14:f894c25619d3 (closed)
446 c 14:f894c25619d3 (closed)
447 a 5:d8cbc61dbaa6 (inactive)
447 a 5:d8cbc61dbaa6 (inactive)
448 default 0:19709c5a4e75 (inactive)
448 default 0:19709c5a4e75 (inactive)
449
449
450 multihead branch
450 multihead branch
451
451
452 $ hg up -C default
452 $ hg up -C default
453 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
453 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
454 $ hg branch m
454 $ hg branch m
455 marked working directory as branch m
455 marked working directory as branch m
456 $ touch m
456 $ touch m
457 $ hg add m
457 $ hg add m
458 $ hg commit -d '10 0' -m 'multihead base'
458 $ hg commit -d '10 0' -m 'multihead base'
459 $ echo "m1" >m
459 $ echo "m1" >m
460 $ hg commit -d '10 0' -m 'head 1'
460 $ hg commit -d '10 0' -m 'head 1'
461 $ hg up -C '.^'
461 $ hg up -C '.^'
462 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
462 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
463 $ echo "m2" >m
463 $ echo "m2" >m
464 $ hg commit -d '10 0' -m 'head 2'
464 $ hg commit -d '10 0' -m 'head 2'
465 created new head
465 created new head
466 $ hg log -b m
466 $ hg log -b m
467 changeset: 17:df343b0df04f
467 changeset: 17:df343b0df04f
468 branch: m
468 branch: m
469 tag: tip
469 tag: tip
470 parent: 15:f3447637f53e
470 parent: 15:f3447637f53e
471 user: test
471 user: test
472 date: Thu Jan 01 00:00:10 1970 +0000
472 date: Thu Jan 01 00:00:10 1970 +0000
473 summary: head 2
473 summary: head 2
474
474
475 changeset: 16:a58ca5d3bdf3
475 changeset: 16:a58ca5d3bdf3
476 branch: m
476 branch: m
477 user: test
477 user: test
478 date: Thu Jan 01 00:00:10 1970 +0000
478 date: Thu Jan 01 00:00:10 1970 +0000
479 summary: head 1
479 summary: head 1
480
480
481 changeset: 15:f3447637f53e
481 changeset: 15:f3447637f53e
482 branch: m
482 branch: m
483 parent: 0:19709c5a4e75
483 parent: 0:19709c5a4e75
484 user: test
484 user: test
485 date: Thu Jan 01 00:00:10 1970 +0000
485 date: Thu Jan 01 00:00:10 1970 +0000
486 summary: multihead base
486 summary: multihead base
487
487
488 $ hg heads --topo m
488 $ hg heads --topo m
489 changeset: 17:df343b0df04f
489 changeset: 17:df343b0df04f
490 branch: m
490 branch: m
491 tag: tip
491 tag: tip
492 parent: 15:f3447637f53e
492 parent: 15:f3447637f53e
493 user: test
493 user: test
494 date: Thu Jan 01 00:00:10 1970 +0000
494 date: Thu Jan 01 00:00:10 1970 +0000
495 summary: head 2
495 summary: head 2
496
496
497 changeset: 16:a58ca5d3bdf3
497 changeset: 16:a58ca5d3bdf3
498 branch: m
498 branch: m
499 user: test
499 user: test
500 date: Thu Jan 01 00:00:10 1970 +0000
500 date: Thu Jan 01 00:00:10 1970 +0000
501 summary: head 1
501 summary: head 1
502
502
503 $ hg branches
503 $ hg branches
504 m 17:df343b0df04f
504 m 17:df343b0df04f
505 b 13:e23b5505d1ad
505 b 13:e23b5505d1ad
506 a branch name much longer than the default justification used by branches 7:10ff5895aa57
506 a branch name much longer than the default justification used by branches 7:10ff5895aa57
507 a 5:d8cbc61dbaa6 (inactive)
507 a 5:d8cbc61dbaa6 (inactive)
508 default 0:19709c5a4e75 (inactive)
508 default 0:19709c5a4e75 (inactive)
509
509
510 partially merge multihead branch
510 partially merge multihead branch
511
511
512 $ hg up -C default
512 $ hg up -C default
513 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
513 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
514 $ hg branch md
514 $ hg branch md
515 marked working directory as branch md
515 marked working directory as branch md
516 $ hg merge m
516 $ hg merge m
517 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
517 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
518 (branch merge, don't forget to commit)
518 (branch merge, don't forget to commit)
519 $ hg commit -d '11 0' -m 'merge head 2'
519 $ hg commit -d '11 0' -m 'merge head 2'
520 $ hg heads --topo m
520 $ hg heads --topo m
521 changeset: 16:a58ca5d3bdf3
521 changeset: 16:a58ca5d3bdf3
522 branch: m
522 branch: m
523 user: test
523 user: test
524 date: Thu Jan 01 00:00:10 1970 +0000
524 date: Thu Jan 01 00:00:10 1970 +0000
525 summary: head 1
525 summary: head 1
526
526
527 $ hg branches
527 $ hg branches
528 md 18:c914c99f1fbb
528 md 18:c914c99f1fbb
529 m 17:df343b0df04f
529 m 17:df343b0df04f
530 b 13:e23b5505d1ad
530 b 13:e23b5505d1ad
531 a branch name much longer than the default justification used by branches 7:10ff5895aa57
531 a branch name much longer than the default justification used by branches 7:10ff5895aa57
532 a 5:d8cbc61dbaa6 (inactive)
532 a 5:d8cbc61dbaa6 (inactive)
533 default 0:19709c5a4e75 (inactive)
533 default 0:19709c5a4e75 (inactive)
534
534
535 partially close multihead branch
535 partially close multihead branch
536
536
537 $ hg up -C a58ca5d3bdf3
537 $ hg up -C a58ca5d3bdf3
538 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
538 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
539 $ hg commit -d '12 0' -m 'close head 1' --close-branch
539 $ hg commit -d '12 0' -m 'close head 1' --close-branch
540 $ hg heads --topo m
540 $ hg heads --topo m
541 changeset: 19:cd21a80baa3d
541 changeset: 19:cd21a80baa3d
542 branch: m
542 branch: m
543 tag: tip
543 tag: tip
544 parent: 16:a58ca5d3bdf3
544 parent: 16:a58ca5d3bdf3
545 user: test
545 user: test
546 date: Thu Jan 01 00:00:12 1970 +0000
546 date: Thu Jan 01 00:00:12 1970 +0000
547 summary: close head 1
547 summary: close head 1
548
548
549 $ hg branches
549 $ hg branches
550 md 18:c914c99f1fbb
550 md 18:c914c99f1fbb
551 b 13:e23b5505d1ad
551 b 13:e23b5505d1ad
552 a branch name much longer than the default justification used by branches 7:10ff5895aa57
552 a branch name much longer than the default justification used by branches 7:10ff5895aa57
553 m 17:df343b0df04f (inactive)
553 m 17:df343b0df04f (inactive)
554 a 5:d8cbc61dbaa6 (inactive)
554 a 5:d8cbc61dbaa6 (inactive)
555 default 0:19709c5a4e75 (inactive)
555 default 0:19709c5a4e75 (inactive)
556
556
557 default branch colors:
557 default branch colors:
558
558
559 $ cat <<EOF >> $HGRCPATH
559 $ cat <<EOF >> $HGRCPATH
560 > [extensions]
560 > [extensions]
561 > color =
561 > color =
562 > [color]
562 > [color]
563 > mode = ansi
563 > mode = ansi
564 > EOF
564 > EOF
565
565
566 $ hg up -C b
566 $ hg up -C b
567 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
567 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
568 $ hg branches --color=always
568 $ hg branches --color=always
569 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
569 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
570 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
570 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
571 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
571 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
572 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
572 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
573 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
573 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
574 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
574 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
575
575
576 default closed branch color:
576 default closed branch color:
577
577
578 $ hg branches --color=always --closed
578 $ hg branches --color=always --closed
579 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
579 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
580 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
580 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
581 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
581 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
582 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
582 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
583 \x1b[0;30;1mc\x1b[0m\x1b[0;33m 14:f894c25619d3\x1b[0m (closed) (esc)
583 \x1b[0;30;1mc\x1b[0m\x1b[0;33m 14:f894c25619d3\x1b[0m (closed) (esc)
584 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
584 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
585 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
585 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
586
586
587 $ cat <<EOF >> $HGRCPATH
587 $ cat <<EOF >> $HGRCPATH
588 > [extensions]
588 > [extensions]
589 > color =
589 > color =
590 > [color]
590 > [color]
591 > branches.active = green
591 > branches.active = green
592 > branches.closed = blue
592 > branches.closed = blue
593 > branches.current = red
593 > branches.current = red
594 > branches.inactive = magenta
594 > branches.inactive = magenta
595 > log.changeset = cyan
595 > log.changeset = cyan
596 > EOF
596 > EOF
597
597
598 custom branch colors:
598 custom branch colors:
599
599
600 $ hg branches --color=always
600 $ hg branches --color=always
601 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
601 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
602 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
602 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
603 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
603 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
604 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
604 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
605 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
605 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
606 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
606 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
607
607
608 custom closed branch color:
608 custom closed branch color:
609
609
610 $ hg branches --color=always --closed
610 $ hg branches --color=always --closed
611 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
611 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
612 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
612 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
613 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
613 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
614 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
614 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
615 \x1b[0;34mc\x1b[0m\x1b[0;36m 14:f894c25619d3\x1b[0m (closed) (esc)
615 \x1b[0;34mc\x1b[0m\x1b[0;36m 14:f894c25619d3\x1b[0m (closed) (esc)
616 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
616 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
617 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
617 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
618
618
619 template output:
619 template output:
620
620
621 $ hg branches -Tjson --closed
621 $ hg branches -Tjson --closed
622 [
622 [
623 {
623 {
624 "active": true,
624 "active": true,
625 "branch": "md",
625 "branch": "md",
626 "closed": false,
626 "closed": false,
627 "current": false,
627 "current": false,
628 "node": "c914c99f1fbb2b1d785a0a939ed3f67275df18e9",
628 "node": "c914c99f1fbb2b1d785a0a939ed3f67275df18e9",
629 "rev": 18
629 "rev": 18
630 },
630 },
631 {
631 {
632 "active": true,
632 "active": true,
633 "branch": "b",
633 "branch": "b",
634 "closed": false,
634 "closed": false,
635 "current": true,
635 "current": true,
636 "node": "e23b5505d1ad24aab6f84fd8c7cb8cd8e5e93be0",
636 "node": "e23b5505d1ad24aab6f84fd8c7cb8cd8e5e93be0",
637 "rev": 13
637 "rev": 13
638 },
638 },
639 {
639 {
640 "active": true,
640 "active": true,
641 "branch": "a branch name much longer than the default justification used by branches",
641 "branch": "a branch name much longer than the default justification used by branches",
642 "closed": false,
642 "closed": false,
643 "current": false,
643 "current": false,
644 "node": "10ff5895aa5793bd378da574af8cec8ea408d831",
644 "node": "10ff5895aa5793bd378da574af8cec8ea408d831",
645 "rev": 7
645 "rev": 7
646 },
646 },
647 {
647 {
648 "active": false,
648 "active": false,
649 "branch": "m",
649 "branch": "m",
650 "closed": false,
650 "closed": false,
651 "current": false,
651 "current": false,
652 "node": "df343b0df04feb2a946cd4b6e9520e552fef14ee",
652 "node": "df343b0df04feb2a946cd4b6e9520e552fef14ee",
653 "rev": 17
653 "rev": 17
654 },
654 },
655 {
655 {
656 "active": false,
656 "active": false,
657 "branch": "c",
657 "branch": "c",
658 "closed": true,
658 "closed": true,
659 "current": false,
659 "current": false,
660 "node": "f894c25619d3f1484639d81be950e0a07bc6f1f6",
660 "node": "f894c25619d3f1484639d81be950e0a07bc6f1f6",
661 "rev": 14
661 "rev": 14
662 },
662 },
663 {
663 {
664 "active": false,
664 "active": false,
665 "branch": "a",
665 "branch": "a",
666 "closed": false,
666 "closed": false,
667 "current": false,
667 "current": false,
668 "node": "d8cbc61dbaa6dc817175d1e301eecb863f280832",
668 "node": "d8cbc61dbaa6dc817175d1e301eecb863f280832",
669 "rev": 5
669 "rev": 5
670 },
670 },
671 {
671 {
672 "active": false,
672 "active": false,
673 "branch": "default",
673 "branch": "default",
674 "closed": false,
674 "closed": false,
675 "current": false,
675 "current": false,
676 "node": "19709c5a4e75bf938f8e349aff97438539bb729e",
676 "node": "19709c5a4e75bf938f8e349aff97438539bb729e",
677 "rev": 0
677 "rev": 0
678 }
678 }
679 ]
679 ]
680
680
681 $ hg branches --closed -T '{if(closed, "{branch}\n")}'
681 $ hg branches --closed -T '{if(closed, "{branch}\n")}'
682 c
682 c
683
683
684 $ hg branches -T '{word(0, branch)}: {desc|firstline}\n'
684 $ hg branches -T '{word(0, branch)}: {desc|firstline}\n'
685 md: merge head 2
685 md: merge head 2
686 b: reopen branch with a change
686 b: reopen branch with a change
687 a: Adding d branch
687 a: Adding d branch
688 m: head 2
688 m: head 2
689 a: Adding b branch head 2
689 a: Adding b branch head 2
690 default: Adding root node
690 default: Adding root node
691
691
692 $ cat <<'EOF' > "$TESTTMP/map-myjson"
692 $ cat <<'EOF' > "$TESTTMP/map-myjson"
693 > docheader = '\{\n'
693 > docheader = '\{\n'
694 > docfooter = '\n}\n'
694 > docfooter = '\n}\n'
695 > separator = ',\n'
695 > separator = ',\n'
696 > branches = ' {dict(branch, node|short)|json}'
696 > branches = ' {dict(branch, node|short)|json}'
697 > EOF
697 > EOF
698 $ hg branches -T "$TESTTMP/map-myjson"
698 $ hg branches -T "$TESTTMP/map-myjson"
699 {
699 {
700 {"branch": "md", "node": "c914c99f1fbb"},
700 {"branch": "md", "node": "c914c99f1fbb"},
701 {"branch": "b", "node": "e23b5505d1ad"},
701 {"branch": "b", "node": "e23b5505d1ad"},
702 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
702 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
703 {"branch": "m", "node": "df343b0df04f"},
703 {"branch": "m", "node": "df343b0df04f"},
704 {"branch": "a", "node": "d8cbc61dbaa6"},
704 {"branch": "a", "node": "d8cbc61dbaa6"},
705 {"branch": "default", "node": "19709c5a4e75"}
705 {"branch": "default", "node": "19709c5a4e75"}
706 }
706 }
707
707
708 $ cat <<'EOF' >> .hg/hgrc
708 $ cat <<'EOF' >> .hg/hgrc
709 > [templates]
709 > [templates]
710 > myjson = ' {dict(branch, node|short)|json}'
710 > myjson = ' {dict(branch, node|short)|json}'
711 > myjson:docheader = '\{\n'
711 > myjson:docheader = '\{\n'
712 > myjson:docfooter = '\n}\n'
712 > myjson:docfooter = '\n}\n'
713 > myjson:separator = ',\n'
713 > myjson:separator = ',\n'
714 > EOF
714 > EOF
715 $ hg branches -T myjson
715 $ hg branches -T myjson
716 {
716 {
717 {"branch": "md", "node": "c914c99f1fbb"},
717 {"branch": "md", "node": "c914c99f1fbb"},
718 {"branch": "b", "node": "e23b5505d1ad"},
718 {"branch": "b", "node": "e23b5505d1ad"},
719 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
719 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
720 {"branch": "m", "node": "df343b0df04f"},
720 {"branch": "m", "node": "df343b0df04f"},
721 {"branch": "a", "node": "d8cbc61dbaa6"},
721 {"branch": "a", "node": "d8cbc61dbaa6"},
722 {"branch": "default", "node": "19709c5a4e75"}
722 {"branch": "default", "node": "19709c5a4e75"}
723 }
723 }
724
724
725 $ cat <<'EOF' >> .hg/hgrc
725 $ cat <<'EOF' >> .hg/hgrc
726 > [templates]
726 > [templates]
727 > :docheader = 'should not be selected as a docheader for literal templates\n'
727 > :docheader = 'should not be selected as a docheader for literal templates\n'
728 > EOF
728 > EOF
729 $ hg branches -T '{branch}\n'
729 $ hg branches -T '{branch}\n'
730 md
730 md
731 b
731 b
732 a branch name much longer than the default justification used by branches
732 a branch name much longer than the default justification used by branches
733 m
733 m
734 a
734 a
735 default
735 default
736
736
737 Tests of revision branch name caching
737 Tests of revision branch name caching
738
738
739 We rev branch cache is updated automatically. In these tests we use a trick to
739 We rev branch cache is updated automatically. In these tests we use a trick to
740 trigger rebuilds. We remove the branch head cache and run 'hg head' to cause a
740 trigger rebuilds. We remove the branch head cache and run 'hg head' to cause a
741 rebuild that also will populate the rev branch cache.
741 rebuild that also will populate the rev branch cache.
742
742
743 revision branch cache is created when building the branch head cache
743 revision branch cache is created when building the branch head cache
744 $ rm -rf .hg/cache; hg head a -T '{rev}\n'
744 $ rm -rf .hg/cache; hg head a -T '{rev}\n'
745 5
745 5
746 $ f --hexdump --size .hg/cache/rbc-*
746 $ f --hexdump --size .hg/cache/rbc-*
747 .hg/cache/rbc-names-v1: size=92
747 .hg/cache/rbc-names-v1: size=92
748 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
748 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
749 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
749 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
750 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
750 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
751 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
751 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
752 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
752 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
753 0050: 72 61 6e 63 68 65 73 00 6d 00 6d 64 |ranches.m.md|
753 0050: 72 61 6e 63 68 65 73 00 6d 00 6d 64 |ranches.m.md|
754 .hg/cache/rbc-revs-v1: size=160
754 .hg/cache/rbc-revs-v1: size=160
755 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
755 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
756 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
756 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
757 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
757 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
758 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
758 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
759 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
759 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
760 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
760 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
761 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
761 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
762 0070: f8 94 c2 56 80 00 00 03 f3 44 76 37 00 00 00 05 |...V.....Dv7....|
762 0070: f8 94 c2 56 80 00 00 03 f3 44 76 37 00 00 00 05 |...V.....Dv7....|
763 0080: a5 8c a5 d3 00 00 00 05 df 34 3b 0d 00 00 00 05 |.........4;.....|
763 0080: a5 8c a5 d3 00 00 00 05 df 34 3b 0d 00 00 00 05 |.........4;.....|
764 0090: c9 14 c9 9f 00 00 00 06 cd 21 a8 0b 80 00 00 05 |.........!......|
764 0090: c9 14 c9 9f 00 00 00 06 cd 21 a8 0b 80 00 00 05 |.........!......|
765
765
766 no errors when revbranchcache is not writable
766 no errors when revbranchcache is not writable
767
767
768 $ echo >> .hg/cache/rbc-revs-v1
768 $ echo >> .hg/cache/rbc-revs-v1
769 $ mv .hg/cache/rbc-revs-v1 .hg/cache/rbc-revs-v1_
769 $ mv .hg/cache/rbc-revs-v1 .hg/cache/rbc-revs-v1_
770 $ mkdir .hg/cache/rbc-revs-v1
770 $ mkdir .hg/cache/rbc-revs-v1
771 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n'
771 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n'
772 5
772 5
773 $ rmdir .hg/cache/rbc-revs-v1
773 $ rmdir .hg/cache/rbc-revs-v1
774 $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1
774 $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1
775
775
776 no errors when wlock cannot be acquired
776 no errors when wlock cannot be acquired
777
777
778 #if unix-permissions
778 #if unix-permissions
779 $ mv .hg/cache/rbc-revs-v1 .hg/cache/rbc-revs-v1_
779 $ mv .hg/cache/rbc-revs-v1 .hg/cache/rbc-revs-v1_
780 $ rm -f .hg/cache/branch*
780 $ rm -f .hg/cache/branch*
781 $ chmod 555 .hg
781 $ chmod 555 .hg
782 $ hg head a -T '{rev}\n'
782 $ hg head a -T '{rev}\n'
783 5
783 5
784 $ chmod 755 .hg
784 $ chmod 755 .hg
785 $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1
785 $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1
786 #endif
786 #endif
787
787
788 recovery from invalid cache revs file with trailing data
788 recovery from invalid cache revs file with trailing data
789 $ echo >> .hg/cache/rbc-revs-v1
789 $ echo >> .hg/cache/rbc-revs-v1
790 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
790 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
791 5
791 5
792 truncating cache/rbc-revs-v1 to 160
792 truncating cache/rbc-revs-v1 to 160
793 $ f --size .hg/cache/rbc-revs*
793 $ f --size .hg/cache/rbc-revs*
794 .hg/cache/rbc-revs-v1: size=160
794 .hg/cache/rbc-revs-v1: size=160
795 recovery from invalid cache file with partial last record
795 recovery from invalid cache file with partial last record
796 $ mv .hg/cache/rbc-revs-v1 .
796 $ mv .hg/cache/rbc-revs-v1 .
797 $ f -qDB 119 rbc-revs-v1 > .hg/cache/rbc-revs-v1
797 $ f -qDB 119 rbc-revs-v1 > .hg/cache/rbc-revs-v1
798 $ f --size .hg/cache/rbc-revs*
798 $ f --size .hg/cache/rbc-revs*
799 .hg/cache/rbc-revs-v1: size=119
799 .hg/cache/rbc-revs-v1: size=119
800 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
800 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
801 5
801 5
802 truncating cache/rbc-revs-v1 to 112
802 truncating cache/rbc-revs-v1 to 112
803 $ f --size .hg/cache/rbc-revs*
803 $ f --size .hg/cache/rbc-revs*
804 .hg/cache/rbc-revs-v1: size=160
804 .hg/cache/rbc-revs-v1: size=160
805 recovery from invalid cache file with missing record - no truncation
805 recovery from invalid cache file with missing record - no truncation
806 $ mv .hg/cache/rbc-revs-v1 .
806 $ mv .hg/cache/rbc-revs-v1 .
807 $ f -qDB 112 rbc-revs-v1 > .hg/cache/rbc-revs-v1
807 $ f -qDB 112 rbc-revs-v1 > .hg/cache/rbc-revs-v1
808 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
808 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
809 5
809 5
810 $ f --size .hg/cache/rbc-revs*
810 $ f --size .hg/cache/rbc-revs*
811 .hg/cache/rbc-revs-v1: size=160
811 .hg/cache/rbc-revs-v1: size=160
812 recovery from invalid cache file with some bad records
812 recovery from invalid cache file with some bad records
813 $ mv .hg/cache/rbc-revs-v1 .
813 $ mv .hg/cache/rbc-revs-v1 .
814 $ f -qDB 8 rbc-revs-v1 > .hg/cache/rbc-revs-v1
814 $ f -qDB 8 rbc-revs-v1 > .hg/cache/rbc-revs-v1
815 $ f --size .hg/cache/rbc-revs*
815 $ f --size .hg/cache/rbc-revs*
816 .hg/cache/rbc-revs-v1: size=8
816 .hg/cache/rbc-revs-v1: size=8
817 $ f -qDB 112 rbc-revs-v1 >> .hg/cache/rbc-revs-v1
817 $ f -qDB 112 rbc-revs-v1 >> .hg/cache/rbc-revs-v1
818 $ f --size .hg/cache/rbc-revs*
818 $ f --size .hg/cache/rbc-revs*
819 .hg/cache/rbc-revs-v1: size=120
819 .hg/cache/rbc-revs-v1: size=120
820 $ hg log -r 'branch(.)' -T '{rev} ' --debug
820 $ hg log -r 'branch(.)' -T '{rev} ' --debug
821 history modification detected - truncating revision branch cache to revision 13
821 history modification detected - truncating revision branch cache to revision 13
822 history modification detected - truncating revision branch cache to revision 1
822 history modification detected - truncating revision branch cache to revision 1
823 3 4 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 8
823 3 4 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 8
824 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
824 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
825 5
825 5
826 truncating cache/rbc-revs-v1 to 104
826 truncating cache/rbc-revs-v1 to 104
827 $ f --size --hexdump --bytes=16 .hg/cache/rbc-revs*
827 $ f --size --hexdump --bytes=16 .hg/cache/rbc-revs*
828 .hg/cache/rbc-revs-v1: size=160
828 .hg/cache/rbc-revs-v1: size=160
829 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
829 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
830 cache is updated when committing
830 cache is updated when committing
831 $ hg branch i-will-regret-this
831 $ hg branch i-will-regret-this
832 marked working directory as branch i-will-regret-this
832 marked working directory as branch i-will-regret-this
833 $ hg ci -m regrets
833 $ hg ci -m regrets
834 $ f --size .hg/cache/rbc-*
834 $ f --size .hg/cache/rbc-*
835 .hg/cache/rbc-names-v1: size=111
835 .hg/cache/rbc-names-v1: size=111
836 .hg/cache/rbc-revs-v1: size=168
836 .hg/cache/rbc-revs-v1: size=168
837 update after rollback - the cache will be correct but rbc-names will will still
837 update after rollback - the cache will be correct but rbc-names will will still
838 contain the branch name even though it no longer is used
838 contain the branch name even though it no longer is used
839 $ hg up -qr '.^'
839 $ hg up -qr '.^'
840 $ hg rollback -qf
840 $ hg rollback -qf
841 $ f --size --hexdump .hg/cache/rbc-*
841 $ f --size --hexdump .hg/cache/rbc-*
842 .hg/cache/rbc-names-v1: size=111
842 .hg/cache/rbc-names-v1: size=111
843 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
843 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
844 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
844 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
845 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
845 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
846 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
846 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
847 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
847 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
848 0050: 72 61 6e 63 68 65 73 00 6d 00 6d 64 00 69 2d 77 |ranches.m.md.i-w|
848 0050: 72 61 6e 63 68 65 73 00 6d 00 6d 64 00 69 2d 77 |ranches.m.md.i-w|
849 0060: 69 6c 6c 2d 72 65 67 72 65 74 2d 74 68 69 73 |ill-regret-this|
849 0060: 69 6c 6c 2d 72 65 67 72 65 74 2d 74 68 69 73 |ill-regret-this|
850 .hg/cache/rbc-revs-v1: size=160
850 .hg/cache/rbc-revs-v1: size=160
851 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
851 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
852 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
852 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
853 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
853 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
854 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
854 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
855 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
855 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
856 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
856 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
857 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
857 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
858 0070: f8 94 c2 56 80 00 00 03 f3 44 76 37 00 00 00 05 |...V.....Dv7....|
858 0070: f8 94 c2 56 80 00 00 03 f3 44 76 37 00 00 00 05 |...V.....Dv7....|
859 0080: a5 8c a5 d3 00 00 00 05 df 34 3b 0d 00 00 00 05 |.........4;.....|
859 0080: a5 8c a5 d3 00 00 00 05 df 34 3b 0d 00 00 00 05 |.........4;.....|
860 0090: c9 14 c9 9f 00 00 00 06 cd 21 a8 0b 80 00 00 05 |.........!......|
860 0090: c9 14 c9 9f 00 00 00 06 cd 21 a8 0b 80 00 00 05 |.........!......|
861 cache is updated/truncated when stripping - it is thus very hard to get in a
861 cache is updated/truncated when stripping - it is thus very hard to get in a
862 situation where the cache is out of sync and the hash check detects it
862 situation where the cache is out of sync and the hash check detects it
863 $ hg --config extensions.strip= strip -r tip --nob
863 $ hg --config extensions.strip= strip -r tip --nob
864 $ f --size .hg/cache/rbc-revs*
864 $ f --size .hg/cache/rbc-revs*
865 .hg/cache/rbc-revs-v1: size=152
865 .hg/cache/rbc-revs-v1: size=152
866
866
867 cache is rebuilt when corruption is detected
867 cache is rebuilt when corruption is detected
868 $ echo > .hg/cache/rbc-names-v1
868 $ echo > .hg/cache/rbc-names-v1
869 $ hg log -r '5:&branch(.)' -T '{rev} ' --debug
869 $ hg log -r '5:&branch(.)' -T '{rev} ' --debug
870 referenced branch names not found - rebuilding revision branch cache from scratch
870 referenced branch names not found - rebuilding revision branch cache from scratch
871 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 40
871 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 40
872 $ f --size --hexdump .hg/cache/rbc-*
872 $ f --size --hexdump .hg/cache/rbc-*
873 .hg/cache/rbc-names-v1: size=84
873 .hg/cache/rbc-names-v1: size=84
874 0000: 62 00 61 00 63 00 61 20 62 72 61 6e 63 68 20 6e |b.a.c.a branch n|
874 0000: 62 00 61 00 63 00 61 20 62 72 61 6e 63 68 20 6e |b.a.c.a branch n|
875 0010: 61 6d 65 20 6d 75 63 68 20 6c 6f 6e 67 65 72 20 |ame much longer |
875 0010: 61 6d 65 20 6d 75 63 68 20 6c 6f 6e 67 65 72 20 |ame much longer |
876 0020: 74 68 61 6e 20 74 68 65 20 64 65 66 61 75 6c 74 |than the default|
876 0020: 74 68 61 6e 20 74 68 65 20 64 65 66 61 75 6c 74 |than the default|
877 0030: 20 6a 75 73 74 69 66 69 63 61 74 69 6f 6e 20 75 | justification u|
877 0030: 20 6a 75 73 74 69 66 69 63 61 74 69 6f 6e 20 75 | justification u|
878 0040: 73 65 64 20 62 79 20 62 72 61 6e 63 68 65 73 00 |sed by branches.|
878 0040: 73 65 64 20 62 79 20 62 72 61 6e 63 68 65 73 00 |sed by branches.|
879 0050: 6d 00 6d 64 |m.md|
879 0050: 6d 00 6d 64 |m.md|
880 .hg/cache/rbc-revs-v1: size=152
880 .hg/cache/rbc-revs-v1: size=152
881 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
881 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
882 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
882 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
883 0020: 00 00 00 00 00 00 00 00 d8 cb c6 1d 00 00 00 01 |................|
883 0020: 00 00 00 00 00 00 00 00 d8 cb c6 1d 00 00 00 01 |................|
884 0030: 58 97 36 a2 00 00 00 02 10 ff 58 95 00 00 00 03 |X.6.......X.....|
884 0030: 58 97 36 a2 00 00 00 02 10 ff 58 95 00 00 00 03 |X.6.......X.....|
885 0040: ee bb 94 44 00 00 00 00 5f 40 61 bb 00 00 00 00 |...D...._@a.....|
885 0040: ee bb 94 44 00 00 00 00 5f 40 61 bb 00 00 00 00 |...D...._@a.....|
886 0050: bf be 84 1b 00 00 00 00 d3 f1 63 45 80 00 00 00 |..........cE....|
886 0050: bf be 84 1b 00 00 00 00 d3 f1 63 45 80 00 00 00 |..........cE....|
887 0060: e3 d4 9c 05 80 00 00 00 e2 3b 55 05 00 00 00 00 |.........;U.....|
887 0060: e3 d4 9c 05 80 00 00 00 e2 3b 55 05 00 00 00 00 |.........;U.....|
888 0070: f8 94 c2 56 80 00 00 02 f3 44 76 37 00 00 00 04 |...V.....Dv7....|
888 0070: f8 94 c2 56 80 00 00 02 f3 44 76 37 00 00 00 04 |...V.....Dv7....|
889 0080: a5 8c a5 d3 00 00 00 04 df 34 3b 0d 00 00 00 04 |.........4;.....|
889 0080: a5 8c a5 d3 00 00 00 04 df 34 3b 0d 00 00 00 04 |.........4;.....|
890 0090: c9 14 c9 9f 00 00 00 05 |........|
890 0090: c9 14 c9 9f 00 00 00 05 |........|
891
891
892 Test that cache files are created and grows correctly:
892 Test that cache files are created and grows correctly:
893
893
894 $ rm .hg/cache/rbc*
894 $ rm .hg/cache/rbc*
895 $ hg log -r "5 & branch(5)" -T "{rev}\n"
895 $ hg log -r "5 & branch(5)" -T "{rev}\n"
896 5
896 5
897 $ f --size --hexdump .hg/cache/rbc-*
897 $ f --size --hexdump .hg/cache/rbc-*
898 .hg/cache/rbc-names-v1: size=1
898 .hg/cache/rbc-names-v1: size=1
899 0000: 61 |a|
899 0000: 61 |a|
900 .hg/cache/rbc-revs-v1: size=152
900 .hg/cache/rbc-revs-v1: size=152
901 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
901 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
902 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
902 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
903 0020: 00 00 00 00 00 00 00 00 d8 cb c6 1d 00 00 00 00 |................|
903 0020: 00 00 00 00 00 00 00 00 d8 cb c6 1d 00 00 00 00 |................|
904 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
904 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
905 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
905 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
906 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
906 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
907 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
907 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
908 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
908 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
909 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
909 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
910 0090: 00 00 00 00 00 00 00 00 |........|
910 0090: 00 00 00 00 00 00 00 00 |........|
911
911
912 $ cd ..
912 $ cd ..
913
913
914 Test for multiple incorrect branch cache entries:
914 Test for multiple incorrect branch cache entries:
915
915
916 $ hg init b
916 $ hg init b
917 $ cd b
917 $ cd b
918 $ touch f
918 $ touch f
919 $ hg ci -Aqmf
919 $ hg ci -Aqmf
920 $ echo >> f
920 $ echo >> f
921 $ hg ci -Amf
921 $ hg ci -Amf
922 $ hg branch -q branch
922 $ hg branch -q branch
923 $ hg ci -Amf
923 $ hg ci -Amf
924
924
925 $ f --size --hexdump .hg/cache/rbc-*
925 $ f --size --hexdump .hg/cache/rbc-*
926 .hg/cache/rbc-names-v1: size=14
926 .hg/cache/rbc-names-v1: size=14
927 0000: 64 65 66 61 75 6c 74 00 62 72 61 6e 63 68 |default.branch|
927 0000: 64 65 66 61 75 6c 74 00 62 72 61 6e 63 68 |default.branch|
928 .hg/cache/rbc-revs-v1: size=24
928 .hg/cache/rbc-revs-v1: size=24
929 0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......|
929 0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......|
930 0010: 56 46 78 69 00 00 00 01 |VFxi....|
930 0010: 56 46 78 69 00 00 00 01 |VFxi....|
931 $ : > .hg/cache/rbc-revs-v1
931 $ : > .hg/cache/rbc-revs-v1
932
932
933 No superfluous rebuilding of cache:
933 No superfluous rebuilding of cache:
934 $ hg log -r "branch(null)&branch(branch)" --debug
934 $ hg log -r "branch(null)&branch(branch)" --debug
935 $ f --size --hexdump .hg/cache/rbc-*
935 $ f --size --hexdump .hg/cache/rbc-*
936 .hg/cache/rbc-names-v1: size=14
936 .hg/cache/rbc-names-v1: size=14
937 0000: 64 65 66 61 75 6c 74 00 62 72 61 6e 63 68 |default.branch|
937 0000: 64 65 66 61 75 6c 74 00 62 72 61 6e 63 68 |default.branch|
938 .hg/cache/rbc-revs-v1: size=24
938 .hg/cache/rbc-revs-v1: size=24
939 0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......|
939 0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......|
940 0010: 56 46 78 69 00 00 00 01 |VFxi....|
940 0010: 56 46 78 69 00 00 00 01 |VFxi....|
941
941
942 $ cd ..
942 $ cd ..
943
944 Test to make sure that `--close-branch` only works on a branch head:
945 --------------------------------------------------------------------
946 $ hg init closebranch
947 $ cd closebranch
948 $ for ch in a b c; do
949 > echo $ch > $ch
950 > hg add $ch
951 > hg ci -m "added "$ch
952 > done;
953
954 $ hg up -r "desc('added b')"
955 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
956
957 trying to close branch from a cset which is not a branch head
958 it should abort:
959 XXX: it should have aborted here
960 $ hg ci -m "closing branch" --close-branch
961 created new head
962
963 $ hg up 0
964 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
965 $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
966 _ 3: 006876ddd20e closing branch
967 | default
968 |
969 | o 2: 155349b645be added c
970 |/ default
971 |
972 o 1: 5f6d8a4bf34a added b
973 | default
974 |
975 @ 0: 9092f1db7931 added a
976 default
977
General Comments 0
You need to be logged in to leave comments. Login now