Debian Codegraph @

tests/test-rebase-named-branches.t

raw
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > rebase=
4 >
5 > [phases]
6 > publish=False
7 >
8 > [alias]
9 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
10 > EOF
11
12 $ hg init a
13 $ cd a
14 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
15 adding changesets
16 adding manifests
17 adding file changes
18 added 8 changesets with 7 changes to 7 files (+2 heads)
19 new changesets cd010b8cd998:02de42196ebe (8 drafts)
20 (run 'hg heads' to see heads, 'hg merge' to merge)
21 $ hg up tip
22 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 $ cd ..
24
25 $ hg clone -q -u . a a1
26
27 $ cd a1
28
29 $ hg update 3
30 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
31 $ hg branch dev-one
32 marked working directory as branch dev-one
33 (branches are permanent and global, did you want a bookmark?)
34 $ hg ci -m 'dev-one named branch'
35
36 $ hg update 7
37 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
38 $ hg branch dev-two
39 marked working directory as branch dev-two
40
41 $ echo x > x
42
43 $ hg add x
44
45 $ hg ci -m 'dev-two named branch'
46
47 $ hg tglog
48 @ 9: cb039b7cae8e 'dev-two named branch' dev-two
49 |
50 | o 8: 643fc9128048 'dev-one named branch' dev-one
51 | |
52 o | 7: 02de42196ebe 'H'
53 | |
54 +---o 6: eea13746799a 'G'
55 | | |
56 o | | 5: 24b6387c8c8c 'F'
57 | | |
58 +---o 4: 9520eea781bc 'E'
59 | |
60 | o 3: 32af7686d403 'D'
61 | |
62 | o 2: 5fddd98957c8 'C'
63 | |
64 | o 1: 42ccdea3bb16 'B'
65 |/
66 o 0: cd010b8cd998 'A'
67
68
69 Branch name containing a dash (issue3181)
70
71 $ hg rebase -b dev-two -d dev-one --keepbranches
72 rebasing 5:24b6387c8c8c "F"
73 rebasing 6:eea13746799a "G"
74 rebasing 7:02de42196ebe "H"
75 rebasing 9:cb039b7cae8e tip "dev-two named branch"
76 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/24b6387c8c8c-24cb8001-rebase.hg
77
78 $ hg tglog
79 @ 9: 9e70cd31750f 'dev-two named branch' dev-two
80 |
81 o 8: 31d0e4ba75e6 'H'
82 |
83 | o 7: 4b988a958030 'G'
84 |/|
85 o | 6: 24de4aff8e28 'F'
86 | |
87 o | 5: 643fc9128048 'dev-one named branch' dev-one
88 | |
89 | o 4: 9520eea781bc 'E'
90 | |
91 o | 3: 32af7686d403 'D'
92 | |
93 o | 2: 5fddd98957c8 'C'
94 | |
95 o | 1: 42ccdea3bb16 'B'
96 |/
97 o 0: cd010b8cd998 'A'
98
99 $ hg rebase -s dev-one -d 0 --keepbranches
100 rebasing 5:643fc9128048 "dev-one named branch"
101 rebasing 6:24de4aff8e28 "F"
102 rebasing 7:4b988a958030 "G"
103 rebasing 8:31d0e4ba75e6 "H"
104 rebasing 9:9e70cd31750f tip "dev-two named branch"
105 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-c4ee9ef5-rebase.hg
106
107 $ hg tglog
108 @ 9: 59c2e59309fe 'dev-two named branch' dev-two
109 |
110 o 8: 904590360559 'H'
111 |
112 | o 7: 1a1e6f72ec38 'G'
113 |/|
114 o | 6: 42aa3cf0fa7a 'F'
115 | |
116 o | 5: bc8139ee757c 'dev-one named branch' dev-one
117 | |
118 | o 4: 9520eea781bc 'E'
119 |/
120 | o 3: 32af7686d403 'D'
121 | |
122 | o 2: 5fddd98957c8 'C'
123 | |
124 | o 1: 42ccdea3bb16 'B'
125 |/
126 o 0: cd010b8cd998 'A'
127
128 $ hg update 3
129 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
130 $ hg branch -f dev-one
131 marked working directory as branch dev-one
132 $ hg ci -m 'dev-one named branch'
133 created new head
134
135 $ hg tglog
136 @ 10: 643fc9128048 'dev-one named branch' dev-one
137 |
138 | o 9: 59c2e59309fe 'dev-two named branch' dev-two
139 | |
140 | o 8: 904590360559 'H'
141 | |
142 | | o 7: 1a1e6f72ec38 'G'
143 | |/|
144 | o | 6: 42aa3cf0fa7a 'F'
145 | | |
146 | o | 5: bc8139ee757c 'dev-one named branch' dev-one
147 | | |
148 | | o 4: 9520eea781bc 'E'
149 | |/
150 o | 3: 32af7686d403 'D'
151 | |
152 o | 2: 5fddd98957c8 'C'
153 | |
154 o | 1: 42ccdea3bb16 'B'
155 |/
156 o 0: cd010b8cd998 'A'
157
158 $ hg rebase -b 'max(branch("dev-two"))' -d dev-one --keepbranches
159 rebasing 5:bc8139ee757c "dev-one named branch"
160 note: not rebasing 5:bc8139ee757c "dev-one named branch", its destination already has all its changes
161 rebasing 6:42aa3cf0fa7a "F"
162 rebasing 7:1a1e6f72ec38 "G"
163 rebasing 8:904590360559 "H"
164 rebasing 9:59c2e59309fe "dev-two named branch"
165 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/bc8139ee757c-f11c1080-rebase.hg
166
167 $ hg tglog
168 o 9: 71325f8bc082 'dev-two named branch' dev-two
169 |
170 o 8: 12b2bc666e20 'H'
171 |
172 | o 7: 549f007a9f5f 'G'
173 |/|
174 o | 6: 679f28760620 'F'
175 | |
176 @ | 5: 643fc9128048 'dev-one named branch' dev-one
177 | |
178 | o 4: 9520eea781bc 'E'
179 | |
180 o | 3: 32af7686d403 'D'
181 | |
182 o | 2: 5fddd98957c8 'C'
183 | |
184 o | 1: 42ccdea3bb16 'B'
185 |/
186 o 0: cd010b8cd998 'A'
187
188 $ hg rebase -s 'max(branch("dev-one"))' -d 0 --keepbranches
189 rebasing 5:643fc9128048 "dev-one named branch"
190 rebasing 6:679f28760620 "F"
191 rebasing 7:549f007a9f5f "G"
192 rebasing 8:12b2bc666e20 "H"
193 rebasing 9:71325f8bc082 tip "dev-two named branch"
194 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-6cdd1a52-rebase.hg
195
196 $ hg tglog
197 o 9: 3944801ae4ea 'dev-two named branch' dev-two
198 |
199 o 8: 8e279d293175 'H'
200 |
201 | o 7: aeefee77ab01 'G'
202 |/|
203 o | 6: e908b85f3729 'F'
204 | |
205 @ | 5: bc8139ee757c 'dev-one named branch' dev-one
206 | |
207 | o 4: 9520eea781bc 'E'
208 |/
209 | o 3: 32af7686d403 'D'
210 | |
211 | o 2: 5fddd98957c8 'C'
212 | |
213 | o 1: 42ccdea3bb16 'B'
214 |/
215 o 0: cd010b8cd998 'A'
216
217 $ hg up -r 0 > /dev/null
218
219 Rebasing descendant onto ancestor across different named branches
220
221 $ hg rebase -s 1 -d 9 --keepbranches
222 rebasing 1:42ccdea3bb16 "B"
223 rebasing 2:5fddd98957c8 "C"
224 rebasing 3:32af7686d403 "D"
225 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
226
227 $ hg tglog
228 o 9: e9f862ce8bad 'D'
229 |
230 o 8: a0d543090fa4 'C'
231 |
232 o 7: 3bdb949809d9 'B'
233 |
234 o 6: 3944801ae4ea 'dev-two named branch' dev-two
235 |
236 o 5: 8e279d293175 'H'
237 |
238 | o 4: aeefee77ab01 'G'
239 |/|
240 o | 3: e908b85f3729 'F'
241 | |
242 o | 2: bc8139ee757c 'dev-one named branch' dev-one
243 | |
244 | o 1: 9520eea781bc 'E'
245 |/
246 @ 0: cd010b8cd998 'A'
247
248 $ hg rebase -s 5 -d 6
249 abort: source and destination form a cycle
250 [10]
251
252 $ hg rebase -s 6 -d 5
253 rebasing 6:3944801ae4ea "dev-two named branch"
254 rebasing 7:3bdb949809d9 "B"
255 rebasing 8:a0d543090fa4 "C"
256 rebasing 9:e9f862ce8bad tip "D"
257 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/3944801ae4ea-fb46ed74-rebase.hg
258
259 $ hg tglog
260 o 9: e522577ccdbd 'D'
261 |
262 o 8: 810110211f50 'C'
263 |
264 o 7: 160b0930ccc6 'B'
265 |
266 o 6: c57724c84928 'dev-two named branch'
267 |
268 o 5: 8e279d293175 'H'
269 |
270 | o 4: aeefee77ab01 'G'
271 |/|
272 o | 3: e908b85f3729 'F'
273 | |
274 o | 2: bc8139ee757c 'dev-one named branch' dev-one
275 | |
276 | o 1: 9520eea781bc 'E'
277 |/
278 @ 0: cd010b8cd998 'A'
279
280
281 Reopen branch by rebase
282
283 $ hg up -qr3
284 $ hg branch -q b
285 $ hg ci -m 'create b'
286 $ hg ci -m 'close b' --close
287 $ hg rebase -b 8 -d b
288 reopening closed branch head 2b586e70108d
289 rebasing 5:8e279d293175 "H"
290 rebasing 6:c57724c84928 "dev-two named branch"
291 rebasing 7:160b0930ccc6 "B"
292 rebasing 8:810110211f50 "C"
293 rebasing 9:e522577ccdbd "D"
294 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/8e279d293175-b023e27c-rebase.hg
295
296 $ hg log -G -Tcompact
297 o 11[tip] be1dea60f2a6 2011-04-30 15:24 +0200 nicdumz
298 | D
299 |
300 o 10 ac34ce92632a 2011-04-30 15:24 +0200 nicdumz
301 | C
302 |
303 o 9 7bd665b6ce12 2011-04-30 15:24 +0200 nicdumz
304 | B
305 |
306 o 8 58e7c36e77f7 1970-01-01 00:00 +0000 test
307 | dev-two named branch
308 |
309 o 7 8e5a320651f3 2011-04-30 15:24 +0200 nicdumz
310 | H
311 |
312 @ 6 2b586e70108d 1970-01-01 00:00 +0000 test
313 | close b
314 |
315 o 5:3 3f9d5df8a707 1970-01-01 00:00 +0000 test
316 | create b
317 |
318 | o 4:3,1 aeefee77ab01 2011-04-30 15:24 +0200 nicdumz
319 |/| G
320 | |
321 o | 3 e908b85f3729 2011-04-30 15:24 +0200 nicdumz
322 | | F
323 | |
324 o | 2:0 bc8139ee757c 1970-01-01 00:00 +0000 test
325 | | dev-one named branch
326 | |
327 | o 1 9520eea781bc 2011-04-30 15:24 +0200 nicdumz
328 |/ E
329 |
330 o 0 cd010b8cd998 2011-04-30 15:24 +0200 nicdumz
331 A
332
333 $ echo A-mod > A
334 $ hg diff
335 diff -r 2b586e70108d A
336 --- a/A Thu Jan 01 00:00:00 1970 +0000
337 +++ b/A Thu Jan 01 00:00:00 1970 +0000
338 @@ -1,1 +1,1 @@
339 -A
340 +A-mod
341
342 --dry-run doesn't affect a dirty working directory that is unrelated to the
343 source or destination.
344
345 $ hg rebase -s tip -d 4 --dry-run
346 starting dry-run rebase; repository will not be changed
347 rebasing 11:be1dea60f2a6 tip "D"
348 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
349 $ hg diff
350 diff -r 2b586e70108d A
351 --- a/A Thu Jan 01 00:00:00 1970 +0000
352 +++ b/A Thu Jan 01 00:00:00 1970 +0000
353 @@ -1,1 +1,1 @@
354 -A
355 +A-mod
356
357 Bailing out on --confirm doesn't affect a dirty working directory that is
358 unrelated to the source or destination.
359
360 $ echo A-mod > A
361 $ echo n | hg rebase -s tip -d 4 --confirm --config ui.interactive=True
362 starting in-memory rebase
363 rebasing 11:be1dea60f2a6 tip "D"
364 rebase completed successfully
365 apply changes (yn)? n
366 $ hg diff
367 diff -r 2b586e70108d A
368 --- a/A Thu Jan 01 00:00:00 1970 +0000
369 +++ b/A Thu Jan 01 00:00:00 1970 +0000
370 @@ -1,1 +1,1 @@
371 -A
372 +A-mod
373
374 $ echo A-mod > A
375 $ hg rebase -s tip -d 4 --confirm
376 starting in-memory rebase
377 rebasing 11:be1dea60f2a6 tip "D"
378 rebase completed successfully
379 apply changes (yn)? y
380 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/be1dea60f2a6-ca6d2dac-rebase.hg
381 $ hg diff
382 diff -r 2b586e70108d A
383 --- a/A Thu Jan 01 00:00:00 1970 +0000
384 +++ b/A Thu Jan 01 00:00:00 1970 +0000
385 @@ -1,1 +1,1 @@
386 -A
387 +A-mod
388
389 Attempting to rebase the parent of a dirty working directory will abort, without
390 mangling the working directory...
391
392 $ hg rebase -s 5 -d 4 --dry-run
393 starting dry-run rebase; repository will not be changed
394 abort: uncommitted changes
395 [20]
396 $ hg diff
397 diff -r 2b586e70108d A
398 --- a/A Thu Jan 01 00:00:00 1970 +0000
399 +++ b/A Thu Jan 01 00:00:00 1970 +0000
400 @@ -1,1 +1,1 @@
401 -A
402 +A-mod
403
404 ... ditto for --confirm
405
406 $ echo n | hg rebase -s 5 -d 4 --confirm --config ui.interactive=True
407 starting in-memory rebase
408 abort: uncommitted changes
409 [20]
410 $ hg diff
411 diff -r 2b586e70108d A
412 --- a/A Thu Jan 01 00:00:00 1970 +0000
413 +++ b/A Thu Jan 01 00:00:00 1970 +0000
414 @@ -1,1 +1,1 @@
415 -A
416 +A-mod
417 $ hg rebase -s 5 -d 4 --confirm
418 starting in-memory rebase
419 abort: uncommitted changes
420 [20]
421 $ hg diff
422 diff -r 2b586e70108d A
423 --- a/A Thu Jan 01 00:00:00 1970 +0000
424 +++ b/A Thu Jan 01 00:00:00 1970 +0000
425 @@ -1,1 +1,1 @@
426 -A
427 +A-mod
428
429 $ cd ..
430
431 Rebase to other head on branch
432
433 Set up a case:
434
435 $ hg init case1
436 $ cd case1
437 $ touch f
438 $ hg ci -qAm0
439 $ hg branch -q b
440 $ echo >> f
441 $ hg ci -qAm 'b1'
442 $ hg up -qr -2
443 $ hg branch -qf b
444 $ hg ci -qm 'b2'
445 $ hg up -qr -3
446 $ hg branch -q c
447 $ hg ci -m 'c1'
448
449 $ hg tglog
450 @ 3: c062e3ecd6c6 'c1' c
451 |
452 | o 2: 792845bb77ee 'b2' b
453 |/
454 | o 1: 40039acb7ca5 'b1' b
455 |/
456 o 0: d681519c3ea7 '0'
457
458 $ hg clone -q . ../case2
459
460 rebase 'b2' to another lower branch head
461
462 $ hg up -qr 2
463 $ hg rebase
464 rebasing 2:792845bb77ee "b2"
465 note: not rebasing 2:792845bb77ee "b2", its destination already has all its changes
466 saved backup bundle to $TESTTMP/case1/.hg/strip-backup/792845bb77ee-627120ee-rebase.hg
467 $ hg tglog
468 o 2: c062e3ecd6c6 'c1' c
469 |
470 | @ 1: 40039acb7ca5 'b1' b
471 |/
472 o 0: d681519c3ea7 '0'
473
474
475 rebase 'b1' on top of the tip of the branch ('b2') - ignoring the tip branch ('c1')
476
477 $ cd ../case2
478 $ hg up -qr 1
479 $ hg rebase
480 rebasing 1:40039acb7ca5 "b1"
481 saved backup bundle to $TESTTMP/case2/.hg/strip-backup/40039acb7ca5-342b72d1-rebase.hg
482 $ hg tglog
483 @ 3: 76abc1c6f8c7 'b1' b
484 |
485 | o 2: c062e3ecd6c6 'c1' c
486 | |
487 o | 1: 792845bb77ee 'b2' b
488 |/
489 o 0: d681519c3ea7 '0'
490
491
492 rebase 'c1' to the branch head 'c2' that is closed
493
494 $ hg branch -qf c
495 $ hg ci -qm 'c2 closed' --close
496 $ hg up -qr 2
497 $ hg tglog
498 _ 4: 8427af5d86f2 'c2 closed' c
499 |
500 o 3: 76abc1c6f8c7 'b1' b
501 |
502 | @ 2: c062e3ecd6c6 'c1' c
503 | |
504 o | 1: 792845bb77ee 'b2' b
505 |/
506 o 0: d681519c3ea7 '0'
507
508 $ hg rebase
509 abort: branch 'c' has one head - please rebase to an explicit rev
510 (run 'hg heads' to see all heads, specify destination with -d)
511 [255]
512 $ hg tglog
513 _ 4: 8427af5d86f2 'c2 closed' c
514 |
515 o 3: 76abc1c6f8c7 'b1' b
516 |
517 | @ 2: c062e3ecd6c6 'c1' c
518 | |
519 o | 1: 792845bb77ee 'b2' b
520 |/
521 o 0: d681519c3ea7 '0'
522
523
524 $ hg up -cr 1
525 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
526 $ hg branch x
527 marked working directory as branch x
528 $ hg rebase -r 3:: -d .
529 rebasing 3:76abc1c6f8c7 "b1"
530 rebasing 4:8427af5d86f2 tip "c2 closed"
531 note: not rebasing 4:8427af5d86f2 tip "c2 closed", its destination already has all its changes
532 saved backup bundle to $TESTTMP/case2/.hg/strip-backup/76abc1c6f8c7-cd698d13-rebase.hg
533 $ hg tglog
534 o 3: 117b0ed08075 'b1' x
535 |
536 | o 2: c062e3ecd6c6 'c1' c
537 | |
538 @ | 1: 792845bb77ee 'b2' b
539 |/
540 o 0: d681519c3ea7 '0'
541
542
543 $ cd ..