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