##// END OF EJS Templates
tests: have a more elaborated test for _destrebase...
Pierre-Yves David -
r28135:ecfa8244 default
parent child Browse files
Show More
@@ -1,773 +1,830 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 >
4 >
5 > [phases]
5 > [phases]
6 > publish=False
6 > publish=False
7 >
7 >
8 > [alias]
8 > [alias]
9 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
9 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
10 > EOF
10 > EOF
11
11
12
12
13 $ hg init a
13 $ hg init a
14 $ cd a
14 $ cd a
15 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
15 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
16 adding changesets
16 adding changesets
17 adding manifests
17 adding manifests
18 adding file changes
18 adding file changes
19 added 8 changesets with 7 changes to 7 files (+2 heads)
19 added 8 changesets with 7 changes to 7 files (+2 heads)
20 (run 'hg heads' to see heads, 'hg merge' to merge)
20 (run 'hg heads' to see heads, 'hg merge' to merge)
21 $ hg up tip
21 $ hg up tip
22 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 $ cd ..
23 $ cd ..
24
24
25
25
26 Rebasing
26 Rebasing
27 D onto H - simple rebase:
27 D onto H - simple rebase:
28 (this also tests that editor is invoked if '--edit' is specified, and that we
28 (this also tests that editor is invoked if '--edit' is specified, and that we
29 can abort or warn for colliding untracked files)
29 can abort or warn for colliding untracked files)
30
30
31 $ hg clone -q -u . a a1
31 $ hg clone -q -u . a a1
32 $ cd a1
32 $ cd a1
33
33
34 $ hg tglog
34 $ hg tglog
35 @ 7: 'H'
35 @ 7: 'H'
36 |
36 |
37 | o 6: 'G'
37 | o 6: 'G'
38 |/|
38 |/|
39 o | 5: 'F'
39 o | 5: 'F'
40 | |
40 | |
41 | o 4: 'E'
41 | o 4: 'E'
42 |/
42 |/
43 | o 3: 'D'
43 | o 3: 'D'
44 | |
44 | |
45 | o 2: 'C'
45 | o 2: 'C'
46 | |
46 | |
47 | o 1: 'B'
47 | o 1: 'B'
48 |/
48 |/
49 o 0: 'A'
49 o 0: 'A'
50
50
51
51
52 $ hg status --rev "3^1" --rev 3
52 $ hg status --rev "3^1" --rev 3
53 A D
53 A D
54 $ echo collide > D
54 $ echo collide > D
55 $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit --config merge.checkunknown=warn
55 $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit --config merge.checkunknown=warn
56 rebasing 3:32af7686d403 "D"
56 rebasing 3:32af7686d403 "D"
57 D: replacing untracked file
57 D: replacing untracked file
58 D
58 D
59
59
60
60
61 HG: Enter commit message. Lines beginning with 'HG:' are removed.
61 HG: Enter commit message. Lines beginning with 'HG:' are removed.
62 HG: Leave message empty to abort commit.
62 HG: Leave message empty to abort commit.
63 HG: --
63 HG: --
64 HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com>
64 HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com>
65 HG: branch 'default'
65 HG: branch 'default'
66 HG: added D
66 HG: added D
67 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob)
67 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob)
68 $ cat D.orig
68 $ cat D.orig
69 collide
69 collide
70 $ rm D.orig
70 $ rm D.orig
71
71
72 $ hg tglog
72 $ hg tglog
73 o 7: 'D'
73 o 7: 'D'
74 |
74 |
75 @ 6: 'H'
75 @ 6: 'H'
76 |
76 |
77 | o 5: 'G'
77 | o 5: 'G'
78 |/|
78 |/|
79 o | 4: 'F'
79 o | 4: 'F'
80 | |
80 | |
81 | o 3: 'E'
81 | o 3: 'E'
82 |/
82 |/
83 | o 2: 'C'
83 | o 2: 'C'
84 | |
84 | |
85 | o 1: 'B'
85 | o 1: 'B'
86 |/
86 |/
87 o 0: 'A'
87 o 0: 'A'
88
88
89 $ cd ..
89 $ cd ..
90
90
91
91
92 D onto F - intermediate point:
92 D onto F - intermediate point:
93 (this also tests that editor is not invoked if '--edit' is not specified, and
93 (this also tests that editor is not invoked if '--edit' is not specified, and
94 that we can ignore for colliding untracked files)
94 that we can ignore for colliding untracked files)
95
95
96 $ hg clone -q -u . a a2
96 $ hg clone -q -u . a a2
97 $ cd a2
97 $ cd a2
98 $ echo collide > D
98 $ echo collide > D
99
99
100 $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore
100 $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore
101 rebasing 3:32af7686d403 "D"
101 rebasing 3:32af7686d403 "D"
102 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob)
102 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob)
103 $ cat D.orig
103 $ cat D.orig
104 collide
104 collide
105 $ rm D.orig
105 $ rm D.orig
106
106
107 $ hg tglog
107 $ hg tglog
108 o 7: 'D'
108 o 7: 'D'
109 |
109 |
110 | @ 6: 'H'
110 | @ 6: 'H'
111 |/
111 |/
112 | o 5: 'G'
112 | o 5: 'G'
113 |/|
113 |/|
114 o | 4: 'F'
114 o | 4: 'F'
115 | |
115 | |
116 | o 3: 'E'
116 | o 3: 'E'
117 |/
117 |/
118 | o 2: 'C'
118 | o 2: 'C'
119 | |
119 | |
120 | o 1: 'B'
120 | o 1: 'B'
121 |/
121 |/
122 o 0: 'A'
122 o 0: 'A'
123
123
124 $ cd ..
124 $ cd ..
125
125
126
126
127 E onto H - skip of G:
127 E onto H - skip of G:
128 (this also tests that we can overwrite untracked files and don't create backups
128 (this also tests that we can overwrite untracked files and don't create backups
129 if they have the same contents)
129 if they have the same contents)
130
130
131 $ hg clone -q -u . a a3
131 $ hg clone -q -u . a a3
132 $ cd a3
132 $ cd a3
133 $ hg cat -r 4 E | tee E
133 $ hg cat -r 4 E | tee E
134 E
134 E
135
135
136 $ hg rebase -s 4 -d 7
136 $ hg rebase -s 4 -d 7
137 rebasing 4:9520eea781bc "E"
137 rebasing 4:9520eea781bc "E"
138 rebasing 6:eea13746799a "G"
138 rebasing 6:eea13746799a "G"
139 note: rebase of 6:eea13746799a created no changes to commit
139 note: rebase of 6:eea13746799a created no changes to commit
140 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-backup.hg (glob)
140 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-backup.hg (glob)
141 $ f E.orig
141 $ f E.orig
142 E.orig: file not found
142 E.orig: file not found
143
143
144 $ hg tglog
144 $ hg tglog
145 o 6: 'E'
145 o 6: 'E'
146 |
146 |
147 @ 5: 'H'
147 @ 5: 'H'
148 |
148 |
149 o 4: 'F'
149 o 4: 'F'
150 |
150 |
151 | o 3: 'D'
151 | o 3: 'D'
152 | |
152 | |
153 | o 2: 'C'
153 | o 2: 'C'
154 | |
154 | |
155 | o 1: 'B'
155 | o 1: 'B'
156 |/
156 |/
157 o 0: 'A'
157 o 0: 'A'
158
158
159 $ cd ..
159 $ cd ..
160
160
161
161
162 F onto E - rebase of a branching point (skip G):
162 F onto E - rebase of a branching point (skip G):
163
163
164 $ hg clone -q -u . a a4
164 $ hg clone -q -u . a a4
165 $ cd a4
165 $ cd a4
166
166
167 $ hg rebase -s 5 -d 4
167 $ hg rebase -s 5 -d 4
168 rebasing 5:24b6387c8c8c "F"
168 rebasing 5:24b6387c8c8c "F"
169 rebasing 6:eea13746799a "G"
169 rebasing 6:eea13746799a "G"
170 note: rebase of 6:eea13746799a created no changes to commit
170 note: rebase of 6:eea13746799a created no changes to commit
171 rebasing 7:02de42196ebe "H" (tip)
171 rebasing 7:02de42196ebe "H" (tip)
172 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/24b6387c8c8c-c3fe765d-backup.hg (glob)
172 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/24b6387c8c8c-c3fe765d-backup.hg (glob)
173
173
174 $ hg tglog
174 $ hg tglog
175 @ 6: 'H'
175 @ 6: 'H'
176 |
176 |
177 o 5: 'F'
177 o 5: 'F'
178 |
178 |
179 o 4: 'E'
179 o 4: 'E'
180 |
180 |
181 | o 3: 'D'
181 | o 3: 'D'
182 | |
182 | |
183 | o 2: 'C'
183 | o 2: 'C'
184 | |
184 | |
185 | o 1: 'B'
185 | o 1: 'B'
186 |/
186 |/
187 o 0: 'A'
187 o 0: 'A'
188
188
189 $ cd ..
189 $ cd ..
190
190
191
191
192 G onto H - merged revision having a parent in ancestors of target:
192 G onto H - merged revision having a parent in ancestors of target:
193
193
194 $ hg clone -q -u . a a5
194 $ hg clone -q -u . a a5
195 $ cd a5
195 $ cd a5
196
196
197 $ hg rebase -s 6 -d 7
197 $ hg rebase -s 6 -d 7
198 rebasing 6:eea13746799a "G"
198 rebasing 6:eea13746799a "G"
199 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/eea13746799a-883828ed-backup.hg (glob)
199 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/eea13746799a-883828ed-backup.hg (glob)
200
200
201 $ hg tglog
201 $ hg tglog
202 o 7: 'G'
202 o 7: 'G'
203 |\
203 |\
204 | @ 6: 'H'
204 | @ 6: 'H'
205 | |
205 | |
206 | o 5: 'F'
206 | o 5: 'F'
207 | |
207 | |
208 o | 4: 'E'
208 o | 4: 'E'
209 |/
209 |/
210 | o 3: 'D'
210 | o 3: 'D'
211 | |
211 | |
212 | o 2: 'C'
212 | o 2: 'C'
213 | |
213 | |
214 | o 1: 'B'
214 | o 1: 'B'
215 |/
215 |/
216 o 0: 'A'
216 o 0: 'A'
217
217
218 $ cd ..
218 $ cd ..
219
219
220
220
221 F onto B - G maintains E as parent:
221 F onto B - G maintains E as parent:
222
222
223 $ hg clone -q -u . a a6
223 $ hg clone -q -u . a a6
224 $ cd a6
224 $ cd a6
225
225
226 $ hg rebase -s 5 -d 1
226 $ hg rebase -s 5 -d 1
227 rebasing 5:24b6387c8c8c "F"
227 rebasing 5:24b6387c8c8c "F"
228 rebasing 6:eea13746799a "G"
228 rebasing 6:eea13746799a "G"
229 rebasing 7:02de42196ebe "H" (tip)
229 rebasing 7:02de42196ebe "H" (tip)
230 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/24b6387c8c8c-c3fe765d-backup.hg (glob)
230 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/24b6387c8c8c-c3fe765d-backup.hg (glob)
231
231
232 $ hg tglog
232 $ hg tglog
233 @ 7: 'H'
233 @ 7: 'H'
234 |
234 |
235 | o 6: 'G'
235 | o 6: 'G'
236 |/|
236 |/|
237 o | 5: 'F'
237 o | 5: 'F'
238 | |
238 | |
239 | o 4: 'E'
239 | o 4: 'E'
240 | |
240 | |
241 | | o 3: 'D'
241 | | o 3: 'D'
242 | | |
242 | | |
243 +---o 2: 'C'
243 +---o 2: 'C'
244 | |
244 | |
245 o | 1: 'B'
245 o | 1: 'B'
246 |/
246 |/
247 o 0: 'A'
247 o 0: 'A'
248
248
249 $ cd ..
249 $ cd ..
250
250
251
251
252 These will fail (using --source):
252 These will fail (using --source):
253
253
254 G onto F - rebase onto an ancestor:
254 G onto F - rebase onto an ancestor:
255
255
256 $ hg clone -q -u . a a7
256 $ hg clone -q -u . a a7
257 $ cd a7
257 $ cd a7
258
258
259 $ hg rebase -s 6 -d 5
259 $ hg rebase -s 6 -d 5
260 nothing to rebase
260 nothing to rebase
261 [1]
261 [1]
262
262
263 F onto G - rebase onto a descendant:
263 F onto G - rebase onto a descendant:
264
264
265 $ hg rebase -s 5 -d 6
265 $ hg rebase -s 5 -d 6
266 abort: source is ancestor of destination
266 abort: source is ancestor of destination
267 [255]
267 [255]
268
268
269 G onto B - merge revision with both parents not in ancestors of target:
269 G onto B - merge revision with both parents not in ancestors of target:
270
270
271 $ hg rebase -s 6 -d 1
271 $ hg rebase -s 6 -d 1
272 rebasing 6:eea13746799a "G"
272 rebasing 6:eea13746799a "G"
273 abort: cannot use revision 6 as base, result would have 3 parents
273 abort: cannot use revision 6 as base, result would have 3 parents
274 [255]
274 [255]
275
275
276
276
277 These will abort gracefully (using --base):
277 These will abort gracefully (using --base):
278
278
279 G onto G - rebase onto same changeset:
279 G onto G - rebase onto same changeset:
280
280
281 $ hg rebase -b 6 -d 6
281 $ hg rebase -b 6 -d 6
282 nothing to rebase - eea13746799a is both "base" and destination
282 nothing to rebase - eea13746799a is both "base" and destination
283 [1]
283 [1]
284
284
285 G onto F - rebase onto an ancestor:
285 G onto F - rebase onto an ancestor:
286
286
287 $ hg rebase -b 6 -d 5
287 $ hg rebase -b 6 -d 5
288 nothing to rebase
288 nothing to rebase
289 [1]
289 [1]
290
290
291 F onto G - rebase onto a descendant:
291 F onto G - rebase onto a descendant:
292
292
293 $ hg rebase -b 5 -d 6
293 $ hg rebase -b 5 -d 6
294 nothing to rebase - "base" 24b6387c8c8c is already an ancestor of destination eea13746799a
294 nothing to rebase - "base" 24b6387c8c8c is already an ancestor of destination eea13746799a
295 [1]
295 [1]
296
296
297 C onto A - rebase onto an ancestor:
297 C onto A - rebase onto an ancestor:
298
298
299 $ hg rebase -d 0 -s 2
299 $ hg rebase -d 0 -s 2
300 rebasing 2:5fddd98957c8 "C"
300 rebasing 2:5fddd98957c8 "C"
301 rebasing 3:32af7686d403 "D"
301 rebasing 3:32af7686d403 "D"
302 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-backup.hg (glob)
302 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-backup.hg (glob)
303 $ hg tglog
303 $ hg tglog
304 o 7: 'D'
304 o 7: 'D'
305 |
305 |
306 o 6: 'C'
306 o 6: 'C'
307 |
307 |
308 | @ 5: 'H'
308 | @ 5: 'H'
309 | |
309 | |
310 | | o 4: 'G'
310 | | o 4: 'G'
311 | |/|
311 | |/|
312 | o | 3: 'F'
312 | o | 3: 'F'
313 |/ /
313 |/ /
314 | o 2: 'E'
314 | o 2: 'E'
315 |/
315 |/
316 | o 1: 'B'
316 | o 1: 'B'
317 |/
317 |/
318 o 0: 'A'
318 o 0: 'A'
319
319
320
320
321 Check rebasing public changeset
321 Check rebasing public changeset
322
322
323 $ hg pull --config phases.publish=True -q -r 6 . # update phase of 6
323 $ hg pull --config phases.publish=True -q -r 6 . # update phase of 6
324 $ hg rebase -d 0 -b 6
324 $ hg rebase -d 0 -b 6
325 nothing to rebase
325 nothing to rebase
326 [1]
326 [1]
327 $ hg rebase -d 5 -b 6
327 $ hg rebase -d 5 -b 6
328 abort: can't rebase public changeset e1c4361dd923
328 abort: can't rebase public changeset e1c4361dd923
329 (see "hg help phases" for details)
329 (see "hg help phases" for details)
330 [255]
330 [255]
331
331
332 $ hg rebase -d 5 -b 6 --keep
332 $ hg rebase -d 5 -b 6 --keep
333 rebasing 6:e1c4361dd923 "C"
333 rebasing 6:e1c4361dd923 "C"
334 rebasing 7:c9659aac0000 "D" (tip)
334 rebasing 7:c9659aac0000 "D" (tip)
335
335
336 Check rebasing mutable changeset
336 Check rebasing mutable changeset
337 Source phase greater or equal to destination phase: new changeset get the phase of source:
337 Source phase greater or equal to destination phase: new changeset get the phase of source:
338 $ hg id -n
338 $ hg id -n
339 5
339 5
340 $ hg rebase -s9 -d0
340 $ hg rebase -s9 -d0
341 rebasing 9:2b23e52411f4 "D" (tip)
341 rebasing 9:2b23e52411f4 "D" (tip)
342 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-backup.hg (glob)
342 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-backup.hg (glob)
343 $ hg id -n # check we updated back to parent
343 $ hg id -n # check we updated back to parent
344 5
344 5
345 $ hg log --template "{phase}\n" -r 9
345 $ hg log --template "{phase}\n" -r 9
346 draft
346 draft
347 $ hg rebase -s9 -d1
347 $ hg rebase -s9 -d1
348 rebasing 9:2cb10d0cfc6c "D" (tip)
348 rebasing 9:2cb10d0cfc6c "D" (tip)
349 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-backup.hg (glob)
349 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-backup.hg (glob)
350 $ hg log --template "{phase}\n" -r 9
350 $ hg log --template "{phase}\n" -r 9
351 draft
351 draft
352 $ hg phase --force --secret 9
352 $ hg phase --force --secret 9
353 $ hg rebase -s9 -d0
353 $ hg rebase -s9 -d0
354 rebasing 9:c5b12b67163a "D" (tip)
354 rebasing 9:c5b12b67163a "D" (tip)
355 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-backup.hg (glob)
355 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-backup.hg (glob)
356 $ hg log --template "{phase}\n" -r 9
356 $ hg log --template "{phase}\n" -r 9
357 secret
357 secret
358 $ hg rebase -s9 -d1
358 $ hg rebase -s9 -d1
359 rebasing 9:2a0524f868ac "D" (tip)
359 rebasing 9:2a0524f868ac "D" (tip)
360 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-backup.hg (glob)
360 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-backup.hg (glob)
361 $ hg log --template "{phase}\n" -r 9
361 $ hg log --template "{phase}\n" -r 9
362 secret
362 secret
363 Source phase lower than destination phase: new changeset get the phase of destination:
363 Source phase lower than destination phase: new changeset get the phase of destination:
364 $ hg rebase -s8 -d9
364 $ hg rebase -s8 -d9
365 rebasing 8:6d4f22462821 "C"
365 rebasing 8:6d4f22462821 "C"
366 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-backup.hg (glob)
366 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-backup.hg (glob)
367 $ hg log --template "{phase}\n" -r 'rev(9)'
367 $ hg log --template "{phase}\n" -r 'rev(9)'
368 secret
368 secret
369
369
370 $ cd ..
370 $ cd ..
371
371
372 Test for revset
372 Test for revset
373
373
374 We need a bit different graph
374 We need a bit different graph
375 All destination are B
375 All destination are B
376
376
377 $ hg init ah
377 $ hg init ah
378 $ cd ah
378 $ cd ah
379 $ hg unbundle "$TESTDIR/bundles/rebase-revset.hg"
379 $ hg unbundle "$TESTDIR/bundles/rebase-revset.hg"
380 adding changesets
380 adding changesets
381 adding manifests
381 adding manifests
382 adding file changes
382 adding file changes
383 added 9 changesets with 9 changes to 9 files (+2 heads)
383 added 9 changesets with 9 changes to 9 files (+2 heads)
384 (run 'hg heads' to see heads, 'hg merge' to merge)
384 (run 'hg heads' to see heads, 'hg merge' to merge)
385 $ hg tglog
385 $ hg tglog
386 o 8: 'I'
386 o 8: 'I'
387 |
387 |
388 o 7: 'H'
388 o 7: 'H'
389 |
389 |
390 o 6: 'G'
390 o 6: 'G'
391 |
391 |
392 | o 5: 'F'
392 | o 5: 'F'
393 | |
393 | |
394 | o 4: 'E'
394 | o 4: 'E'
395 |/
395 |/
396 o 3: 'D'
396 o 3: 'D'
397 |
397 |
398 o 2: 'C'
398 o 2: 'C'
399 |
399 |
400 | o 1: 'B'
400 | o 1: 'B'
401 |/
401 |/
402 o 0: 'A'
402 o 0: 'A'
403
403
404 $ cd ..
404 $ cd ..
405
405
406
406
407 Simple case with keep:
407 Simple case with keep:
408
408
409 Source on have two descendant heads but ask for one
409 Source on have two descendant heads but ask for one
410
410
411 $ hg clone -q -u . ah ah1
411 $ hg clone -q -u . ah ah1
412 $ cd ah1
412 $ cd ah1
413 $ hg rebase -r '2::8' -d 1
413 $ hg rebase -r '2::8' -d 1
414 abort: can't remove original changesets with unrebased descendants
414 abort: can't remove original changesets with unrebased descendants
415 (use --keep to keep original changesets)
415 (use --keep to keep original changesets)
416 [255]
416 [255]
417 $ hg rebase -r '2::8' -d 1 -k
417 $ hg rebase -r '2::8' -d 1 -k
418 rebasing 2:c9e50f6cdc55 "C"
418 rebasing 2:c9e50f6cdc55 "C"
419 rebasing 3:ffd453c31098 "D"
419 rebasing 3:ffd453c31098 "D"
420 rebasing 6:3d8a618087a7 "G"
420 rebasing 6:3d8a618087a7 "G"
421 rebasing 7:72434a4e60b0 "H"
421 rebasing 7:72434a4e60b0 "H"
422 rebasing 8:479ddb54a924 "I" (tip)
422 rebasing 8:479ddb54a924 "I" (tip)
423 $ hg tglog
423 $ hg tglog
424 o 13: 'I'
424 o 13: 'I'
425 |
425 |
426 o 12: 'H'
426 o 12: 'H'
427 |
427 |
428 o 11: 'G'
428 o 11: 'G'
429 |
429 |
430 o 10: 'D'
430 o 10: 'D'
431 |
431 |
432 o 9: 'C'
432 o 9: 'C'
433 |
433 |
434 | o 8: 'I'
434 | o 8: 'I'
435 | |
435 | |
436 | o 7: 'H'
436 | o 7: 'H'
437 | |
437 | |
438 | o 6: 'G'
438 | o 6: 'G'
439 | |
439 | |
440 | | o 5: 'F'
440 | | o 5: 'F'
441 | | |
441 | | |
442 | | o 4: 'E'
442 | | o 4: 'E'
443 | |/
443 | |/
444 | o 3: 'D'
444 | o 3: 'D'
445 | |
445 | |
446 | o 2: 'C'
446 | o 2: 'C'
447 | |
447 | |
448 o | 1: 'B'
448 o | 1: 'B'
449 |/
449 |/
450 o 0: 'A'
450 o 0: 'A'
451
451
452
452
453 $ cd ..
453 $ cd ..
454
454
455 Base on have one descendant heads we ask for but common ancestor have two
455 Base on have one descendant heads we ask for but common ancestor have two
456
456
457 $ hg clone -q -u . ah ah2
457 $ hg clone -q -u . ah ah2
458 $ cd ah2
458 $ cd ah2
459 $ hg rebase -r '3::8' -d 1
459 $ hg rebase -r '3::8' -d 1
460 abort: can't remove original changesets with unrebased descendants
460 abort: can't remove original changesets with unrebased descendants
461 (use --keep to keep original changesets)
461 (use --keep to keep original changesets)
462 [255]
462 [255]
463 $ hg rebase -r '3::8' -d 1 --keep
463 $ hg rebase -r '3::8' -d 1 --keep
464 rebasing 3:ffd453c31098 "D"
464 rebasing 3:ffd453c31098 "D"
465 rebasing 6:3d8a618087a7 "G"
465 rebasing 6:3d8a618087a7 "G"
466 rebasing 7:72434a4e60b0 "H"
466 rebasing 7:72434a4e60b0 "H"
467 rebasing 8:479ddb54a924 "I" (tip)
467 rebasing 8:479ddb54a924 "I" (tip)
468 $ hg tglog
468 $ hg tglog
469 o 12: 'I'
469 o 12: 'I'
470 |
470 |
471 o 11: 'H'
471 o 11: 'H'
472 |
472 |
473 o 10: 'G'
473 o 10: 'G'
474 |
474 |
475 o 9: 'D'
475 o 9: 'D'
476 |
476 |
477 | o 8: 'I'
477 | o 8: 'I'
478 | |
478 | |
479 | o 7: 'H'
479 | o 7: 'H'
480 | |
480 | |
481 | o 6: 'G'
481 | o 6: 'G'
482 | |
482 | |
483 | | o 5: 'F'
483 | | o 5: 'F'
484 | | |
484 | | |
485 | | o 4: 'E'
485 | | o 4: 'E'
486 | |/
486 | |/
487 | o 3: 'D'
487 | o 3: 'D'
488 | |
488 | |
489 | o 2: 'C'
489 | o 2: 'C'
490 | |
490 | |
491 o | 1: 'B'
491 o | 1: 'B'
492 |/
492 |/
493 o 0: 'A'
493 o 0: 'A'
494
494
495
495
496 $ cd ..
496 $ cd ..
497
497
498 rebase subset
498 rebase subset
499
499
500 $ hg clone -q -u . ah ah3
500 $ hg clone -q -u . ah ah3
501 $ cd ah3
501 $ cd ah3
502 $ hg rebase -r '3::7' -d 1
502 $ hg rebase -r '3::7' -d 1
503 abort: can't remove original changesets with unrebased descendants
503 abort: can't remove original changesets with unrebased descendants
504 (use --keep to keep original changesets)
504 (use --keep to keep original changesets)
505 [255]
505 [255]
506 $ hg rebase -r '3::7' -d 1 --keep
506 $ hg rebase -r '3::7' -d 1 --keep
507 rebasing 3:ffd453c31098 "D"
507 rebasing 3:ffd453c31098 "D"
508 rebasing 6:3d8a618087a7 "G"
508 rebasing 6:3d8a618087a7 "G"
509 rebasing 7:72434a4e60b0 "H"
509 rebasing 7:72434a4e60b0 "H"
510 $ hg tglog
510 $ hg tglog
511 o 11: 'H'
511 o 11: 'H'
512 |
512 |
513 o 10: 'G'
513 o 10: 'G'
514 |
514 |
515 o 9: 'D'
515 o 9: 'D'
516 |
516 |
517 | o 8: 'I'
517 | o 8: 'I'
518 | |
518 | |
519 | o 7: 'H'
519 | o 7: 'H'
520 | |
520 | |
521 | o 6: 'G'
521 | o 6: 'G'
522 | |
522 | |
523 | | o 5: 'F'
523 | | o 5: 'F'
524 | | |
524 | | |
525 | | o 4: 'E'
525 | | o 4: 'E'
526 | |/
526 | |/
527 | o 3: 'D'
527 | o 3: 'D'
528 | |
528 | |
529 | o 2: 'C'
529 | o 2: 'C'
530 | |
530 | |
531 o | 1: 'B'
531 o | 1: 'B'
532 |/
532 |/
533 o 0: 'A'
533 o 0: 'A'
534
534
535
535
536 $ cd ..
536 $ cd ..
537
537
538 rebase subset with multiple head
538 rebase subset with multiple head
539
539
540 $ hg clone -q -u . ah ah4
540 $ hg clone -q -u . ah ah4
541 $ cd ah4
541 $ cd ah4
542 $ hg rebase -r '3::(7+5)' -d 1
542 $ hg rebase -r '3::(7+5)' -d 1
543 abort: can't remove original changesets with unrebased descendants
543 abort: can't remove original changesets with unrebased descendants
544 (use --keep to keep original changesets)
544 (use --keep to keep original changesets)
545 [255]
545 [255]
546 $ hg rebase -r '3::(7+5)' -d 1 --keep
546 $ hg rebase -r '3::(7+5)' -d 1 --keep
547 rebasing 3:ffd453c31098 "D"
547 rebasing 3:ffd453c31098 "D"
548 rebasing 4:c01897464e7f "E"
548 rebasing 4:c01897464e7f "E"
549 rebasing 5:41bfcc75ed73 "F"
549 rebasing 5:41bfcc75ed73 "F"
550 rebasing 6:3d8a618087a7 "G"
550 rebasing 6:3d8a618087a7 "G"
551 rebasing 7:72434a4e60b0 "H"
551 rebasing 7:72434a4e60b0 "H"
552 $ hg tglog
552 $ hg tglog
553 o 13: 'H'
553 o 13: 'H'
554 |
554 |
555 o 12: 'G'
555 o 12: 'G'
556 |
556 |
557 | o 11: 'F'
557 | o 11: 'F'
558 | |
558 | |
559 | o 10: 'E'
559 | o 10: 'E'
560 |/
560 |/
561 o 9: 'D'
561 o 9: 'D'
562 |
562 |
563 | o 8: 'I'
563 | o 8: 'I'
564 | |
564 | |
565 | o 7: 'H'
565 | o 7: 'H'
566 | |
566 | |
567 | o 6: 'G'
567 | o 6: 'G'
568 | |
568 | |
569 | | o 5: 'F'
569 | | o 5: 'F'
570 | | |
570 | | |
571 | | o 4: 'E'
571 | | o 4: 'E'
572 | |/
572 | |/
573 | o 3: 'D'
573 | o 3: 'D'
574 | |
574 | |
575 | o 2: 'C'
575 | o 2: 'C'
576 | |
576 | |
577 o | 1: 'B'
577 o | 1: 'B'
578 |/
578 |/
579 o 0: 'A'
579 o 0: 'A'
580
580
581
581
582 $ cd ..
582 $ cd ..
583
583
584 More advanced tests
584 More advanced tests
585
585
586 rebase on ancestor with revset
586 rebase on ancestor with revset
587
587
588 $ hg clone -q -u . ah ah5
588 $ hg clone -q -u . ah ah5
589 $ cd ah5
589 $ cd ah5
590 $ hg rebase -r '6::' -d 2
590 $ hg rebase -r '6::' -d 2
591 rebasing 6:3d8a618087a7 "G"
591 rebasing 6:3d8a618087a7 "G"
592 rebasing 7:72434a4e60b0 "H"
592 rebasing 7:72434a4e60b0 "H"
593 rebasing 8:479ddb54a924 "I" (tip)
593 rebasing 8:479ddb54a924 "I" (tip)
594 saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-backup.hg (glob)
594 saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-backup.hg (glob)
595 $ hg tglog
595 $ hg tglog
596 o 8: 'I'
596 o 8: 'I'
597 |
597 |
598 o 7: 'H'
598 o 7: 'H'
599 |
599 |
600 o 6: 'G'
600 o 6: 'G'
601 |
601 |
602 | o 5: 'F'
602 | o 5: 'F'
603 | |
603 | |
604 | o 4: 'E'
604 | o 4: 'E'
605 | |
605 | |
606 | o 3: 'D'
606 | o 3: 'D'
607 |/
607 |/
608 o 2: 'C'
608 o 2: 'C'
609 |
609 |
610 | o 1: 'B'
610 | o 1: 'B'
611 |/
611 |/
612 o 0: 'A'
612 o 0: 'A'
613
613
614 $ cd ..
614 $ cd ..
615
615
616
616
617 rebase with multiple root.
617 rebase with multiple root.
618 We rebase E and G on B
618 We rebase E and G on B
619 We would expect heads are I, F if it was supported
619 We would expect heads are I, F if it was supported
620
620
621 $ hg clone -q -u . ah ah6
621 $ hg clone -q -u . ah ah6
622 $ cd ah6
622 $ cd ah6
623 $ hg rebase -r '(4+6)::' -d 1
623 $ hg rebase -r '(4+6)::' -d 1
624 rebasing 4:c01897464e7f "E"
624 rebasing 4:c01897464e7f "E"
625 rebasing 5:41bfcc75ed73 "F"
625 rebasing 5:41bfcc75ed73 "F"
626 rebasing 6:3d8a618087a7 "G"
626 rebasing 6:3d8a618087a7 "G"
627 rebasing 7:72434a4e60b0 "H"
627 rebasing 7:72434a4e60b0 "H"
628 rebasing 8:479ddb54a924 "I" (tip)
628 rebasing 8:479ddb54a924 "I" (tip)
629 saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-backup.hg (glob)
629 saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-backup.hg (glob)
630 $ hg tglog
630 $ hg tglog
631 o 8: 'I'
631 o 8: 'I'
632 |
632 |
633 o 7: 'H'
633 o 7: 'H'
634 |
634 |
635 o 6: 'G'
635 o 6: 'G'
636 |
636 |
637 | o 5: 'F'
637 | o 5: 'F'
638 | |
638 | |
639 | o 4: 'E'
639 | o 4: 'E'
640 |/
640 |/
641 | o 3: 'D'
641 | o 3: 'D'
642 | |
642 | |
643 | o 2: 'C'
643 | o 2: 'C'
644 | |
644 | |
645 o | 1: 'B'
645 o | 1: 'B'
646 |/
646 |/
647 o 0: 'A'
647 o 0: 'A'
648
648
649 $ cd ..
649 $ cd ..
650
650
651 More complex rebase with multiple roots
651 More complex rebase with multiple roots
652 each root have a different common ancestor with the destination and this is a detach
652 each root have a different common ancestor with the destination and this is a detach
653
653
654 (setup)
654 (setup)
655
655
656 $ hg clone -q -u . a a8
656 $ hg clone -q -u . a a8
657 $ cd a8
657 $ cd a8
658 $ echo I > I
658 $ echo I > I
659 $ hg add I
659 $ hg add I
660 $ hg commit -m I
660 $ hg commit -m I
661 $ hg up 4
661 $ hg up 4
662 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
662 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
663 $ echo I > J
663 $ echo I > J
664 $ hg add J
664 $ hg add J
665 $ hg commit -m J
665 $ hg commit -m J
666 created new head
666 created new head
667 $ echo I > K
667 $ echo I > K
668 $ hg add K
668 $ hg add K
669 $ hg commit -m K
669 $ hg commit -m K
670 $ hg tglog
670 $ hg tglog
671 @ 10: 'K'
671 @ 10: 'K'
672 |
672 |
673 o 9: 'J'
673 o 9: 'J'
674 |
674 |
675 | o 8: 'I'
675 | o 8: 'I'
676 | |
676 | |
677 | o 7: 'H'
677 | o 7: 'H'
678 | |
678 | |
679 +---o 6: 'G'
679 +---o 6: 'G'
680 | |/
680 | |/
681 | o 5: 'F'
681 | o 5: 'F'
682 | |
682 | |
683 o | 4: 'E'
683 o | 4: 'E'
684 |/
684 |/
685 | o 3: 'D'
685 | o 3: 'D'
686 | |
686 | |
687 | o 2: 'C'
687 | o 2: 'C'
688 | |
688 | |
689 | o 1: 'B'
689 | o 1: 'B'
690 |/
690 |/
691 o 0: 'A'
691 o 0: 'A'
692
692
693 (actual test)
693 (actual test)
694
694
695 $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)'
695 $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)'
696 rebasing 8:e7ec4e813ba6 "I"
696 rebasing 8:e7ec4e813ba6 "I"
697 rebasing 10:23a4ace37988 "K" (tip)
697 rebasing 10:23a4ace37988 "K" (tip)
698 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-backup.hg (glob)
698 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-backup.hg (glob)
699 $ hg log --rev 'children(desc(G))'
699 $ hg log --rev 'children(desc(G))'
700 changeset: 9:adb617877056
700 changeset: 9:adb617877056
701 parent: 6:eea13746799a
701 parent: 6:eea13746799a
702 user: test
702 user: test
703 date: Thu Jan 01 00:00:00 1970 +0000
703 date: Thu Jan 01 00:00:00 1970 +0000
704 summary: I
704 summary: I
705
705
706 changeset: 10:882431a34a0e
706 changeset: 10:882431a34a0e
707 tag: tip
707 tag: tip
708 parent: 6:eea13746799a
708 parent: 6:eea13746799a
709 user: test
709 user: test
710 date: Thu Jan 01 00:00:00 1970 +0000
710 date: Thu Jan 01 00:00:00 1970 +0000
711 summary: K
711 summary: K
712
712
713 $ hg tglog
713 $ hg tglog
714 @ 10: 'K'
714 @ 10: 'K'
715 |
715 |
716 | o 9: 'I'
716 | o 9: 'I'
717 |/
717 |/
718 | o 8: 'J'
718 | o 8: 'J'
719 | |
719 | |
720 | | o 7: 'H'
720 | | o 7: 'H'
721 | | |
721 | | |
722 o---+ 6: 'G'
722 o---+ 6: 'G'
723 |/ /
723 |/ /
724 | o 5: 'F'
724 | o 5: 'F'
725 | |
725 | |
726 o | 4: 'E'
726 o | 4: 'E'
727 |/
727 |/
728 | o 3: 'D'
728 | o 3: 'D'
729 | |
729 | |
730 | o 2: 'C'
730 | o 2: 'C'
731 | |
731 | |
732 | o 1: 'B'
732 | o 1: 'B'
733 |/
733 |/
734 o 0: 'A'
734 o 0: 'A'
735
735
736
736
737 Test that rebase is not confused by $CWD disappearing during rebase (issue4121)
737 Test that rebase is not confused by $CWD disappearing during rebase (issue4121)
738
738
739 $ cd ..
739 $ cd ..
740 $ hg init cwd-vanish
740 $ hg init cwd-vanish
741 $ cd cwd-vanish
741 $ cd cwd-vanish
742 $ touch initial-file
742 $ touch initial-file
743 $ hg add initial-file
743 $ hg add initial-file
744 $ hg commit -m 'initial commit'
744 $ hg commit -m 'initial commit'
745 $ touch dest-file
745 $ touch dest-file
746 $ hg add dest-file
746 $ hg add dest-file
747 $ hg commit -m 'dest commit'
747 $ hg commit -m 'dest commit'
748 $ hg up 0
748 $ hg up 0
749 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
749 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
750 $ touch other-file
750 $ touch other-file
751 $ hg add other-file
751 $ hg add other-file
752 $ hg commit -m 'first source commit'
752 $ hg commit -m 'first source commit'
753 created new head
753 created new head
754 $ mkdir subdir
754 $ mkdir subdir
755 $ cd subdir
755 $ cd subdir
756 $ touch subfile
756 $ touch subfile
757 $ hg add subfile
757 $ hg add subfile
758 $ hg commit -m 'second source with subdir'
758 $ hg commit -m 'second source with subdir'
759 $ hg rebase -b . -d 1 --traceback
759 $ hg rebase -b . -d 1 --traceback
760 rebasing 2:779a07b1b7a0 "first source commit"
760 rebasing 2:779a07b1b7a0 "first source commit"
761 rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip)
761 rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip)
762 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-backup.hg (glob)
762 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-backup.hg (glob)
763
763
764 Test experimental revset
764 Test experimental revset
765 ========================
765
766
766 $ cd ..
767 $ cd ..
768
769 Make the repo a bit more interresting
770
771 $ hg up 1
772 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
773 $ echo aaa > aaa
774 $ hg add aaa
775 $ hg commit -m aaa
776 created new head
777 $ hg log -G
778 @ changeset: 4:5f7bc9025ed2
779 | tag: tip
780 | parent: 1:58d79cc1cf43
781 | user: test
782 | date: Thu Jan 01 00:00:00 1970 +0000
783 | summary: aaa
784 |
785 | o changeset: 3:1910d5ff34ea
786 | | user: test
787 | | date: Thu Jan 01 00:00:00 1970 +0000
788 | | summary: second source with subdir
789 | |
790 | o changeset: 2:82901330b6ef
791 |/ user: test
792 | date: Thu Jan 01 00:00:00 1970 +0000
793 | summary: first source commit
794 |
795 o changeset: 1:58d79cc1cf43
796 | user: test
797 | date: Thu Jan 01 00:00:00 1970 +0000
798 | summary: dest commit
799 |
800 o changeset: 0:e94b687f7da3
801 user: test
802 date: Thu Jan 01 00:00:00 1970 +0000
803 summary: initial commit
804
805
806 Testing from lower head
807
808 $ hg up 3
809 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
767 $ hg log -r '_destrebase()'
810 $ hg log -r '_destrebase()'
768 changeset: 3:1910d5ff34ea
811 changeset: 4:5f7bc9025ed2
769 tag: tip
812 tag: tip
813 parent: 1:58d79cc1cf43
770 user: test
814 user: test
771 date: Thu Jan 01 00:00:00 1970 +0000
815 date: Thu Jan 01 00:00:00 1970 +0000
772 summary: second source with subdir
816 summary: aaa
773
817
818
819 Testing from upper head
820
821 $ hg up 4
822 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
823 $ hg log -r '_destrebase()'
824 changeset: 4:5f7bc9025ed2
825 tag: tip
826 parent: 1:58d79cc1cf43
827 user: test
828 date: Thu Jan 01 00:00:00 1970 +0000
829 summary: aaa
830
General Comments 0
You need to be logged in to leave comments. Login now