##// END OF EJS Templates
tests: add test showing that rebase of extinct commit with successor fails...
Martin von Zweigbergk -
r39363:a3af500a default
parent child Browse files
Show More
@@ -1,2117 +1,2139
1 1 ==========================
2 2 Test rebase with obsolete
3 3 ==========================
4 4
5 5 Enable obsolete
6 6
7 7 $ cat >> $HGRCPATH << EOF
8 8 > [ui]
9 9 > logtemplate= {rev}:{node|short} {desc|firstline}{if(obsolete,' ({obsfate})')}
10 10 > [experimental]
11 11 > evolution.createmarkers=True
12 12 > evolution.allowunstable=True
13 13 > [phases]
14 14 > publish=False
15 15 > [extensions]
16 16 > rebase=
17 17 > drawdag=$TESTDIR/drawdag.py
18 18 > strip=
19 19 > EOF
20 20
21 21 Setup rebase canonical repo
22 22
23 23 $ hg init base
24 24 $ cd base
25 25 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
26 26 adding changesets
27 27 adding manifests
28 28 adding file changes
29 29 added 8 changesets with 7 changes to 7 files (+2 heads)
30 30 new changesets cd010b8cd998:02de42196ebe
31 31 (run 'hg heads' to see heads, 'hg merge' to merge)
32 32 $ hg up tip
33 33 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 34 $ hg log -G
35 35 @ 7:02de42196ebe H
36 36 |
37 37 | o 6:eea13746799a G
38 38 |/|
39 39 o | 5:24b6387c8c8c F
40 40 | |
41 41 | o 4:9520eea781bc E
42 42 |/
43 43 | o 3:32af7686d403 D
44 44 | |
45 45 | o 2:5fddd98957c8 C
46 46 | |
47 47 | o 1:42ccdea3bb16 B
48 48 |/
49 49 o 0:cd010b8cd998 A
50 50
51 51 $ cd ..
52 52
53 53 simple rebase
54 54 ---------------------------------
55 55
56 56 $ hg clone base simple
57 57 updating to branch default
58 58 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 59 $ cd simple
60 60 $ hg up 32af7686d403
61 61 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
62 62 $ hg rebase -d eea13746799a
63 63 rebasing 1:42ccdea3bb16 "B"
64 64 rebasing 2:5fddd98957c8 "C"
65 65 rebasing 3:32af7686d403 "D"
66 66 $ hg log -G
67 67 @ 10:8eeb3c33ad33 D
68 68 |
69 69 o 9:2327fea05063 C
70 70 |
71 71 o 8:e4e5be0395b2 B
72 72 |
73 73 | o 7:02de42196ebe H
74 74 | |
75 75 o | 6:eea13746799a G
76 76 |\|
77 77 | o 5:24b6387c8c8c F
78 78 | |
79 79 o | 4:9520eea781bc E
80 80 |/
81 81 o 0:cd010b8cd998 A
82 82
83 83 $ hg log --hidden -G
84 84 @ 10:8eeb3c33ad33 D
85 85 |
86 86 o 9:2327fea05063 C
87 87 |
88 88 o 8:e4e5be0395b2 B
89 89 |
90 90 | o 7:02de42196ebe H
91 91 | |
92 92 o | 6:eea13746799a G
93 93 |\|
94 94 | o 5:24b6387c8c8c F
95 95 | |
96 96 o | 4:9520eea781bc E
97 97 |/
98 98 | x 3:32af7686d403 D (rewritten using rebase as 10:8eeb3c33ad33)
99 99 | |
100 100 | x 2:5fddd98957c8 C (rewritten using rebase as 9:2327fea05063)
101 101 | |
102 102 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:e4e5be0395b2)
103 103 |/
104 104 o 0:cd010b8cd998 A
105 105
106 106 $ hg debugobsolete
107 107 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
108 108 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
109 109 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
110 110
111 111
112 112 $ cd ..
113 113
114 114 empty changeset
115 115 ---------------------------------
116 116
117 117 $ hg clone base empty
118 118 updating to branch default
119 119 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 120 $ cd empty
121 121 $ hg up eea13746799a
122 122 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
123 123
124 124 We make a copy of both the first changeset in the rebased and some other in the
125 125 set.
126 126
127 127 $ hg graft 42ccdea3bb16 32af7686d403
128 128 grafting 1:42ccdea3bb16 "B"
129 129 grafting 3:32af7686d403 "D"
130 130 $ hg rebase -s 42ccdea3bb16 -d .
131 131 rebasing 1:42ccdea3bb16 "B"
132 132 note: rebase of 1:42ccdea3bb16 created no changes to commit
133 133 rebasing 2:5fddd98957c8 "C"
134 134 rebasing 3:32af7686d403 "D"
135 135 note: rebase of 3:32af7686d403 created no changes to commit
136 136 $ hg log -G
137 137 o 10:5ae4c968c6ac C
138 138 |
139 139 @ 9:08483444fef9 D
140 140 |
141 141 o 8:8877864f1edb B
142 142 |
143 143 | o 7:02de42196ebe H
144 144 | |
145 145 o | 6:eea13746799a G
146 146 |\|
147 147 | o 5:24b6387c8c8c F
148 148 | |
149 149 o | 4:9520eea781bc E
150 150 |/
151 151 o 0:cd010b8cd998 A
152 152
153 153 $ hg log --hidden -G
154 154 o 10:5ae4c968c6ac C
155 155 |
156 156 @ 9:08483444fef9 D
157 157 |
158 158 o 8:8877864f1edb B
159 159 |
160 160 | o 7:02de42196ebe H
161 161 | |
162 162 o | 6:eea13746799a G
163 163 |\|
164 164 | o 5:24b6387c8c8c F
165 165 | |
166 166 o | 4:9520eea781bc E
167 167 |/
168 168 | x 3:32af7686d403 D (pruned using rebase)
169 169 | |
170 170 | x 2:5fddd98957c8 C (rewritten using rebase as 10:5ae4c968c6ac)
171 171 | |
172 172 | x 1:42ccdea3bb16 B (pruned using rebase)
173 173 |/
174 174 o 0:cd010b8cd998 A
175 175
176 176 $ hg debugobsolete
177 177 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
178 178 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
179 179 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
180 180
181 181
182 182 More complex case where part of the rebase set were already rebased
183 183
184 184 $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
185 185 rebasing 9:08483444fef9 "D"
186 186 1 new orphan changesets
187 187 $ hg debugobsolete
188 188 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
189 189 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
190 190 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
191 191 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
192 192 $ hg log -G
193 193 @ 11:4596109a6a43 D
194 194 |
195 195 | * 10:5ae4c968c6ac C
196 196 | |
197 197 | x 9:08483444fef9 D (rewritten using rebase as 11:4596109a6a43)
198 198 | |
199 199 | o 8:8877864f1edb B
200 200 | |
201 201 o | 7:02de42196ebe H
202 202 | |
203 203 | o 6:eea13746799a G
204 204 |/|
205 205 o | 5:24b6387c8c8c F
206 206 | |
207 207 | o 4:9520eea781bc E
208 208 |/
209 209 o 0:cd010b8cd998 A
210 210
211 211 $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
212 212 rebasing 8:8877864f1edb "B"
213 213 note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D" (tip)
214 214 rebasing 10:5ae4c968c6ac "C"
215 215 $ hg debugobsolete
216 216 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
217 217 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
218 218 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
219 219 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
220 220 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
221 221 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
222 222 $ hg log --rev 'contentdivergent()'
223 223 $ hg log -G
224 224 o 13:98f6af4ee953 C
225 225 |
226 226 o 12:462a34d07e59 B
227 227 |
228 228 @ 11:4596109a6a43 D
229 229 |
230 230 o 7:02de42196ebe H
231 231 |
232 232 | o 6:eea13746799a G
233 233 |/|
234 234 o | 5:24b6387c8c8c F
235 235 | |
236 236 | o 4:9520eea781bc E
237 237 |/
238 238 o 0:cd010b8cd998 A
239 239
240 240 $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
241 241 changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003
242 242 phase: draft
243 243 parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6
244 244 parent: -1:0000000000000000000000000000000000000000
245 245 manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905
246 246 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
247 247 date: Sat Apr 30 15:24:48 2011 +0200
248 248 files+: D
249 249 extra: branch=default
250 250 extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
251 251 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
252 252 description:
253 253 D
254 254
255 255
256 256 $ hg up -qr 'desc(G)'
257 257 $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
258 258 grafting 11:4596109a6a43 "D"
259 259 $ hg up -qr 'desc(E)'
260 260 $ hg rebase -s tip -d .
261 261 rebasing 14:9e36056a46e3 "D" (tip)
262 262 $ hg log --style default --debug -r tip
263 263 changeset: 15:627d4614809036ba22b9e7cb31638ddc06ab99ab
264 264 tag: tip
265 265 phase: draft
266 266 parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
267 267 parent: -1:0000000000000000000000000000000000000000
268 268 manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
269 269 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
270 270 date: Sat Apr 30 15:24:48 2011 +0200
271 271 files+: D
272 272 extra: branch=default
273 273 extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
274 274 extra: rebase_source=9e36056a46e37c9776168c7375734eebc70e294f
275 275 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
276 276 description:
277 277 D
278 278
279 279
280 280 Start rebase from a commit that is obsolete but not hidden only because it's
281 281 a working copy parent. We should be moved back to the starting commit as usual
282 282 even though it is hidden (until we're moved there).
283 283
284 284 $ hg --hidden up -qr 'first(hidden())'
285 285 updated to hidden changeset 42ccdea3bb16
286 286 (hidden revision '42ccdea3bb16' is pruned)
287 287 $ hg rebase --rev 13 --dest 15
288 288 rebasing 13:98f6af4ee953 "C"
289 289 $ hg log -G
290 290 o 16:294a2b93eb4d C
291 291 |
292 292 o 15:627d46148090 D
293 293 |
294 294 | o 12:462a34d07e59 B
295 295 | |
296 296 | o 11:4596109a6a43 D
297 297 | |
298 298 | o 7:02de42196ebe H
299 299 | |
300 300 +---o 6:eea13746799a G
301 301 | |/
302 302 | o 5:24b6387c8c8c F
303 303 | |
304 304 o | 4:9520eea781bc E
305 305 |/
306 306 | @ 1:42ccdea3bb16 B (pruned using rebase)
307 307 |/
308 308 o 0:cd010b8cd998 A
309 309
310 310
311 311 $ cd ..
312 312
313 313 collapse rebase
314 314 ---------------------------------
315 315
316 316 $ hg clone base collapse
317 317 updating to branch default
318 318 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
319 319 $ cd collapse
320 320 $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse
321 321 rebasing 1:42ccdea3bb16 "B"
322 322 rebasing 2:5fddd98957c8 "C"
323 323 rebasing 3:32af7686d403 "D"
324 324 $ hg log -G
325 325 o 8:4dc2197e807b Collapsed revision
326 326 |
327 327 | @ 7:02de42196ebe H
328 328 | |
329 329 o | 6:eea13746799a G
330 330 |\|
331 331 | o 5:24b6387c8c8c F
332 332 | |
333 333 o | 4:9520eea781bc E
334 334 |/
335 335 o 0:cd010b8cd998 A
336 336
337 337 $ hg log --hidden -G
338 338 o 8:4dc2197e807b Collapsed revision
339 339 |
340 340 | @ 7:02de42196ebe H
341 341 | |
342 342 o | 6:eea13746799a G
343 343 |\|
344 344 | o 5:24b6387c8c8c F
345 345 | |
346 346 o | 4:9520eea781bc E
347 347 |/
348 348 | x 3:32af7686d403 D (rewritten using rebase as 8:4dc2197e807b)
349 349 | |
350 350 | x 2:5fddd98957c8 C (rewritten using rebase as 8:4dc2197e807b)
351 351 | |
352 352 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:4dc2197e807b)
353 353 |/
354 354 o 0:cd010b8cd998 A
355 355
356 356 $ hg id --debug -r tip
357 357 4dc2197e807bae9817f09905b50ab288be2dbbcf tip
358 358 $ hg debugobsolete
359 359 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'rebase', 'user': 'test'}
360 360 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'rebase', 'user': 'test'}
361 361 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'rebase', 'user': 'test'}
362 362
363 363 $ cd ..
364 364
365 365 Rebase set has hidden descendants
366 366 ---------------------------------
367 367
368 368 We rebase a changeset which has hidden descendants. Hidden changesets must not
369 369 be rebased.
370 370
371 371 $ hg clone base hidden
372 372 updating to branch default
373 373 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
374 374 $ cd hidden
375 375 $ hg log -G
376 376 @ 7:02de42196ebe H
377 377 |
378 378 | o 6:eea13746799a G
379 379 |/|
380 380 o | 5:24b6387c8c8c F
381 381 | |
382 382 | o 4:9520eea781bc E
383 383 |/
384 384 | o 3:32af7686d403 D
385 385 | |
386 386 | o 2:5fddd98957c8 C
387 387 | |
388 388 | o 1:42ccdea3bb16 B
389 389 |/
390 390 o 0:cd010b8cd998 A
391 391
392 392 $ hg rebase -s 5fddd98957c8 -d eea13746799a
393 393 rebasing 2:5fddd98957c8 "C"
394 394 rebasing 3:32af7686d403 "D"
395 395 $ hg log -G
396 396 o 9:cf44d2f5a9f4 D
397 397 |
398 398 o 8:e273c5e7d2d2 C
399 399 |
400 400 | @ 7:02de42196ebe H
401 401 | |
402 402 o | 6:eea13746799a G
403 403 |\|
404 404 | o 5:24b6387c8c8c F
405 405 | |
406 406 o | 4:9520eea781bc E
407 407 |/
408 408 | o 1:42ccdea3bb16 B
409 409 |/
410 410 o 0:cd010b8cd998 A
411 411
412 412 $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
413 413 rebasing 1:42ccdea3bb16 "B"
414 414 $ hg log -G
415 415 o 10:7c6027df6a99 B
416 416 |
417 417 | o 9:cf44d2f5a9f4 D
418 418 | |
419 419 | o 8:e273c5e7d2d2 C
420 420 | |
421 421 @ | 7:02de42196ebe H
422 422 | |
423 423 | o 6:eea13746799a G
424 424 |/|
425 425 o | 5:24b6387c8c8c F
426 426 | |
427 427 | o 4:9520eea781bc E
428 428 |/
429 429 o 0:cd010b8cd998 A
430 430
431 431 $ hg log --hidden -G
432 432 o 10:7c6027df6a99 B
433 433 |
434 434 | o 9:cf44d2f5a9f4 D
435 435 | |
436 436 | o 8:e273c5e7d2d2 C
437 437 | |
438 438 @ | 7:02de42196ebe H
439 439 | |
440 440 | o 6:eea13746799a G
441 441 |/|
442 442 o | 5:24b6387c8c8c F
443 443 | |
444 444 | o 4:9520eea781bc E
445 445 |/
446 446 | x 3:32af7686d403 D (rewritten using rebase as 9:cf44d2f5a9f4)
447 447 | |
448 448 | x 2:5fddd98957c8 C (rewritten using rebase as 8:e273c5e7d2d2)
449 449 | |
450 450 | x 1:42ccdea3bb16 B (rewritten using rebase as 10:7c6027df6a99)
451 451 |/
452 452 o 0:cd010b8cd998 A
453 453
454 454 $ hg debugobsolete
455 455 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
456 456 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
457 457 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
458 458
459 459 Test that rewriting leaving instability behind is allowed
460 460 ---------------------------------------------------------------------
461 461
462 462 $ hg log -r 'children(8)'
463 463 9:cf44d2f5a9f4 D (no-eol)
464 464 $ hg rebase -r 8
465 465 rebasing 8:e273c5e7d2d2 "C"
466 466 1 new orphan changesets
467 467 $ hg log -G
468 468 o 11:0d8f238b634c C
469 469 |
470 470 o 10:7c6027df6a99 B
471 471 |
472 472 | * 9:cf44d2f5a9f4 D
473 473 | |
474 474 | x 8:e273c5e7d2d2 C (rewritten using rebase as 11:0d8f238b634c)
475 475 | |
476 476 @ | 7:02de42196ebe H
477 477 | |
478 478 | o 6:eea13746799a G
479 479 |/|
480 480 o | 5:24b6387c8c8c F
481 481 | |
482 482 | o 4:9520eea781bc E
483 483 |/
484 484 o 0:cd010b8cd998 A
485 485
486 486 $ cd ..
487 487 $ cp -R hidden stabilize
488 488 $ cd stabilize
489 489 $ hg rebase --auto-orphans '0::' -d 10
490 490 abort: --auto-orphans is incompatible with --dest
491 491 [255]
492 492 $ hg rebase --auto-orphans '0::'
493 493 rebasing 9:cf44d2f5a9f4 "D"
494 494 $ hg log -G
495 495 o 12:7e3935feaa68 D
496 496 |
497 497 o 11:0d8f238b634c C
498 498 |
499 499 o 10:7c6027df6a99 B
500 500 |
501 501 @ 7:02de42196ebe H
502 502 |
503 503 | o 6:eea13746799a G
504 504 |/|
505 505 o | 5:24b6387c8c8c F
506 506 | |
507 507 | o 4:9520eea781bc E
508 508 |/
509 509 o 0:cd010b8cd998 A
510 510
511 511
512 512 $ cd ../hidden
513 513 $ rm -r ../stabilize
514 514
515 515 Test multiple root handling
516 516 ------------------------------------
517 517
518 518 $ hg rebase --dest 4 --rev '7+11+9'
519 519 rebasing 9:cf44d2f5a9f4 "D"
520 520 rebasing 7:02de42196ebe "H"
521 521 rebasing 11:0d8f238b634c "C" (tip)
522 522 $ hg log -G
523 523 o 14:1e8370e38cca C
524 524 |
525 525 @ 13:bfe264faf697 H
526 526 |
527 527 | o 12:102b4c1d889b D
528 528 |/
529 529 | * 10:7c6027df6a99 B
530 530 | |
531 531 | x 7:02de42196ebe H (rewritten using rebase as 13:bfe264faf697)
532 532 | |
533 533 +---o 6:eea13746799a G
534 534 | |/
535 535 | o 5:24b6387c8c8c F
536 536 | |
537 537 o | 4:9520eea781bc E
538 538 |/
539 539 o 0:cd010b8cd998 A
540 540
541 541 $ cd ..
542 542
543 543 Detach both parents
544 544
545 545 $ hg init double-detach
546 546 $ cd double-detach
547 547
548 548 $ hg debugdrawdag <<EOF
549 549 > F
550 550 > /|
551 551 > C E
552 552 > | |
553 553 > B D G
554 554 > \|/
555 555 > A
556 556 > EOF
557 557
558 558 $ hg rebase -d G -r 'B + D + F'
559 559 rebasing 1:112478962961 "B" (B)
560 560 rebasing 2:b18e25de2cf5 "D" (D)
561 561 rebasing 6:f15c3adaf214 "F" (F tip)
562 562 abort: cannot rebase 6:f15c3adaf214 without moving at least one of its parents
563 563 [255]
564 564
565 565 $ cd ..
566 566
567 567 test on rebase dropping a merge
568 568
569 569 (setup)
570 570
571 571 $ hg init dropmerge
572 572 $ cd dropmerge
573 573 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
574 574 adding changesets
575 575 adding manifests
576 576 adding file changes
577 577 added 8 changesets with 7 changes to 7 files (+2 heads)
578 578 new changesets cd010b8cd998:02de42196ebe
579 579 (run 'hg heads' to see heads, 'hg merge' to merge)
580 580 $ hg up 3
581 581 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
582 582 $ hg merge 7
583 583 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
584 584 (branch merge, don't forget to commit)
585 585 $ hg ci -m 'M'
586 586 $ echo I > I
587 587 $ hg add I
588 588 $ hg ci -m I
589 589 $ hg log -G
590 590 @ 9:4bde274eefcf I
591 591 |
592 592 o 8:53a6a128b2b7 M
593 593 |\
594 594 | o 7:02de42196ebe H
595 595 | |
596 596 | | o 6:eea13746799a G
597 597 | |/|
598 598 | o | 5:24b6387c8c8c F
599 599 | | |
600 600 | | o 4:9520eea781bc E
601 601 | |/
602 602 o | 3:32af7686d403 D
603 603 | |
604 604 o | 2:5fddd98957c8 C
605 605 | |
606 606 o | 1:42ccdea3bb16 B
607 607 |/
608 608 o 0:cd010b8cd998 A
609 609
610 610 (actual test)
611 611
612 612 $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)'
613 613 rebasing 3:32af7686d403 "D"
614 614 rebasing 7:02de42196ebe "H"
615 615 rebasing 9:4bde274eefcf "I" (tip)
616 616 1 new orphan changesets
617 617 $ hg log -G
618 618 @ 12:acd174b7ab39 I
619 619 |
620 620 o 11:6c11a6218c97 H
621 621 |
622 622 | o 10:b5313c85b22e D
623 623 |/
624 624 | * 8:53a6a128b2b7 M
625 625 | |\
626 626 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
627 627 | | |
628 628 o---+ 6:eea13746799a G
629 629 | | |
630 630 | | o 5:24b6387c8c8c F
631 631 | | |
632 632 o---+ 4:9520eea781bc E
633 633 / /
634 634 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
635 635 | |
636 636 o | 2:5fddd98957c8 C
637 637 | |
638 638 o | 1:42ccdea3bb16 B
639 639 |/
640 640 o 0:cd010b8cd998 A
641 641
642 642
643 643 Test hidden changesets in the rebase set (issue4504)
644 644
645 645 $ hg up --hidden 9
646 646 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
647 647 updated to hidden changeset 4bde274eefcf
648 648 (hidden revision '4bde274eefcf' was rewritten as: acd174b7ab39)
649 649 $ echo J > J
650 650 $ hg add J
651 651 $ hg commit -m J
652 652 1 new orphan changesets
653 653 $ hg debugobsolete `hg log --rev . -T '{node}'`
654 654 obsoleted 1 changesets
655 655
656 656 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
657 657 rebasing 9:4bde274eefcf "I"
658 658 rebasing 13:06edfc82198f "J" (tip)
659 659 2 new content-divergent changesets
660 660 $ hg log -G
661 661 @ 15:5ae8a643467b J
662 662 |
663 663 * 14:9ad579b4a5de I
664 664 |
665 665 | * 12:acd174b7ab39 I
666 666 | |
667 667 | o 11:6c11a6218c97 H
668 668 | |
669 669 o | 10:b5313c85b22e D
670 670 |/
671 671 | * 8:53a6a128b2b7 M
672 672 | |\
673 673 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
674 674 | | |
675 675 o---+ 6:eea13746799a G
676 676 | | |
677 677 | | o 5:24b6387c8c8c F
678 678 | | |
679 679 o---+ 4:9520eea781bc E
680 680 / /
681 681 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
682 682 | |
683 683 o | 2:5fddd98957c8 C
684 684 | |
685 685 o | 1:42ccdea3bb16 B
686 686 |/
687 687 o 0:cd010b8cd998 A
688 688
689 689 $ hg up 14 -C
690 690 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
691 691 $ echo "K" > K
692 692 $ hg add K
693 693 $ hg commit --amend -m "K"
694 694 1 new orphan changesets
695 695 $ echo "L" > L
696 696 $ hg add L
697 697 $ hg commit -m "L"
698 698 $ hg up '.^'
699 699 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
700 700 $ echo "M" > M
701 701 $ hg add M
702 702 $ hg commit --amend -m "M"
703 703 1 new orphan changesets
704 704 $ hg log -G
705 705 @ 18:bfaedf8eb73b M
706 706 |
707 707 | * 17:97219452e4bd L
708 708 | |
709 709 | x 16:fc37a630c901 K (rewritten using amend as 18:bfaedf8eb73b)
710 710 |/
711 711 | * 15:5ae8a643467b J
712 712 | |
713 713 | x 14:9ad579b4a5de I (rewritten using amend as 16:fc37a630c901)
714 714 |/
715 715 | * 12:acd174b7ab39 I
716 716 | |
717 717 | o 11:6c11a6218c97 H
718 718 | |
719 719 o | 10:b5313c85b22e D
720 720 |/
721 721 | * 8:53a6a128b2b7 M
722 722 | |\
723 723 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
724 724 | | |
725 725 o---+ 6:eea13746799a G
726 726 | | |
727 727 | | o 5:24b6387c8c8c F
728 728 | | |
729 729 o---+ 4:9520eea781bc E
730 730 / /
731 731 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
732 732 | |
733 733 o | 2:5fddd98957c8 C
734 734 | |
735 735 o | 1:42ccdea3bb16 B
736 736 |/
737 737 o 0:cd010b8cd998 A
738 738
739 739 $ hg rebase -s 14 -d 17 --config experimental.rebaseskipobsolete=True
740 740 note: not rebasing 14:9ad579b4a5de "I", already in destination as 16:fc37a630c901 "K"
741 741 rebasing 15:5ae8a643467b "J"
742 742 1 new orphan changesets
743 743
744 744 $ cd ..
745 745
746 746 Skip obsolete changeset even with multiple hops
747 747 -----------------------------------------------
748 748
749 749 setup
750 750
751 751 $ hg init obsskip
752 752 $ cd obsskip
753 753 $ cat << EOF >> .hg/hgrc
754 754 > [experimental]
755 755 > rebaseskipobsolete = True
756 756 > [extensions]
757 757 > strip =
758 758 > EOF
759 759 $ echo A > A
760 760 $ hg add A
761 761 $ hg commit -m A
762 762 $ echo B > B
763 763 $ hg add B
764 764 $ hg commit -m B0
765 765 $ hg commit --amend -m B1
766 766 $ hg commit --amend -m B2
767 767 $ hg up --hidden 'desc(B0)'
768 768 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
769 769 updated to hidden changeset a8b11f55fb19
770 770 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
771 771 $ echo C > C
772 772 $ hg add C
773 773 $ hg commit -m C
774 774 1 new orphan changesets
775 775 $ hg log -G
776 776 @ 4:212cb178bcbb C
777 777 |
778 778 | o 3:261e70097290 B2
779 779 | |
780 780 x | 1:a8b11f55fb19 B0 (rewritten using amend as 3:261e70097290)
781 781 |/
782 782 o 0:4a2df7238c3b A
783 783
784 784
785 785 Rebase finds its way in a chain of marker
786 786
787 787 $ hg rebase -d 'desc(B2)'
788 788 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
789 789 rebasing 4:212cb178bcbb "C" (tip)
790 790
791 791 Even when the chain include missing node
792 792
793 793 $ hg up --hidden 'desc(B0)'
794 794 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
795 795 updated to hidden changeset a8b11f55fb19
796 796 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
797 797 $ echo D > D
798 798 $ hg add D
799 799 $ hg commit -m D
800 800 1 new orphan changesets
801 801 $ hg --hidden strip -r 'desc(B1)'
802 802 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg
803 803 1 new orphan changesets
804 804 $ hg log -G
805 805 @ 5:1a79b7535141 D
806 806 |
807 807 | o 4:ff2c4d47b71d C
808 808 | |
809 809 | o 2:261e70097290 B2
810 810 | |
811 811 x | 1:a8b11f55fb19 B0 (rewritten using amend as 2:261e70097290)
812 812 |/
813 813 o 0:4a2df7238c3b A
814 814
815 815
816 816 $ hg rebase -d 'desc(B2)'
817 817 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
818 818 rebasing 5:1a79b7535141 "D" (tip)
819 819 $ hg up 4
820 820 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
821 821 $ echo "O" > O
822 822 $ hg add O
823 823 $ hg commit -m O
824 824 $ echo "P" > P
825 825 $ hg add P
826 826 $ hg commit -m P
827 827 $ hg log -G
828 828 @ 8:8d47583e023f P
829 829 |
830 830 o 7:360bbaa7d3ce O
831 831 |
832 832 | o 6:9c48361117de D
833 833 | |
834 834 o | 4:ff2c4d47b71d C
835 835 |/
836 836 o 2:261e70097290 B2
837 837 |
838 838 o 0:4a2df7238c3b A
839 839
840 840 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=true
841 841 obsoleted 1 changesets
842 842 1 new orphan changesets
843 843 $ hg rebase -d 6 -r "4::"
844 844 rebasing 4:ff2c4d47b71d "C"
845 845 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
846 846 rebasing 8:8d47583e023f "P" (tip)
847 847
848 848 If all the changeset to be rebased are obsolete and present in the destination, we
849 849 should display a friendly error message
850 850
851 851 $ hg log -G
852 852 @ 10:121d9e3bc4c6 P
853 853 |
854 854 o 9:4be60e099a77 C
855 855 |
856 856 o 6:9c48361117de D
857 857 |
858 858 o 2:261e70097290 B2
859 859 |
860 860 o 0:4a2df7238c3b A
861 861
862 862
863 863 $ hg up 9
864 864 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
865 865 $ echo "non-relevant change" > nonrelevant
866 866 $ hg add nonrelevant
867 867 $ hg commit -m nonrelevant
868 868 created new head
869 869 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=true
870 870 obsoleted 1 changesets
871 871 $ hg log -G
872 872 @ 11:f44da1f4954c nonrelevant (pruned)
873 873 |
874 874 | o 10:121d9e3bc4c6 P
875 875 |/
876 876 o 9:4be60e099a77 C
877 877 |
878 878 o 6:9c48361117de D
879 879 |
880 880 o 2:261e70097290 B2
881 881 |
882 882 o 0:4a2df7238c3b A
883 883
884 884 $ hg rebase -r . -d 10
885 885 note: not rebasing 11:f44da1f4954c "nonrelevant" (tip), it has no successor
886 886
887 887 If a rebase is going to create divergence, it should abort
888 888
889 889 $ hg log -G
890 890 @ 10:121d9e3bc4c6 P
891 891 |
892 892 o 9:4be60e099a77 C
893 893 |
894 894 o 6:9c48361117de D
895 895 |
896 896 o 2:261e70097290 B2
897 897 |
898 898 o 0:4a2df7238c3b A
899 899
900 900
901 901 $ hg up 9
902 902 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
903 903 $ echo "john" > doe
904 904 $ hg add doe
905 905 $ hg commit -m "john doe"
906 906 created new head
907 907 $ hg up 10
908 908 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
909 909 $ echo "foo" > bar
910 910 $ hg add bar
911 911 $ hg commit --amend -m "10'"
912 912 $ hg up 10 --hidden
913 913 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
914 914 updated to hidden changeset 121d9e3bc4c6
915 915 (hidden revision '121d9e3bc4c6' was rewritten as: 77d874d096a2)
916 916 $ echo "bar" > foo
917 917 $ hg add foo
918 918 $ hg commit -m "bar foo"
919 919 1 new orphan changesets
920 920 $ hg log -G
921 921 @ 14:73568ab6879d bar foo
922 922 |
923 923 | o 13:77d874d096a2 10'
924 924 | |
925 925 | | o 12:3eb461388009 john doe
926 926 | |/
927 927 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
928 928 |/
929 929 o 9:4be60e099a77 C
930 930 |
931 931 o 6:9c48361117de D
932 932 |
933 933 o 2:261e70097290 B2
934 934 |
935 935 o 0:4a2df7238c3b A
936 936
937 937 $ hg summary
938 938 parent: 14:73568ab6879d tip (orphan)
939 939 bar foo
940 940 branch: default
941 941 commit: (clean)
942 942 update: 2 new changesets, 3 branch heads (merge)
943 943 phases: 8 draft
944 944 orphan: 1 changesets
945 945 $ hg rebase -s 10 -d 12
946 946 abort: this rebase will cause divergences from: 121d9e3bc4c6
947 947 (to force the rebase please set experimental.evolution.allowdivergence=True)
948 948 [255]
949 949 $ hg log -G
950 950 @ 14:73568ab6879d bar foo
951 951 |
952 952 | o 13:77d874d096a2 10'
953 953 | |
954 954 | | o 12:3eb461388009 john doe
955 955 | |/
956 956 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
957 957 |/
958 958 o 9:4be60e099a77 C
959 959 |
960 960 o 6:9c48361117de D
961 961 |
962 962 o 2:261e70097290 B2
963 963 |
964 964 o 0:4a2df7238c3b A
965 965
966 966 With experimental.evolution.allowdivergence=True, rebase can create divergence
967 967
968 968 $ hg rebase -s 10 -d 12 --config experimental.evolution.allowdivergence=True
969 969 rebasing 10:121d9e3bc4c6 "P"
970 970 rebasing 14:73568ab6879d "bar foo" (tip)
971 971 2 new content-divergent changesets
972 972 $ hg summary
973 973 parent: 16:61bd55f69bc4 tip
974 974 bar foo
975 975 branch: default
976 976 commit: (clean)
977 977 update: 1 new changesets, 2 branch heads (merge)
978 978 phases: 8 draft
979 979 content-divergent: 2 changesets
980 980
981 981 rebase --continue + skipped rev because their successors are in destination
982 982 we make a change in trunk and work on conflicting changes to make rebase abort.
983 983
984 984 $ hg log -G -r 16::
985 985 @ 16:61bd55f69bc4 bar foo
986 986 |
987 987 ~
988 988
989 989 Create the two changes in trunk
990 990 $ printf "a" > willconflict
991 991 $ hg add willconflict
992 992 $ hg commit -m "willconflict first version"
993 993
994 994 $ printf "dummy" > C
995 995 $ hg commit -m "dummy change successor"
996 996
997 997 Create the changes that we will rebase
998 998 $ hg update -C 16 -q
999 999 $ printf "b" > willconflict
1000 1000 $ hg add willconflict
1001 1001 $ hg commit -m "willconflict second version"
1002 1002 created new head
1003 1003 $ printf "dummy" > K
1004 1004 $ hg add K
1005 1005 $ hg commit -m "dummy change"
1006 1006 $ printf "dummy" > L
1007 1007 $ hg add L
1008 1008 $ hg commit -m "dummy change"
1009 1009 $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.evolution=true
1010 1010 obsoleted 1 changesets
1011 1011 1 new orphan changesets
1012 1012
1013 1013 $ hg log -G -r 16::
1014 1014 @ 21:7bdc8a87673d dummy change
1015 1015 |
1016 1016 x 20:8b31da3c4919 dummy change (rewritten as 18:601db7a18f51)
1017 1017 |
1018 1018 o 19:b82fb57ea638 willconflict second version
1019 1019 |
1020 1020 | o 18:601db7a18f51 dummy change successor
1021 1021 | |
1022 1022 | o 17:357ddf1602d5 willconflict first version
1023 1023 |/
1024 1024 o 16:61bd55f69bc4 bar foo
1025 1025 |
1026 1026 ~
1027 1027 $ hg rebase -r ".^^ + .^ + ." -d 18
1028 1028 rebasing 19:b82fb57ea638 "willconflict second version"
1029 1029 merging willconflict
1030 1030 warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
1031 1031 unresolved conflicts (see hg resolve, then hg rebase --continue)
1032 1032 [1]
1033 1033
1034 1034 $ hg resolve --mark willconflict
1035 1035 (no more unresolved files)
1036 1036 continue: hg rebase --continue
1037 1037 $ hg rebase --continue
1038 1038 rebasing 19:b82fb57ea638 "willconflict second version"
1039 1039 note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
1040 1040 rebasing 21:7bdc8a87673d "dummy change" (tip)
1041 1041 $ cd ..
1042 1042
1043 1043 Divergence cases due to obsolete changesets
1044 1044 -------------------------------------------
1045 1045
1046 1046 We should ignore branches with unstable changesets when they are based on an
1047 1047 obsolete changeset which successor is in rebase set.
1048 1048
1049 1049 $ hg init divergence
1050 1050 $ cd divergence
1051 1051 $ cat >> .hg/hgrc << EOF
1052 1052 > [extensions]
1053 1053 > strip =
1054 1054 > [alias]
1055 1055 > strip = strip --no-backup --quiet
1056 1056 > [templates]
1057 1057 > instabilities = '{rev}:{node|short} {desc|firstline}{if(instabilities," ({instabilities})")}\n'
1058 1058 > EOF
1059 1059
1060 1060 $ hg debugdrawdag <<EOF
1061 1061 > e f
1062 1062 > | |
1063 1063 > d' d # replace: d -> d'
1064 1064 > \ /
1065 1065 > c
1066 1066 > |
1067 1067 > x b
1068 1068 > \|
1069 1069 > a
1070 1070 > EOF
1071 1071 1 new orphan changesets
1072 1072 $ hg log -G -r 'a'::
1073 1073 * 7:1143e9adc121 f
1074 1074 |
1075 1075 | o 6:d60ebfa0f1cb e
1076 1076 | |
1077 1077 | o 5:027ad6c5830d d'
1078 1078 | |
1079 1079 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1080 1080 |/
1081 1081 o 3:a82ac2b38757 c
1082 1082 |
1083 1083 | o 2:630d7c95eff7 x
1084 1084 | |
1085 1085 o | 1:488e1b7e7341 b
1086 1086 |/
1087 1087 o 0:b173517d0057 a
1088 1088
1089 1089
1090 1090 Changeset d and its descendants are excluded to avoid divergence of d, which
1091 1091 would occur because the successor of d (d') is also in rebaseset. As a
1092 1092 consequence f (descendant of d) is left behind.
1093 1093
1094 1094 $ hg rebase -b 'e' -d 'x'
1095 1095 rebasing 1:488e1b7e7341 "b" (b)
1096 1096 rebasing 3:a82ac2b38757 "c" (c)
1097 1097 rebasing 5:027ad6c5830d "d'" (d')
1098 1098 rebasing 6:d60ebfa0f1cb "e" (e)
1099 1099 note: not rebasing 4:76be324c128b "d" (d) and its descendants as this would cause divergence
1100 1100 $ hg log -G -r 'a'::
1101 1101 o 11:eb6d63fc4ed5 e
1102 1102 |
1103 1103 o 10:44d8c724a70c d'
1104 1104 |
1105 1105 o 9:d008e6b4d3fd c
1106 1106 |
1107 1107 o 8:67e8f4a16c49 b
1108 1108 |
1109 1109 | * 7:1143e9adc121 f
1110 1110 | |
1111 1111 | | x 6:d60ebfa0f1cb e (rewritten using rebase as 11:eb6d63fc4ed5)
1112 1112 | | |
1113 1113 | | x 5:027ad6c5830d d' (rewritten using rebase as 10:44d8c724a70c)
1114 1114 | | |
1115 1115 | x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1116 1116 | |/
1117 1117 | x 3:a82ac2b38757 c (rewritten using rebase as 9:d008e6b4d3fd)
1118 1118 | |
1119 1119 o | 2:630d7c95eff7 x
1120 1120 | |
1121 1121 | x 1:488e1b7e7341 b (rewritten using rebase as 8:67e8f4a16c49)
1122 1122 |/
1123 1123 o 0:b173517d0057 a
1124 1124
1125 1125 $ hg strip -r 8:
1126 1126 $ hg log -G -r 'a'::
1127 1127 * 7:1143e9adc121 f
1128 1128 |
1129 1129 | o 6:d60ebfa0f1cb e
1130 1130 | |
1131 1131 | o 5:027ad6c5830d d'
1132 1132 | |
1133 1133 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1134 1134 |/
1135 1135 o 3:a82ac2b38757 c
1136 1136 |
1137 1137 | o 2:630d7c95eff7 x
1138 1138 | |
1139 1139 o | 1:488e1b7e7341 b
1140 1140 |/
1141 1141 o 0:b173517d0057 a
1142 1142
1143 1143
1144 1144 If the rebase set has an obsolete (d) with a successor (d') outside the rebase
1145 1145 set and none in destination, we still get the divergence warning.
1146 1146 By allowing divergence, we can perform the rebase.
1147 1147
1148 1148 $ hg rebase -r 'c'::'f' -d 'x'
1149 1149 abort: this rebase will cause divergences from: 76be324c128b
1150 1150 (to force the rebase please set experimental.evolution.allowdivergence=True)
1151 1151 [255]
1152 1152 $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x'
1153 1153 rebasing 3:a82ac2b38757 "c" (c)
1154 1154 rebasing 4:76be324c128b "d" (d)
1155 1155 rebasing 7:1143e9adc121 "f" (f tip)
1156 1156 1 new orphan changesets
1157 1157 2 new content-divergent changesets
1158 1158 $ hg log -G -r 'a':: -T instabilities
1159 1159 o 10:e1744ea07510 f
1160 1160 |
1161 1161 * 9:e2b36ea9a0a0 d (content-divergent)
1162 1162 |
1163 1163 o 8:6a0376de376e c
1164 1164 |
1165 1165 | x 7:1143e9adc121 f
1166 1166 | |
1167 1167 | | * 6:d60ebfa0f1cb e (orphan)
1168 1168 | | |
1169 1169 | | * 5:027ad6c5830d d' (orphan content-divergent)
1170 1170 | | |
1171 1171 | x | 4:76be324c128b d
1172 1172 | |/
1173 1173 | x 3:a82ac2b38757 c
1174 1174 | |
1175 1175 o | 2:630d7c95eff7 x
1176 1176 | |
1177 1177 | o 1:488e1b7e7341 b
1178 1178 |/
1179 1179 o 0:b173517d0057 a
1180 1180
1181 1181 $ hg strip -r 8:
1182 1182
1183 1183 (Not skipping obsoletes means that divergence is allowed.)
1184 1184
1185 1185 $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x'
1186 1186 rebasing 3:a82ac2b38757 "c" (c)
1187 1187 rebasing 4:76be324c128b "d" (d)
1188 1188 rebasing 7:1143e9adc121 "f" (f tip)
1189 1189 1 new orphan changesets
1190 1190 2 new content-divergent changesets
1191 1191
1192 1192 $ hg strip -r 0:
1193 1193
1194 1194 Similar test on a more complex graph
1195 1195
1196 1196 $ hg debugdrawdag <<EOF
1197 1197 > g
1198 1198 > |
1199 1199 > f e
1200 1200 > | |
1201 1201 > e' d # replace: e -> e'
1202 1202 > \ /
1203 1203 > c
1204 1204 > |
1205 1205 > x b
1206 1206 > \|
1207 1207 > a
1208 1208 > EOF
1209 1209 1 new orphan changesets
1210 1210 $ hg log -G -r 'a':
1211 1211 * 8:2876ce66c6eb g
1212 1212 |
1213 1213 | o 7:3ffec603ab53 f
1214 1214 | |
1215 1215 x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1216 1216 | |
1217 1217 | o 5:63324dc512ea e'
1218 1218 | |
1219 1219 o | 4:76be324c128b d
1220 1220 |/
1221 1221 o 3:a82ac2b38757 c
1222 1222 |
1223 1223 | o 2:630d7c95eff7 x
1224 1224 | |
1225 1225 o | 1:488e1b7e7341 b
1226 1226 |/
1227 1227 o 0:b173517d0057 a
1228 1228
1229 1229 $ hg rebase -b 'f' -d 'x'
1230 1230 rebasing 1:488e1b7e7341 "b" (b)
1231 1231 rebasing 3:a82ac2b38757 "c" (c)
1232 1232 rebasing 5:63324dc512ea "e'" (e')
1233 1233 rebasing 7:3ffec603ab53 "f" (f)
1234 1234 rebasing 4:76be324c128b "d" (d)
1235 1235 note: not rebasing 6:e36fae928aec "e" (e) and its descendants as this would cause divergence
1236 1236 $ hg log -G -r 'a':
1237 1237 o 13:a1707a5b7c2c d
1238 1238 |
1239 1239 | o 12:ef6251596616 f
1240 1240 | |
1241 1241 | o 11:b6f172e64af9 e'
1242 1242 |/
1243 1243 o 10:d008e6b4d3fd c
1244 1244 |
1245 1245 o 9:67e8f4a16c49 b
1246 1246 |
1247 1247 | * 8:2876ce66c6eb g
1248 1248 | |
1249 1249 | | x 7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
1250 1250 | | |
1251 1251 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1252 1252 | | |
1253 1253 | | x 5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
1254 1254 | | |
1255 1255 | x | 4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
1256 1256 | |/
1257 1257 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
1258 1258 | |
1259 1259 o | 2:630d7c95eff7 x
1260 1260 | |
1261 1261 | x 1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49)
1262 1262 |/
1263 1263 o 0:b173517d0057 a
1264 1264
1265 1265
1266 1266 issue5782
1267 1267 $ hg strip -r 0:
1268 1268 $ hg debugdrawdag <<EOF
1269 1269 > d
1270 1270 > |
1271 1271 > c1 c # replace: c -> c1
1272 1272 > \ /
1273 1273 > b
1274 1274 > |
1275 1275 > a
1276 1276 > EOF
1277 1277 1 new orphan changesets
1278 1278 $ hg debugobsolete `hg log -T "{node}" --hidden -r 'desc("c1")'`
1279 1279 obsoleted 1 changesets
1280 1280 $ hg log -G -r 'a': --hidden
1281 1281 * 4:76be324c128b d
1282 1282 |
1283 1283 | x 3:ef8a456de8fa c1 (pruned)
1284 1284 | |
1285 1285 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1286 1286 |/
1287 1287 o 1:488e1b7e7341 b
1288 1288 |
1289 1289 o 0:b173517d0057 a
1290 1290
1291 1291 $ hg rebase -d 0 -r 2
1292 1292 rebasing 2:a82ac2b38757 "c" (c)
1293 1293 $ hg log -G -r 'a': --hidden
1294 1294 o 5:69ad416a4a26 c
1295 1295 |
1296 1296 | * 4:76be324c128b d
1297 1297 | |
1298 1298 | | x 3:ef8a456de8fa c1 (pruned)
1299 1299 | | |
1300 1300 | x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa rewritten using rebase as 5:69ad416a4a26)
1301 1301 | |/
1302 1302 | o 1:488e1b7e7341 b
1303 1303 |/
1304 1304 o 0:b173517d0057 a
1305 1305
1306 1306 $ cd ..
1307 1307
1308 1308 Rebase merge where successor of one parent is equal to destination (issue5198)
1309 1309
1310 1310 $ hg init p1-succ-is-dest
1311 1311 $ cd p1-succ-is-dest
1312 1312
1313 1313 $ hg debugdrawdag <<EOF
1314 1314 > F
1315 1315 > /|
1316 1316 > E D B # replace: D -> B
1317 1317 > \|/
1318 1318 > A
1319 1319 > EOF
1320 1320 1 new orphan changesets
1321 1321
1322 1322 $ hg rebase -d B -s D
1323 1323 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1324 1324 rebasing 4:66f1a38021c9 "F" (F tip)
1325 1325 $ hg log -G
1326 1326 o 5:50e9d60b99c6 F
1327 1327 |\
1328 1328 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:50e9d60b99c6)
1329 1329 | |/|
1330 1330 | o | 3:7fb047a69f22 E
1331 1331 | | |
1332 1332 | | x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1333 1333 | |/
1334 1334 o | 1:112478962961 B
1335 1335 |/
1336 1336 o 0:426bada5c675 A
1337 1337
1338 1338 $ cd ..
1339 1339
1340 1340 Rebase merge where successor of other parent is equal to destination
1341 1341
1342 1342 $ hg init p2-succ-is-dest
1343 1343 $ cd p2-succ-is-dest
1344 1344
1345 1345 $ hg debugdrawdag <<EOF
1346 1346 > F
1347 1347 > /|
1348 1348 > E D B # replace: E -> B
1349 1349 > \|/
1350 1350 > A
1351 1351 > EOF
1352 1352 1 new orphan changesets
1353 1353
1354 1354 $ hg rebase -d B -s E
1355 1355 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1356 1356 rebasing 4:66f1a38021c9 "F" (F tip)
1357 1357 $ hg log -G
1358 1358 o 5:aae1787dacee F
1359 1359 |\
1360 1360 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:aae1787dacee)
1361 1361 | |/|
1362 1362 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1363 1363 | | |
1364 1364 | o | 2:b18e25de2cf5 D
1365 1365 | |/
1366 1366 o / 1:112478962961 B
1367 1367 |/
1368 1368 o 0:426bada5c675 A
1369 1369
1370 1370 $ cd ..
1371 1371
1372 1372 Rebase merge where successor of one parent is ancestor of destination
1373 1373
1374 1374 $ hg init p1-succ-in-dest
1375 1375 $ cd p1-succ-in-dest
1376 1376
1377 1377 $ hg debugdrawdag <<EOF
1378 1378 > F C
1379 1379 > /| |
1380 1380 > E D B # replace: D -> B
1381 1381 > \|/
1382 1382 > A
1383 1383 > EOF
1384 1384 1 new orphan changesets
1385 1385
1386 1386 $ hg rebase -d C -s D
1387 1387 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1388 1388 rebasing 5:66f1a38021c9 "F" (F tip)
1389 1389
1390 1390 $ hg log -G
1391 1391 o 6:0913febf6439 F
1392 1392 |\
1393 1393 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:0913febf6439)
1394 1394 | | |
1395 1395 | o | 4:26805aba1e60 C
1396 1396 | | |
1397 1397 o | | 3:7fb047a69f22 E
1398 1398 | | |
1399 1399 +---x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1400 1400 | |
1401 1401 | o 1:112478962961 B
1402 1402 |/
1403 1403 o 0:426bada5c675 A
1404 1404
1405 1405 $ cd ..
1406 1406
1407 1407 Rebase merge where successor of other parent is ancestor of destination
1408 1408
1409 1409 $ hg init p2-succ-in-dest
1410 1410 $ cd p2-succ-in-dest
1411 1411
1412 1412 $ hg debugdrawdag <<EOF
1413 1413 > F C
1414 1414 > /| |
1415 1415 > E D B # replace: E -> B
1416 1416 > \|/
1417 1417 > A
1418 1418 > EOF
1419 1419 1 new orphan changesets
1420 1420
1421 1421 $ hg rebase -d C -s E
1422 1422 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1423 1423 rebasing 5:66f1a38021c9 "F" (F tip)
1424 1424 $ hg log -G
1425 1425 o 6:c6ab0cc6d220 F
1426 1426 |\
1427 1427 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:c6ab0cc6d220)
1428 1428 | | |
1429 1429 | o | 4:26805aba1e60 C
1430 1430 | | |
1431 1431 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1432 1432 | | |
1433 1433 o---+ 2:b18e25de2cf5 D
1434 1434 / /
1435 1435 o / 1:112478962961 B
1436 1436 |/
1437 1437 o 0:426bada5c675 A
1438 1438
1439 1439 $ cd ..
1440 1440
1441 1441 Rebase merge where successor of one parent is ancestor of destination
1442 1442
1443 1443 $ hg init p1-succ-in-dest-b
1444 1444 $ cd p1-succ-in-dest-b
1445 1445
1446 1446 $ hg debugdrawdag <<EOF
1447 1447 > F C
1448 1448 > /| |
1449 1449 > E D B # replace: E -> B
1450 1450 > \|/
1451 1451 > A
1452 1452 > EOF
1453 1453 1 new orphan changesets
1454 1454
1455 1455 $ hg rebase -d C -b F
1456 1456 rebasing 2:b18e25de2cf5 "D" (D)
1457 1457 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1458 1458 rebasing 5:66f1a38021c9 "F" (F tip)
1459 1459 note: rebase of 5:66f1a38021c9 created no changes to commit
1460 1460 $ hg log -G
1461 1461 o 6:8f47515dda15 D
1462 1462 |
1463 1463 | x 5:66f1a38021c9 F (pruned using rebase)
1464 1464 | |\
1465 1465 o | | 4:26805aba1e60 C
1466 1466 | | |
1467 1467 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1468 1468 | | |
1469 1469 | x | 2:b18e25de2cf5 D (rewritten using rebase as 6:8f47515dda15)
1470 1470 | |/
1471 1471 o / 1:112478962961 B
1472 1472 |/
1473 1473 o 0:426bada5c675 A
1474 1474
1475 1475 $ cd ..
1476 1476
1477 1477 Rebase merge where successor of other parent is ancestor of destination
1478 1478
1479 1479 $ hg init p2-succ-in-dest-b
1480 1480 $ cd p2-succ-in-dest-b
1481 1481
1482 1482 $ hg debugdrawdag <<EOF
1483 1483 > F C
1484 1484 > /| |
1485 1485 > E D B # replace: D -> B
1486 1486 > \|/
1487 1487 > A
1488 1488 > EOF
1489 1489 1 new orphan changesets
1490 1490
1491 1491 $ hg rebase -d C -b F
1492 1492 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1493 1493 rebasing 3:7fb047a69f22 "E" (E)
1494 1494 rebasing 5:66f1a38021c9 "F" (F tip)
1495 1495 note: rebase of 5:66f1a38021c9 created no changes to commit
1496 1496
1497 1497 $ hg log -G
1498 1498 o 6:533690786a86 E
1499 1499 |
1500 1500 | x 5:66f1a38021c9 F (pruned using rebase)
1501 1501 | |\
1502 1502 o | | 4:26805aba1e60 C
1503 1503 | | |
1504 1504 | | x 3:7fb047a69f22 E (rewritten using rebase as 6:533690786a86)
1505 1505 | | |
1506 1506 | x | 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1507 1507 | |/
1508 1508 o / 1:112478962961 B
1509 1509 |/
1510 1510 o 0:426bada5c675 A
1511 1511
1512 1512 $ cd ..
1513 1513
1514 Rebase merge where extinct node has successor that is not an ancestor of
1515 destination
1516
1517 $ hg init extinct-with-succ-not-in-dest
1518 $ cd extinct-with-succ-not-in-dest
1519
1520 $ hg debugdrawdag <<EOF
1521 > E C # replace: C -> E
1522 > | |
1523 > D B
1524 > |/
1525 > A
1526 > EOF
1527
1528 TODO: There doesn't seem to be much reason to fail this rebase. Make it pass?
1529 $ hg rebase -d D -s B
1530 abort: this rebase will cause divergences from: 26805aba1e60
1531 (to force the rebase please set experimental.evolution.allowdivergence=True)
1532 [255]
1533
1534 $ cd ..
1535
1514 1536 $ hg init p2-succ-in-dest-c
1515 1537 $ cd p2-succ-in-dest-c
1516 1538
1517 1539 The scenario here was that B::D were developed on default. B was queued on
1518 1540 stable, but amended before being push to hg-committed. C was queued on default,
1519 1541 along with unrelated J.
1520 1542
1521 1543 $ hg debugdrawdag <<EOF
1522 1544 > J
1523 1545 > |
1524 1546 > F
1525 1547 > |
1526 1548 > E
1527 1549 > | D
1528 1550 > | |
1529 1551 > | C # replace: C -> F
1530 1552 > | | H I # replace: B -> H -> I
1531 1553 > | B |/
1532 1554 > |/ G
1533 1555 > A
1534 1556 > EOF
1535 1557 1 new orphan changesets
1536 1558
1537 1559 This strip seems to be the key to avoid an early divergence warning.
1538 1560 $ hg --config extensions.strip= --hidden strip -qr H
1539 1561 1 new orphan changesets
1540 1562
1541 1563 $ hg rebase -b 'desc("D")' -d 'desc("J")'
1542 1564 abort: this rebase will cause divergences from: 112478962961
1543 1565 (to force the rebase please set experimental.evolution.allowdivergence=True)
1544 1566 [255]
1545 1567
1546 1568 Rebase merge where both parents have successors in destination
1547 1569
1548 1570 $ hg init p12-succ-in-dest
1549 1571 $ cd p12-succ-in-dest
1550 1572 $ hg debugdrawdag <<'EOS'
1551 1573 > E F
1552 1574 > /| /| # replace: A -> C
1553 1575 > A B C D # replace: B -> D
1554 1576 > | |
1555 1577 > X Y
1556 1578 > EOS
1557 1579 1 new orphan changesets
1558 1580 $ hg rebase -r A+B+E -d F
1559 1581 note: not rebasing 4:a3d17304151f "A" (A), already in destination as 0:96cc3511f894 "C" (C)
1560 1582 note: not rebasing 5:b23a2cc00842 "B" (B), already in destination as 1:058c1e1fb10a "D" (D)
1561 1583 rebasing 7:dac5d11c5a7d "E" (E tip)
1562 1584 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
1563 1585 [255]
1564 1586 $ cd ..
1565 1587
1566 1588 Rebase a non-clean merge. One parent has successor in destination, the other
1567 1589 parent moves as requested.
1568 1590
1569 1591 $ hg init p1-succ-p2-move
1570 1592 $ cd p1-succ-p2-move
1571 1593 $ hg debugdrawdag <<'EOS'
1572 1594 > D Z
1573 1595 > /| | # replace: A -> C
1574 1596 > A B C # D/D = D
1575 1597 > EOS
1576 1598 1 new orphan changesets
1577 1599 $ hg rebase -r A+B+D -d Z
1578 1600 note: not rebasing 0:426bada5c675 "A" (A), already in destination as 2:96cc3511f894 "C" (C)
1579 1601 rebasing 1:fc2b737bb2e5 "B" (B)
1580 1602 rebasing 3:b8ed089c80ad "D" (D)
1581 1603
1582 1604 $ rm .hg/localtags
1583 1605 $ hg log -G
1584 1606 o 6:e4f78693cc88 D
1585 1607 |
1586 1608 o 5:76840d832e98 B
1587 1609 |
1588 1610 o 4:50e41c1f3950 Z
1589 1611 |
1590 1612 o 2:96cc3511f894 C
1591 1613
1592 1614 $ hg files -r tip
1593 1615 B
1594 1616 C
1595 1617 D
1596 1618 Z
1597 1619
1598 1620 $ cd ..
1599 1621
1600 1622 $ hg init p1-move-p2-succ
1601 1623 $ cd p1-move-p2-succ
1602 1624 $ hg debugdrawdag <<'EOS'
1603 1625 > D Z
1604 1626 > /| | # replace: B -> C
1605 1627 > A B C # D/D = D
1606 1628 > EOS
1607 1629 1 new orphan changesets
1608 1630 $ hg rebase -r B+A+D -d Z
1609 1631 rebasing 0:426bada5c675 "A" (A)
1610 1632 note: not rebasing 1:fc2b737bb2e5 "B" (B), already in destination as 2:96cc3511f894 "C" (C)
1611 1633 rebasing 3:b8ed089c80ad "D" (D)
1612 1634
1613 1635 $ rm .hg/localtags
1614 1636 $ hg log -G
1615 1637 o 6:1b355ed94d82 D
1616 1638 |
1617 1639 o 5:a81a74d764a6 A
1618 1640 |
1619 1641 o 4:50e41c1f3950 Z
1620 1642 |
1621 1643 o 2:96cc3511f894 C
1622 1644
1623 1645 $ hg files -r tip
1624 1646 A
1625 1647 C
1626 1648 D
1627 1649 Z
1628 1650
1629 1651 $ cd ..
1630 1652
1631 1653 Test that bookmark is moved and working dir is updated when all changesets have
1632 1654 equivalents in destination
1633 1655 $ hg init rbsrepo && cd rbsrepo
1634 1656 $ echo "[experimental]" > .hg/hgrc
1635 1657 $ echo "evolution=true" >> .hg/hgrc
1636 1658 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
1637 1659 $ echo root > root && hg ci -Am root
1638 1660 adding root
1639 1661 $ echo a > a && hg ci -Am a
1640 1662 adding a
1641 1663 $ hg up 0
1642 1664 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1643 1665 $ echo b > b && hg ci -Am b
1644 1666 adding b
1645 1667 created new head
1646 1668 $ hg rebase -r 2 -d 1
1647 1669 rebasing 2:1e9a3c00cbe9 "b" (tip)
1648 1670 $ hg log -r . # working dir is at rev 3 (successor of 2)
1649 1671 3:be1832deae9a b (no-eol)
1650 1672 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
1651 1673 bookmarking hidden changeset 1e9a3c00cbe9
1652 1674 (hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a)
1653 1675 $ hg up 2 && hg log -r . # working dir is at rev 2 again
1654 1676 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1655 1677 2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)
1656 1678 $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
1657 1679 note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" (tip)
1658 1680 Check that working directory and bookmark was updated to rev 3 although rev 2
1659 1681 was skipped
1660 1682 $ hg log -r .
1661 1683 3:be1832deae9a b (no-eol)
1662 1684 $ hg bookmarks
1663 1685 mybook 3:be1832deae9a
1664 1686 $ hg debugobsolete --rev tip
1665 1687 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
1666 1688
1667 1689 Obsoleted working parent and bookmark could be moved if an ancestor of working
1668 1690 parent gets moved:
1669 1691
1670 1692 $ hg init $TESTTMP/ancestor-wd-move
1671 1693 $ cd $TESTTMP/ancestor-wd-move
1672 1694 $ hg debugdrawdag <<'EOS'
1673 1695 > E D1 # rebase: D1 -> D2
1674 1696 > | |
1675 1697 > | C
1676 1698 > D2 |
1677 1699 > | B
1678 1700 > |/
1679 1701 > A
1680 1702 > EOS
1681 1703 $ hg update D1 -q
1682 1704 $ hg bookmark book -i
1683 1705 $ hg rebase -r B+D1 -d E
1684 1706 rebasing 1:112478962961 "B" (B)
1685 1707 note: not rebasing 5:15ecf15e0114 "D1" (book D1 tip), already in destination as 2:0807738e0be9 "D2" (D2)
1686 1708 1 new orphan changesets
1687 1709 $ hg log -G -T '{desc} {bookmarks}'
1688 1710 @ B book
1689 1711 |
1690 1712 | x D1
1691 1713 | |
1692 1714 o | E
1693 1715 | |
1694 1716 | * C
1695 1717 | |
1696 1718 o | D2
1697 1719 | |
1698 1720 | x B
1699 1721 |/
1700 1722 o A
1701 1723
1702 1724 Rebasing a merge with one of its parent having a hidden successor
1703 1725
1704 1726 $ hg init $TESTTMP/merge-p1-hidden-successor
1705 1727 $ cd $TESTTMP/merge-p1-hidden-successor
1706 1728
1707 1729 $ hg debugdrawdag <<'EOS'
1708 1730 > E
1709 1731 > |
1710 1732 > B3 B2 # amend: B1 -> B2 -> B3
1711 1733 > |/ # B2 is hidden
1712 1734 > | D
1713 1735 > | |\
1714 1736 > | B1 C
1715 1737 > |/
1716 1738 > A
1717 1739 > EOS
1718 1740 1 new orphan changesets
1719 1741
1720 1742 $ eval `hg tags -T '{tag}={node}\n'`
1721 1743 $ rm .hg/localtags
1722 1744
1723 1745 $ hg rebase -r $D -d $E
1724 1746 rebasing 5:9e62094e4d94 "D"
1725 1747
1726 1748 $ hg log -G
1727 1749 o 7:a699d059adcf D
1728 1750 |\
1729 1751 | o 6:ecc93090a95c E
1730 1752 | |
1731 1753 | o 4:0dc878468a23 B3
1732 1754 | |
1733 1755 o | 1:96cc3511f894 C
1734 1756 /
1735 1757 o 0:426bada5c675 A
1736 1758
1737 1759 For some reasons (--hidden, rebaseskipobsolete=0, directaccess, etc.),
1738 1760 rebasestate may contain hidden hashes. "rebase --abort" should work regardless.
1739 1761
1740 1762 $ hg init $TESTTMP/hidden-state1
1741 1763 $ cd $TESTTMP/hidden-state1
1742 1764 $ cat >> .hg/hgrc <<EOF
1743 1765 > [experimental]
1744 1766 > rebaseskipobsolete=0
1745 1767 > EOF
1746 1768
1747 1769 $ hg debugdrawdag <<'EOS'
1748 1770 > C
1749 1771 > |
1750 1772 > D B # prune: B, C
1751 1773 > |/ # B/D=B
1752 1774 > A
1753 1775 > EOS
1754 1776
1755 1777 $ eval `hg tags -T '{tag}={node}\n'`
1756 1778 $ rm .hg/localtags
1757 1779
1758 1780 $ hg update -q $C --hidden
1759 1781 updated to hidden changeset 7829726be4dc
1760 1782 (hidden revision '7829726be4dc' is pruned)
1761 1783 $ hg rebase -s $B -d $D
1762 1784 rebasing 1:2ec65233581b "B"
1763 1785 merging D
1764 1786 warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
1765 1787 unresolved conflicts (see hg resolve, then hg rebase --continue)
1766 1788 [1]
1767 1789
1768 1790 $ cp -R . $TESTTMP/hidden-state2
1769 1791
1770 1792 $ hg log -G
1771 1793 @ 2:b18e25de2cf5 D
1772 1794 |
1773 1795 | @ 1:2ec65233581b B (pruned using prune)
1774 1796 |/
1775 1797 o 0:426bada5c675 A
1776 1798
1777 1799 $ hg summary
1778 1800 parent: 2:b18e25de2cf5 tip
1779 1801 D
1780 1802 parent: 1:2ec65233581b (obsolete)
1781 1803 B
1782 1804 branch: default
1783 1805 commit: 2 modified, 1 unknown, 1 unresolved (merge)
1784 1806 update: (current)
1785 1807 phases: 3 draft
1786 1808 rebase: 0 rebased, 2 remaining (rebase --continue)
1787 1809
1788 1810 $ hg rebase --abort
1789 1811 rebase aborted
1790 1812
1791 1813 Also test --continue for the above case
1792 1814
1793 1815 $ cd $TESTTMP/hidden-state2
1794 1816 $ hg resolve -m
1795 1817 (no more unresolved files)
1796 1818 continue: hg rebase --continue
1797 1819 $ hg rebase --continue
1798 1820 rebasing 1:2ec65233581b "B"
1799 1821 rebasing 3:7829726be4dc "C" (tip)
1800 1822 $ hg log -G
1801 1823 @ 5:1964d5d5b547 C
1802 1824 |
1803 1825 o 4:68deb90c12a2 B
1804 1826 |
1805 1827 o 2:b18e25de2cf5 D
1806 1828 |
1807 1829 o 0:426bada5c675 A
1808 1830
1809 1831 ====================
1810 1832 Test --stop option |
1811 1833 ====================
1812 1834 $ cd ..
1813 1835 $ hg init rbstop
1814 1836 $ cd rbstop
1815 1837 $ echo a>a
1816 1838 $ hg ci -Aqma
1817 1839 $ echo b>b
1818 1840 $ hg ci -Aqmb
1819 1841 $ echo c>c
1820 1842 $ hg ci -Aqmc
1821 1843 $ echo d>d
1822 1844 $ hg ci -Aqmd
1823 1845 $ hg up 0 -q
1824 1846 $ echo f>f
1825 1847 $ hg ci -Aqmf
1826 1848 $ echo D>d
1827 1849 $ hg ci -Aqm "conflict with d"
1828 1850 $ hg up 3 -q
1829 1851 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1830 1852 o 5:00bfc9898aeb test
1831 1853 | conflict with d
1832 1854 |
1833 1855 o 4:dafd40200f93 test
1834 1856 | f
1835 1857 |
1836 1858 | @ 3:055a42cdd887 test
1837 1859 | | d
1838 1860 | |
1839 1861 | o 2:177f92b77385 test
1840 1862 | | c
1841 1863 | |
1842 1864 | o 1:d2ae7f538514 test
1843 1865 |/ b
1844 1866 |
1845 1867 o 0:cb9a9f314b8b test
1846 1868 a
1847 1869
1848 1870 $ hg rebase -s 1 -d 5
1849 1871 rebasing 1:d2ae7f538514 "b"
1850 1872 rebasing 2:177f92b77385 "c"
1851 1873 rebasing 3:055a42cdd887 "d"
1852 1874 merging d
1853 1875 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1854 1876 unresolved conflicts (see hg resolve, then hg rebase --continue)
1855 1877 [1]
1856 1878 $ hg rebase --stop
1857 1879 1 new orphan changesets
1858 1880 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1859 1881 o 7:7fffad344617 test
1860 1882 | c
1861 1883 |
1862 1884 o 6:b15528633407 test
1863 1885 | b
1864 1886 |
1865 1887 o 5:00bfc9898aeb test
1866 1888 | conflict with d
1867 1889 |
1868 1890 o 4:dafd40200f93 test
1869 1891 | f
1870 1892 |
1871 1893 | @ 3:055a42cdd887 test
1872 1894 | | d
1873 1895 | |
1874 1896 | x 2:177f92b77385 test
1875 1897 | | c
1876 1898 | |
1877 1899 | x 1:d2ae7f538514 test
1878 1900 |/ b
1879 1901 |
1880 1902 o 0:cb9a9f314b8b test
1881 1903 a
1882 1904
1883 1905 Test it aborts if unstable csets is not allowed:
1884 1906 ===============================================
1885 1907 $ cat >> $HGRCPATH << EOF
1886 1908 > [experimental]
1887 1909 > evolution.allowunstable=False
1888 1910 > EOF
1889 1911
1890 1912 $ hg strip 6 --no-backup -q
1891 1913 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1892 1914 o 5:00bfc9898aeb test
1893 1915 | conflict with d
1894 1916 |
1895 1917 o 4:dafd40200f93 test
1896 1918 | f
1897 1919 |
1898 1920 | @ 3:055a42cdd887 test
1899 1921 | | d
1900 1922 | |
1901 1923 | o 2:177f92b77385 test
1902 1924 | | c
1903 1925 | |
1904 1926 | o 1:d2ae7f538514 test
1905 1927 |/ b
1906 1928 |
1907 1929 o 0:cb9a9f314b8b test
1908 1930 a
1909 1931
1910 1932 $ hg rebase -s 1 -d 5
1911 1933 rebasing 1:d2ae7f538514 "b"
1912 1934 rebasing 2:177f92b77385 "c"
1913 1935 rebasing 3:055a42cdd887 "d"
1914 1936 merging d
1915 1937 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1916 1938 unresolved conflicts (see hg resolve, then hg rebase --continue)
1917 1939 [1]
1918 1940 $ hg rebase --stop
1919 1941 abort: cannot remove original changesets with unrebased descendants
1920 1942 (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
1921 1943 [255]
1922 1944 $ hg rebase --abort
1923 1945 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1924 1946 rebase aborted
1925 1947
1926 1948 Test --stop when --keep is passed:
1927 1949 ==================================
1928 1950 $ hg rebase -s 1 -d 5 --keep
1929 1951 rebasing 1:d2ae7f538514 "b"
1930 1952 rebasing 2:177f92b77385 "c"
1931 1953 rebasing 3:055a42cdd887 "d"
1932 1954 merging d
1933 1955 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1934 1956 unresolved conflicts (see hg resolve, then hg rebase --continue)
1935 1957 [1]
1936 1958 $ hg rebase --stop
1937 1959 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1938 1960 o 7:7fffad344617 test
1939 1961 | c
1940 1962 |
1941 1963 o 6:b15528633407 test
1942 1964 | b
1943 1965 |
1944 1966 o 5:00bfc9898aeb test
1945 1967 | conflict with d
1946 1968 |
1947 1969 o 4:dafd40200f93 test
1948 1970 | f
1949 1971 |
1950 1972 | @ 3:055a42cdd887 test
1951 1973 | | d
1952 1974 | |
1953 1975 | o 2:177f92b77385 test
1954 1976 | | c
1955 1977 | |
1956 1978 | o 1:d2ae7f538514 test
1957 1979 |/ b
1958 1980 |
1959 1981 o 0:cb9a9f314b8b test
1960 1982 a
1961 1983
1962 1984 Test --stop aborts when --collapse was passed:
1963 1985 =============================================
1964 1986 $ cat >> $HGRCPATH << EOF
1965 1987 > [experimental]
1966 1988 > evolution.allowunstable=True
1967 1989 > EOF
1968 1990
1969 1991 $ hg strip 6
1970 1992 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1971 1993 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1972 1994 o 5:00bfc9898aeb test
1973 1995 | conflict with d
1974 1996 |
1975 1997 o 4:dafd40200f93 test
1976 1998 | f
1977 1999 |
1978 2000 | @ 3:055a42cdd887 test
1979 2001 | | d
1980 2002 | |
1981 2003 | o 2:177f92b77385 test
1982 2004 | | c
1983 2005 | |
1984 2006 | o 1:d2ae7f538514 test
1985 2007 |/ b
1986 2008 |
1987 2009 o 0:cb9a9f314b8b test
1988 2010 a
1989 2011
1990 2012 $ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d"
1991 2013 rebasing 1:d2ae7f538514 "b"
1992 2014 rebasing 2:177f92b77385 "c"
1993 2015 rebasing 3:055a42cdd887 "d"
1994 2016 merging d
1995 2017 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1996 2018 unresolved conflicts (see hg resolve, then hg rebase --continue)
1997 2019 [1]
1998 2020 $ hg rebase --stop
1999 2021 abort: cannot stop in --collapse session
2000 2022 [255]
2001 2023 $ hg rebase --abort
2002 2024 rebase aborted
2003 2025 $ hg diff
2004 2026 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
2005 2027 o 5:00bfc9898aeb test
2006 2028 | conflict with d
2007 2029 |
2008 2030 o 4:dafd40200f93 test
2009 2031 | f
2010 2032 |
2011 2033 | @ 3:055a42cdd887 test
2012 2034 | | d
2013 2035 | |
2014 2036 | o 2:177f92b77385 test
2015 2037 | | c
2016 2038 | |
2017 2039 | o 1:d2ae7f538514 test
2018 2040 |/ b
2019 2041 |
2020 2042 o 0:cb9a9f314b8b test
2021 2043 a
2022 2044
2023 2045 Test --stop raise errors with conflicting options:
2024 2046 =================================================
2025 2047 $ hg rebase -s 3 -d 5
2026 2048 rebasing 3:055a42cdd887 "d"
2027 2049 merging d
2028 2050 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2029 2051 unresolved conflicts (see hg resolve, then hg rebase --continue)
2030 2052 [1]
2031 2053 $ hg rebase --stop --dry-run
2032 2054 abort: cannot specify both --dry-run and --stop
2033 2055 [255]
2034 2056
2035 2057 $ hg rebase -s 3 -d 5
2036 2058 abort: rebase in progress
2037 2059 (use 'hg rebase --continue' or 'hg rebase --abort')
2038 2060 [255]
2039 2061 $ hg rebase --stop --continue
2040 2062 abort: cannot use --stop with --continue
2041 2063 [255]
2042 2064
2043 2065 Test --stop moves bookmarks of original revisions to new rebased nodes:
2044 2066 ======================================================================
2045 2067 $ cd ..
2046 2068 $ hg init repo
2047 2069 $ cd repo
2048 2070
2049 2071 $ echo a > a
2050 2072 $ hg ci -Am A
2051 2073 adding a
2052 2074
2053 2075 $ echo b > b
2054 2076 $ hg ci -Am B
2055 2077 adding b
2056 2078 $ hg book X
2057 2079 $ hg book Y
2058 2080
2059 2081 $ echo c > c
2060 2082 $ hg ci -Am C
2061 2083 adding c
2062 2084 $ hg book Z
2063 2085
2064 2086 $ echo d > d
2065 2087 $ hg ci -Am D
2066 2088 adding d
2067 2089
2068 2090 $ hg up 0 -q
2069 2091 $ echo e > e
2070 2092 $ hg ci -Am E
2071 2093 adding e
2072 2094 created new head
2073 2095
2074 2096 $ echo doubt > d
2075 2097 $ hg ci -Am "conflict with d"
2076 2098 adding d
2077 2099
2078 2100 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2079 2101 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2080 2102 |
2081 2103 o 4: 9c1e55f411b6 'E' bookmarks:
2082 2104 |
2083 2105 | o 3: 67a385d4e6f2 'D' bookmarks: Z
2084 2106 | |
2085 2107 | o 2: 49cb3485fa0c 'C' bookmarks: Y
2086 2108 | |
2087 2109 | o 1: 6c81ed0049f8 'B' bookmarks: X
2088 2110 |/
2089 2111 o 0: 1994f17a630e 'A' bookmarks:
2090 2112
2091 2113 $ hg rebase -s 1 -d 5
2092 2114 rebasing 1:6c81ed0049f8 "B" (X)
2093 2115 rebasing 2:49cb3485fa0c "C" (Y)
2094 2116 rebasing 3:67a385d4e6f2 "D" (Z)
2095 2117 merging d
2096 2118 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2097 2119 unresolved conflicts (see hg resolve, then hg rebase --continue)
2098 2120 [1]
2099 2121 $ hg rebase --stop
2100 2122 1 new orphan changesets
2101 2123 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2102 2124 o 7: 9c86c650b686 'C' bookmarks: Y
2103 2125 |
2104 2126 o 6: 9b87b54e5fd8 'B' bookmarks: X
2105 2127 |
2106 2128 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2107 2129 |
2108 2130 o 4: 9c1e55f411b6 'E' bookmarks:
2109 2131 |
2110 2132 | * 3: 67a385d4e6f2 'D' bookmarks: Z
2111 2133 | |
2112 2134 | x 2: 49cb3485fa0c 'C' bookmarks:
2113 2135 | |
2114 2136 | x 1: 6c81ed0049f8 'B' bookmarks:
2115 2137 |/
2116 2138 o 0: 1994f17a630e 'A' bookmarks:
2117 2139
General Comments 0
You need to be logged in to leave comments. Login now