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