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