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