##// END OF EJS Templates
rebase: add test to show --stop moves bookmarks...
Sushil khanchi -
r39131:33f5cffe default
parent child Browse files
Show More
@@ -1,2024 +1,2100 b''
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
1127 1127 If the rebase set has an obsolete (d) with a successor (d') outside the rebase
1128 1128 set and none in destination, we still get the divergence warning.
1129 1129 By allowing divergence, we can perform the rebase.
1130 1130
1131 1131 $ hg rebase -r 'c'::'f' -d 'x'
1132 1132 abort: this rebase will cause divergences from: 76be324c128b
1133 1133 (to force the rebase please set experimental.evolution.allowdivergence=True)
1134 1134 [255]
1135 1135 $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x'
1136 1136 rebasing 3:a82ac2b38757 "c" (c)
1137 1137 rebasing 4:76be324c128b "d" (d)
1138 1138 rebasing 7:1143e9adc121 "f" (f tip)
1139 1139 1 new orphan changesets
1140 1140 2 new content-divergent changesets
1141 1141 $ hg log -G -r 'a':: -T instabilities
1142 1142 o 10:e1744ea07510 f
1143 1143 |
1144 1144 * 9:e2b36ea9a0a0 d (content-divergent)
1145 1145 |
1146 1146 o 8:6a0376de376e c
1147 1147 |
1148 1148 | x 7:1143e9adc121 f
1149 1149 | |
1150 1150 | | * 6:d60ebfa0f1cb e (orphan)
1151 1151 | | |
1152 1152 | | * 5:027ad6c5830d d' (orphan content-divergent)
1153 1153 | | |
1154 1154 | x | 4:76be324c128b d
1155 1155 | |/
1156 1156 | x 3:a82ac2b38757 c
1157 1157 | |
1158 1158 o | 2:630d7c95eff7 x
1159 1159 | |
1160 1160 | o 1:488e1b7e7341 b
1161 1161 |/
1162 1162 o 0:b173517d0057 a
1163 1163
1164 1164 $ hg strip -r 8:
1165 1165
1166 1166 (Not skipping obsoletes means that divergence is allowed.)
1167 1167
1168 1168 $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x'
1169 1169 rebasing 3:a82ac2b38757 "c" (c)
1170 1170 rebasing 4:76be324c128b "d" (d)
1171 1171 rebasing 7:1143e9adc121 "f" (f tip)
1172 1172 1 new orphan changesets
1173 1173 2 new content-divergent changesets
1174 1174
1175 1175 $ hg strip -r 0:
1176 1176
1177 1177 Similar test on a more complex graph
1178 1178
1179 1179 $ hg debugdrawdag <<EOF
1180 1180 > g
1181 1181 > |
1182 1182 > f e
1183 1183 > | |
1184 1184 > e' d # replace: e -> e'
1185 1185 > \ /
1186 1186 > c
1187 1187 > |
1188 1188 > x b
1189 1189 > \|
1190 1190 > a
1191 1191 > EOF
1192 1192 1 new orphan changesets
1193 1193 $ hg log -G -r 'a':
1194 1194 * 8:2876ce66c6eb g
1195 1195 |
1196 1196 | o 7:3ffec603ab53 f
1197 1197 | |
1198 1198 x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1199 1199 | |
1200 1200 | o 5:63324dc512ea e'
1201 1201 | |
1202 1202 o | 4:76be324c128b d
1203 1203 |/
1204 1204 o 3:a82ac2b38757 c
1205 1205 |
1206 1206 | o 2:630d7c95eff7 x
1207 1207 | |
1208 1208 o | 1:488e1b7e7341 b
1209 1209 |/
1210 1210 o 0:b173517d0057 a
1211 1211
1212 1212 $ hg rebase -b 'f' -d 'x'
1213 1213 rebasing 1:488e1b7e7341 "b" (b)
1214 1214 rebasing 3:a82ac2b38757 "c" (c)
1215 1215 rebasing 5:63324dc512ea "e'" (e')
1216 1216 rebasing 7:3ffec603ab53 "f" (f)
1217 1217 rebasing 4:76be324c128b "d" (d)
1218 1218 note: not rebasing 6:e36fae928aec "e" (e) and its descendants as this would cause divergence
1219 1219 $ hg log -G -r 'a':
1220 1220 o 13:a1707a5b7c2c d
1221 1221 |
1222 1222 | o 12:ef6251596616 f
1223 1223 | |
1224 1224 | o 11:b6f172e64af9 e'
1225 1225 |/
1226 1226 o 10:d008e6b4d3fd c
1227 1227 |
1228 1228 o 9:67e8f4a16c49 b
1229 1229 |
1230 1230 | * 8:2876ce66c6eb g
1231 1231 | |
1232 1232 | | x 7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
1233 1233 | | |
1234 1234 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1235 1235 | | |
1236 1236 | | x 5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
1237 1237 | | |
1238 1238 | x | 4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
1239 1239 | |/
1240 1240 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
1241 1241 | |
1242 1242 o | 2:630d7c95eff7 x
1243 1243 | |
1244 1244 | x 1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49)
1245 1245 |/
1246 1246 o 0:b173517d0057 a
1247 1247
1248 1248
1249 1249 issue5782
1250 1250 $ hg strip -r 0:
1251 1251 $ hg debugdrawdag <<EOF
1252 1252 > d
1253 1253 > |
1254 1254 > c1 c # replace: c -> c1
1255 1255 > \ /
1256 1256 > b
1257 1257 > |
1258 1258 > a
1259 1259 > EOF
1260 1260 1 new orphan changesets
1261 1261 $ hg debugobsolete `hg log -T "{node}" --hidden -r 'desc("c1")'`
1262 1262 obsoleted 1 changesets
1263 1263 $ hg log -G -r 'a': --hidden
1264 1264 * 4:76be324c128b d
1265 1265 |
1266 1266 | x 3:ef8a456de8fa c1 (pruned)
1267 1267 | |
1268 1268 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1269 1269 |/
1270 1270 o 1:488e1b7e7341 b
1271 1271 |
1272 1272 o 0:b173517d0057 a
1273 1273
1274 1274 $ hg rebase -d 0 -r 2
1275 1275 rebasing 2:a82ac2b38757 "c" (c)
1276 1276 $ hg log -G -r 'a': --hidden
1277 1277 o 5:69ad416a4a26 c
1278 1278 |
1279 1279 | * 4:76be324c128b d
1280 1280 | |
1281 1281 | | x 3:ef8a456de8fa c1 (pruned)
1282 1282 | | |
1283 1283 | x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa rewritten using rebase as 5:69ad416a4a26)
1284 1284 | |/
1285 1285 | o 1:488e1b7e7341 b
1286 1286 |/
1287 1287 o 0:b173517d0057 a
1288 1288
1289 1289 $ cd ..
1290 1290
1291 1291 Rebase merge where successor of one parent is equal to destination (issue5198)
1292 1292
1293 1293 $ hg init p1-succ-is-dest
1294 1294 $ cd p1-succ-is-dest
1295 1295
1296 1296 $ hg debugdrawdag <<EOF
1297 1297 > F
1298 1298 > /|
1299 1299 > E D B # replace: D -> B
1300 1300 > \|/
1301 1301 > A
1302 1302 > EOF
1303 1303 1 new orphan changesets
1304 1304
1305 1305 $ hg rebase -d B -s D
1306 1306 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1307 1307 rebasing 4:66f1a38021c9 "F" (F tip)
1308 1308 $ hg log -G
1309 1309 o 5:50e9d60b99c6 F
1310 1310 |\
1311 1311 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:50e9d60b99c6)
1312 1312 | |/|
1313 1313 | o | 3:7fb047a69f22 E
1314 1314 | | |
1315 1315 | | x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1316 1316 | |/
1317 1317 o | 1:112478962961 B
1318 1318 |/
1319 1319 o 0:426bada5c675 A
1320 1320
1321 1321 $ cd ..
1322 1322
1323 1323 Rebase merge where successor of other parent is equal to destination
1324 1324
1325 1325 $ hg init p2-succ-is-dest
1326 1326 $ cd p2-succ-is-dest
1327 1327
1328 1328 $ hg debugdrawdag <<EOF
1329 1329 > F
1330 1330 > /|
1331 1331 > E D B # replace: E -> B
1332 1332 > \|/
1333 1333 > A
1334 1334 > EOF
1335 1335 1 new orphan changesets
1336 1336
1337 1337 $ hg rebase -d B -s E
1338 1338 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1339 1339 rebasing 4:66f1a38021c9 "F" (F tip)
1340 1340 $ hg log -G
1341 1341 o 5:aae1787dacee F
1342 1342 |\
1343 1343 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:aae1787dacee)
1344 1344 | |/|
1345 1345 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1346 1346 | | |
1347 1347 | o | 2:b18e25de2cf5 D
1348 1348 | |/
1349 1349 o / 1:112478962961 B
1350 1350 |/
1351 1351 o 0:426bada5c675 A
1352 1352
1353 1353 $ cd ..
1354 1354
1355 1355 Rebase merge where successor of one parent is ancestor of destination
1356 1356
1357 1357 $ hg init p1-succ-in-dest
1358 1358 $ cd p1-succ-in-dest
1359 1359
1360 1360 $ hg debugdrawdag <<EOF
1361 1361 > F C
1362 1362 > /| |
1363 1363 > E D B # replace: D -> B
1364 1364 > \|/
1365 1365 > A
1366 1366 > EOF
1367 1367 1 new orphan changesets
1368 1368
1369 1369 $ hg rebase -d C -s D
1370 1370 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1371 1371 rebasing 5:66f1a38021c9 "F" (F tip)
1372 1372
1373 1373 $ hg log -G
1374 1374 o 6:0913febf6439 F
1375 1375 |\
1376 1376 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:0913febf6439)
1377 1377 | | |
1378 1378 | o | 4:26805aba1e60 C
1379 1379 | | |
1380 1380 o | | 3:7fb047a69f22 E
1381 1381 | | |
1382 1382 +---x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1383 1383 | |
1384 1384 | o 1:112478962961 B
1385 1385 |/
1386 1386 o 0:426bada5c675 A
1387 1387
1388 1388 $ cd ..
1389 1389
1390 1390 Rebase merge where successor of other parent is ancestor of destination
1391 1391
1392 1392 $ hg init p2-succ-in-dest
1393 1393 $ cd p2-succ-in-dest
1394 1394
1395 1395 $ hg debugdrawdag <<EOF
1396 1396 > F C
1397 1397 > /| |
1398 1398 > E D B # replace: E -> B
1399 1399 > \|/
1400 1400 > A
1401 1401 > EOF
1402 1402 1 new orphan changesets
1403 1403
1404 1404 $ hg rebase -d C -s E
1405 1405 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1406 1406 rebasing 5:66f1a38021c9 "F" (F tip)
1407 1407 $ hg log -G
1408 1408 o 6:c6ab0cc6d220 F
1409 1409 |\
1410 1410 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:c6ab0cc6d220)
1411 1411 | | |
1412 1412 | o | 4:26805aba1e60 C
1413 1413 | | |
1414 1414 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1415 1415 | | |
1416 1416 o---+ 2:b18e25de2cf5 D
1417 1417 / /
1418 1418 o / 1:112478962961 B
1419 1419 |/
1420 1420 o 0:426bada5c675 A
1421 1421
1422 1422 $ cd ..
1423 1423
1424 1424 Rebase merge where successor of one parent is ancestor of destination
1425 1425
1426 1426 $ hg init p1-succ-in-dest-b
1427 1427 $ cd p1-succ-in-dest-b
1428 1428
1429 1429 $ hg debugdrawdag <<EOF
1430 1430 > F C
1431 1431 > /| |
1432 1432 > E D B # replace: E -> B
1433 1433 > \|/
1434 1434 > A
1435 1435 > EOF
1436 1436 1 new orphan changesets
1437 1437
1438 1438 $ hg rebase -d C -b F
1439 1439 rebasing 2:b18e25de2cf5 "D" (D)
1440 1440 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1441 1441 rebasing 5:66f1a38021c9 "F" (F tip)
1442 1442 note: rebase of 5:66f1a38021c9 created no changes to commit
1443 1443 $ hg log -G
1444 1444 o 6:8f47515dda15 D
1445 1445 |
1446 1446 | x 5:66f1a38021c9 F (pruned using rebase)
1447 1447 | |\
1448 1448 o | | 4:26805aba1e60 C
1449 1449 | | |
1450 1450 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1451 1451 | | |
1452 1452 | x | 2:b18e25de2cf5 D (rewritten using rebase as 6:8f47515dda15)
1453 1453 | |/
1454 1454 o / 1:112478962961 B
1455 1455 |/
1456 1456 o 0:426bada5c675 A
1457 1457
1458 1458 $ cd ..
1459 1459
1460 1460 Rebase merge where successor of other parent is ancestor of destination
1461 1461
1462 1462 $ hg init p2-succ-in-dest-b
1463 1463 $ cd p2-succ-in-dest-b
1464 1464
1465 1465 $ hg debugdrawdag <<EOF
1466 1466 > F C
1467 1467 > /| |
1468 1468 > E D B # replace: D -> B
1469 1469 > \|/
1470 1470 > A
1471 1471 > EOF
1472 1472 1 new orphan changesets
1473 1473
1474 1474 $ hg rebase -d C -b F
1475 1475 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1476 1476 rebasing 3:7fb047a69f22 "E" (E)
1477 1477 rebasing 5:66f1a38021c9 "F" (F tip)
1478 1478 note: rebase of 5:66f1a38021c9 created no changes to commit
1479 1479
1480 1480 $ hg log -G
1481 1481 o 6:533690786a86 E
1482 1482 |
1483 1483 | x 5:66f1a38021c9 F (pruned using rebase)
1484 1484 | |\
1485 1485 o | | 4:26805aba1e60 C
1486 1486 | | |
1487 1487 | | x 3:7fb047a69f22 E (rewritten using rebase as 6:533690786a86)
1488 1488 | | |
1489 1489 | x | 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1490 1490 | |/
1491 1491 o / 1:112478962961 B
1492 1492 |/
1493 1493 o 0:426bada5c675 A
1494 1494
1495 1495 $ cd ..
1496 1496
1497 1497 $ hg init p2-succ-in-dest-c
1498 1498 $ cd p2-succ-in-dest-c
1499 1499
1500 1500 The scenario here was that B::D were developed on default. B was queued on
1501 1501 stable, but amended before being push to hg-committed. C was queued on default,
1502 1502 along with unrelated J.
1503 1503
1504 1504 $ hg debugdrawdag <<EOF
1505 1505 > J
1506 1506 > |
1507 1507 > F
1508 1508 > |
1509 1509 > E
1510 1510 > | D
1511 1511 > | |
1512 1512 > | C # replace: C -> F
1513 1513 > | | H I # replace: B -> H -> I
1514 1514 > | B |/
1515 1515 > |/ G
1516 1516 > A
1517 1517 > EOF
1518 1518 1 new orphan changesets
1519 1519
1520 1520 This strip seems to be the key to avoid an early divergence warning.
1521 1521 $ hg --config extensions.strip= --hidden strip -qr H
1522 1522 1 new orphan changesets
1523 1523
1524 1524 $ hg rebase -b 'desc("D")' -d 'desc("J")'
1525 1525 abort: this rebase will cause divergences from: 112478962961
1526 1526 (to force the rebase please set experimental.evolution.allowdivergence=True)
1527 1527 [255]
1528 1528
1529 1529 Rebase merge where both parents have successors in destination
1530 1530
1531 1531 $ hg init p12-succ-in-dest
1532 1532 $ cd p12-succ-in-dest
1533 1533 $ hg debugdrawdag <<'EOS'
1534 1534 > E F
1535 1535 > /| /| # replace: A -> C
1536 1536 > A B C D # replace: B -> D
1537 1537 > | |
1538 1538 > X Y
1539 1539 > EOS
1540 1540 1 new orphan changesets
1541 1541 $ hg rebase -r A+B+E -d F
1542 1542 note: not rebasing 4:a3d17304151f "A" (A), already in destination as 0:96cc3511f894 "C" (C)
1543 1543 note: not rebasing 5:b23a2cc00842 "B" (B), already in destination as 1:058c1e1fb10a "D" (D)
1544 1544 rebasing 7:dac5d11c5a7d "E" (E tip)
1545 1545 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
1546 1546 [255]
1547 1547 $ cd ..
1548 1548
1549 1549 Rebase a non-clean merge. One parent has successor in destination, the other
1550 1550 parent moves as requested.
1551 1551
1552 1552 $ hg init p1-succ-p2-move
1553 1553 $ cd p1-succ-p2-move
1554 1554 $ hg debugdrawdag <<'EOS'
1555 1555 > D Z
1556 1556 > /| | # replace: A -> C
1557 1557 > A B C # D/D = D
1558 1558 > EOS
1559 1559 1 new orphan changesets
1560 1560 $ hg rebase -r A+B+D -d Z
1561 1561 note: not rebasing 0:426bada5c675 "A" (A), already in destination as 2:96cc3511f894 "C" (C)
1562 1562 rebasing 1:fc2b737bb2e5 "B" (B)
1563 1563 rebasing 3:b8ed089c80ad "D" (D)
1564 1564
1565 1565 $ rm .hg/localtags
1566 1566 $ hg log -G
1567 1567 o 6:e4f78693cc88 D
1568 1568 |
1569 1569 o 5:76840d832e98 B
1570 1570 |
1571 1571 o 4:50e41c1f3950 Z
1572 1572 |
1573 1573 o 2:96cc3511f894 C
1574 1574
1575 1575 $ hg files -r tip
1576 1576 B
1577 1577 C
1578 1578 D
1579 1579 Z
1580 1580
1581 1581 $ cd ..
1582 1582
1583 1583 $ hg init p1-move-p2-succ
1584 1584 $ cd p1-move-p2-succ
1585 1585 $ hg debugdrawdag <<'EOS'
1586 1586 > D Z
1587 1587 > /| | # replace: B -> C
1588 1588 > A B C # D/D = D
1589 1589 > EOS
1590 1590 1 new orphan changesets
1591 1591 $ hg rebase -r B+A+D -d Z
1592 1592 rebasing 0:426bada5c675 "A" (A)
1593 1593 note: not rebasing 1:fc2b737bb2e5 "B" (B), already in destination as 2:96cc3511f894 "C" (C)
1594 1594 rebasing 3:b8ed089c80ad "D" (D)
1595 1595
1596 1596 $ rm .hg/localtags
1597 1597 $ hg log -G
1598 1598 o 6:1b355ed94d82 D
1599 1599 |
1600 1600 o 5:a81a74d764a6 A
1601 1601 |
1602 1602 o 4:50e41c1f3950 Z
1603 1603 |
1604 1604 o 2:96cc3511f894 C
1605 1605
1606 1606 $ hg files -r tip
1607 1607 A
1608 1608 C
1609 1609 D
1610 1610 Z
1611 1611
1612 1612 $ cd ..
1613 1613
1614 1614 Test that bookmark is moved and working dir is updated when all changesets have
1615 1615 equivalents in destination
1616 1616 $ hg init rbsrepo && cd rbsrepo
1617 1617 $ echo "[experimental]" > .hg/hgrc
1618 1618 $ echo "evolution=true" >> .hg/hgrc
1619 1619 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
1620 1620 $ echo root > root && hg ci -Am root
1621 1621 adding root
1622 1622 $ echo a > a && hg ci -Am a
1623 1623 adding a
1624 1624 $ hg up 0
1625 1625 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1626 1626 $ echo b > b && hg ci -Am b
1627 1627 adding b
1628 1628 created new head
1629 1629 $ hg rebase -r 2 -d 1
1630 1630 rebasing 2:1e9a3c00cbe9 "b" (tip)
1631 1631 $ hg log -r . # working dir is at rev 3 (successor of 2)
1632 1632 3:be1832deae9a b (no-eol)
1633 1633 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
1634 1634 bookmarking hidden changeset 1e9a3c00cbe9
1635 1635 (hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a)
1636 1636 $ hg up 2 && hg log -r . # working dir is at rev 2 again
1637 1637 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1638 1638 2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)
1639 1639 $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
1640 1640 note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" (tip)
1641 1641 Check that working directory and bookmark was updated to rev 3 although rev 2
1642 1642 was skipped
1643 1643 $ hg log -r .
1644 1644 3:be1832deae9a b (no-eol)
1645 1645 $ hg bookmarks
1646 1646 mybook 3:be1832deae9a
1647 1647 $ hg debugobsolete --rev tip
1648 1648 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
1649 1649
1650 1650 Obsoleted working parent and bookmark could be moved if an ancestor of working
1651 1651 parent gets moved:
1652 1652
1653 1653 $ hg init $TESTTMP/ancestor-wd-move
1654 1654 $ cd $TESTTMP/ancestor-wd-move
1655 1655 $ hg debugdrawdag <<'EOS'
1656 1656 > E D1 # rebase: D1 -> D2
1657 1657 > | |
1658 1658 > | C
1659 1659 > D2 |
1660 1660 > | B
1661 1661 > |/
1662 1662 > A
1663 1663 > EOS
1664 1664 $ hg update D1 -q
1665 1665 $ hg bookmark book -i
1666 1666 $ hg rebase -r B+D1 -d E
1667 1667 rebasing 1:112478962961 "B" (B)
1668 1668 note: not rebasing 5:15ecf15e0114 "D1" (book D1 tip), already in destination as 2:0807738e0be9 "D2" (D2)
1669 1669 1 new orphan changesets
1670 1670 $ hg log -G -T '{desc} {bookmarks}'
1671 1671 @ B book
1672 1672 |
1673 1673 | x D1
1674 1674 | |
1675 1675 o | E
1676 1676 | |
1677 1677 | * C
1678 1678 | |
1679 1679 o | D2
1680 1680 | |
1681 1681 | x B
1682 1682 |/
1683 1683 o A
1684 1684
1685 1685 Rebasing a merge with one of its parent having a hidden successor
1686 1686
1687 1687 $ hg init $TESTTMP/merge-p1-hidden-successor
1688 1688 $ cd $TESTTMP/merge-p1-hidden-successor
1689 1689
1690 1690 $ hg debugdrawdag <<'EOS'
1691 1691 > E
1692 1692 > |
1693 1693 > B3 B2 # amend: B1 -> B2 -> B3
1694 1694 > |/ # B2 is hidden
1695 1695 > | D
1696 1696 > | |\
1697 1697 > | B1 C
1698 1698 > |/
1699 1699 > A
1700 1700 > EOS
1701 1701 1 new orphan changesets
1702 1702
1703 1703 $ eval `hg tags -T '{tag}={node}\n'`
1704 1704 $ rm .hg/localtags
1705 1705
1706 1706 $ hg rebase -r $D -d $E
1707 1707 rebasing 5:9e62094e4d94 "D"
1708 1708
1709 1709 $ hg log -G
1710 1710 o 7:a699d059adcf D
1711 1711 |\
1712 1712 | o 6:ecc93090a95c E
1713 1713 | |
1714 1714 | o 4:0dc878468a23 B3
1715 1715 | |
1716 1716 o | 1:96cc3511f894 C
1717 1717 /
1718 1718 o 0:426bada5c675 A
1719 1719
1720 1720 For some reasons (--hidden, rebaseskipobsolete=0, directaccess, etc.),
1721 1721 rebasestate may contain hidden hashes. "rebase --abort" should work regardless.
1722 1722
1723 1723 $ hg init $TESTTMP/hidden-state1
1724 1724 $ cd $TESTTMP/hidden-state1
1725 1725 $ cat >> .hg/hgrc <<EOF
1726 1726 > [experimental]
1727 1727 > rebaseskipobsolete=0
1728 1728 > EOF
1729 1729
1730 1730 $ hg debugdrawdag <<'EOS'
1731 1731 > C
1732 1732 > |
1733 1733 > D B # prune: B, C
1734 1734 > |/ # B/D=B
1735 1735 > A
1736 1736 > EOS
1737 1737
1738 1738 $ eval `hg tags -T '{tag}={node}\n'`
1739 1739 $ rm .hg/localtags
1740 1740
1741 1741 $ hg update -q $C --hidden
1742 1742 updated to hidden changeset 7829726be4dc
1743 1743 (hidden revision '7829726be4dc' is pruned)
1744 1744 $ hg rebase -s $B -d $D
1745 1745 rebasing 1:2ec65233581b "B"
1746 1746 merging D
1747 1747 warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
1748 1748 unresolved conflicts (see hg resolve, then hg rebase --continue)
1749 1749 [1]
1750 1750
1751 1751 $ cp -R . $TESTTMP/hidden-state2
1752 1752
1753 1753 $ hg log -G
1754 1754 @ 2:b18e25de2cf5 D
1755 1755 |
1756 1756 | @ 1:2ec65233581b B (pruned using prune)
1757 1757 |/
1758 1758 o 0:426bada5c675 A
1759 1759
1760 1760 $ hg summary
1761 1761 parent: 2:b18e25de2cf5 tip
1762 1762 D
1763 1763 parent: 1:2ec65233581b (obsolete)
1764 1764 B
1765 1765 branch: default
1766 1766 commit: 2 modified, 1 unknown, 1 unresolved (merge)
1767 1767 update: (current)
1768 1768 phases: 3 draft
1769 1769 rebase: 0 rebased, 2 remaining (rebase --continue)
1770 1770
1771 1771 $ hg rebase --abort
1772 1772 rebase aborted
1773 1773
1774 1774 Also test --continue for the above case
1775 1775
1776 1776 $ cd $TESTTMP/hidden-state2
1777 1777 $ hg resolve -m
1778 1778 (no more unresolved files)
1779 1779 continue: hg rebase --continue
1780 1780 $ hg rebase --continue
1781 1781 rebasing 1:2ec65233581b "B"
1782 1782 rebasing 3:7829726be4dc "C" (tip)
1783 1783 $ hg log -G
1784 1784 @ 5:1964d5d5b547 C
1785 1785 |
1786 1786 o 4:68deb90c12a2 B
1787 1787 |
1788 1788 o 2:b18e25de2cf5 D
1789 1789 |
1790 1790 o 0:426bada5c675 A
1791 1791
1792 1792 ====================
1793 1793 Test --stop option |
1794 1794 ====================
1795 1795 $ cd ..
1796 1796 $ hg init rbstop
1797 1797 $ cd rbstop
1798 1798 $ echo a>a
1799 1799 $ hg ci -Aqma
1800 1800 $ echo b>b
1801 1801 $ hg ci -Aqmb
1802 1802 $ echo c>c
1803 1803 $ hg ci -Aqmc
1804 1804 $ echo d>d
1805 1805 $ hg ci -Aqmd
1806 1806 $ hg up 0 -q
1807 1807 $ echo f>f
1808 1808 $ hg ci -Aqmf
1809 1809 $ echo D>d
1810 1810 $ hg ci -Aqm "conflict with d"
1811 1811 $ hg up 3 -q
1812 1812 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1813 1813 o 5:00bfc9898aeb test
1814 1814 | conflict with d
1815 1815 |
1816 1816 o 4:dafd40200f93 test
1817 1817 | f
1818 1818 |
1819 1819 | @ 3:055a42cdd887 test
1820 1820 | | d
1821 1821 | |
1822 1822 | o 2:177f92b77385 test
1823 1823 | | c
1824 1824 | |
1825 1825 | o 1:d2ae7f538514 test
1826 1826 |/ b
1827 1827 |
1828 1828 o 0:cb9a9f314b8b test
1829 1829 a
1830 1830
1831 1831 $ hg rebase -s 1 -d 5
1832 1832 rebasing 1:d2ae7f538514 "b"
1833 1833 rebasing 2:177f92b77385 "c"
1834 1834 rebasing 3:055a42cdd887 "d"
1835 1835 merging d
1836 1836 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1837 1837 unresolved conflicts (see hg resolve, then hg rebase --continue)
1838 1838 [1]
1839 1839 $ hg rebase --stop
1840 1840 1 new orphan changesets
1841 1841 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1842 1842 o 7:7fffad344617 test
1843 1843 | c
1844 1844 |
1845 1845 o 6:b15528633407 test
1846 1846 | b
1847 1847 |
1848 1848 o 5:00bfc9898aeb test
1849 1849 | conflict with d
1850 1850 |
1851 1851 o 4:dafd40200f93 test
1852 1852 | f
1853 1853 |
1854 1854 | @ 3:055a42cdd887 test
1855 1855 | | d
1856 1856 | |
1857 1857 | x 2:177f92b77385 test
1858 1858 | | c
1859 1859 | |
1860 1860 | x 1:d2ae7f538514 test
1861 1861 |/ b
1862 1862 |
1863 1863 o 0:cb9a9f314b8b test
1864 1864 a
1865 1865
1866 1866 Test it aborts if unstable csets is not allowed:
1867 1867 ===============================================
1868 1868 $ cat >> $HGRCPATH << EOF
1869 1869 > [experimental]
1870 1870 > evolution.allowunstable=False
1871 1871 > EOF
1872 1872
1873 1873 $ hg strip 6 --no-backup -q
1874 1874 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1875 1875 o 5:00bfc9898aeb test
1876 1876 | conflict with d
1877 1877 |
1878 1878 o 4:dafd40200f93 test
1879 1879 | f
1880 1880 |
1881 1881 | @ 3:055a42cdd887 test
1882 1882 | | d
1883 1883 | |
1884 1884 | o 2:177f92b77385 test
1885 1885 | | c
1886 1886 | |
1887 1887 | o 1:d2ae7f538514 test
1888 1888 |/ b
1889 1889 |
1890 1890 o 0:cb9a9f314b8b test
1891 1891 a
1892 1892
1893 1893 $ hg rebase -s 1 -d 5
1894 1894 rebasing 1:d2ae7f538514 "b"
1895 1895 rebasing 2:177f92b77385 "c"
1896 1896 rebasing 3:055a42cdd887 "d"
1897 1897 merging d
1898 1898 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1899 1899 unresolved conflicts (see hg resolve, then hg rebase --continue)
1900 1900 [1]
1901 1901 $ hg rebase --stop
1902 1902 abort: cannot remove original changesets with unrebased descendants
1903 1903 (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
1904 1904 [255]
1905 1905 $ hg rebase --abort
1906 1906 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1907 1907 rebase aborted
1908 1908
1909 1909 Test --stop when --keep is passed:
1910 1910 ==================================
1911 1911 $ hg rebase -s 1 -d 5 --keep
1912 1912 rebasing 1:d2ae7f538514 "b"
1913 1913 rebasing 2:177f92b77385 "c"
1914 1914 rebasing 3:055a42cdd887 "d"
1915 1915 merging d
1916 1916 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1917 1917 unresolved conflicts (see hg resolve, then hg rebase --continue)
1918 1918 [1]
1919 1919 $ hg rebase --stop
1920 1920 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1921 1921 o 7:7fffad344617 test
1922 1922 | c
1923 1923 |
1924 1924 o 6:b15528633407 test
1925 1925 | b
1926 1926 |
1927 1927 o 5:00bfc9898aeb test
1928 1928 | conflict with d
1929 1929 |
1930 1930 o 4:dafd40200f93 test
1931 1931 | f
1932 1932 |
1933 1933 | @ 3:055a42cdd887 test
1934 1934 | | d
1935 1935 | |
1936 1936 | o 2:177f92b77385 test
1937 1937 | | c
1938 1938 | |
1939 1939 | o 1:d2ae7f538514 test
1940 1940 |/ b
1941 1941 |
1942 1942 o 0:cb9a9f314b8b test
1943 1943 a
1944 1944
1945 1945 Test --stop aborts when --collapse was passed:
1946 1946 =============================================
1947 1947 $ cat >> $HGRCPATH << EOF
1948 1948 > [experimental]
1949 1949 > evolution.allowunstable=True
1950 1950 > EOF
1951 1951
1952 1952 $ hg strip 6
1953 1953 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1954 1954 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1955 1955 o 5:00bfc9898aeb test
1956 1956 | conflict with d
1957 1957 |
1958 1958 o 4:dafd40200f93 test
1959 1959 | f
1960 1960 |
1961 1961 | @ 3:055a42cdd887 test
1962 1962 | | d
1963 1963 | |
1964 1964 | o 2:177f92b77385 test
1965 1965 | | c
1966 1966 | |
1967 1967 | o 1:d2ae7f538514 test
1968 1968 |/ b
1969 1969 |
1970 1970 o 0:cb9a9f314b8b test
1971 1971 a
1972 1972
1973 1973 $ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d"
1974 1974 rebasing 1:d2ae7f538514 "b"
1975 1975 rebasing 2:177f92b77385 "c"
1976 1976 rebasing 3:055a42cdd887 "d"
1977 1977 merging d
1978 1978 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1979 1979 unresolved conflicts (see hg resolve, then hg rebase --continue)
1980 1980 [1]
1981 1981 $ hg rebase --stop
1982 1982 abort: cannot stop in --collapse session
1983 1983 [255]
1984 1984 $ hg rebase --abort
1985 1985 rebase aborted
1986 1986 $ hg diff
1987 1987 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1988 1988 o 5:00bfc9898aeb test
1989 1989 | conflict with d
1990 1990 |
1991 1991 o 4:dafd40200f93 test
1992 1992 | f
1993 1993 |
1994 1994 | @ 3:055a42cdd887 test
1995 1995 | | d
1996 1996 | |
1997 1997 | o 2:177f92b77385 test
1998 1998 | | c
1999 1999 | |
2000 2000 | o 1:d2ae7f538514 test
2001 2001 |/ b
2002 2002 |
2003 2003 o 0:cb9a9f314b8b test
2004 2004 a
2005 2005
2006 2006 Test --stop raise errors with conflicting options:
2007 2007 =================================================
2008 2008 $ hg rebase -s 3 -d 5
2009 2009 rebasing 3:055a42cdd887 "d"
2010 2010 merging d
2011 2011 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2012 2012 unresolved conflicts (see hg resolve, then hg rebase --continue)
2013 2013 [1]
2014 2014 $ hg rebase --stop --dry-run
2015 2015 abort: cannot use --stop with --dry-run or --confirm
2016 2016 [255]
2017 2017
2018 2018 $ hg rebase -s 3 -d 5
2019 2019 abort: rebase in progress
2020 2020 (use 'hg rebase --continue' or 'hg rebase --abort')
2021 2021 [255]
2022 2022 $ hg rebase --stop --continue
2023 2023 abort: cannot use --stop with --abort or --continue
2024 2024 [255]
2025
2026 Test --stop moves bookmarks of original revisions to new rebased nodes:
2027 ======================================================================
2028 $ cd ..
2029 $ hg init repo
2030 $ cd repo
2031
2032 $ echo a > a
2033 $ hg ci -Am A
2034 adding a
2035
2036 $ echo b > b
2037 $ hg ci -Am B
2038 adding b
2039 $ hg book X
2040 $ hg book Y
2041
2042 $ echo c > c
2043 $ hg ci -Am C
2044 adding c
2045 $ hg book Z
2046
2047 $ echo d > d
2048 $ hg ci -Am D
2049 adding d
2050
2051 $ hg up 0 -q
2052 $ echo e > e
2053 $ hg ci -Am E
2054 adding e
2055 created new head
2056
2057 $ echo doubt > d
2058 $ hg ci -Am "conflict with d"
2059 adding d
2060
2061 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2062 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2063 |
2064 o 4: 9c1e55f411b6 'E' bookmarks:
2065 |
2066 | o 3: 67a385d4e6f2 'D' bookmarks: Z
2067 | |
2068 | o 2: 49cb3485fa0c 'C' bookmarks: Y
2069 | |
2070 | o 1: 6c81ed0049f8 'B' bookmarks: X
2071 |/
2072 o 0: 1994f17a630e 'A' bookmarks:
2073
2074 $ hg rebase -s 1 -d 5
2075 rebasing 1:6c81ed0049f8 "B" (X)
2076 rebasing 2:49cb3485fa0c "C" (Y)
2077 rebasing 3:67a385d4e6f2 "D" (Z)
2078 merging d
2079 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2080 unresolved conflicts (see hg resolve, then hg rebase --continue)
2081 [1]
2082 $ hg rebase --stop
2083 1 new orphan changesets
2084 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2085 o 7: 9c86c650b686 'C' bookmarks: Y
2086 |
2087 o 6: 9b87b54e5fd8 'B' bookmarks: X
2088 |
2089 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2090 |
2091 o 4: 9c1e55f411b6 'E' bookmarks:
2092 |
2093 | * 3: 67a385d4e6f2 'D' bookmarks: Z
2094 | |
2095 | x 2: 49cb3485fa0c 'C' bookmarks:
2096 | |
2097 | x 1: 6c81ed0049f8 'B' bookmarks:
2098 |/
2099 o 0: 1994f17a630e 'A' bookmarks:
2100
General Comments 0
You need to be logged in to leave comments. Login now