##// END OF EJS Templates
test-bookmark: clarify the path involved in a pull creating divergence...
marmoute -
r48381:28a914b3 default
parent child Browse files
Show More
@@ -1,1257 +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 [255]
188 [255]
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 [255]
195 [255]
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 [255]
200 [255]
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 [255]
203 [255]
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 [255]
281 [255]
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 [255]
301 [255]
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 ci -Amr
579 adding f1
579 adding f1
580 $ hg bookmarks
580 $ hg bookmarks
581 X2 1:925d80f479bb
581 X2 1:925d80f479bb
582 Y 2:db815d6d32e6
582 Y 2:db815d6d32e6
583 Z 2:db815d6d32e6
583 Z 2:db815d6d32e6
584 * tmp-rollback 3:2bf5cfec5864
584 * tmp-rollback 3:2bf5cfec5864
585 x y 2:db815d6d32e6
585 x y 2:db815d6d32e6
586 $ hg rollback
586 $ hg rollback
587 repository tip rolled back to revision 2 (undo commit)
587 repository tip rolled back to revision 2 (undo commit)
588 working directory now based on revision 2
588 working directory now based on revision 2
589 $ hg bookmarks
589 $ hg bookmarks
590 X2 1:925d80f479bb
590 X2 1:925d80f479bb
591 Y 2:db815d6d32e6
591 Y 2:db815d6d32e6
592 Z 2:db815d6d32e6
592 Z 2:db815d6d32e6
593 * tmp-rollback 2:db815d6d32e6
593 * tmp-rollback 2:db815d6d32e6
594 x y 2:db815d6d32e6
594 x y 2:db815d6d32e6
595 $ hg bookmark -f Z -r 1
595 $ hg bookmark -f Z -r 1
596 $ hg rollback
596 $ hg rollback
597 repository tip rolled back to revision 2 (undo bookmark)
597 repository tip rolled back to revision 2 (undo bookmark)
598 $ hg bookmarks
598 $ hg bookmarks
599 X2 1:925d80f479bb
599 X2 1:925d80f479bb
600 Y 2:db815d6d32e6
600 Y 2:db815d6d32e6
601 Z 2:db815d6d32e6
601 Z 2:db815d6d32e6
602 * tmp-rollback 2:db815d6d32e6
602 * tmp-rollback 2:db815d6d32e6
603 x y 2:db815d6d32e6
603 x y 2:db815d6d32e6
604 $ hg bookmark -d tmp-rollback
604 $ hg bookmark -d tmp-rollback
605
605
606 activate bookmark on working dir parent without --force
606 activate bookmark on working dir parent without --force
607
607
608 $ hg bookmark --inactive Z
608 $ hg bookmark --inactive Z
609 $ hg bookmark Z
609 $ hg bookmark Z
610
610
611 deactivate current 'Z', but also add 'Y'
611 deactivate current 'Z', but also add 'Y'
612
612
613 $ hg bookmark -d Y
613 $ hg bookmark -d Y
614 $ hg bookmark --inactive Z Y
614 $ hg bookmark --inactive Z Y
615 $ hg bookmark -l
615 $ hg bookmark -l
616 X2 1:925d80f479bb
616 X2 1:925d80f479bb
617 Y 2:db815d6d32e6
617 Y 2:db815d6d32e6
618 Z 2:db815d6d32e6
618 Z 2:db815d6d32e6
619 x y 2:db815d6d32e6
619 x y 2:db815d6d32e6
620 $ hg bookmark Z
620 $ hg bookmark Z
621
621
622 bookmark wdir to activate it (issue6218)
622 bookmark wdir to activate it (issue6218)
623
623
624 $ hg bookmark -d Z
624 $ hg bookmark -d Z
625 $ hg bookmark -r 'wdir()' Z
625 $ hg bookmark -r 'wdir()' Z
626 $ hg bookmark -l
626 $ hg bookmark -l
627 X2 1:925d80f479bb
627 X2 1:925d80f479bb
628 Y 2:db815d6d32e6
628 Y 2:db815d6d32e6
629 * Z 2:db815d6d32e6
629 * Z 2:db815d6d32e6
630 x y 2:db815d6d32e6
630 x y 2:db815d6d32e6
631
631
632 test clone
632 test clone
633
633
634 $ hg bookmark -r 2 -i @
634 $ hg bookmark -r 2 -i @
635 $ hg bookmark -r 2 -i a@
635 $ hg bookmark -r 2 -i a@
636 $ hg bookmarks
636 $ hg bookmarks
637 @ 2:db815d6d32e6
637 @ 2:db815d6d32e6
638 X2 1:925d80f479bb
638 X2 1:925d80f479bb
639 Y 2:db815d6d32e6
639 Y 2:db815d6d32e6
640 * Z 2:db815d6d32e6
640 * Z 2:db815d6d32e6
641 a@ 2:db815d6d32e6
641 a@ 2:db815d6d32e6
642 x y 2:db815d6d32e6
642 x y 2:db815d6d32e6
643 $ hg clone . cloned-bookmarks
643 $ hg clone . cloned-bookmarks
644 updating to bookmark @
644 updating to bookmark @
645 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
645 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 $ hg -R cloned-bookmarks bookmarks
646 $ hg -R cloned-bookmarks bookmarks
647 * @ 2:db815d6d32e6
647 * @ 2:db815d6d32e6
648 X2 1:925d80f479bb
648 X2 1:925d80f479bb
649 Y 2:db815d6d32e6
649 Y 2:db815d6d32e6
650 Z 2:db815d6d32e6
650 Z 2:db815d6d32e6
651 a@ 2:db815d6d32e6
651 a@ 2:db815d6d32e6
652 x y 2:db815d6d32e6
652 x y 2:db815d6d32e6
653
653
654 test clone with pull protocol
654 test clone with pull protocol
655
655
656 $ hg clone --pull . cloned-bookmarks-pull
656 $ hg clone --pull . cloned-bookmarks-pull
657 requesting all changes
657 requesting all changes
658 adding changesets
658 adding changesets
659 adding manifests
659 adding manifests
660 adding file changes
660 adding file changes
661 added 3 changesets with 3 changes to 3 files (+1 heads)
661 added 3 changesets with 3 changes to 3 files (+1 heads)
662 new changesets f7b1eb17ad24:db815d6d32e6
662 new changesets f7b1eb17ad24:db815d6d32e6
663 updating to bookmark @
663 updating to bookmark @
664 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
664 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
665 $ hg -R cloned-bookmarks-pull bookmarks
665 $ hg -R cloned-bookmarks-pull bookmarks
666 * @ 2:db815d6d32e6
666 * @ 2:db815d6d32e6
667 X2 1:925d80f479bb
667 X2 1:925d80f479bb
668 Y 2:db815d6d32e6
668 Y 2:db815d6d32e6
669 Z 2:db815d6d32e6
669 Z 2:db815d6d32e6
670 a@ 2:db815d6d32e6
670 a@ 2:db815d6d32e6
671 x y 2:db815d6d32e6
671 x y 2:db815d6d32e6
672
672
673 delete multiple bookmarks at once
673 delete multiple bookmarks at once
674
674
675 $ hg bookmark -d @ a@
675 $ hg bookmark -d @ a@
676
676
677 test clone with a bookmark named "default" (issue3677)
677 test clone with a bookmark named "default" (issue3677)
678
678
679 $ hg bookmark -r 1 -f -i default
679 $ hg bookmark -r 1 -f -i default
680 $ hg clone . cloned-bookmark-default
680 $ hg clone . cloned-bookmark-default
681 updating to branch default
681 updating to branch default
682 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
682 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
683 $ hg -R cloned-bookmark-default bookmarks
683 $ hg -R cloned-bookmark-default bookmarks
684 X2 1:925d80f479bb
684 X2 1:925d80f479bb
685 Y 2:db815d6d32e6
685 Y 2:db815d6d32e6
686 Z 2:db815d6d32e6
686 Z 2:db815d6d32e6
687 default 1:925d80f479bb
687 default 1:925d80f479bb
688 x y 2:db815d6d32e6
688 x y 2:db815d6d32e6
689 $ hg -R cloned-bookmark-default parents -q
689 $ hg -R cloned-bookmark-default parents -q
690 2:db815d6d32e6
690 2:db815d6d32e6
691 $ hg bookmark -d default
691 $ hg bookmark -d default
692
692
693 test clone with a specific revision
693 test clone with a specific revision
694
694
695 $ hg clone -r 925d80 . cloned-bookmarks-rev
695 $ hg clone -r 925d80 . cloned-bookmarks-rev
696 adding changesets
696 adding changesets
697 adding manifests
697 adding manifests
698 adding file changes
698 adding file changes
699 added 2 changesets with 2 changes to 2 files
699 added 2 changesets with 2 changes to 2 files
700 new changesets f7b1eb17ad24:925d80f479bb
700 new changesets f7b1eb17ad24:925d80f479bb
701 updating to branch default
701 updating to branch default
702 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
702 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
703 $ hg -R cloned-bookmarks-rev bookmarks
703 $ hg -R cloned-bookmarks-rev bookmarks
704 X2 1:925d80f479bb
704 X2 1:925d80f479bb
705
705
706 test clone with update to a bookmark
706 test clone with update to a bookmark
707
707
708 $ hg clone -u Z . ../cloned-bookmarks-update
708 $ hg clone -u Z . ../cloned-bookmarks-update
709 updating to branch default
709 updating to branch default
710 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
710 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
711 $ hg -R ../cloned-bookmarks-update bookmarks
711 $ hg -R ../cloned-bookmarks-update bookmarks
712 X2 1:925d80f479bb
712 X2 1:925d80f479bb
713 Y 2:db815d6d32e6
713 Y 2:db815d6d32e6
714 * Z 2:db815d6d32e6
714 * Z 2:db815d6d32e6
715 x y 2:db815d6d32e6
715 x y 2:db815d6d32e6
716
716
717 create bundle with two heads
717 create bundle with two heads
718
718
719 $ hg clone . tobundle
719 $ hg clone . tobundle
720 updating to branch default
720 updating to branch default
721 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
721 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
722 $ echo x > tobundle/x
722 $ echo x > tobundle/x
723 $ hg -R tobundle add tobundle/x
723 $ hg -R tobundle add tobundle/x
724 $ hg -R tobundle commit -m'x'
724 $ hg -R tobundle commit -m'x'
725 $ hg -R tobundle update -r -2
725 $ hg -R tobundle update -r -2
726 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
726 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
727 $ echo y > tobundle/y
727 $ echo y > tobundle/y
728 $ hg -R tobundle branch test
728 $ hg -R tobundle branch test
729 marked working directory as branch test
729 marked working directory as branch test
730 (branches are permanent and global, did you want a bookmark?)
730 (branches are permanent and global, did you want a bookmark?)
731 $ hg -R tobundle add tobundle/y
731 $ hg -R tobundle add tobundle/y
732 $ hg -R tobundle commit -m'y'
732 $ hg -R tobundle commit -m'y'
733 $ hg -R tobundle bundle tobundle.hg
733 $ hg -R tobundle bundle tobundle.hg
734 searching for changes
734 searching for changes
735 2 changesets found
735 2 changesets found
736 $ hg unbundle tobundle.hg
736 $ hg unbundle tobundle.hg
737 adding changesets
737 adding changesets
738 adding manifests
738 adding manifests
739 adding file changes
739 adding file changes
740 added 2 changesets with 2 changes to 2 files (+1 heads)
740 added 2 changesets with 2 changes to 2 files (+1 heads)
741 new changesets 125c9a1d6df6:9ba5f110a0b3 (2 drafts)
741 new changesets 125c9a1d6df6:9ba5f110a0b3 (2 drafts)
742 (run 'hg heads' to see heads, 'hg merge' to merge)
742 (run 'hg heads' to see heads, 'hg merge' to merge)
743
743
744 update to active bookmark if it's not the parent
744 update to active bookmark if it's not the parent
745
745
746 (it is known issue that fsmonitor can't handle nested repositories. In
746 (it is known issue that fsmonitor can't handle nested repositories. In
747 this test scenario, cloned-bookmark-default and tobundle exist in the
747 this test scenario, cloned-bookmark-default and tobundle exist in the
748 working directory of current repository)
748 working directory of current repository)
749
749
750 $ hg summary
750 $ hg summary
751 parent: 2:db815d6d32e6
751 parent: 2:db815d6d32e6
752 2
752 2
753 branch: default
753 branch: default
754 bookmarks: *Z Y x y
754 bookmarks: *Z Y x y
755 commit: 1 added, 1 unknown (new branch head) (no-fsmonitor !)
755 commit: 1 added, 1 unknown (new branch head) (no-fsmonitor !)
756 commit: 1 added, * unknown (new branch head) (glob) (fsmonitor !)
756 commit: 1 added, * unknown (new branch head) (glob) (fsmonitor !)
757 update: 2 new changesets (update)
757 update: 2 new changesets (update)
758 phases: 5 draft
758 phases: 5 draft
759 $ hg update
759 $ hg update
760 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
760 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
761 updating bookmark Z
761 updating bookmark Z
762 $ hg bookmarks
762 $ hg bookmarks
763 X2 1:925d80f479bb
763 X2 1:925d80f479bb
764 Y 2:db815d6d32e6
764 Y 2:db815d6d32e6
765 * Z 3:125c9a1d6df6
765 * Z 3:125c9a1d6df6
766 x y 2:db815d6d32e6
766 x y 2:db815d6d32e6
767
767
768 pull --update works the same as pull && update
768 pull --update works the same as pull && update
769
769
770 $ hg bookmark -r3 Y
770 $ hg bookmark -r3 Y
771 moving bookmark 'Y' forward from db815d6d32e6
771 moving bookmark 'Y' forward from db815d6d32e6
772 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
772 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
773 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
773 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
774
774
775 (manual version)
775 (manual version)
776
776
777 $ hg -R ../cloned-bookmarks-manual-update update Y
777 $ hg -R ../cloned-bookmarks-manual-update update Y
778 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
778 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
779 (activating bookmark Y)
779 (activating bookmark Y)
780 $ hg -R ../cloned-bookmarks-manual-update pull .
780 $ hg -R ../cloned-bookmarks-manual-update pull .
781 pulling from .
781 pulling from .
782 searching for changes
782 searching for changes
783 adding changesets
783 adding changesets
784 adding manifests
784 adding manifests
785 adding file changes
785 adding file changes
786 updating bookmark Y
786 updating bookmark Y
787 updating bookmark Z
787 updating bookmark Z
788 added 2 changesets with 2 changes to 2 files (+1 heads)
788 added 2 changesets with 2 changes to 2 files (+1 heads)
789 new changesets 125c9a1d6df6:9ba5f110a0b3
789 new changesets 125c9a1d6df6:9ba5f110a0b3
790 (run 'hg heads' to see heads, 'hg merge' to merge)
790 (run 'hg heads' to see heads, 'hg merge' to merge)
791
791
792 (# tests strange but with --date crashing when bookmark have to move)
792 (# tests strange but with --date crashing when bookmark have to move)
793
793
794 $ hg -R ../cloned-bookmarks-manual-update update -d 1986
794 $ hg -R ../cloned-bookmarks-manual-update update -d 1986
795 abort: revision matching date not found
795 abort: revision matching date not found
796 [10]
796 [10]
797 $ hg -R ../cloned-bookmarks-manual-update update
797 $ hg -R ../cloned-bookmarks-manual-update update
798 updating to active bookmark Y
798 updating to active bookmark Y
799 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
799 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
800
800
801 (all in one version)
801 (all in one version)
802
802
803 $ hg -R ../cloned-bookmarks-update update Y
803 $ hg -R ../cloned-bookmarks-update update Y
804 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
804 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
805 (activating bookmark Y)
805 (activating bookmark Y)
806 $ hg -R ../cloned-bookmarks-update pull --update .
806 $ hg -R ../cloned-bookmarks-update pull --update .
807 pulling from .
807 pulling from .
808 searching for changes
808 searching for changes
809 adding changesets
809 adding changesets
810 adding manifests
810 adding manifests
811 adding file changes
811 adding file changes
812 updating bookmark Y
812 updating bookmark Y
813 updating bookmark Z
813 updating bookmark Z
814 added 2 changesets with 2 changes to 2 files (+1 heads)
814 added 2 changesets with 2 changes to 2 files (+1 heads)
815 new changesets 125c9a1d6df6:9ba5f110a0b3
815 new changesets 125c9a1d6df6:9ba5f110a0b3
816 updating to active bookmark Y
816 updating to active bookmark Y
817 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
817 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
818
818
819 We warn about divergent during bare update to the active bookmark
819 We warn about divergent during bare update to the active bookmark
820
820
821 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update Y
821 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update Y
822 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
822 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
823 (activating bookmark Y)
823 (activating bookmark Y)
824 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks -r X2 Y@1
824 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks -r X2 Y@1
825 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks
825 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks
826 X2 1:925d80f479bb
826 X2 1:925d80f479bb
827 * Y 2:db815d6d32e6
827 * Y 2:db815d6d32e6
828 Y@1 1:925d80f479bb
828 Y@1 1:925d80f479bb
829 Z 2:db815d6d32e6
829 Z 2:db815d6d32e6
830 x y 2:db815d6d32e6
830 x y 2:db815d6d32e6
831 $ hg -R ../cloned-bookmarks-manual-update-with-divergence pull
831 $ hg -R ../cloned-bookmarks-manual-update-with-divergence pull
832 pulling from $TESTTMP/repo
832 pulling from $TESTTMP/repo
833 searching for changes
833 searching for changes
834 adding changesets
834 adding changesets
835 adding manifests
835 adding manifests
836 adding file changes
836 adding file changes
837 updating bookmark Y
837 updating bookmark Y
838 updating bookmark Z
838 updating bookmark Z
839 added 2 changesets with 2 changes to 2 files (+1 heads)
839 added 2 changesets with 2 changes to 2 files (+1 heads)
840 new changesets 125c9a1d6df6:9ba5f110a0b3
840 new changesets 125c9a1d6df6:9ba5f110a0b3
841 (run 'hg heads' to see heads, 'hg merge' to merge)
841 (run 'hg heads' to see heads, 'hg merge' to merge)
842 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update
842 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update
843 updating to active bookmark Y
843 updating to active bookmark Y
844 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
844 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
845 1 other divergent bookmarks for "Y"
845 1 other divergent bookmarks for "Y"
846
846
847 test wrongly formated bookmark
847 test wrongly formated bookmark
848
848
849 $ echo '' >> .hg/bookmarks
849 $ echo '' >> .hg/bookmarks
850 $ hg bookmarks
850 $ hg bookmarks
851 X2 1:925d80f479bb
851 X2 1:925d80f479bb
852 Y 3:125c9a1d6df6
852 Y 3:125c9a1d6df6
853 * Z 3:125c9a1d6df6
853 * Z 3:125c9a1d6df6
854 x y 2:db815d6d32e6
854 x y 2:db815d6d32e6
855 $ echo "Ican'thasformatedlines" >> .hg/bookmarks
855 $ echo "Ican'thasformatedlines" >> .hg/bookmarks
856 $ hg bookmarks
856 $ hg bookmarks
857 malformed line in .hg/bookmarks: "Ican'thasformatedlines"
857 malformed line in .hg/bookmarks: "Ican'thasformatedlines"
858 X2 1:925d80f479bb
858 X2 1:925d80f479bb
859 Y 3:125c9a1d6df6
859 Y 3:125c9a1d6df6
860 * Z 3:125c9a1d6df6
860 * Z 3:125c9a1d6df6
861 x y 2:db815d6d32e6
861 x y 2:db815d6d32e6
862
862
863 test missing revisions
863 test missing revisions
864
864
865 $ echo "925d80f479b925d80f479bc925d80f479bccabab z" > .hg/bookmarks
865 $ echo "925d80f479b925d80f479bc925d80f479bccabab z" > .hg/bookmarks
866 $ hg book
866 $ hg book
867 no bookmarks set
867 no bookmarks set
868
868
869 test stripping a non-checked-out but bookmarked revision
869 test stripping a non-checked-out but bookmarked revision
870
870
871 $ hg log --graph
871 $ hg log --graph
872 o changeset: 4:9ba5f110a0b3
872 o changeset: 4:9ba5f110a0b3
873 | branch: test
873 | branch: test
874 | tag: tip
874 | tag: tip
875 | parent: 2:db815d6d32e6
875 | parent: 2:db815d6d32e6
876 | user: test
876 | user: test
877 | date: Thu Jan 01 00:00:00 1970 +0000
877 | date: Thu Jan 01 00:00:00 1970 +0000
878 | summary: y
878 | summary: y
879 |
879 |
880 | @ changeset: 3:125c9a1d6df6
880 | @ changeset: 3:125c9a1d6df6
881 |/ user: test
881 |/ user: test
882 | date: Thu Jan 01 00:00:00 1970 +0000
882 | date: Thu Jan 01 00:00:00 1970 +0000
883 | summary: x
883 | summary: x
884 |
884 |
885 o changeset: 2:db815d6d32e6
885 o changeset: 2:db815d6d32e6
886 | parent: 0:f7b1eb17ad24
886 | parent: 0:f7b1eb17ad24
887 | user: test
887 | user: test
888 | date: Thu Jan 01 00:00:00 1970 +0000
888 | date: Thu Jan 01 00:00:00 1970 +0000
889 | summary: 2
889 | summary: 2
890 |
890 |
891 | o changeset: 1:925d80f479bb
891 | o changeset: 1:925d80f479bb
892 |/ user: test
892 |/ user: test
893 | date: Thu Jan 01 00:00:00 1970 +0000
893 | date: Thu Jan 01 00:00:00 1970 +0000
894 | summary: 1
894 | summary: 1
895 |
895 |
896 o changeset: 0:f7b1eb17ad24
896 o changeset: 0:f7b1eb17ad24
897 user: test
897 user: test
898 date: Thu Jan 01 00:00:00 1970 +0000
898 date: Thu Jan 01 00:00:00 1970 +0000
899 summary: 0
899 summary: 0
900
900
901 $ hg book should-end-on-two
901 $ hg book should-end-on-two
902 $ hg co --clean 4
902 $ hg co --clean 4
903 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
903 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
904 (leaving bookmark should-end-on-two)
904 (leaving bookmark should-end-on-two)
905 $ hg book four
905 $ hg book four
906 $ hg --config extensions.mq= strip 3
906 $ hg --config extensions.mq= strip 3
907 saved backup bundle to * (glob)
907 saved backup bundle to * (glob)
908 should-end-on-two should end up pointing to revision 2, as that's the
908 should-end-on-two should end up pointing to revision 2, as that's the
909 tipmost surviving ancestor of the stripped revision.
909 tipmost surviving ancestor of the stripped revision.
910 $ hg log --graph
910 $ hg log --graph
911 @ changeset: 3:9ba5f110a0b3
911 @ changeset: 3:9ba5f110a0b3
912 | branch: test
912 | branch: test
913 | bookmark: four
913 | bookmark: four
914 | tag: tip
914 | tag: tip
915 | user: test
915 | user: test
916 | date: Thu Jan 01 00:00:00 1970 +0000
916 | date: Thu Jan 01 00:00:00 1970 +0000
917 | summary: y
917 | summary: y
918 |
918 |
919 o changeset: 2:db815d6d32e6
919 o changeset: 2:db815d6d32e6
920 | bookmark: should-end-on-two
920 | bookmark: should-end-on-two
921 | parent: 0:f7b1eb17ad24
921 | parent: 0:f7b1eb17ad24
922 | user: test
922 | user: test
923 | date: Thu Jan 01 00:00:00 1970 +0000
923 | date: Thu Jan 01 00:00:00 1970 +0000
924 | summary: 2
924 | summary: 2
925 |
925 |
926 | o changeset: 1:925d80f479bb
926 | o changeset: 1:925d80f479bb
927 |/ user: test
927 |/ user: test
928 | date: Thu Jan 01 00:00:00 1970 +0000
928 | date: Thu Jan 01 00:00:00 1970 +0000
929 | summary: 1
929 | summary: 1
930 |
930 |
931 o changeset: 0:f7b1eb17ad24
931 o changeset: 0:f7b1eb17ad24
932 user: test
932 user: test
933 date: Thu Jan 01 00:00:00 1970 +0000
933 date: Thu Jan 01 00:00:00 1970 +0000
934 summary: 0
934 summary: 0
935
935
936
936
937 no-op update doesn't deactivate bookmarks
937 no-op update doesn't deactivate bookmarks
938
938
939 (it is known issue that fsmonitor can't handle nested repositories. In
939 (it is known issue that fsmonitor can't handle nested repositories. In
940 this test scenario, cloned-bookmark-default and tobundle exist in the
940 this test scenario, cloned-bookmark-default and tobundle exist in the
941 working directory of current repository)
941 working directory of current repository)
942
942
943 $ hg bookmarks
943 $ hg bookmarks
944 * four 3:9ba5f110a0b3
944 * four 3:9ba5f110a0b3
945 should-end-on-two 2:db815d6d32e6
945 should-end-on-two 2:db815d6d32e6
946 $ hg up four
946 $ hg up four
947 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
947 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
948 $ hg up
948 $ hg up
949 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
949 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
950 $ hg sum
950 $ hg sum
951 parent: 3:9ba5f110a0b3 tip
951 parent: 3:9ba5f110a0b3 tip
952 y
952 y
953 branch: test
953 branch: test
954 bookmarks: *four
954 bookmarks: *four
955 commit: 2 unknown (clean) (no-fsmonitor !)
955 commit: 2 unknown (clean) (no-fsmonitor !)
956 commit: * unknown (clean) (glob) (fsmonitor !)
956 commit: * unknown (clean) (glob) (fsmonitor !)
957 update: (current)
957 update: (current)
958 phases: 4 draft
958 phases: 4 draft
959
959
960 test clearing divergent bookmarks of linear ancestors
960 test clearing divergent bookmarks of linear ancestors
961
961
962 $ hg bookmark Z -r 0
962 $ hg bookmark Z -r 0
963 $ hg bookmark Z@1 -r 1
963 $ hg bookmark Z@1 -r 1
964 $ hg bookmark Z@2 -r 2
964 $ hg bookmark Z@2 -r 2
965 $ hg bookmark Z@3 -r 3
965 $ hg bookmark Z@3 -r 3
966 $ hg book
966 $ hg book
967 Z 0:f7b1eb17ad24
967 Z 0:f7b1eb17ad24
968 Z@1 1:925d80f479bb
968 Z@1 1:925d80f479bb
969 Z@2 2:db815d6d32e6
969 Z@2 2:db815d6d32e6
970 Z@3 3:9ba5f110a0b3
970 Z@3 3:9ba5f110a0b3
971 * four 3:9ba5f110a0b3
971 * four 3:9ba5f110a0b3
972 should-end-on-two 2:db815d6d32e6
972 should-end-on-two 2:db815d6d32e6
973 $ hg bookmark Z
973 $ hg bookmark Z
974 moving bookmark 'Z' forward from f7b1eb17ad24
974 moving bookmark 'Z' forward from f7b1eb17ad24
975 $ hg book
975 $ hg book
976 * Z 3:9ba5f110a0b3
976 * Z 3:9ba5f110a0b3
977 Z@1 1:925d80f479bb
977 Z@1 1:925d80f479bb
978 four 3:9ba5f110a0b3
978 four 3:9ba5f110a0b3
979 should-end-on-two 2:db815d6d32e6
979 should-end-on-two 2:db815d6d32e6
980
980
981 test clearing only a single divergent bookmark across branches
981 test clearing only a single divergent bookmark across branches
982
982
983 $ hg book foo -r 1
983 $ hg book foo -r 1
984 $ hg book foo@1 -r 0
984 $ hg book foo@1 -r 0
985 $ hg book foo@2 -r 2
985 $ hg book foo@2 -r 2
986 $ hg book foo@3 -r 3
986 $ hg book foo@3 -r 3
987 $ hg book foo -r foo@3
987 $ hg book foo -r foo@3
988 $ hg book
988 $ hg book
989 * Z 3:9ba5f110a0b3
989 * Z 3:9ba5f110a0b3
990 Z@1 1:925d80f479bb
990 Z@1 1:925d80f479bb
991 foo 3:9ba5f110a0b3
991 foo 3:9ba5f110a0b3
992 foo@1 0:f7b1eb17ad24
992 foo@1 0:f7b1eb17ad24
993 foo@2 2:db815d6d32e6
993 foo@2 2:db815d6d32e6
994 four 3:9ba5f110a0b3
994 four 3:9ba5f110a0b3
995 should-end-on-two 2:db815d6d32e6
995 should-end-on-two 2:db815d6d32e6
996
996
997 pull --update works the same as pull && update (case #2)
997 pull --update works the same as pull && update (case #2)
998
998
999 It is assumed that "hg pull" itself doesn't update current active
999 It is assumed that "hg pull" itself doesn't update current active
1000 bookmark ('Y' in tests below).
1000 bookmark ('Y' in tests below).
1001
1001
1002 $ hg pull -q ../cloned-bookmarks-update
1002 $ hg pull -q ../cloned-bookmarks-update
1003 divergent bookmark Z stored as Z@2
1003 divergent bookmark Z stored as Z@2
1004
1004
1005 (pulling revision on another named branch with --update updates
1005 (pulling revision on another named branch with --update updates
1006 neither the working directory nor current active bookmark: "no-op"
1006 neither the working directory nor current active bookmark: "no-op"
1007 case)
1007 case)
1008
1008
1009 $ echo yy >> y
1009 $ echo yy >> y
1010 $ hg commit -m yy
1010 $ hg commit -m yy
1011
1011
1012 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1012 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1013 * Y 3:125c9a1d6df6
1013 * Y 3:125c9a1d6df6
1014 $ hg -R ../cloned-bookmarks-update path
1015 default = $TESTTMP/repo
1016 $ pwd
1017 $TESTTMP/repo
1014 $ hg -R ../cloned-bookmarks-update pull . --update
1018 $ hg -R ../cloned-bookmarks-update pull . --update
1015 pulling from .
1019 pulling from .
1016 searching for changes
1020 searching for changes
1017 adding changesets
1021 adding changesets
1018 adding manifests
1022 adding manifests
1019 adding file changes
1023 adding file changes
1020 divergent bookmark Z stored as Z@default
1024 divergent bookmark Z stored as Z@default
1021 adding remote bookmark foo
1025 adding remote bookmark foo
1022 adding remote bookmark four
1026 adding remote bookmark four
1023 adding remote bookmark should-end-on-two
1027 adding remote bookmark should-end-on-two
1024 added 1 changesets with 1 changes to 1 files
1028 added 1 changesets with 1 changes to 1 files
1025 new changesets 5fb12f0f2d51
1029 new changesets 5fb12f0f2d51
1026 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1030 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1027 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
1031 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
1028 3:125c9a1d6df6
1032 3:125c9a1d6df6
1029 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1033 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1030 * Y 3:125c9a1d6df6
1034 * Y 3:125c9a1d6df6
1031
1035
1032 (pulling revision on current named/topological branch with --update
1036 (pulling revision on current named/topological branch with --update
1033 updates the working directory and current active bookmark)
1037 updates the working directory and current active bookmark)
1034
1038
1035 $ hg update -C -q 125c9a1d6df6
1039 $ hg update -C -q 125c9a1d6df6
1036 $ echo xx >> x
1040 $ echo xx >> x
1037 $ hg commit -m xx
1041 $ hg commit -m xx
1038
1042
1039 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1043 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1040 * Y 3:125c9a1d6df6
1044 * Y 3:125c9a1d6df6
1041 $ hg -R ../cloned-bookmarks-update pull . --update
1045 $ hg -R ../cloned-bookmarks-update pull . --update
1042 pulling from .
1046 pulling from .
1043 searching for changes
1047 searching for changes
1044 adding changesets
1048 adding changesets
1045 adding manifests
1049 adding manifests
1046 adding file changes
1050 adding file changes
1047 divergent bookmark Z stored as Z@default
1051 divergent bookmark Z stored as Z@default
1048 added 1 changesets with 1 changes to 1 files
1052 added 1 changesets with 1 changes to 1 files
1049 new changesets 81dcce76aa0b
1053 new changesets 81dcce76aa0b
1050 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1054 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1051 updating bookmark Y
1055 updating bookmark Y
1052 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
1056 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
1053 6:81dcce76aa0b
1057 6:81dcce76aa0b
1054 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1058 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
1055 * Y 6:81dcce76aa0b
1059 * Y 6:81dcce76aa0b
1056
1060
1057 $ cd ..
1061 $ cd ..
1058
1062
1059 ensure changelog is written before bookmarks
1063 ensure changelog is written before bookmarks
1060 $ hg init orderrepo
1064 $ hg init orderrepo
1061 $ cd orderrepo
1065 $ cd orderrepo
1062 $ touch a
1066 $ touch a
1063 $ hg commit -Aqm one
1067 $ hg commit -Aqm one
1064 $ hg book mybook
1068 $ hg book mybook
1065 $ echo a > a
1069 $ echo a > a
1066
1070
1067 $ cat > $TESTTMP/pausefinalize.py <<EOF
1071 $ cat > $TESTTMP/pausefinalize.py <<EOF
1068 > from __future__ import absolute_import
1072 > from __future__ import absolute_import
1069 > import os
1073 > import os
1070 > import time
1074 > import time
1071 > from mercurial import extensions, localrepo
1075 > from mercurial import extensions, localrepo
1072 > def transaction(orig, self, desc, report=None):
1076 > def transaction(orig, self, desc, report=None):
1073 > tr = orig(self, desc, report)
1077 > tr = orig(self, desc, report)
1074 > def sleep(*args, **kwargs):
1078 > def sleep(*args, **kwargs):
1075 > retry = 20
1079 > retry = 20
1076 > while retry > 0 and not os.path.exists(b"$TESTTMP/unpause"):
1080 > while retry > 0 and not os.path.exists(b"$TESTTMP/unpause"):
1077 > retry -= 1
1081 > retry -= 1
1078 > time.sleep(0.5)
1082 > time.sleep(0.5)
1079 > if os.path.exists(b"$TESTTMP/unpause"):
1083 > if os.path.exists(b"$TESTTMP/unpause"):
1080 > os.remove(b"$TESTTMP/unpause")
1084 > os.remove(b"$TESTTMP/unpause")
1081 > # 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
1082 > # the changelog finalizer appends to the changelog.
1086 > # the changelog finalizer appends to the changelog.
1083 > tr.addfinalize(b'a-sleep', sleep)
1087 > tr.addfinalize(b'a-sleep', sleep)
1084 > return tr
1088 > return tr
1085 >
1089 >
1086 > def extsetup(ui):
1090 > def extsetup(ui):
1087 > # This extension inserts an artifical pause during the transaction
1091 > # This extension inserts an artifical pause during the transaction
1088 > # finalizer, so we can run commands mid-transaction-close.
1092 > # finalizer, so we can run commands mid-transaction-close.
1089 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
1093 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
1090 > transaction)
1094 > transaction)
1091 > EOF
1095 > EOF
1092 $ hg commit -qm two --config extensions.pausefinalize=$TESTTMP/pausefinalize.py &
1096 $ hg commit -qm two --config extensions.pausefinalize=$TESTTMP/pausefinalize.py &
1093 $ sleep 2
1097 $ sleep 2
1094 $ hg log -r .
1098 $ hg log -r .
1095 changeset: 0:867bc5792c8c
1099 changeset: 0:867bc5792c8c
1096 bookmark: mybook
1100 bookmark: mybook
1097 tag: tip
1101 tag: tip
1098 user: test
1102 user: test
1099 date: Thu Jan 01 00:00:00 1970 +0000
1103 date: Thu Jan 01 00:00:00 1970 +0000
1100 summary: one
1104 summary: one
1101
1105
1102 $ hg bookmarks
1106 $ hg bookmarks
1103 * mybook 0:867bc5792c8c
1107 * mybook 0:867bc5792c8c
1104 $ touch $TESTTMP/unpause
1108 $ touch $TESTTMP/unpause
1105
1109
1106 $ cd ..
1110 $ cd ..
1107
1111
1108 check whether HG_PENDING makes pending changes only in related
1112 check whether HG_PENDING makes pending changes only in related
1109 repositories visible to an external hook.
1113 repositories visible to an external hook.
1110
1114
1111 (emulate a transaction running concurrently by copied
1115 (emulate a transaction running concurrently by copied
1112 .hg/bookmarks.pending in subsequent test)
1116 .hg/bookmarks.pending in subsequent test)
1113
1117
1114 $ cat > $TESTTMP/savepending.sh <<EOF
1118 $ cat > $TESTTMP/savepending.sh <<EOF
1115 > cp .hg/bookmarks.pending .hg/bookmarks.pending.saved
1119 > cp .hg/bookmarks.pending .hg/bookmarks.pending.saved
1116 > exit 1 # to avoid adding new bookmark for subsequent tests
1120 > exit 1 # to avoid adding new bookmark for subsequent tests
1117 > EOF
1121 > EOF
1118
1122
1119 $ hg init unrelated
1123 $ hg init unrelated
1120 $ cd unrelated
1124 $ cd unrelated
1121 $ echo a > a
1125 $ echo a > a
1122 $ hg add a
1126 $ hg add a
1123 $ hg commit -m '#0'
1127 $ hg commit -m '#0'
1124 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" bookmarks INVISIBLE
1128 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" bookmarks INVISIBLE
1125 transaction abort!
1129 transaction abort!
1126 rollback completed
1130 rollback completed
1127 abort: pretxnclose hook exited with status 1
1131 abort: pretxnclose hook exited with status 1
1128 [40]
1132 [40]
1129 $ cp .hg/bookmarks.pending.saved .hg/bookmarks.pending
1133 $ cp .hg/bookmarks.pending.saved .hg/bookmarks.pending
1130
1134
1131 (check visible bookmarks while transaction running in repo)
1135 (check visible bookmarks while transaction running in repo)
1132
1136
1133 $ cat > $TESTTMP/checkpending.sh <<EOF
1137 $ cat > $TESTTMP/checkpending.sh <<EOF
1134 > echo "@repo"
1138 > echo "@repo"
1135 > hg -R "$TESTTMP/repo" bookmarks
1139 > hg -R "$TESTTMP/repo" bookmarks
1136 > echo "@unrelated"
1140 > echo "@unrelated"
1137 > hg -R "$TESTTMP/unrelated" bookmarks
1141 > hg -R "$TESTTMP/unrelated" bookmarks
1138 > exit 1 # to avoid adding new bookmark for subsequent tests
1142 > exit 1 # to avoid adding new bookmark for subsequent tests
1139 > EOF
1143 > EOF
1140
1144
1141 $ cd ../repo
1145 $ cd ../repo
1142 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" bookmarks NEW
1146 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" bookmarks NEW
1143 @repo
1147 @repo
1144 * NEW 6:81dcce76aa0b
1148 * NEW 6:81dcce76aa0b
1145 X2 1:925d80f479bb
1149 X2 1:925d80f479bb
1146 Y 4:125c9a1d6df6
1150 Y 4:125c9a1d6df6
1147 Z 5:5fb12f0f2d51
1151 Z 5:5fb12f0f2d51
1148 Z@1 1:925d80f479bb
1152 Z@1 1:925d80f479bb
1149 Z@2 4:125c9a1d6df6
1153 Z@2 4:125c9a1d6df6
1150 foo 3:9ba5f110a0b3
1154 foo 3:9ba5f110a0b3
1151 foo@1 0:f7b1eb17ad24
1155 foo@1 0:f7b1eb17ad24
1152 foo@2 2:db815d6d32e6
1156 foo@2 2:db815d6d32e6
1153 four 3:9ba5f110a0b3
1157 four 3:9ba5f110a0b3
1154 should-end-on-two 2:db815d6d32e6
1158 should-end-on-two 2:db815d6d32e6
1155 x y 2:db815d6d32e6
1159 x y 2:db815d6d32e6
1156 @unrelated
1160 @unrelated
1157 no bookmarks set
1161 no bookmarks set
1158 transaction abort!
1162 transaction abort!
1159 rollback completed
1163 rollback completed
1160 abort: pretxnclose hook exited with status 1
1164 abort: pretxnclose hook exited with status 1
1161 [40]
1165 [40]
1162
1166
1163 Check pretxnclose-bookmark can abort a transaction
1167 Check pretxnclose-bookmark can abort a transaction
1164 --------------------------------------------------
1168 --------------------------------------------------
1165
1169
1166 add hooks:
1170 add hooks:
1167
1171
1168 * to prevent NEW bookmark on a non-public changeset
1172 * to prevent NEW bookmark on a non-public changeset
1169 * to prevent non-forward move of NEW bookmark
1173 * to prevent non-forward move of NEW bookmark
1170
1174
1171 $ cat << EOF >> .hg/hgrc
1175 $ cat << EOF >> .hg/hgrc
1172 > [hooks]
1176 > [hooks]
1173 > 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)"
1174 > 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)"
1175 > EOF
1179 > EOF
1176
1180
1177 $ hg log -G -T phases
1181 $ hg log -G -T phases
1178 @ changeset: 6:81dcce76aa0b
1182 @ changeset: 6:81dcce76aa0b
1179 | tag: tip
1183 | tag: tip
1180 | phase: draft
1184 | phase: draft
1181 | parent: 4:125c9a1d6df6
1185 | parent: 4:125c9a1d6df6
1182 | user: test
1186 | user: test
1183 | date: Thu Jan 01 00:00:00 1970 +0000
1187 | date: Thu Jan 01 00:00:00 1970 +0000
1184 | summary: xx
1188 | summary: xx
1185 |
1189 |
1186 | o changeset: 5:5fb12f0f2d51
1190 | o changeset: 5:5fb12f0f2d51
1187 | | branch: test
1191 | | branch: test
1188 | | bookmark: Z
1192 | | bookmark: Z
1189 | | phase: draft
1193 | | phase: draft
1190 | | parent: 3:9ba5f110a0b3
1194 | | parent: 3:9ba5f110a0b3
1191 | | user: test
1195 | | user: test
1192 | | date: Thu Jan 01 00:00:00 1970 +0000
1196 | | date: Thu Jan 01 00:00:00 1970 +0000
1193 | | summary: yy
1197 | | summary: yy
1194 | |
1198 | |
1195 o | changeset: 4:125c9a1d6df6
1199 o | changeset: 4:125c9a1d6df6
1196 | | bookmark: Y
1200 | | bookmark: Y
1197 | | bookmark: Z@2
1201 | | bookmark: Z@2
1198 | | phase: public
1202 | | phase: public
1199 | | parent: 2:db815d6d32e6
1203 | | parent: 2:db815d6d32e6
1200 | | user: test
1204 | | user: test
1201 | | date: Thu Jan 01 00:00:00 1970 +0000
1205 | | date: Thu Jan 01 00:00:00 1970 +0000
1202 | | summary: x
1206 | | summary: x
1203 | |
1207 | |
1204 | o changeset: 3:9ba5f110a0b3
1208 | o changeset: 3:9ba5f110a0b3
1205 |/ branch: test
1209 |/ branch: test
1206 | bookmark: foo
1210 | bookmark: foo
1207 | bookmark: four
1211 | bookmark: four
1208 | phase: public
1212 | phase: public
1209 | user: test
1213 | user: test
1210 | date: Thu Jan 01 00:00:00 1970 +0000
1214 | date: Thu Jan 01 00:00:00 1970 +0000
1211 | summary: y
1215 | summary: y
1212 |
1216 |
1213 o changeset: 2:db815d6d32e6
1217 o changeset: 2:db815d6d32e6
1214 | bookmark: foo@2
1218 | bookmark: foo@2
1215 | bookmark: should-end-on-two
1219 | bookmark: should-end-on-two
1216 | bookmark: x y
1220 | bookmark: x y
1217 | phase: public
1221 | phase: public
1218 | parent: 0:f7b1eb17ad24
1222 | parent: 0:f7b1eb17ad24
1219 | user: test
1223 | user: test
1220 | date: Thu Jan 01 00:00:00 1970 +0000
1224 | date: Thu Jan 01 00:00:00 1970 +0000
1221 | summary: 2
1225 | summary: 2
1222 |
1226 |
1223 | o changeset: 1:925d80f479bb
1227 | o changeset: 1:925d80f479bb
1224 |/ bookmark: X2
1228 |/ bookmark: X2
1225 | bookmark: Z@1
1229 | bookmark: Z@1
1226 | phase: public
1230 | phase: public
1227 | user: test
1231 | user: test
1228 | date: Thu Jan 01 00:00:00 1970 +0000
1232 | date: Thu Jan 01 00:00:00 1970 +0000
1229 | summary: 1
1233 | summary: 1
1230 |
1234 |
1231 o changeset: 0:f7b1eb17ad24
1235 o changeset: 0:f7b1eb17ad24
1232 bookmark: foo@1
1236 bookmark: foo@1
1233 phase: public
1237 phase: public
1234 user: test
1238 user: test
1235 date: Thu Jan 01 00:00:00 1970 +0000
1239 date: Thu Jan 01 00:00:00 1970 +0000
1236 summary: 0
1240 summary: 0
1237
1241
1238
1242
1239 attempt to create on a default changeset
1243 attempt to create on a default changeset
1240
1244
1241 $ hg bookmark -r 81dcce76aa0b NEW
1245 $ hg bookmark -r 81dcce76aa0b NEW
1242 transaction abort!
1246 transaction abort!
1243 rollback completed
1247 rollback completed
1244 abort: pretxnclose-bookmark.force-public hook exited with status 1
1248 abort: pretxnclose-bookmark.force-public hook exited with status 1
1245 [40]
1249 [40]
1246
1250
1247 create on a public changeset
1251 create on a public changeset
1248
1252
1249 $ hg bookmark -r 9ba5f110a0b3 NEW
1253 $ hg bookmark -r 9ba5f110a0b3 NEW
1250
1254
1251 move to the other branch
1255 move to the other branch
1252
1256
1253 $ hg bookmark -f -r 125c9a1d6df6 NEW
1257 $ hg bookmark -f -r 125c9a1d6df6 NEW
1254 transaction abort!
1258 transaction abort!
1255 rollback completed
1259 rollback completed
1256 abort: pretxnclose-bookmark.force-forward hook exited with status 1
1260 abort: pretxnclose-bookmark.force-forward hook exited with status 1
1257 [40]
1261 [40]
General Comments 0
You need to be logged in to leave comments. Login now