##// END OF EJS Templates
rebase: test for empty dest revision
Mads Kiilerich -
r20246:e4dc4c89 default
parent child Browse files
Show More
@@ -1,439 +1,442 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
23
24 $ echo I > I
24 $ echo I > I
25 $ hg ci -AmI
25 $ hg ci -AmI
26 adding I
26 adding I
27
27
28 $ hg tglog
28 $ hg tglog
29 @ 8: 'I'
29 @ 8: 'I'
30 |
30 |
31 o 7: 'H'
31 o 7: 'H'
32 |
32 |
33 | o 6: 'G'
33 | o 6: 'G'
34 |/|
34 |/|
35 o | 5: 'F'
35 o | 5: 'F'
36 | |
36 | |
37 | o 4: 'E'
37 | o 4: 'E'
38 |/
38 |/
39 | o 3: 'D'
39 | o 3: 'D'
40 | |
40 | |
41 | o 2: 'C'
41 | o 2: 'C'
42 | |
42 | |
43 | o 1: 'B'
43 | o 1: 'B'
44 |/
44 |/
45 o 0: 'A'
45 o 0: 'A'
46
46
47 $ cd ..
47 $ cd ..
48
48
49
49
50 These fail:
50 These fail:
51
51
52 $ hg clone -q -u . a a1
52 $ hg clone -q -u . a a1
53 $ cd a1
53 $ cd a1
54
54
55 $ hg rebase -s 8 -d 7
55 $ hg rebase -s 8 -d 7
56 nothing to rebase
56 nothing to rebase
57 [1]
57 [1]
58
58
59 $ hg rebase --continue --abort
59 $ hg rebase --continue --abort
60 abort: cannot use both abort and continue
60 abort: cannot use both abort and continue
61 [255]
61 [255]
62
62
63 $ hg rebase --continue --collapse
63 $ hg rebase --continue --collapse
64 abort: cannot use collapse with continue or abort
64 abort: cannot use collapse with continue or abort
65 [255]
65 [255]
66
66
67 $ hg rebase --continue --dest 4
67 $ hg rebase --continue --dest 4
68 abort: abort and continue do not allow specifying revisions
68 abort: abort and continue do not allow specifying revisions
69 [255]
69 [255]
70
70
71 $ hg rebase --base 5 --source 4
71 $ hg rebase --base 5 --source 4
72 abort: cannot specify both a source and a base
72 abort: cannot specify both a source and a base
73 [255]
73 [255]
74
74
75 $ hg rebase --rev 5 --source 4
75 $ hg rebase --rev 5 --source 4
76 abort: cannot specify both a revision and a source
76 abort: cannot specify both a revision and a source
77 [255]
77 [255]
78 $ hg rebase --base 5 --rev 4
78 $ hg rebase --base 5 --rev 4
79 abort: cannot specify both a revision and a base
79 abort: cannot specify both a revision and a base
80 [255]
80 [255]
81
81
82 $ hg rebase
82 $ hg rebase
83 nothing to rebase
83 nothing to rebase
84 [1]
84 [1]
85
85
86 $ hg up -q 7
86 $ hg up -q 7
87
87
88 $ hg rebase --traceback
88 $ hg rebase --traceback
89 nothing to rebase
89 nothing to rebase
90 [1]
90 [1]
91
91
92 $ hg rebase --dest '1 & !1'
93 abort: empty revision set
94 [255]
92
95
93 These work:
96 These work:
94
97
95 Rebase with no arguments (from 3 onto 8):
98 Rebase with no arguments (from 3 onto 8):
96
99
97 $ hg up -q -C 3
100 $ hg up -q -C 3
98
101
99 $ hg rebase
102 $ hg rebase
100 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
103 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
101
104
102 $ hg tglog
105 $ hg tglog
103 @ 8: 'D'
106 @ 8: 'D'
104 |
107 |
105 o 7: 'C'
108 o 7: 'C'
106 |
109 |
107 o 6: 'B'
110 o 6: 'B'
108 |
111 |
109 o 5: 'I'
112 o 5: 'I'
110 |
113 |
111 o 4: 'H'
114 o 4: 'H'
112 |
115 |
113 | o 3: 'G'
116 | o 3: 'G'
114 |/|
117 |/|
115 o | 2: 'F'
118 o | 2: 'F'
116 | |
119 | |
117 | o 1: 'E'
120 | o 1: 'E'
118 |/
121 |/
119 o 0: 'A'
122 o 0: 'A'
120
123
121 Try to rollback after a rebase (fail):
124 Try to rollback after a rebase (fail):
122
125
123 $ hg rollback
126 $ hg rollback
124 no rollback information available
127 no rollback information available
125 [1]
128 [1]
126
129
127 $ cd ..
130 $ cd ..
128
131
129
132
130 Rebase with base == '.' => same as no arguments (from 3 onto 8):
133 Rebase with base == '.' => same as no arguments (from 3 onto 8):
131
134
132 $ hg clone -q -u 3 a a2
135 $ hg clone -q -u 3 a a2
133 $ cd a2
136 $ cd a2
134
137
135 $ hg rebase --base .
138 $ hg rebase --base .
136 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/*-backup.hg (glob)
139 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/*-backup.hg (glob)
137
140
138 $ hg tglog
141 $ hg tglog
139 @ 8: 'D'
142 @ 8: 'D'
140 |
143 |
141 o 7: 'C'
144 o 7: 'C'
142 |
145 |
143 o 6: 'B'
146 o 6: 'B'
144 |
147 |
145 o 5: 'I'
148 o 5: 'I'
146 |
149 |
147 o 4: 'H'
150 o 4: 'H'
148 |
151 |
149 | o 3: 'G'
152 | o 3: 'G'
150 |/|
153 |/|
151 o | 2: 'F'
154 o | 2: 'F'
152 | |
155 | |
153 | o 1: 'E'
156 | o 1: 'E'
154 |/
157 |/
155 o 0: 'A'
158 o 0: 'A'
156
159
157 $ cd ..
160 $ cd ..
158
161
159
162
160 Rebase with dest == branch(.) => same as no arguments (from 3 onto 8):
163 Rebase with dest == branch(.) => same as no arguments (from 3 onto 8):
161
164
162 $ hg clone -q -u 3 a a3
165 $ hg clone -q -u 3 a a3
163 $ cd a3
166 $ cd a3
164
167
165 $ hg rebase --dest 'branch(.)'
168 $ hg rebase --dest 'branch(.)'
166 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob)
169 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob)
167
170
168 $ hg tglog
171 $ hg tglog
169 @ 8: 'D'
172 @ 8: 'D'
170 |
173 |
171 o 7: 'C'
174 o 7: 'C'
172 |
175 |
173 o 6: 'B'
176 o 6: 'B'
174 |
177 |
175 o 5: 'I'
178 o 5: 'I'
176 |
179 |
177 o 4: 'H'
180 o 4: 'H'
178 |
181 |
179 | o 3: 'G'
182 | o 3: 'G'
180 |/|
183 |/|
181 o | 2: 'F'
184 o | 2: 'F'
182 | |
185 | |
183 | o 1: 'E'
186 | o 1: 'E'
184 |/
187 |/
185 o 0: 'A'
188 o 0: 'A'
186
189
187 $ cd ..
190 $ cd ..
188
191
189
192
190 Specify only source (from 2 onto 8):
193 Specify only source (from 2 onto 8):
191
194
192 $ hg clone -q -u . a a4
195 $ hg clone -q -u . a a4
193 $ cd a4
196 $ cd a4
194
197
195 $ hg rebase --source 'desc("C")'
198 $ hg rebase --source 'desc("C")'
196 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/*-backup.hg (glob)
199 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/*-backup.hg (glob)
197
200
198 $ hg tglog
201 $ hg tglog
199 o 8: 'D'
202 o 8: 'D'
200 |
203 |
201 o 7: 'C'
204 o 7: 'C'
202 |
205 |
203 @ 6: 'I'
206 @ 6: 'I'
204 |
207 |
205 o 5: 'H'
208 o 5: 'H'
206 |
209 |
207 | o 4: 'G'
210 | o 4: 'G'
208 |/|
211 |/|
209 o | 3: 'F'
212 o | 3: 'F'
210 | |
213 | |
211 | o 2: 'E'
214 | o 2: 'E'
212 |/
215 |/
213 | o 1: 'B'
216 | o 1: 'B'
214 |/
217 |/
215 o 0: 'A'
218 o 0: 'A'
216
219
217 $ cd ..
220 $ cd ..
218
221
219
222
220 Specify only dest (from 3 onto 6):
223 Specify only dest (from 3 onto 6):
221
224
222 $ hg clone -q -u 3 a a5
225 $ hg clone -q -u 3 a a5
223 $ cd a5
226 $ cd a5
224
227
225 $ hg rebase --dest 6
228 $ hg rebase --dest 6
226 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/*-backup.hg (glob)
229 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/*-backup.hg (glob)
227
230
228 $ hg tglog
231 $ hg tglog
229 @ 8: 'D'
232 @ 8: 'D'
230 |
233 |
231 o 7: 'C'
234 o 7: 'C'
232 |
235 |
233 o 6: 'B'
236 o 6: 'B'
234 |
237 |
235 | o 5: 'I'
238 | o 5: 'I'
236 | |
239 | |
237 | o 4: 'H'
240 | o 4: 'H'
238 | |
241 | |
239 o | 3: 'G'
242 o | 3: 'G'
240 |\|
243 |\|
241 | o 2: 'F'
244 | o 2: 'F'
242 | |
245 | |
243 o | 1: 'E'
246 o | 1: 'E'
244 |/
247 |/
245 o 0: 'A'
248 o 0: 'A'
246
249
247 $ cd ..
250 $ cd ..
248
251
249
252
250 Specify only base (from 1 onto 8):
253 Specify only base (from 1 onto 8):
251
254
252 $ hg clone -q -u . a a6
255 $ hg clone -q -u . a a6
253 $ cd a6
256 $ cd a6
254
257
255 $ hg rebase --base 'desc("D")'
258 $ hg rebase --base 'desc("D")'
256 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/*-backup.hg (glob)
259 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/*-backup.hg (glob)
257
260
258 $ hg tglog
261 $ hg tglog
259 o 8: 'D'
262 o 8: 'D'
260 |
263 |
261 o 7: 'C'
264 o 7: 'C'
262 |
265 |
263 o 6: 'B'
266 o 6: 'B'
264 |
267 |
265 @ 5: 'I'
268 @ 5: 'I'
266 |
269 |
267 o 4: 'H'
270 o 4: 'H'
268 |
271 |
269 | o 3: 'G'
272 | o 3: 'G'
270 |/|
273 |/|
271 o | 2: 'F'
274 o | 2: 'F'
272 | |
275 | |
273 | o 1: 'E'
276 | o 1: 'E'
274 |/
277 |/
275 o 0: 'A'
278 o 0: 'A'
276
279
277 $ cd ..
280 $ cd ..
278
281
279
282
280 Specify source and dest (from 2 onto 7):
283 Specify source and dest (from 2 onto 7):
281
284
282 $ hg clone -q -u . a a7
285 $ hg clone -q -u . a a7
283 $ cd a7
286 $ cd a7
284
287
285 $ hg rebase --source 2 --dest 7
288 $ hg rebase --source 2 --dest 7
286 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/*-backup.hg (glob)
289 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/*-backup.hg (glob)
287
290
288 $ hg tglog
291 $ hg tglog
289 o 8: 'D'
292 o 8: 'D'
290 |
293 |
291 o 7: 'C'
294 o 7: 'C'
292 |
295 |
293 | @ 6: 'I'
296 | @ 6: 'I'
294 |/
297 |/
295 o 5: 'H'
298 o 5: 'H'
296 |
299 |
297 | o 4: 'G'
300 | o 4: 'G'
298 |/|
301 |/|
299 o | 3: 'F'
302 o | 3: 'F'
300 | |
303 | |
301 | o 2: 'E'
304 | o 2: 'E'
302 |/
305 |/
303 | o 1: 'B'
306 | o 1: 'B'
304 |/
307 |/
305 o 0: 'A'
308 o 0: 'A'
306
309
307 $ cd ..
310 $ cd ..
308
311
309
312
310 Specify base and dest (from 1 onto 7):
313 Specify base and dest (from 1 onto 7):
311
314
312 $ hg clone -q -u . a a8
315 $ hg clone -q -u . a a8
313 $ cd a8
316 $ cd a8
314
317
315 $ hg rebase --base 3 --dest 7
318 $ hg rebase --base 3 --dest 7
316 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/*-backup.hg (glob)
319 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/*-backup.hg (glob)
317
320
318 $ hg tglog
321 $ hg tglog
319 o 8: 'D'
322 o 8: 'D'
320 |
323 |
321 o 7: 'C'
324 o 7: 'C'
322 |
325 |
323 o 6: 'B'
326 o 6: 'B'
324 |
327 |
325 | @ 5: 'I'
328 | @ 5: 'I'
326 |/
329 |/
327 o 4: 'H'
330 o 4: 'H'
328 |
331 |
329 | o 3: 'G'
332 | o 3: 'G'
330 |/|
333 |/|
331 o | 2: 'F'
334 o | 2: 'F'
332 | |
335 | |
333 | o 1: 'E'
336 | o 1: 'E'
334 |/
337 |/
335 o 0: 'A'
338 o 0: 'A'
336
339
337 $ cd ..
340 $ cd ..
338
341
339
342
340 Specify only revs (from 2 onto 8)
343 Specify only revs (from 2 onto 8)
341
344
342 $ hg clone -q -u . a a9
345 $ hg clone -q -u . a a9
343 $ cd a9
346 $ cd a9
344
347
345 $ hg rebase --rev 'desc("C")::'
348 $ hg rebase --rev 'desc("C")::'
346 saved backup bundle to $TESTTMP/a9/.hg/strip-backup/*-backup.hg (glob)
349 saved backup bundle to $TESTTMP/a9/.hg/strip-backup/*-backup.hg (glob)
347
350
348 $ hg tglog
351 $ hg tglog
349 o 8: 'D'
352 o 8: 'D'
350 |
353 |
351 o 7: 'C'
354 o 7: 'C'
352 |
355 |
353 @ 6: 'I'
356 @ 6: 'I'
354 |
357 |
355 o 5: 'H'
358 o 5: 'H'
356 |
359 |
357 | o 4: 'G'
360 | o 4: 'G'
358 |/|
361 |/|
359 o | 3: 'F'
362 o | 3: 'F'
360 | |
363 | |
361 | o 2: 'E'
364 | o 2: 'E'
362 |/
365 |/
363 | o 1: 'B'
366 | o 1: 'B'
364 |/
367 |/
365 o 0: 'A'
368 o 0: 'A'
366
369
367 $ cd ..
370 $ cd ..
368
371
369 Test --tool parameter:
372 Test --tool parameter:
370
373
371 $ hg init b
374 $ hg init b
372 $ cd b
375 $ cd b
373
376
374 $ echo c1 > c1
377 $ echo c1 > c1
375 $ hg ci -Am c1
378 $ hg ci -Am c1
376 adding c1
379 adding c1
377
380
378 $ echo c2 > c2
381 $ echo c2 > c2
379 $ hg ci -Am c2
382 $ hg ci -Am c2
380 adding c2
383 adding c2
381
384
382 $ hg up -q 0
385 $ hg up -q 0
383 $ echo c2b > c2
386 $ echo c2b > c2
384 $ hg ci -Am c2b
387 $ hg ci -Am c2b
385 adding c2
388 adding c2
386 created new head
389 created new head
387
390
388 $ cd ..
391 $ cd ..
389
392
390 $ hg clone -q -u . b b1
393 $ hg clone -q -u . b b1
391 $ cd b1
394 $ cd b1
392
395
393 $ hg rebase -s 2 -d 1 --tool internal:local
396 $ hg rebase -s 2 -d 1 --tool internal:local
394 saved backup bundle to $TESTTMP/b1/.hg/strip-backup/*-backup.hg (glob)
397 saved backup bundle to $TESTTMP/b1/.hg/strip-backup/*-backup.hg (glob)
395
398
396 $ hg cat c2
399 $ hg cat c2
397 c2
400 c2
398
401
399 $ cd ..
402 $ cd ..
400
403
401
404
402 $ hg clone -q -u . b b2
405 $ hg clone -q -u . b b2
403 $ cd b2
406 $ cd b2
404
407
405 $ hg rebase -s 2 -d 1 --tool internal:other
408 $ hg rebase -s 2 -d 1 --tool internal:other
406 saved backup bundle to $TESTTMP/b2/.hg/strip-backup/*-backup.hg (glob)
409 saved backup bundle to $TESTTMP/b2/.hg/strip-backup/*-backup.hg (glob)
407
410
408 $ hg cat c2
411 $ hg cat c2
409 c2b
412 c2b
410
413
411 $ cd ..
414 $ cd ..
412
415
413
416
414 $ hg clone -q -u . b b3
417 $ hg clone -q -u . b b3
415 $ cd b3
418 $ cd b3
416
419
417 $ hg rebase -s 2 -d 1 --tool internal:fail
420 $ hg rebase -s 2 -d 1 --tool internal:fail
418 unresolved conflicts (see hg resolve, then hg rebase --continue)
421 unresolved conflicts (see hg resolve, then hg rebase --continue)
419 [1]
422 [1]
420
423
421 $ hg summary
424 $ hg summary
422 parent: 1:56daeba07f4b
425 parent: 1:56daeba07f4b
423 c2
426 c2
424 parent: 2:e4e3f3546619 tip
427 parent: 2:e4e3f3546619 tip
425 c2b
428 c2b
426 branch: default
429 branch: default
427 commit: 1 modified, 1 unresolved (merge)
430 commit: 1 modified, 1 unresolved (merge)
428 update: (current)
431 update: (current)
429 rebase: 0 rebased, 1 remaining (rebase --continue)
432 rebase: 0 rebased, 1 remaining (rebase --continue)
430
433
431 $ hg resolve -l
434 $ hg resolve -l
432 U c2
435 U c2
433
436
434 $ hg resolve -m c2
437 $ hg resolve -m c2
435 $ hg rebase -c --tool internal:fail
438 $ hg rebase -c --tool internal:fail
436 tool option will be ignored
439 tool option will be ignored
437 saved backup bundle to $TESTTMP/b3/.hg/strip-backup/*-backup.hg (glob)
440 saved backup bundle to $TESTTMP/b3/.hg/strip-backup/*-backup.hg (glob)
438
441
439 $ cd ..
442 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now