##// END OF EJS Templates
test: explicitly "add" file before some commit in test-bookmark.t...
marmoute -
r50882:1e6015dd default
parent child Browse files
Show More
@@ -1,1260 +1,1261 b''
1
1
2 $ hg init repo
2 $ hg init repo
3 $ cd repo
3 $ cd repo
4
4
5 $ cat > $TESTTMP/hook.sh <<'EOF'
5 $ cat > $TESTTMP/hook.sh <<'EOF'
6 > echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"
6 > echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"
7 > EOF
7 > EOF
8 $ TESTHOOK="hooks.txnclose-bookmark.test=sh $TESTTMP/hook.sh"
8 $ TESTHOOK="hooks.txnclose-bookmark.test=sh $TESTTMP/hook.sh"
9
9
10 no bookmarks
10 no bookmarks
11
11
12 $ hg bookmarks
12 $ hg bookmarks
13 no bookmarks set
13 no bookmarks set
14
14
15 $ hg bookmarks -Tjson
15 $ hg bookmarks -Tjson
16 [
16 [
17 ]
17 ]
18
18
19 bookmark rev -1
19 bookmark rev -1
20
20
21 $ hg bookmark X --config "$TESTHOOK"
21 $ hg bookmark X --config "$TESTHOOK"
22 test-hook-bookmark: X: -> 0000000000000000000000000000000000000000
22 test-hook-bookmark: X: -> 0000000000000000000000000000000000000000
23
23
24 list bookmarks
24 list bookmarks
25
25
26 $ hg bookmarks
26 $ hg bookmarks
27 * X -1:000000000000
27 * X -1:000000000000
28
28
29 list bookmarks with color
29 list bookmarks with color
30
30
31 $ hg --config extensions.color= --config color.mode=ansi \
31 $ hg --config extensions.color= --config color.mode=ansi \
32 > bookmarks --color=always
32 > bookmarks --color=always
33 \x1b[0;32m * \x1b[0m\x1b[0;32mX\x1b[0m\x1b[0;32m -1:000000000000\x1b[0m (esc)
33 \x1b[0;32m * \x1b[0m\x1b[0;32mX\x1b[0m\x1b[0;32m -1:000000000000\x1b[0m (esc)
34
34
35 $ echo a > a
35 $ echo a > a
36 $ hg add a
36 $ hg add a
37 $ hg commit -m 0 --config "$TESTHOOK"
37 $ hg commit -m 0 --config "$TESTHOOK"
38 test-hook-bookmark: X: 0000000000000000000000000000000000000000 -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
38 test-hook-bookmark: X: 0000000000000000000000000000000000000000 -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
39
39
40 bookmark X moved to rev 0
40 bookmark X moved to rev 0
41
41
42 $ hg bookmarks
42 $ hg bookmarks
43 * X 0:f7b1eb17ad24
43 * X 0:f7b1eb17ad24
44
44
45 look up bookmark
45 look up bookmark
46
46
47 $ hg log -r X
47 $ hg log -r X
48 changeset: 0:f7b1eb17ad24
48 changeset: 0:f7b1eb17ad24
49 bookmark: X
49 bookmark: X
50 tag: tip
50 tag: tip
51 user: test
51 user: test
52 date: Thu Jan 01 00:00:00 1970 +0000
52 date: Thu Jan 01 00:00:00 1970 +0000
53 summary: 0
53 summary: 0
54
54
55
55
56 second bookmark for rev 0, command should work even with ui.strict on
56 second bookmark for rev 0, command should work even with ui.strict on
57
57
58 $ hg --config ui.strict=1 bookmark X2 --config "$TESTHOOK"
58 $ hg --config ui.strict=1 bookmark X2 --config "$TESTHOOK"
59 test-hook-bookmark: X2: -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
59 test-hook-bookmark: X2: -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
60
60
61 bookmark rev -1 again
61 bookmark rev -1 again
62
62
63 $ hg bookmark -r null Y
63 $ hg bookmark -r null Y
64
64
65 list bookmarks
65 list bookmarks
66
66
67 $ hg bookmarks
67 $ hg bookmarks
68 X 0:f7b1eb17ad24
68 X 0:f7b1eb17ad24
69 * X2 0:f7b1eb17ad24
69 * X2 0:f7b1eb17ad24
70 Y -1:000000000000
70 Y -1:000000000000
71 $ hg bookmarks -l
71 $ hg bookmarks -l
72 X 0:f7b1eb17ad24
72 X 0:f7b1eb17ad24
73 * X2 0:f7b1eb17ad24
73 * X2 0:f7b1eb17ad24
74 Y -1:000000000000
74 Y -1:000000000000
75 $ hg bookmarks -l X Y
75 $ hg bookmarks -l X Y
76 X 0:f7b1eb17ad24
76 X 0:f7b1eb17ad24
77 Y -1:000000000000
77 Y -1:000000000000
78 $ hg bookmarks -l .
78 $ hg bookmarks -l .
79 * X2 0:f7b1eb17ad24
79 * X2 0:f7b1eb17ad24
80 $ hg bookmarks -l X A Y
80 $ hg bookmarks -l X A Y
81 abort: bookmark 'A' does not exist
81 abort: bookmark 'A' does not exist
82 [10]
82 [10]
83 $ hg bookmarks -l -r0
83 $ hg bookmarks -l -r0
84 abort: cannot specify both --list and --rev
84 abort: cannot specify both --list and --rev
85 [10]
85 [10]
86 $ hg bookmarks -l --inactive
86 $ hg bookmarks -l --inactive
87 abort: cannot specify both --inactive and --list
87 abort: cannot specify both --inactive and --list
88 [10]
88 [10]
89
89
90 $ hg log -T '{bookmarks % "{rev} {bookmark}\n"}'
90 $ hg log -T '{bookmarks % "{rev} {bookmark}\n"}'
91 0 X
91 0 X
92 0 X2
92 0 X2
93
93
94 $ echo b > b
94 $ echo b > b
95 $ hg add b
95 $ hg add b
96 $ hg commit -m 1 --config "$TESTHOOK"
96 $ hg commit -m 1 --config "$TESTHOOK"
97 test-hook-bookmark: X2: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac -> 925d80f479bb026b0fb3deb27503780b13f74123
97 test-hook-bookmark: X2: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac -> 925d80f479bb026b0fb3deb27503780b13f74123
98
98
99 $ hg bookmarks -T '{rev}:{node|shortest} {bookmark} {desc|firstline}\n'
99 $ hg bookmarks -T '{rev}:{node|shortest} {bookmark} {desc|firstline}\n'
100 0:f7b1 X 0
100 0:f7b1 X 0
101 1:925d X2 1
101 1:925d X2 1
102 -1:0000 Y
102 -1:0000 Y
103
103
104 $ hg bookmarks -Tjson
104 $ hg bookmarks -Tjson
105 [
105 [
106 {
106 {
107 "active": false,
107 "active": false,
108 "bookmark": "X",
108 "bookmark": "X",
109 "node": "f7b1eb17ad24730a1651fccd46c43826d1bbc2ac",
109 "node": "f7b1eb17ad24730a1651fccd46c43826d1bbc2ac",
110 "rev": 0
110 "rev": 0
111 },
111 },
112 {
112 {
113 "active": true,
113 "active": true,
114 "bookmark": "X2",
114 "bookmark": "X2",
115 "node": "925d80f479bb026b0fb3deb27503780b13f74123",
115 "node": "925d80f479bb026b0fb3deb27503780b13f74123",
116 "rev": 1
116 "rev": 1
117 },
117 },
118 {
118 {
119 "active": false,
119 "active": false,
120 "bookmark": "Y",
120 "bookmark": "Y",
121 "node": "0000000000000000000000000000000000000000",
121 "node": "0000000000000000000000000000000000000000",
122 "rev": -1
122 "rev": -1
123 }
123 }
124 ]
124 ]
125
125
126 bookmarks revset
126 bookmarks revset
127
127
128 $ hg log -r 'bookmark()'
128 $ hg log -r 'bookmark()'
129 changeset: 0:f7b1eb17ad24
129 changeset: 0:f7b1eb17ad24
130 bookmark: X
130 bookmark: X
131 user: test
131 user: test
132 date: Thu Jan 01 00:00:00 1970 +0000
132 date: Thu Jan 01 00:00:00 1970 +0000
133 summary: 0
133 summary: 0
134
134
135 changeset: 1:925d80f479bb
135 changeset: 1:925d80f479bb
136 bookmark: X2
136 bookmark: X2
137 tag: tip
137 tag: tip
138 user: test
138 user: test
139 date: Thu Jan 01 00:00:00 1970 +0000
139 date: Thu Jan 01 00:00:00 1970 +0000
140 summary: 1
140 summary: 1
141
141
142 $ hg log -r 'bookmark(Y)'
142 $ hg log -r 'bookmark(Y)'
143 $ hg log -r 'bookmark(X2)'
143 $ hg log -r 'bookmark(X2)'
144 changeset: 1:925d80f479bb
144 changeset: 1:925d80f479bb
145 bookmark: X2
145 bookmark: X2
146 tag: tip
146 tag: tip
147 user: test
147 user: test
148 date: Thu Jan 01 00:00:00 1970 +0000
148 date: Thu Jan 01 00:00:00 1970 +0000
149 summary: 1
149 summary: 1
150
150
151 $ hg log -r 'bookmark("re:X")'
151 $ hg log -r 'bookmark("re:X")'
152 changeset: 0:f7b1eb17ad24
152 changeset: 0:f7b1eb17ad24
153 bookmark: X
153 bookmark: X
154 user: test
154 user: test
155 date: Thu Jan 01 00:00:00 1970 +0000
155 date: Thu Jan 01 00:00:00 1970 +0000
156 summary: 0
156 summary: 0
157
157
158 changeset: 1:925d80f479bb
158 changeset: 1:925d80f479bb
159 bookmark: X2
159 bookmark: X2
160 tag: tip
160 tag: tip
161 user: test
161 user: test
162 date: Thu Jan 01 00:00:00 1970 +0000
162 date: Thu Jan 01 00:00:00 1970 +0000
163 summary: 1
163 summary: 1
164
164
165 $ hg log -r 'bookmark("literal:X")'
165 $ hg log -r 'bookmark("literal:X")'
166 changeset: 0:f7b1eb17ad24
166 changeset: 0:f7b1eb17ad24
167 bookmark: X
167 bookmark: X
168 user: test
168 user: test
169 date: Thu Jan 01 00:00:00 1970 +0000
169 date: Thu Jan 01 00:00:00 1970 +0000
170 summary: 0
170 summary: 0
171
171
172
172
173 "." is expanded to the active bookmark:
173 "." is expanded to the active bookmark:
174
174
175 $ hg log -r 'bookmark(.)'
175 $ hg log -r 'bookmark(.)'
176 changeset: 1:925d80f479bb
176 changeset: 1:925d80f479bb
177 bookmark: X2
177 bookmark: X2
178 tag: tip
178 tag: tip
179 user: test
179 user: test
180 date: Thu Jan 01 00:00:00 1970 +0000
180 date: Thu Jan 01 00:00:00 1970 +0000
181 summary: 1
181 summary: 1
182
182
183
183
184 but "literal:." is not since "." seems not a literal bookmark:
184 but "literal:." is not since "." seems not a literal bookmark:
185
185
186 $ hg log -r 'bookmark("literal:.")'
186 $ hg log -r 'bookmark("literal:.")'
187 abort: bookmark '.' does not exist
187 abort: bookmark '.' does not exist
188 [10]
188 [10]
189
189
190 "." should fail if there's no active bookmark:
190 "." should fail if there's no active bookmark:
191
191
192 $ hg bookmark --inactive
192 $ hg bookmark --inactive
193 $ hg log -r 'bookmark(.)'
193 $ hg log -r 'bookmark(.)'
194 abort: no active bookmark
194 abort: no active bookmark
195 [10]
195 [10]
196 $ hg log -r 'present(bookmark(.))'
196 $ hg log -r 'present(bookmark(.))'
197
197
198 $ hg log -r 'bookmark(unknown)'
198 $ hg log -r 'bookmark(unknown)'
199 abort: bookmark 'unknown' does not exist
199 abort: bookmark 'unknown' does not exist
200 [10]
200 [10]
201 $ hg log -r 'bookmark("literal:unknown")'
201 $ hg log -r 'bookmark("literal:unknown")'
202 abort: bookmark 'unknown' does not exist
202 abort: bookmark 'unknown' does not exist
203 [10]
203 [10]
204 $ hg log -r 'bookmark("re:unknown")'
204 $ hg log -r 'bookmark("re:unknown")'
205 $ hg log -r 'present(bookmark("literal:unknown"))'
205 $ hg log -r 'present(bookmark("literal:unknown"))'
206 $ hg log -r 'present(bookmark("re:unknown"))'
206 $ hg log -r 'present(bookmark("re:unknown"))'
207
207
208 $ hg help revsets | grep 'bookmark('
208 $ hg help revsets | grep 'bookmark('
209 "bookmark([name])"
209 "bookmark([name])"
210
210
211 reactivate "X2"
211 reactivate "X2"
212
212
213 $ hg update X2
213 $ hg update X2
214 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
214 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
215 (activating bookmark X2)
215 (activating bookmark X2)
216
216
217 bookmarks X and X2 moved to rev 1, Y at rev -1
217 bookmarks X and X2 moved to rev 1, Y at rev -1
218
218
219 $ hg bookmarks
219 $ hg bookmarks
220 X 0:f7b1eb17ad24
220 X 0:f7b1eb17ad24
221 * X2 1:925d80f479bb
221 * X2 1:925d80f479bb
222 Y -1:000000000000
222 Y -1:000000000000
223
223
224 bookmark rev 0 again
224 bookmark rev 0 again
225
225
226 $ hg bookmark -r 0 Z
226 $ hg bookmark -r 0 Z
227
227
228 $ hg update X
228 $ hg update X
229 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
229 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
230 (activating bookmark X)
230 (activating bookmark X)
231 $ echo c > c
231 $ echo c > c
232 $ hg add c
232 $ hg add c
233 $ hg commit -m 2
233 $ hg commit -m 2
234 created new head
234 created new head
235
235
236 bookmarks X moved to rev 2, Y at rev -1, Z at rev 0
236 bookmarks X moved to rev 2, Y at rev -1, Z at rev 0
237
237
238 $ hg bookmarks
238 $ hg bookmarks
239 * X 2:db815d6d32e6
239 * X 2:db815d6d32e6
240 X2 1:925d80f479bb
240 X2 1:925d80f479bb
241 Y -1:000000000000
241 Y -1:000000000000
242 Z 0:f7b1eb17ad24
242 Z 0:f7b1eb17ad24
243
243
244 rename nonexistent bookmark
244 rename nonexistent bookmark
245
245
246 $ hg bookmark -m A B
246 $ hg bookmark -m A B
247 abort: bookmark 'A' does not exist
247 abort: bookmark 'A' does not exist
248 [10]
248 [10]
249
249
250 rename to existent bookmark
250 rename to existent bookmark
251
251
252 $ hg bookmark -m X Y
252 $ hg bookmark -m X Y
253 abort: bookmark 'Y' already exists (use -f to force)
253 abort: bookmark 'Y' already exists (use -f to force)
254 [255]
254 [255]
255
255
256 force rename to existent bookmark
256 force rename to existent bookmark
257
257
258 $ hg bookmark -f -m X Y
258 $ hg bookmark -f -m X Y
259
259
260 rename bookmark using .
260 rename bookmark using .
261
261
262 $ hg book rename-me
262 $ hg book rename-me
263 $ hg book -m . renamed --config "$TESTHOOK"
263 $ hg book -m . renamed --config "$TESTHOOK"
264 test-hook-bookmark: rename-me: db815d6d32e69058eadefc8cffbad37675707975 ->
264 test-hook-bookmark: rename-me: db815d6d32e69058eadefc8cffbad37675707975 ->
265 test-hook-bookmark: renamed: -> db815d6d32e69058eadefc8cffbad37675707975
265 test-hook-bookmark: renamed: -> db815d6d32e69058eadefc8cffbad37675707975
266 $ hg bookmark
266 $ hg bookmark
267 X2 1:925d80f479bb
267 X2 1:925d80f479bb
268 Y 2:db815d6d32e6
268 Y 2:db815d6d32e6
269 Z 0:f7b1eb17ad24
269 Z 0:f7b1eb17ad24
270 * renamed 2:db815d6d32e6
270 * renamed 2:db815d6d32e6
271 $ hg up -q Y
271 $ hg up -q Y
272 $ hg book -d renamed --config "$TESTHOOK"
272 $ hg book -d renamed --config "$TESTHOOK"
273 test-hook-bookmark: renamed: db815d6d32e69058eadefc8cffbad37675707975 ->
273 test-hook-bookmark: renamed: db815d6d32e69058eadefc8cffbad37675707975 ->
274
274
275 rename bookmark using . with no active bookmark
275 rename bookmark using . with no active bookmark
276
276
277 $ hg book rename-me
277 $ hg book rename-me
278 $ hg book -i rename-me
278 $ hg book -i rename-me
279 $ hg book -m . renamed
279 $ hg book -m . renamed
280 abort: no active bookmark
280 abort: no active bookmark
281 [10]
281 [10]
282 $ hg up -q Y
282 $ hg up -q Y
283 $ hg book -d rename-me
283 $ hg book -d rename-me
284
284
285 delete bookmark using .
285 delete bookmark using .
286
286
287 $ hg book delete-me
287 $ hg book delete-me
288 $ hg book -d .
288 $ hg book -d .
289 $ hg bookmark
289 $ hg bookmark
290 X2 1:925d80f479bb
290 X2 1:925d80f479bb
291 Y 2:db815d6d32e6
291 Y 2:db815d6d32e6
292 Z 0:f7b1eb17ad24
292 Z 0:f7b1eb17ad24
293 $ hg up -q Y
293 $ hg up -q Y
294
294
295 delete bookmark using . with no active bookmark
295 delete bookmark using . with no active bookmark
296
296
297 $ hg book delete-me
297 $ hg book delete-me
298 $ hg book -i delete-me
298 $ hg book -i delete-me
299 $ hg book -d .
299 $ hg book -d .
300 abort: no active bookmark
300 abort: no active bookmark
301 [10]
301 [10]
302 $ hg up -q Y
302 $ hg up -q Y
303 $ hg book -d delete-me
303 $ hg book -d delete-me
304
304
305 list bookmarks
305 list bookmarks
306
306
307 $ hg bookmark
307 $ hg bookmark
308 X2 1:925d80f479bb
308 X2 1:925d80f479bb
309 * Y 2:db815d6d32e6
309 * Y 2:db815d6d32e6
310 Z 0:f7b1eb17ad24
310 Z 0:f7b1eb17ad24
311
311
312 bookmarks from a revset
312 bookmarks from a revset
313 $ hg bookmark -r '.^1' REVSET
313 $ hg bookmark -r '.^1' REVSET
314 $ hg bookmark -r ':tip' TIP
314 $ hg bookmark -r ':tip' TIP
315 $ hg up -q TIP
315 $ hg up -q TIP
316 $ hg bookmarks
316 $ hg bookmarks
317 REVSET 0:f7b1eb17ad24
317 REVSET 0:f7b1eb17ad24
318 * TIP 2:db815d6d32e6
318 * TIP 2:db815d6d32e6
319 X2 1:925d80f479bb
319 X2 1:925d80f479bb
320 Y 2:db815d6d32e6
320 Y 2:db815d6d32e6
321 Z 0:f7b1eb17ad24
321 Z 0:f7b1eb17ad24
322
322
323 $ hg bookmark -d REVSET
323 $ hg bookmark -d REVSET
324 $ hg bookmark -d TIP
324 $ hg bookmark -d TIP
325
325
326 rename without new name or multiple names
326 rename without new name or multiple names
327
327
328 $ hg bookmark -m Y
328 $ hg bookmark -m Y
329 abort: new bookmark name required
329 abort: new bookmark name required
330 [10]
330 [10]
331 $ hg bookmark -m Y Y2 Y3
331 $ hg bookmark -m Y Y2 Y3
332 abort: only one new bookmark name allowed
332 abort: only one new bookmark name allowed
333 [10]
333 [10]
334
334
335 delete without name
335 delete without name
336
336
337 $ hg bookmark -d
337 $ hg bookmark -d
338 abort: bookmark name required
338 abort: bookmark name required
339 [10]
339 [10]
340
340
341 delete nonexistent bookmark
341 delete nonexistent bookmark
342
342
343 $ hg bookmark -d A
343 $ hg bookmark -d A
344 abort: bookmark 'A' does not exist
344 abort: bookmark 'A' does not exist
345 [10]
345 [10]
346
346
347 delete with --inactive
347 delete with --inactive
348
348
349 $ hg bookmark -d --inactive Y
349 $ hg bookmark -d --inactive Y
350 abort: cannot specify both --inactive and --delete
350 abort: cannot specify both --inactive and --delete
351 [10]
351 [10]
352
352
353 bookmark name with spaces should be stripped
353 bookmark name with spaces should be stripped
354
354
355 $ hg bookmark ' x y '
355 $ hg bookmark ' x y '
356
356
357 list bookmarks
357 list bookmarks
358
358
359 $ hg bookmarks
359 $ hg bookmarks
360 X2 1:925d80f479bb
360 X2 1:925d80f479bb
361 Y 2:db815d6d32e6
361 Y 2:db815d6d32e6
362 Z 0:f7b1eb17ad24
362 Z 0:f7b1eb17ad24
363 * x y 2:db815d6d32e6
363 * x y 2:db815d6d32e6
364 $ hg log -T '{bookmarks % "{rev} {bookmark}\n"}'
364 $ hg log -T '{bookmarks % "{rev} {bookmark}\n"}'
365 2 Y
365 2 Y
366 2 x y
366 2 x y
367 1 X2
367 1 X2
368 0 Z
368 0 Z
369
369
370 look up stripped bookmark name
370 look up stripped bookmark name
371
371
372 $ hg log -r '"x y"'
372 $ hg log -r '"x y"'
373 changeset: 2:db815d6d32e6
373 changeset: 2:db815d6d32e6
374 bookmark: Y
374 bookmark: Y
375 bookmark: x y
375 bookmark: x y
376 tag: tip
376 tag: tip
377 parent: 0:f7b1eb17ad24
377 parent: 0:f7b1eb17ad24
378 user: test
378 user: test
379 date: Thu Jan 01 00:00:00 1970 +0000
379 date: Thu Jan 01 00:00:00 1970 +0000
380 summary: 2
380 summary: 2
381
381
382
382
383 reject bookmark name with newline
383 reject bookmark name with newline
384
384
385 $ hg bookmark '
385 $ hg bookmark '
386 > '
386 > '
387 abort: bookmark names cannot consist entirely of whitespace
387 abort: bookmark names cannot consist entirely of whitespace
388 [10]
388 [10]
389
389
390 $ hg bookmark -m Z '
390 $ hg bookmark -m Z '
391 > '
391 > '
392 abort: bookmark names cannot consist entirely of whitespace
392 abort: bookmark names cannot consist entirely of whitespace
393 [10]
393 [10]
394
394
395 bookmark with reserved name
395 bookmark with reserved name
396
396
397 $ hg bookmark tip
397 $ hg bookmark tip
398 abort: the name 'tip' is reserved
398 abort: the name 'tip' is reserved
399 [10]
399 [10]
400
400
401 $ hg bookmark .
401 $ hg bookmark .
402 abort: the name '.' is reserved
402 abort: the name '.' is reserved
403 [10]
403 [10]
404
404
405 $ hg bookmark null
405 $ hg bookmark null
406 abort: the name 'null' is reserved
406 abort: the name 'null' is reserved
407 [10]
407 [10]
408
408
409
409
410 bookmark with existing name
410 bookmark with existing name
411
411
412 $ hg bookmark X2
412 $ hg bookmark X2
413 abort: bookmark 'X2' already exists (use -f to force)
413 abort: bookmark 'X2' already exists (use -f to force)
414 [255]
414 [255]
415
415
416 $ hg bookmark -m Y Z
416 $ hg bookmark -m Y Z
417 abort: bookmark 'Z' already exists (use -f to force)
417 abort: bookmark 'Z' already exists (use -f to force)
418 [255]
418 [255]
419
419
420 bookmark with name of branch
420 bookmark with name of branch
421
421
422 $ hg bookmark default
422 $ hg bookmark default
423 abort: a bookmark cannot have the name of an existing branch
423 abort: a bookmark cannot have the name of an existing branch
424 [255]
424 [255]
425
425
426 $ hg bookmark -m Y default
426 $ hg bookmark -m Y default
427 abort: a bookmark cannot have the name of an existing branch
427 abort: a bookmark cannot have the name of an existing branch
428 [255]
428 [255]
429
429
430 bookmark with integer name
430 bookmark with integer name
431
431
432 $ hg bookmark 10
432 $ hg bookmark 10
433 abort: cannot use an integer as a name
433 abort: cannot use an integer as a name
434 [10]
434 [10]
435
435
436 bookmark with a name that matches a node id
436 bookmark with a name that matches a node id
437 $ hg bookmark 925d80f479bb db815d6d32e6 --config "$TESTHOOK"
437 $ hg bookmark 925d80f479bb db815d6d32e6 --config "$TESTHOOK"
438 bookmark 925d80f479bb matches a changeset hash
438 bookmark 925d80f479bb matches a changeset hash
439 (did you leave a -r out of an 'hg bookmark' command?)
439 (did you leave a -r out of an 'hg bookmark' command?)
440 bookmark db815d6d32e6 matches a changeset hash
440 bookmark db815d6d32e6 matches a changeset hash
441 (did you leave a -r out of an 'hg bookmark' command?)
441 (did you leave a -r out of an 'hg bookmark' command?)
442 test-hook-bookmark: 925d80f479bb: -> db815d6d32e69058eadefc8cffbad37675707975
442 test-hook-bookmark: 925d80f479bb: -> db815d6d32e69058eadefc8cffbad37675707975
443 test-hook-bookmark: db815d6d32e6: -> db815d6d32e69058eadefc8cffbad37675707975
443 test-hook-bookmark: db815d6d32e6: -> db815d6d32e69058eadefc8cffbad37675707975
444 $ hg bookmark -d 925d80f479bb
444 $ hg bookmark -d 925d80f479bb
445 $ hg bookmark -d db815d6d32e6
445 $ hg bookmark -d db815d6d32e6
446
446
447 $ cd ..
447 $ cd ..
448
448
449 bookmark with a name that matches an ambiguous node id
449 bookmark with a name that matches an ambiguous node id
450
450
451 $ hg init ambiguous
451 $ hg init ambiguous
452 $ cd ambiguous
452 $ cd ambiguous
453 $ echo 0 > a
453 $ echo 0 > a
454 $ hg ci -qAm 0
454 $ hg ci -qAm 0
455 $ for i in 1057 2857 4025; do
455 $ for i in 1057 2857 4025; do
456 > hg up -q 0
456 > hg up -q 0
457 > echo $i > a
457 > echo $i > a
458 > hg ci -qm $i
458 > hg ci -qm $i
459 > done
459 > done
460 $ hg up -q null
460 $ hg up -q null
461 $ hg log -r0: -T '{rev}:{node}\n'
461 $ hg log -r0: -T '{rev}:{node}\n'
462 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a
462 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a
463 1:c56256a09cd28e5764f32e8e2810d0f01e2e357a
463 1:c56256a09cd28e5764f32e8e2810d0f01e2e357a
464 2:c5623987d205cd6d9d8389bfc40fff9dbb670b48
464 2:c5623987d205cd6d9d8389bfc40fff9dbb670b48
465 3:c562ddd9c94164376c20b86b0b4991636a3bf84f
465 3:c562ddd9c94164376c20b86b0b4991636a3bf84f
466
466
467 $ hg bookmark -r0 c562
467 $ hg bookmark -r0 c562
468 $ hg bookmarks
468 $ hg bookmarks
469 c562 0:b4e73ffab476
469 c562 0:b4e73ffab476
470
470
471 $ cd ..
471 $ cd ..
472
472
473 incompatible options
473 incompatible options
474
474
475 $ cd repo
475 $ cd repo
476
476
477 $ hg bookmark -m Y -d Z
477 $ hg bookmark -m Y -d Z
478 abort: cannot specify both --delete and --rename
478 abort: cannot specify both --delete and --rename
479 [10]
479 [10]
480
480
481 $ hg bookmark -r 1 -d Z
481 $ hg bookmark -r 1 -d Z
482 abort: cannot specify both --delete and --rev
482 abort: cannot specify both --delete and --rev
483 [10]
483 [10]
484
484
485 $ hg bookmark -r 1 -m Z Y
485 $ hg bookmark -r 1 -m Z Y
486 abort: cannot specify both --rename and --rev
486 abort: cannot specify both --rename and --rev
487 [10]
487 [10]
488
488
489 force bookmark with existing name
489 force bookmark with existing name
490
490
491 $ hg bookmark -f X2 --config "$TESTHOOK"
491 $ hg bookmark -f X2 --config "$TESTHOOK"
492 test-hook-bookmark: X2: 925d80f479bb026b0fb3deb27503780b13f74123 -> db815d6d32e69058eadefc8cffbad37675707975
492 test-hook-bookmark: X2: 925d80f479bb026b0fb3deb27503780b13f74123 -> db815d6d32e69058eadefc8cffbad37675707975
493
493
494 force bookmark back to where it was, should deactivate it
494 force bookmark back to where it was, should deactivate it
495
495
496 $ hg bookmark -fr1 X2
496 $ hg bookmark -fr1 X2
497 $ hg bookmarks
497 $ hg bookmarks
498 X2 1:925d80f479bb
498 X2 1:925d80f479bb
499 Y 2:db815d6d32e6
499 Y 2:db815d6d32e6
500 Z 0:f7b1eb17ad24
500 Z 0:f7b1eb17ad24
501 x y 2:db815d6d32e6
501 x y 2:db815d6d32e6
502
502
503 forward bookmark to descendant without --force
503 forward bookmark to descendant without --force
504
504
505 $ hg bookmark Z
505 $ hg bookmark Z
506 moving bookmark 'Z' forward from f7b1eb17ad24
506 moving bookmark 'Z' forward from f7b1eb17ad24
507
507
508 list bookmarks
508 list bookmarks
509
509
510 $ hg bookmark
510 $ hg bookmark
511 X2 1:925d80f479bb
511 X2 1:925d80f479bb
512 Y 2:db815d6d32e6
512 Y 2:db815d6d32e6
513 * Z 2:db815d6d32e6
513 * Z 2:db815d6d32e6
514 x y 2:db815d6d32e6
514 x y 2:db815d6d32e6
515 $ hg log -T '{bookmarks % "{rev} {bookmark}\n"}'
515 $ hg log -T '{bookmarks % "{rev} {bookmark}\n"}'
516 2 Y
516 2 Y
517 2 Z
517 2 Z
518 2 x y
518 2 x y
519 1 X2
519 1 X2
520
520
521 revision but no bookmark name
521 revision but no bookmark name
522
522
523 $ hg bookmark -r .
523 $ hg bookmark -r .
524 abort: bookmark name required
524 abort: bookmark name required
525 [10]
525 [10]
526
526
527 bookmark name with whitespace only
527 bookmark name with whitespace only
528
528
529 $ hg bookmark ' '
529 $ hg bookmark ' '
530 abort: bookmark names cannot consist entirely of whitespace
530 abort: bookmark names cannot consist entirely of whitespace
531 [10]
531 [10]
532
532
533 $ hg bookmark -m Y ' '
533 $ hg bookmark -m Y ' '
534 abort: bookmark names cannot consist entirely of whitespace
534 abort: bookmark names cannot consist entirely of whitespace
535 [10]
535 [10]
536
536
537 invalid bookmark
537 invalid bookmark
538
538
539 $ hg bookmark 'foo:bar'
539 $ hg bookmark 'foo:bar'
540 abort: ':' cannot be used in a name
540 abort: ':' cannot be used in a name
541 [10]
541 [10]
542
542
543 $ hg bookmark 'foo
543 $ hg bookmark 'foo
544 > bar'
544 > bar'
545 abort: '\n' cannot be used in a name
545 abort: '\n' cannot be used in a name
546 [10]
546 [10]
547
547
548 the bookmark extension should be ignored now that it is part of core
548 the bookmark extension should be ignored now that it is part of core
549
549
550 $ echo "[extensions]" >> $HGRCPATH
550 $ echo "[extensions]" >> $HGRCPATH
551 $ echo "bookmarks=" >> $HGRCPATH
551 $ echo "bookmarks=" >> $HGRCPATH
552 $ hg bookmarks
552 $ hg bookmarks
553 X2 1:925d80f479bb
553 X2 1:925d80f479bb
554 Y 2:db815d6d32e6
554 Y 2:db815d6d32e6
555 * Z 2:db815d6d32e6
555 * Z 2:db815d6d32e6
556 x y 2:db815d6d32e6
556 x y 2:db815d6d32e6
557
557
558 test summary
558 test summary
559
559
560 $ hg summary
560 $ hg summary
561 parent: 2:db815d6d32e6 tip
561 parent: 2:db815d6d32e6 tip
562 2
562 2
563 branch: default
563 branch: default
564 bookmarks: *Z Y x y
564 bookmarks: *Z Y x y
565 commit: (clean)
565 commit: (clean)
566 update: 1 new changesets, 2 branch heads (merge)
566 update: 1 new changesets, 2 branch heads (merge)
567 phases: 3 draft
567 phases: 3 draft
568
568
569 test id
569 test id
570
570
571 $ hg id
571 $ hg id
572 db815d6d32e6 tip Y/Z/x y
572 db815d6d32e6 tip Y/Z/x y
573
573
574 test rollback
574 test rollback
575
575
576 $ echo foo > f1
576 $ echo foo > f1
577 $ hg bookmark tmp-rollback
577 $ hg bookmark tmp-rollback
578 $ hg ci -Amr
578 $ hg add .
579 adding f1
579 adding f1
580 $ hg ci -mr
580 $ hg bookmarks
581 $ hg bookmarks
581 X2 1:925d80f479bb
582 X2 1:925d80f479bb
582 Y 2:db815d6d32e6
583 Y 2:db815d6d32e6
583 Z 2:db815d6d32e6
584 Z 2:db815d6d32e6
584 * tmp-rollback 3:2bf5cfec5864
585 * tmp-rollback 3:2bf5cfec5864
585 x y 2:db815d6d32e6
586 x y 2:db815d6d32e6
586 $ hg rollback
587 $ hg rollback
587 repository tip rolled back to revision 2 (undo commit)
588 repository tip rolled back to revision 2 (undo commit)
588 working directory now based on revision 2
589 working directory now based on revision 2
589 $ hg bookmarks
590 $ hg bookmarks
590 X2 1:925d80f479bb
591 X2 1:925d80f479bb
591 Y 2:db815d6d32e6
592 Y 2:db815d6d32e6
592 Z 2:db815d6d32e6
593 Z 2:db815d6d32e6
593 * tmp-rollback 2:db815d6d32e6
594 * tmp-rollback 2:db815d6d32e6
594 x y 2:db815d6d32e6
595 x y 2:db815d6d32e6
595 $ hg bookmark -f Z -r 1
596 $ hg bookmark -f Z -r 1
596 $ hg rollback
597 $ hg rollback
597 repository tip rolled back to revision 2 (undo bookmark)
598 repository tip rolled back to revision 2 (undo bookmark)
598 $ hg bookmarks
599 $ hg bookmarks
599 X2 1:925d80f479bb
600 X2 1:925d80f479bb
600 Y 2:db815d6d32e6
601 Y 2:db815d6d32e6
601 Z 2:db815d6d32e6
602 Z 2:db815d6d32e6
602 * tmp-rollback 2:db815d6d32e6
603 * tmp-rollback 2:db815d6d32e6
603 x y 2:db815d6d32e6
604 x y 2:db815d6d32e6
604 $ hg bookmark -d tmp-rollback
605 $ hg bookmark -d tmp-rollback
605
606
606 activate bookmark on working dir parent without --force
607 activate bookmark on working dir parent without --force
607
608
608 $ hg bookmark --inactive Z
609 $ hg bookmark --inactive Z
609 $ hg bookmark Z
610 $ hg bookmark Z
610
611
611 deactivate current 'Z', but also add 'Y'
612 deactivate current 'Z', but also add 'Y'
612
613
613 $ hg bookmark -d Y
614 $ hg bookmark -d Y
614 $ hg bookmark --inactive Z Y
615 $ hg bookmark --inactive Z Y
615 $ hg bookmark -l
616 $ hg bookmark -l
616 X2 1:925d80f479bb
617 X2 1:925d80f479bb
617 Y 2:db815d6d32e6
618 Y 2:db815d6d32e6
618 Z 2:db815d6d32e6
619 Z 2:db815d6d32e6
619 x y 2:db815d6d32e6
620 x y 2:db815d6d32e6
620 $ hg bookmark Z
621 $ hg bookmark Z
621
622
622 bookmark wdir to activate it (issue6218)
623 bookmark wdir to activate it (issue6218)
623
624
624 $ hg bookmark -d Z
625 $ hg bookmark -d Z
625 $ hg bookmark -r 'wdir()' Z
626 $ hg bookmark -r 'wdir()' Z
626 $ hg bookmark -l
627 $ hg bookmark -l
627 X2 1:925d80f479bb
628 X2 1:925d80f479bb
628 Y 2:db815d6d32e6
629 Y 2:db815d6d32e6
629 * Z 2:db815d6d32e6
630 * Z 2:db815d6d32e6
630 x y 2:db815d6d32e6
631 x y 2:db815d6d32e6
631
632
632 test clone
633 test clone
633
634
634 $ hg bookmark -r 2 -i @
635 $ hg bookmark -r 2 -i @
635 $ hg bookmark -r 2 -i a@
636 $ hg bookmark -r 2 -i a@
636 $ hg bookmarks
637 $ hg bookmarks
637 @ 2:db815d6d32e6
638 @ 2:db815d6d32e6
638 X2 1:925d80f479bb
639 X2 1:925d80f479bb
639 Y 2:db815d6d32e6
640 Y 2:db815d6d32e6
640 * Z 2:db815d6d32e6
641 * Z 2:db815d6d32e6
641 a@ 2:db815d6d32e6
642 a@ 2:db815d6d32e6
642 x y 2:db815d6d32e6
643 x y 2:db815d6d32e6
643 $ hg clone . cloned-bookmarks
644 $ hg clone . cloned-bookmarks
644 updating to bookmark @
645 updating to bookmark @
645 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 $ hg -R cloned-bookmarks bookmarks
647 $ hg -R cloned-bookmarks bookmarks
647 * @ 2:db815d6d32e6
648 * @ 2:db815d6d32e6
648 X2 1:925d80f479bb
649 X2 1:925d80f479bb
649 Y 2:db815d6d32e6
650 Y 2:db815d6d32e6
650 Z 2:db815d6d32e6
651 Z 2:db815d6d32e6
651 a@ 2:db815d6d32e6
652 a@ 2:db815d6d32e6
652 x y 2:db815d6d32e6
653 x y 2:db815d6d32e6
653
654
654 test clone with pull protocol
655 test clone with pull protocol
655
656
656 $ hg clone --pull . cloned-bookmarks-pull
657 $ hg clone --pull . cloned-bookmarks-pull
657 requesting all changes
658 requesting all changes
658 adding changesets
659 adding changesets
659 adding manifests
660 adding manifests
660 adding file changes
661 adding file changes
661 added 3 changesets with 3 changes to 3 files (+1 heads)
662 added 3 changesets with 3 changes to 3 files (+1 heads)
662 new changesets f7b1eb17ad24:db815d6d32e6
663 new changesets f7b1eb17ad24:db815d6d32e6
663 updating to bookmark @
664 updating to bookmark @
664 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
665 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
665 $ hg -R cloned-bookmarks-pull bookmarks
666 $ hg -R cloned-bookmarks-pull bookmarks
666 * @ 2:db815d6d32e6
667 * @ 2:db815d6d32e6
667 X2 1:925d80f479bb
668 X2 1:925d80f479bb
668 Y 2:db815d6d32e6
669 Y 2:db815d6d32e6
669 Z 2:db815d6d32e6
670 Z 2:db815d6d32e6
670 a@ 2:db815d6d32e6
671 a@ 2:db815d6d32e6
671 x y 2:db815d6d32e6
672 x y 2:db815d6d32e6
672
673
673 delete multiple bookmarks at once
674 delete multiple bookmarks at once
674
675
675 $ hg bookmark -d @ a@
676 $ hg bookmark -d @ a@
676
677
677 test clone with a bookmark named "default" (issue3677)
678 test clone with a bookmark named "default" (issue3677)
678
679
679 $ hg bookmark -r 1 -f -i default
680 $ hg bookmark -r 1 -f -i default
680 $ hg clone . cloned-bookmark-default
681 $ hg clone . cloned-bookmark-default
681 updating to branch default
682 updating to branch default
682 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
683 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
683 $ hg -R cloned-bookmark-default bookmarks
684 $ hg -R cloned-bookmark-default bookmarks
684 X2 1:925d80f479bb
685 X2 1:925d80f479bb
685 Y 2:db815d6d32e6
686 Y 2:db815d6d32e6
686 Z 2:db815d6d32e6
687 Z 2:db815d6d32e6
687 default 1:925d80f479bb
688 default 1:925d80f479bb
688 x y 2:db815d6d32e6
689 x y 2:db815d6d32e6
689 $ hg -R cloned-bookmark-default parents -q
690 $ hg -R cloned-bookmark-default parents -q
690 2:db815d6d32e6
691 2:db815d6d32e6
691 $ hg bookmark -d default
692 $ hg bookmark -d default
692
693
693 test clone with a specific revision
694 test clone with a specific revision
694
695
695 $ hg clone -r 925d80 . cloned-bookmarks-rev
696 $ hg clone -r 925d80 . cloned-bookmarks-rev
696 adding changesets
697 adding changesets
697 adding manifests
698 adding manifests
698 adding file changes
699 adding file changes
699 added 2 changesets with 2 changes to 2 files
700 added 2 changesets with 2 changes to 2 files
700 new changesets f7b1eb17ad24:925d80f479bb
701 new changesets f7b1eb17ad24:925d80f479bb
701 updating to branch default
702 updating to branch default
702 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
703 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
703 $ hg -R cloned-bookmarks-rev bookmarks
704 $ hg -R cloned-bookmarks-rev bookmarks
704 X2 1:925d80f479bb
705 X2 1:925d80f479bb
705
706
706 test clone with update to a bookmark
707 test clone with update to a bookmark
707
708
708 $ hg clone -u Z . ../cloned-bookmarks-update
709 $ hg clone -u Z . ../cloned-bookmarks-update
709 updating to branch default
710 updating to branch default
710 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
711 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
711 $ hg -R ../cloned-bookmarks-update bookmarks
712 $ hg -R ../cloned-bookmarks-update bookmarks
712 X2 1:925d80f479bb
713 X2 1:925d80f479bb
713 Y 2:db815d6d32e6
714 Y 2:db815d6d32e6
714 * Z 2:db815d6d32e6
715 * Z 2:db815d6d32e6
715 x y 2:db815d6d32e6
716 x y 2:db815d6d32e6
716
717
717 create bundle with two heads
718 create bundle with two heads
718
719
719 $ hg clone . tobundle
720 $ hg clone . tobundle
720 updating to branch default
721 updating to branch default
721 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
722 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
722 $ echo x > tobundle/x
723 $ echo x > tobundle/x
723 $ hg -R tobundle add tobundle/x
724 $ hg -R tobundle add tobundle/x
724 $ hg -R tobundle commit -m'x'
725 $ hg -R tobundle commit -m'x'
725 $ hg -R tobundle update -r -2
726 $ hg -R tobundle update -r -2
726 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
727 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
727 $ echo y > tobundle/y
728 $ echo y > tobundle/y
728 $ hg -R tobundle branch test
729 $ hg -R tobundle branch test
729 marked working directory as branch test
730 marked working directory as branch test
730 (branches are permanent and global, did you want a bookmark?)
731 (branches are permanent and global, did you want a bookmark?)
731 $ hg -R tobundle add tobundle/y
732 $ hg -R tobundle add tobundle/y
732 $ hg -R tobundle commit -m'y'
733 $ hg -R tobundle commit -m'y'
733 $ hg -R tobundle bundle tobundle.hg
734 $ hg -R tobundle bundle tobundle.hg
734 searching for changes
735 searching for changes
735 2 changesets found
736 2 changesets found
736 $ hg unbundle tobundle.hg
737 $ hg unbundle tobundle.hg
737 adding changesets
738 adding changesets
738 adding manifests
739 adding manifests
739 adding file changes
740 adding file changes
740 added 2 changesets with 2 changes to 2 files (+1 heads)
741 added 2 changesets with 2 changes to 2 files (+1 heads)
741 new changesets 125c9a1d6df6:9ba5f110a0b3 (2 drafts)
742 new changesets 125c9a1d6df6:9ba5f110a0b3 (2 drafts)
742 (run 'hg heads' to see heads, 'hg merge' to merge)
743 (run 'hg heads' to see heads, 'hg merge' to merge)
743
744
744 update to active bookmark if it's not the parent
745 update to active bookmark if it's not the parent
745
746
746 (it is known issue that fsmonitor can't handle nested repositories. In
747 (it is known issue that fsmonitor can't handle nested repositories. In
747 this test scenario, cloned-bookmark-default and tobundle exist in the
748 this test scenario, cloned-bookmark-default and tobundle exist in the
748 working directory of current repository)
749 working directory of current repository)
749
750
750 $ hg summary
751 $ hg summary
751 parent: 2:db815d6d32e6
752 parent: 2:db815d6d32e6
752 2
753 2
753 branch: default
754 branch: default
754 bookmarks: *Z Y x y
755 bookmarks: *Z Y x y
755 commit: 1 added, 1 unknown (new branch head) (no-fsmonitor !)
756 commit: 1 added, 1 unknown (new branch head) (no-fsmonitor !)
756 commit: 1 added, * unknown (new branch head) (glob) (fsmonitor !)
757 commit: 1 added, * unknown (new branch head) (glob) (fsmonitor !)
757 update: 2 new changesets (update)
758 update: 2 new changesets (update)
758 phases: 5 draft
759 phases: 5 draft
759 $ hg update
760 $ hg update
760 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
761 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
761 updating bookmark Z
762 updating bookmark Z
762 $ hg bookmarks
763 $ hg bookmarks
763 X2 1:925d80f479bb
764 X2 1:925d80f479bb
764 Y 2:db815d6d32e6
765 Y 2:db815d6d32e6
765 * Z 3:125c9a1d6df6
766 * Z 3:125c9a1d6df6
766 x y 2:db815d6d32e6
767 x y 2:db815d6d32e6
767
768
768 pull --update works the same as pull && update
769 pull --update works the same as pull && update
769
770
770 $ hg bookmark -r3 Y
771 $ hg bookmark -r3 Y
771 moving bookmark 'Y' forward from db815d6d32e6
772 moving bookmark 'Y' forward from db815d6d32e6
772 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
773 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
773 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
774 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
774
775
775 (manual version)
776 (manual version)
776
777
777 $ hg -R ../cloned-bookmarks-manual-update update Y
778 $ hg -R ../cloned-bookmarks-manual-update update Y
778 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
779 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
779 (activating bookmark Y)
780 (activating bookmark Y)
780 $ hg -R ../cloned-bookmarks-manual-update pull .
781 $ hg -R ../cloned-bookmarks-manual-update pull .
781 pulling from .
782 pulling from .
782 searching for changes
783 searching for changes
783 adding changesets
784 adding changesets
784 adding manifests
785 adding manifests
785 adding file changes
786 adding file changes
786 updating bookmark Y
787 updating bookmark Y
787 updating bookmark Z
788 updating bookmark Z
788 added 2 changesets with 2 changes to 2 files (+1 heads)
789 added 2 changesets with 2 changes to 2 files (+1 heads)
789 new changesets 125c9a1d6df6:9ba5f110a0b3
790 new changesets 125c9a1d6df6:9ba5f110a0b3
790 (run 'hg heads' to see heads, 'hg merge' to merge)
791 (run 'hg heads' to see heads, 'hg merge' to merge)
791
792
792 (# tests strange but with --date crashing when bookmark have to move)
793 (# tests strange but with --date crashing when bookmark have to move)
793
794
794 $ hg -R ../cloned-bookmarks-manual-update update -d 1986
795 $ hg -R ../cloned-bookmarks-manual-update update -d 1986
795 abort: revision matching date not found
796 abort: revision matching date not found
796 [10]
797 [10]
797 $ hg -R ../cloned-bookmarks-manual-update update
798 $ hg -R ../cloned-bookmarks-manual-update update
798 updating to active bookmark Y
799 updating to active bookmark Y
799 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
800 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
800
801
801 (all in one version)
802 (all in one version)
802
803
803 $ hg -R ../cloned-bookmarks-update update Y
804 $ hg -R ../cloned-bookmarks-update update Y
804 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
805 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
805 (activating bookmark Y)
806 (activating bookmark Y)
806 $ hg -R ../cloned-bookmarks-update pull --update .
807 $ hg -R ../cloned-bookmarks-update pull --update .
807 pulling from .
808 pulling from .
808 searching for changes
809 searching for changes
809 adding changesets
810 adding changesets
810 adding manifests
811 adding manifests
811 adding file changes
812 adding file changes
812 updating bookmark Y
813 updating bookmark Y
813 updating bookmark Z
814 updating bookmark Z
814 added 2 changesets with 2 changes to 2 files (+1 heads)
815 added 2 changesets with 2 changes to 2 files (+1 heads)
815 new changesets 125c9a1d6df6:9ba5f110a0b3
816 new changesets 125c9a1d6df6:9ba5f110a0b3
816 updating to active bookmark Y
817 updating to active bookmark Y
817 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
818 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
818
819
819 We warn about divergent during bare update to the active bookmark
820 We warn about divergent during bare update to the active bookmark
820
821
821 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update Y
822 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update Y
822 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
823 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
823 (activating bookmark Y)
824 (activating bookmark Y)
824 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks -r X2 Y@1
825 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks -r X2 Y@1
825 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks
826 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks
826 X2 1:925d80f479bb
827 X2 1:925d80f479bb
827 * Y 2:db815d6d32e6
828 * Y 2:db815d6d32e6
828 Y@1 1:925d80f479bb
829 Y@1 1:925d80f479bb
829 Z 2:db815d6d32e6
830 Z 2:db815d6d32e6
830 x y 2:db815d6d32e6
831 x y 2:db815d6d32e6
831 $ hg -R ../cloned-bookmarks-manual-update-with-divergence pull
832 $ hg -R ../cloned-bookmarks-manual-update-with-divergence pull
832 pulling from $TESTTMP/repo
833 pulling from $TESTTMP/repo
833 searching for changes
834 searching for changes
834 adding changesets
835 adding changesets
835 adding manifests
836 adding manifests
836 adding file changes
837 adding file changes
837 updating bookmark Y
838 updating bookmark Y
838 updating bookmark Z
839 updating bookmark Z
839 added 2 changesets with 2 changes to 2 files (+1 heads)
840 added 2 changesets with 2 changes to 2 files (+1 heads)
840 new changesets 125c9a1d6df6:9ba5f110a0b3
841 new changesets 125c9a1d6df6:9ba5f110a0b3
841 (run 'hg heads' to see heads, 'hg merge' to merge)
842 (run 'hg heads' to see heads, 'hg merge' to merge)
842 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update
843 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update
843 updating to active bookmark Y
844 updating to active bookmark Y
844 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
845 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
845 1 other divergent bookmarks for "Y"
846 1 other divergent bookmarks for "Y"
846
847
847 test wrongly formated bookmark
848 test wrongly formated bookmark
848
849
849 $ echo '' >> .hg/bookmarks
850 $ echo '' >> .hg/bookmarks
850 $ hg bookmarks
851 $ hg bookmarks
851 X2 1:925d80f479bb
852 X2 1:925d80f479bb
852 Y 3:125c9a1d6df6
853 Y 3:125c9a1d6df6
853 * Z 3:125c9a1d6df6
854 * Z 3:125c9a1d6df6
854 x y 2:db815d6d32e6
855 x y 2:db815d6d32e6
855 $ echo "Ican'thasformatedlines" >> .hg/bookmarks
856 $ echo "Ican'thasformatedlines" >> .hg/bookmarks
856 $ hg bookmarks
857 $ hg bookmarks
857 malformed line in .hg/bookmarks: "Ican'thasformatedlines"
858 malformed line in .hg/bookmarks: "Ican'thasformatedlines"
858 X2 1:925d80f479bb
859 X2 1:925d80f479bb
859 Y 3:125c9a1d6df6
860 Y 3:125c9a1d6df6
860 * Z 3:125c9a1d6df6
861 * Z 3:125c9a1d6df6
861 x y 2:db815d6d32e6
862 x y 2:db815d6d32e6
862
863
863 test missing revisions
864 test missing revisions
864
865
865 $ echo "925d80f479b925d80f479bc925d80f479bccabab z" > .hg/bookmarks
866 $ echo "925d80f479b925d80f479bc925d80f479bccabab z" > .hg/bookmarks
866 $ hg book
867 $ hg book
867 no bookmarks set
868 no bookmarks set
868
869
869 test stripping a non-checked-out but bookmarked revision
870 test stripping a non-checked-out but bookmarked revision
870
871
871 $ hg log --graph
872 $ hg log --graph
872 o changeset: 4:9ba5f110a0b3
873 o changeset: 4:9ba5f110a0b3
873 | branch: test
874 | branch: test
874 | tag: tip
875 | tag: tip
875 | parent: 2:db815d6d32e6
876 | parent: 2:db815d6d32e6
876 | user: test
877 | user: test
877 | date: Thu Jan 01 00:00:00 1970 +0000
878 | date: Thu Jan 01 00:00:00 1970 +0000
878 | summary: y
879 | summary: y
879 |
880 |
880 | @ changeset: 3:125c9a1d6df6
881 | @ changeset: 3:125c9a1d6df6
881 |/ user: test
882 |/ user: test
882 | date: Thu Jan 01 00:00:00 1970 +0000
883 | date: Thu Jan 01 00:00:00 1970 +0000
883 | summary: x
884 | summary: x
884 |
885 |
885 o changeset: 2:db815d6d32e6
886 o changeset: 2:db815d6d32e6
886 | parent: 0:f7b1eb17ad24
887 | parent: 0:f7b1eb17ad24
887 | user: test
888 | user: test
888 | date: Thu Jan 01 00:00:00 1970 +0000
889 | date: Thu Jan 01 00:00:00 1970 +0000
889 | summary: 2
890 | summary: 2
890 |
891 |
891 | o changeset: 1:925d80f479bb
892 | o changeset: 1:925d80f479bb
892 |/ user: test
893 |/ user: test
893 | date: Thu Jan 01 00:00:00 1970 +0000
894 | date: Thu Jan 01 00:00:00 1970 +0000
894 | summary: 1
895 | summary: 1
895 |
896 |
896 o changeset: 0:f7b1eb17ad24
897 o changeset: 0:f7b1eb17ad24
897 user: test
898 user: test
898 date: Thu Jan 01 00:00:00 1970 +0000
899 date: Thu Jan 01 00:00:00 1970 +0000
899 summary: 0
900 summary: 0
900
901
901 $ hg book should-end-on-two
902 $ hg book should-end-on-two
902 $ hg co --clean 4
903 $ hg co --clean 4
903 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
904 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
904 (leaving bookmark should-end-on-two)
905 (leaving bookmark should-end-on-two)
905 $ hg book four
906 $ hg book four
906 $ hg --config extensions.mq= strip 3
907 $ hg --config extensions.mq= strip 3
907 saved backup bundle to * (glob)
908 saved backup bundle to * (glob)
908 should-end-on-two should end up pointing to revision 2, as that's the
909 should-end-on-two should end up pointing to revision 2, as that's the
909 tipmost surviving ancestor of the stripped revision.
910 tipmost surviving ancestor of the stripped revision.
910 $ hg log --graph
911 $ hg log --graph
911 @ changeset: 3:9ba5f110a0b3
912 @ changeset: 3:9ba5f110a0b3
912 | branch: test
913 | branch: test
913 | bookmark: four
914 | bookmark: four
914 | tag: tip
915 | tag: tip
915 | user: test
916 | user: test
916 | date: Thu Jan 01 00:00:00 1970 +0000
917 | date: Thu Jan 01 00:00:00 1970 +0000
917 | summary: y
918 | summary: y
918 |
919 |
919 o changeset: 2:db815d6d32e6
920 o changeset: 2:db815d6d32e6
920 | bookmark: should-end-on-two
921 | bookmark: should-end-on-two
921 | parent: 0:f7b1eb17ad24
922 | parent: 0:f7b1eb17ad24
922 | user: test
923 | user: test
923 | date: Thu Jan 01 00:00:00 1970 +0000
924 | date: Thu Jan 01 00:00:00 1970 +0000
924 | summary: 2
925 | summary: 2
925 |
926 |
926 | o changeset: 1:925d80f479bb
927 | o changeset: 1:925d80f479bb
927 |/ user: test
928 |/ user: test
928 | date: Thu Jan 01 00:00:00 1970 +0000
929 | date: Thu Jan 01 00:00:00 1970 +0000
929 | summary: 1
930 | summary: 1
930 |
931 |
931 o changeset: 0:f7b1eb17ad24
932 o changeset: 0:f7b1eb17ad24
932 user: test
933 user: test
933 date: Thu Jan 01 00:00:00 1970 +0000
934 date: Thu Jan 01 00:00:00 1970 +0000
934 summary: 0
935 summary: 0
935
936
936
937
937 no-op update doesn't deactivate bookmarks
938 no-op update doesn't deactivate bookmarks
938
939
939 (it is known issue that fsmonitor can't handle nested repositories. In
940 (it is known issue that fsmonitor can't handle nested repositories. In
940 this test scenario, cloned-bookmark-default and tobundle exist in the
941 this test scenario, cloned-bookmark-default and tobundle exist in the
941 working directory of current repository)
942 working directory of current repository)
942
943
943 $ hg bookmarks
944 $ hg bookmarks
944 * four 3:9ba5f110a0b3
945 * four 3:9ba5f110a0b3
945 should-end-on-two 2:db815d6d32e6
946 should-end-on-two 2:db815d6d32e6
946 $ hg up four
947 $ hg up four
947 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
948 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
948 $ hg up
949 $ hg up
949 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
950 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
950 $ hg sum
951 $ hg sum
951 parent: 3:9ba5f110a0b3 tip
952 parent: 3:9ba5f110a0b3 tip
952 y
953 y
953 branch: test
954 branch: test
954 bookmarks: *four
955 bookmarks: *four
955 commit: 2 unknown (clean) (no-fsmonitor !)
956 commit: 2 unknown (clean) (no-fsmonitor !)
956 commit: * unknown (clean) (glob) (fsmonitor !)
957 commit: * unknown (clean) (glob) (fsmonitor !)
957 update: (current)
958 update: (current)
958 phases: 4 draft
959 phases: 4 draft
959
960
960 test clearing divergent bookmarks of linear ancestors
961 test clearing divergent bookmarks of linear ancestors
961
962
962 $ hg bookmark Z -r 0
963 $ hg bookmark Z -r 0
963 $ hg bookmark Z@1 -r 1
964 $ hg bookmark Z@1 -r 1
964 $ hg bookmark Z@2 -r 2
965 $ hg bookmark Z@2 -r 2
965 $ hg bookmark Z@3 -r 3
966 $ hg bookmark Z@3 -r 3
966 $ hg book
967 $ hg book
967 Z 0:f7b1eb17ad24
968 Z 0:f7b1eb17ad24
968 Z@1 1:925d80f479bb
969 Z@1 1:925d80f479bb
969 Z@2 2:db815d6d32e6
970 Z@2 2:db815d6d32e6
970 Z@3 3:9ba5f110a0b3
971 Z@3 3:9ba5f110a0b3
971 * four 3:9ba5f110a0b3
972 * four 3:9ba5f110a0b3
972 should-end-on-two 2:db815d6d32e6
973 should-end-on-two 2:db815d6d32e6
973 $ hg bookmark Z
974 $ hg bookmark Z
974 moving bookmark 'Z' forward from f7b1eb17ad24
975 moving bookmark 'Z' forward from f7b1eb17ad24
975 $ hg book
976 $ hg book
976 * Z 3:9ba5f110a0b3
977 * Z 3:9ba5f110a0b3
977 Z@1 1:925d80f479bb
978 Z@1 1:925d80f479bb
978 four 3:9ba5f110a0b3
979 four 3:9ba5f110a0b3
979 should-end-on-two 2:db815d6d32e6
980 should-end-on-two 2:db815d6d32e6
980
981
981 test clearing only a single divergent bookmark across branches
982 test clearing only a single divergent bookmark across branches
982
983
983 $ hg book foo -r 1
984 $ hg book foo -r 1
984 $ hg book foo@1 -r 0
985 $ hg book foo@1 -r 0
985 $ hg book foo@2 -r 2
986 $ hg book foo@2 -r 2
986 $ hg book foo@3 -r 3
987 $ hg book foo@3 -r 3
987 $ hg book foo -r foo@3
988 $ hg book foo -r foo@3
988 $ hg book
989 $ hg book
989 * Z 3:9ba5f110a0b3
990 * Z 3:9ba5f110a0b3
990 Z@1 1:925d80f479bb
991 Z@1 1:925d80f479bb
991 foo 3:9ba5f110a0b3
992 foo 3:9ba5f110a0b3
992 foo@1 0:f7b1eb17ad24
993 foo@1 0:f7b1eb17ad24
993 foo@2 2:db815d6d32e6
994 foo@2 2:db815d6d32e6
994 four 3:9ba5f110a0b3
995 four 3:9ba5f110a0b3
995 should-end-on-two 2:db815d6d32e6
996 should-end-on-two 2:db815d6d32e6
996
997
997 pull --update works the same as pull && update (case #2)
998 pull --update works the same as pull && update (case #2)
998
999
999 It is assumed that "hg pull" itself doesn't update current active
1000 It is assumed that "hg pull" itself doesn't update current active
1000 bookmark ('Y' in tests below).
1001 bookmark ('Y' in tests below).
1001
1002
1002 $ hg pull -q ../cloned-bookmarks-update
1003 $ hg pull -q ../cloned-bookmarks-update
1003 divergent bookmark Z stored as Z@2
1004 divergent bookmark Z stored as Z@2
1004
1005
1005 (pulling revision on another named branch with --update updates
1006 (pulling revision on another named branch with --update updates
1006 neither the working directory nor current active bookmark: "no-op"
1007 neither the working directory nor current active bookmark: "no-op"
1007 case)
1008 case)
1008
1009
1009 $ echo yy >> y
1010 $ echo yy >> y
1010 $ hg commit -m yy
1011 $ hg commit -m yy
1011
1012
1012 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1013 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1013 * Y 3:125c9a1d6df6
1014 * Y 3:125c9a1d6df6
1014 $ hg -R ../cloned-bookmarks-update path
1015 $ hg -R ../cloned-bookmarks-update path
1015 default = $TESTTMP/repo
1016 default = $TESTTMP/repo
1016 $ pwd
1017 $ pwd
1017 $TESTTMP/repo
1018 $TESTTMP/repo
1018 $ hg -R ../cloned-bookmarks-update pull . --update
1019 $ hg -R ../cloned-bookmarks-update pull . --update
1019 pulling from .
1020 pulling from .
1020 searching for changes
1021 searching for changes
1021 adding changesets
1022 adding changesets
1022 adding manifests
1023 adding manifests
1023 adding file changes
1024 adding file changes
1024 divergent bookmark Z stored as Z@default
1025 divergent bookmark Z stored as Z@default
1025 adding remote bookmark foo
1026 adding remote bookmark foo
1026 adding remote bookmark four
1027 adding remote bookmark four
1027 adding remote bookmark should-end-on-two
1028 adding remote bookmark should-end-on-two
1028 added 1 changesets with 1 changes to 1 files
1029 added 1 changesets with 1 changes to 1 files
1029 new changesets 5fb12f0f2d51
1030 new changesets 5fb12f0f2d51
1030 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1031 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1031 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
1032 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
1032 3:125c9a1d6df6
1033 3:125c9a1d6df6
1033 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1034 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1034 * Y 3:125c9a1d6df6
1035 * Y 3:125c9a1d6df6
1035
1036
1036 (pulling revision on current named/topological branch with --update
1037 (pulling revision on current named/topological branch with --update
1037 updates the working directory and current active bookmark)
1038 updates the working directory and current active bookmark)
1038
1039
1039 $ hg update -C -q 125c9a1d6df6
1040 $ hg update -C -q 125c9a1d6df6
1040 $ echo xx >> x
1041 $ echo xx >> x
1041 $ hg commit -m xx
1042 $ hg commit -m xx
1042
1043
1043 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1044 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1044 * Y 3:125c9a1d6df6
1045 * Y 3:125c9a1d6df6
1045 $ hg -R ../cloned-bookmarks-update pull . --update
1046 $ hg -R ../cloned-bookmarks-update pull . --update
1046 pulling from .
1047 pulling from .
1047 searching for changes
1048 searching for changes
1048 adding changesets
1049 adding changesets
1049 adding manifests
1050 adding manifests
1050 adding file changes
1051 adding file changes
1051 divergent bookmark Z stored as Z@default
1052 divergent bookmark Z stored as Z@default
1052 added 1 changesets with 1 changes to 1 files
1053 added 1 changesets with 1 changes to 1 files
1053 new changesets 81dcce76aa0b
1054 new changesets 81dcce76aa0b
1054 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1055 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1055 updating bookmark Y
1056 updating bookmark Y
1056 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
1057 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
1057 6:81dcce76aa0b
1058 6:81dcce76aa0b
1058 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1059 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1059 * Y 6:81dcce76aa0b
1060 * Y 6:81dcce76aa0b
1060
1061
1061 $ cd ..
1062 $ cd ..
1062
1063
1063 ensure changelog is written before bookmarks
1064 ensure changelog is written before bookmarks
1064 $ hg init orderrepo
1065 $ hg init orderrepo
1065 $ cd orderrepo
1066 $ cd orderrepo
1066 $ touch a
1067 $ touch a
1067 $ hg commit -Aqm one
1068 $ hg commit -Aqm one
1068 $ hg book mybook
1069 $ hg book mybook
1069 $ echo a > a
1070 $ echo a > a
1070
1071
1071 $ cat > $TESTTMP/pausefinalize.py <<EOF
1072 $ cat > $TESTTMP/pausefinalize.py <<EOF
1072 > import os
1073 > import os
1073 > import time
1074 > import time
1074 > from mercurial import extensions, localrepo
1075 > from mercurial import extensions, localrepo
1075 > def transaction(orig, self, desc, report=None):
1076 > def transaction(orig, self, desc, report=None):
1076 > tr = orig(self, desc, report)
1077 > tr = orig(self, desc, report)
1077 > def sleep(*args, **kwargs):
1078 > def sleep(*args, **kwargs):
1078 > retry = 20
1079 > retry = 20
1079 > while retry > 0 and not os.path.exists(b"$TESTTMP/unpause"):
1080 > while retry > 0 and not os.path.exists(b"$TESTTMP/unpause"):
1080 > retry -= 1
1081 > retry -= 1
1081 > time.sleep(0.5)
1082 > time.sleep(0.5)
1082 > if os.path.exists(b"$TESTTMP/unpause"):
1083 > if os.path.exists(b"$TESTTMP/unpause"):
1083 > os.remove(b"$TESTTMP/unpause")
1084 > os.remove(b"$TESTTMP/unpause")
1084 > # It is important that this finalizer start with 'a', so it runs before
1085 > # It is important that this finalizer start with 'a', so it runs before
1085 > # the changelog finalizer appends to the changelog.
1086 > # the changelog finalizer appends to the changelog.
1086 > tr.addfinalize(b'a-sleep', sleep)
1087 > tr.addfinalize(b'a-sleep', sleep)
1087 > return tr
1088 > return tr
1088 >
1089 >
1089 > def extsetup(ui):
1090 > def extsetup(ui):
1090 > # This extension inserts an artifical pause during the transaction
1091 > # This extension inserts an artifical pause during the transaction
1091 > # finalizer, so we can run commands mid-transaction-close.
1092 > # finalizer, so we can run commands mid-transaction-close.
1092 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
1093 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
1093 > transaction)
1094 > transaction)
1094 > EOF
1095 > EOF
1095 $ hg commit -qm two --config extensions.pausefinalize=$TESTTMP/pausefinalize.py &
1096 $ hg commit -qm two --config extensions.pausefinalize=$TESTTMP/pausefinalize.py &
1096 $ sleep 2
1097 $ sleep 2
1097 $ hg log -r .
1098 $ hg log -r .
1098 changeset: 0:867bc5792c8c
1099 changeset: 0:867bc5792c8c
1099 bookmark: mybook
1100 bookmark: mybook
1100 tag: tip
1101 tag: tip
1101 user: test
1102 user: test
1102 date: Thu Jan 01 00:00:00 1970 +0000
1103 date: Thu Jan 01 00:00:00 1970 +0000
1103 summary: one
1104 summary: one
1104
1105
1105 $ hg bookmarks
1106 $ hg bookmarks
1106 * mybook 0:867bc5792c8c
1107 * mybook 0:867bc5792c8c
1107 $ touch $TESTTMP/unpause
1108 $ touch $TESTTMP/unpause
1108
1109
1109 $ cd ..
1110 $ cd ..
1110
1111
1111 check whether HG_PENDING makes pending changes only in related
1112 check whether HG_PENDING makes pending changes only in related
1112 repositories visible to an external hook.
1113 repositories visible to an external hook.
1113
1114
1114 (emulate a transaction running concurrently by copied
1115 (emulate a transaction running concurrently by copied
1115 .hg/bookmarks.pending in subsequent test)
1116 .hg/bookmarks.pending in subsequent test)
1116
1117
1117 $ cat > $TESTTMP/savepending.sh <<EOF
1118 $ cat > $TESTTMP/savepending.sh <<EOF
1118 > cp .hg/bookmarks.pending .hg/bookmarks.pending.saved
1119 > cp .hg/bookmarks.pending .hg/bookmarks.pending.saved
1119 > exit 1 # to avoid adding new bookmark for subsequent tests
1120 > exit 1 # to avoid adding new bookmark for subsequent tests
1120 > EOF
1121 > EOF
1121
1122
1122 $ hg init unrelated
1123 $ hg init unrelated
1123 $ cd unrelated
1124 $ cd unrelated
1124 $ echo a > a
1125 $ echo a > a
1125 $ hg add a
1126 $ hg add a
1126 $ hg commit -m '#0'
1127 $ hg commit -m '#0'
1127 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" bookmarks INVISIBLE
1128 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" bookmarks INVISIBLE
1128 transaction abort!
1129 transaction abort!
1129 rollback completed
1130 rollback completed
1130 abort: pretxnclose hook exited with status 1
1131 abort: pretxnclose hook exited with status 1
1131 [40]
1132 [40]
1132 $ cp .hg/bookmarks.pending.saved .hg/bookmarks.pending
1133 $ cp .hg/bookmarks.pending.saved .hg/bookmarks.pending
1133
1134
1134 (check visible bookmarks while transaction running in repo)
1135 (check visible bookmarks while transaction running in repo)
1135
1136
1136 $ cat > $TESTTMP/checkpending.sh <<EOF
1137 $ cat > $TESTTMP/checkpending.sh <<EOF
1137 > echo "@repo"
1138 > echo "@repo"
1138 > hg -R "$TESTTMP/repo" bookmarks
1139 > hg -R "$TESTTMP/repo" bookmarks
1139 > echo "@unrelated"
1140 > echo "@unrelated"
1140 > hg -R "$TESTTMP/unrelated" bookmarks
1141 > hg -R "$TESTTMP/unrelated" bookmarks
1141 > exit 1 # to avoid adding new bookmark for subsequent tests
1142 > exit 1 # to avoid adding new bookmark for subsequent tests
1142 > EOF
1143 > EOF
1143
1144
1144 $ cd ../repo
1145 $ cd ../repo
1145 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" bookmarks NEW
1146 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" bookmarks NEW
1146 @repo
1147 @repo
1147 * NEW 6:81dcce76aa0b
1148 * NEW 6:81dcce76aa0b
1148 X2 1:925d80f479bb
1149 X2 1:925d80f479bb
1149 Y 4:125c9a1d6df6
1150 Y 4:125c9a1d6df6
1150 Z 5:5fb12f0f2d51
1151 Z 5:5fb12f0f2d51
1151 Z@1 1:925d80f479bb
1152 Z@1 1:925d80f479bb
1152 Z@2 4:125c9a1d6df6
1153 Z@2 4:125c9a1d6df6
1153 foo 3:9ba5f110a0b3
1154 foo 3:9ba5f110a0b3
1154 foo@1 0:f7b1eb17ad24
1155 foo@1 0:f7b1eb17ad24
1155 foo@2 2:db815d6d32e6
1156 foo@2 2:db815d6d32e6
1156 four 3:9ba5f110a0b3
1157 four 3:9ba5f110a0b3
1157 should-end-on-two 2:db815d6d32e6
1158 should-end-on-two 2:db815d6d32e6
1158 x y 2:db815d6d32e6
1159 x y 2:db815d6d32e6
1159 @unrelated
1160 @unrelated
1160 no bookmarks set
1161 no bookmarks set
1161 transaction abort!
1162 transaction abort!
1162 rollback completed
1163 rollback completed
1163 abort: pretxnclose hook exited with status 1
1164 abort: pretxnclose hook exited with status 1
1164 [40]
1165 [40]
1165
1166
1166 Check pretxnclose-bookmark can abort a transaction
1167 Check pretxnclose-bookmark can abort a transaction
1167 --------------------------------------------------
1168 --------------------------------------------------
1168
1169
1169 add hooks:
1170 add hooks:
1170
1171
1171 * to prevent NEW bookmark on a non-public changeset
1172 * to prevent NEW bookmark on a non-public changeset
1172 * to prevent non-forward move of NEW bookmark
1173 * to prevent non-forward move of NEW bookmark
1173
1174
1174 $ cat << EOF >> .hg/hgrc
1175 $ cat << EOF >> .hg/hgrc
1175 > [hooks]
1176 > [hooks]
1176 > pretxnclose-bookmark.force-public = sh -c "(echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z \"\$HG_NODE\" ] || (hg log -r \"\$HG_NODE\" -T '{phase}' | grep public > /dev/null)"
1177 > pretxnclose-bookmark.force-public = sh -c "(echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z \"\$HG_NODE\" ] || (hg log -r \"\$HG_NODE\" -T '{phase}' | grep public > /dev/null)"
1177 > pretxnclose-bookmark.force-forward = sh -c "(echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z \"\$HG_NODE\" ] || (hg log -r \"max(\$HG_OLDNODE::\$HG_NODE)\" -T 'MATCH' | grep MATCH > /dev/null)"
1178 > pretxnclose-bookmark.force-forward = sh -c "(echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z \"\$HG_NODE\" ] || (hg log -r \"max(\$HG_OLDNODE::\$HG_NODE)\" -T 'MATCH' | grep MATCH > /dev/null)"
1178 > EOF
1179 > EOF
1179
1180
1180 $ hg log -G -T phases
1181 $ hg log -G -T phases
1181 @ changeset: 6:81dcce76aa0b
1182 @ changeset: 6:81dcce76aa0b
1182 | tag: tip
1183 | tag: tip
1183 | phase: draft
1184 | phase: draft
1184 | parent: 4:125c9a1d6df6
1185 | parent: 4:125c9a1d6df6
1185 | user: test
1186 | user: test
1186 | date: Thu Jan 01 00:00:00 1970 +0000
1187 | date: Thu Jan 01 00:00:00 1970 +0000
1187 | summary: xx
1188 | summary: xx
1188 |
1189 |
1189 | o changeset: 5:5fb12f0f2d51
1190 | o changeset: 5:5fb12f0f2d51
1190 | | branch: test
1191 | | branch: test
1191 | | bookmark: Z
1192 | | bookmark: Z
1192 | | phase: draft
1193 | | phase: draft
1193 | | parent: 3:9ba5f110a0b3
1194 | | parent: 3:9ba5f110a0b3
1194 | | user: test
1195 | | user: test
1195 | | date: Thu Jan 01 00:00:00 1970 +0000
1196 | | date: Thu Jan 01 00:00:00 1970 +0000
1196 | | summary: yy
1197 | | summary: yy
1197 | |
1198 | |
1198 o | changeset: 4:125c9a1d6df6
1199 o | changeset: 4:125c9a1d6df6
1199 | | bookmark: Y
1200 | | bookmark: Y
1200 | | bookmark: Z@2
1201 | | bookmark: Z@2
1201 | | phase: public
1202 | | phase: public
1202 | | parent: 2:db815d6d32e6
1203 | | parent: 2:db815d6d32e6
1203 | | user: test
1204 | | user: test
1204 | | date: Thu Jan 01 00:00:00 1970 +0000
1205 | | date: Thu Jan 01 00:00:00 1970 +0000
1205 | | summary: x
1206 | | summary: x
1206 | |
1207 | |
1207 | o changeset: 3:9ba5f110a0b3
1208 | o changeset: 3:9ba5f110a0b3
1208 |/ branch: test
1209 |/ branch: test
1209 | bookmark: foo
1210 | bookmark: foo
1210 | bookmark: four
1211 | bookmark: four
1211 | phase: public
1212 | phase: public
1212 | user: test
1213 | user: test
1213 | date: Thu Jan 01 00:00:00 1970 +0000
1214 | date: Thu Jan 01 00:00:00 1970 +0000
1214 | summary: y
1215 | summary: y
1215 |
1216 |
1216 o changeset: 2:db815d6d32e6
1217 o changeset: 2:db815d6d32e6
1217 | bookmark: foo@2
1218 | bookmark: foo@2
1218 | bookmark: should-end-on-two
1219 | bookmark: should-end-on-two
1219 | bookmark: x y
1220 | bookmark: x y
1220 | phase: public
1221 | phase: public
1221 | parent: 0:f7b1eb17ad24
1222 | parent: 0:f7b1eb17ad24
1222 | user: test
1223 | user: test
1223 | date: Thu Jan 01 00:00:00 1970 +0000
1224 | date: Thu Jan 01 00:00:00 1970 +0000
1224 | summary: 2
1225 | summary: 2
1225 |
1226 |
1226 | o changeset: 1:925d80f479bb
1227 | o changeset: 1:925d80f479bb
1227 |/ bookmark: X2
1228 |/ bookmark: X2
1228 | bookmark: Z@1
1229 | bookmark: Z@1
1229 | phase: public
1230 | phase: public
1230 | user: test
1231 | user: test
1231 | date: Thu Jan 01 00:00:00 1970 +0000
1232 | date: Thu Jan 01 00:00:00 1970 +0000
1232 | summary: 1
1233 | summary: 1
1233 |
1234 |
1234 o changeset: 0:f7b1eb17ad24
1235 o changeset: 0:f7b1eb17ad24
1235 bookmark: foo@1
1236 bookmark: foo@1
1236 phase: public
1237 phase: public
1237 user: test
1238 user: test
1238 date: Thu Jan 01 00:00:00 1970 +0000
1239 date: Thu Jan 01 00:00:00 1970 +0000
1239 summary: 0
1240 summary: 0
1240
1241
1241
1242
1242 attempt to create on a default changeset
1243 attempt to create on a default changeset
1243
1244
1244 $ hg bookmark -r 81dcce76aa0b NEW
1245 $ hg bookmark -r 81dcce76aa0b NEW
1245 transaction abort!
1246 transaction abort!
1246 rollback completed
1247 rollback completed
1247 abort: pretxnclose-bookmark.force-public hook exited with status 1
1248 abort: pretxnclose-bookmark.force-public hook exited with status 1
1248 [40]
1249 [40]
1249
1250
1250 create on a public changeset
1251 create on a public changeset
1251
1252
1252 $ hg bookmark -r 9ba5f110a0b3 NEW
1253 $ hg bookmark -r 9ba5f110a0b3 NEW
1253
1254
1254 move to the other branch
1255 move to the other branch
1255
1256
1256 $ hg bookmark -f -r 125c9a1d6df6 NEW
1257 $ hg bookmark -f -r 125c9a1d6df6 NEW
1257 transaction abort!
1258 transaction abort!
1258 rollback completed
1259 rollback completed
1259 abort: pretxnclose-bookmark.force-forward hook exited with status 1
1260 abort: pretxnclose-bookmark.force-forward hook exited with status 1
1260 [40]
1261 [40]
General Comments 0
You need to be logged in to leave comments. Login now