##// END OF EJS Templates
test: explicit a rebase source in test-rebase-collapse.t...
Boris Feld -
r41231:c339a01a default
parent child Browse files
Show More
@@ -1,819 +1,819 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 > mq=
4 > mq=
5 > drawdag=$TESTDIR/drawdag.py
5 > drawdag=$TESTDIR/drawdag.py
6 >
6 >
7 > [phases]
7 > [phases]
8 > publish=False
8 > publish=False
9 >
9 >
10 > [alias]
10 > [alias]
11 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
11 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
12 > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' {branches}\n"
12 > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' {branches}\n"
13 > EOF
13 > EOF
14
14
15 Highest phase of source commits is used:
15 Highest phase of source commits is used:
16
16
17 $ hg init phase
17 $ hg init phase
18 $ cd phase
18 $ cd phase
19 $ hg debugdrawdag << 'EOF'
19 $ hg debugdrawdag << 'EOF'
20 > D
20 > D
21 > |
21 > |
22 > F C
22 > F C
23 > | |
23 > | |
24 > E B
24 > E B
25 > |/
25 > |/
26 > A
26 > A
27 > EOF
27 > EOF
28
28
29 $ hg phase --force --secret D
29 $ hg phase --force --secret D
30
30
31 $ cat > $TESTTMP/editor.sh <<EOF
31 $ cat > $TESTTMP/editor.sh <<EOF
32 > echo "==== before editing"
32 > echo "==== before editing"
33 > cat \$1
33 > cat \$1
34 > echo "===="
34 > echo "===="
35 > echo "edited manually" >> \$1
35 > echo "edited manually" >> \$1
36 > EOF
36 > EOF
37 $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e --dest F
37 $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e --source B --dest F
38 rebasing 1:112478962961 "B" (B)
38 rebasing 1:112478962961 "B" (B)
39 rebasing 3:26805aba1e60 "C" (C)
39 rebasing 3:26805aba1e60 "C" (C)
40 rebasing 5:f585351a92f8 "D" (D tip)
40 rebasing 5:f585351a92f8 "D" (D tip)
41 ==== before editing
41 ==== before editing
42 Collapsed revision
42 Collapsed revision
43 * B
43 * B
44 * C
44 * C
45 * D
45 * D
46
46
47
47
48 HG: Enter commit message. Lines beginning with 'HG:' are removed.
48 HG: Enter commit message. Lines beginning with 'HG:' are removed.
49 HG: Leave message empty to abort commit.
49 HG: Leave message empty to abort commit.
50 HG: --
50 HG: --
51 HG: user: test
51 HG: user: test
52 HG: branch 'default'
52 HG: branch 'default'
53 HG: added B
53 HG: added B
54 HG: added C
54 HG: added C
55 HG: added D
55 HG: added D
56 ====
56 ====
57 saved backup bundle to $TESTTMP/phase/.hg/strip-backup/112478962961-cb2a9b47-rebase.hg
57 saved backup bundle to $TESTTMP/phase/.hg/strip-backup/112478962961-cb2a9b47-rebase.hg
58
58
59 $ hg tglogp
59 $ hg tglogp
60 o 3: 92fa5f5fe108 secret 'Collapsed revision
60 o 3: 92fa5f5fe108 secret 'Collapsed revision
61 | * B
61 | * B
62 | * C
62 | * C
63 | * D
63 | * D
64 |
64 |
65 |
65 |
66 | edited manually'
66 | edited manually'
67 o 2: 64a8289d2492 draft 'F'
67 o 2: 64a8289d2492 draft 'F'
68 |
68 |
69 o 1: 7fb047a69f22 draft 'E'
69 o 1: 7fb047a69f22 draft 'E'
70 |
70 |
71 o 0: 426bada5c675 draft 'A'
71 o 0: 426bada5c675 draft 'A'
72
72
73 $ hg manifest --rev tip
73 $ hg manifest --rev tip
74 A
74 A
75 B
75 B
76 C
76 C
77 D
77 D
78 E
78 E
79 F
79 F
80
80
81 $ cd ..
81 $ cd ..
82
82
83
83
84 Merge gets linearized:
84 Merge gets linearized:
85
85
86 $ hg init linearized-merge
86 $ hg init linearized-merge
87 $ cd linearized-merge
87 $ cd linearized-merge
88
88
89 $ hg debugdrawdag << 'EOF'
89 $ hg debugdrawdag << 'EOF'
90 > F D
90 > F D
91 > |/|
91 > |/|
92 > C B
92 > C B
93 > |/
93 > |/
94 > A
94 > A
95 > EOF
95 > EOF
96
96
97 $ hg phase --force --secret D
97 $ hg phase --force --secret D
98 $ hg rebase --source B --collapse --dest F
98 $ hg rebase --source B --collapse --dest F
99 rebasing 1:112478962961 "B" (B)
99 rebasing 1:112478962961 "B" (B)
100 rebasing 3:4e4f9194f9f1 "D" (D)
100 rebasing 3:4e4f9194f9f1 "D" (D)
101 saved backup bundle to $TESTTMP/linearized-merge/.hg/strip-backup/112478962961-e389075b-rebase.hg
101 saved backup bundle to $TESTTMP/linearized-merge/.hg/strip-backup/112478962961-e389075b-rebase.hg
102
102
103 $ hg tglog
103 $ hg tglog
104 o 3: 5bdc08b7da2b 'Collapsed revision
104 o 3: 5bdc08b7da2b 'Collapsed revision
105 | * B
105 | * B
106 | * D'
106 | * D'
107 o 2: afc707c82df0 'F'
107 o 2: afc707c82df0 'F'
108 |
108 |
109 o 1: dc0947a82db8 'C'
109 o 1: dc0947a82db8 'C'
110 |
110 |
111 o 0: 426bada5c675 'A'
111 o 0: 426bada5c675 'A'
112
112
113 $ hg manifest --rev tip
113 $ hg manifest --rev tip
114 A
114 A
115 B
115 B
116 C
116 C
117 F
117 F
118
118
119 $ cd ..
119 $ cd ..
120
120
121 Custom message:
121 Custom message:
122
122
123 $ hg init message
123 $ hg init message
124 $ cd message
124 $ cd message
125
125
126 $ hg debugdrawdag << 'EOF'
126 $ hg debugdrawdag << 'EOF'
127 > C
127 > C
128 > |
128 > |
129 > D B
129 > D B
130 > |/
130 > |/
131 > A
131 > A
132 > EOF
132 > EOF
133
133
134
134
135 $ hg rebase --base B -m 'custom message'
135 $ hg rebase --base B -m 'custom message'
136 abort: message can only be specified with collapse
136 abort: message can only be specified with collapse
137 [255]
137 [255]
138
138
139 $ cat > $TESTTMP/checkeditform.sh <<EOF
139 $ cat > $TESTTMP/checkeditform.sh <<EOF
140 > env | grep HGEDITFORM
140 > env | grep HGEDITFORM
141 > true
141 > true
142 > EOF
142 > EOF
143 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --source B --collapse -m 'custom message' -e --dest D
143 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --source B --collapse -m 'custom message' -e --dest D
144 rebasing 1:112478962961 "B" (B)
144 rebasing 1:112478962961 "B" (B)
145 rebasing 3:26805aba1e60 "C" (C tip)
145 rebasing 3:26805aba1e60 "C" (C tip)
146 HGEDITFORM=rebase.collapse
146 HGEDITFORM=rebase.collapse
147 saved backup bundle to $TESTTMP/message/.hg/strip-backup/112478962961-f4131707-rebase.hg
147 saved backup bundle to $TESTTMP/message/.hg/strip-backup/112478962961-f4131707-rebase.hg
148
148
149 $ hg tglog
149 $ hg tglog
150 o 2: 2f197b9a08f3 'custom message'
150 o 2: 2f197b9a08f3 'custom message'
151 |
151 |
152 o 1: b18e25de2cf5 'D'
152 o 1: b18e25de2cf5 'D'
153 |
153 |
154 o 0: 426bada5c675 'A'
154 o 0: 426bada5c675 'A'
155
155
156 $ hg manifest --rev tip
156 $ hg manifest --rev tip
157 A
157 A
158 B
158 B
159 C
159 C
160 D
160 D
161
161
162 $ cd ..
162 $ cd ..
163
163
164 Rebase and collapse - more than one external (fail):
164 Rebase and collapse - more than one external (fail):
165
165
166 $ hg init multiple-external-parents
166 $ hg init multiple-external-parents
167 $ cd multiple-external-parents
167 $ cd multiple-external-parents
168
168
169 $ hg debugdrawdag << 'EOF'
169 $ hg debugdrawdag << 'EOF'
170 > G
170 > G
171 > |\
171 > |\
172 > | F
172 > | F
173 > | |
173 > | |
174 > D E
174 > D E
175 > |\|
175 > |\|
176 > H C B
176 > H C B
177 > \|/
177 > \|/
178 > A
178 > A
179 > EOF
179 > EOF
180
180
181 $ hg rebase -s C --dest H --collapse
181 $ hg rebase -s C --dest H --collapse
182 abort: unable to collapse on top of 3, there is more than one external parent: 1, 6
182 abort: unable to collapse on top of 3, there is more than one external parent: 1, 6
183 [255]
183 [255]
184
184
185 Rebase and collapse - E onto H:
185 Rebase and collapse - E onto H:
186
186
187 $ hg rebase -s E --dest I --collapse # root (E) is not a merge
187 $ hg rebase -s E --dest I --collapse # root (E) is not a merge
188 abort: unknown revision 'I'!
188 abort: unknown revision 'I'!
189 [255]
189 [255]
190
190
191 $ hg tglog
191 $ hg tglog
192 o 7: 64e264db77f0 'G'
192 o 7: 64e264db77f0 'G'
193 |\
193 |\
194 | o 6: 11abe3fb10b8 'F'
194 | o 6: 11abe3fb10b8 'F'
195 | |
195 | |
196 | o 5: 49cb92066bfd 'E'
196 | o 5: 49cb92066bfd 'E'
197 | |
197 | |
198 o | 4: 4e4f9194f9f1 'D'
198 o | 4: 4e4f9194f9f1 'D'
199 |\|
199 |\|
200 | | o 3: 575c4b5ec114 'H'
200 | | o 3: 575c4b5ec114 'H'
201 | | |
201 | | |
202 o---+ 2: dc0947a82db8 'C'
202 o---+ 2: dc0947a82db8 'C'
203 / /
203 / /
204 o / 1: 112478962961 'B'
204 o / 1: 112478962961 'B'
205 |/
205 |/
206 o 0: 426bada5c675 'A'
206 o 0: 426bada5c675 'A'
207
207
208 $ hg manifest --rev tip
208 $ hg manifest --rev tip
209 A
209 A
210 B
210 B
211 C
211 C
212 E
212 E
213 F
213 F
214
214
215 $ cd ..
215 $ cd ..
216
216
217
217
218
218
219
219
220 Test that branchheads cache is updated correctly when doing a strip in which
220 Test that branchheads cache is updated correctly when doing a strip in which
221 the parent of the ancestor node to be stripped does not become a head and also,
221 the parent of the ancestor node to be stripped does not become a head and also,
222 the parent of a node that is a child of the node stripped becomes a head (node
222 the parent of a node that is a child of the node stripped becomes a head (node
223 3). The code is now much simpler and we could just test a simpler scenario
223 3). The code is now much simpler and we could just test a simpler scenario
224 We keep it the test this way in case new complexity is injected.
224 We keep it the test this way in case new complexity is injected.
225
225
226 Create repo b:
226 Create repo b:
227
227
228 $ hg init branch-heads
228 $ hg init branch-heads
229 $ cd branch-heads
229 $ cd branch-heads
230
230
231 $ hg debugdrawdag << 'EOF'
231 $ hg debugdrawdag << 'EOF'
232 > G
232 > G
233 > |\
233 > |\
234 > | F
234 > | F
235 > | |
235 > | |
236 > D E
236 > D E
237 > |\|
237 > |\|
238 > H C B
238 > H C B
239 > \|/
239 > \|/
240 > A
240 > A
241 > EOF
241 > EOF
242
242
243 $ hg heads --template="{rev}:{node} {branch}\n"
243 $ hg heads --template="{rev}:{node} {branch}\n"
244 7:64e264db77f061f16d9132b70c5a58e2461fb630 default
244 7:64e264db77f061f16d9132b70c5a58e2461fb630 default
245 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default
245 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default
246
246
247 $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served
247 $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served
248 64e264db77f061f16d9132b70c5a58e2461fb630 7
248 64e264db77f061f16d9132b70c5a58e2461fb630 7
249 575c4b5ec114d64b681d33f8792853568bfb2b2c o default
249 575c4b5ec114d64b681d33f8792853568bfb2b2c o default
250 64e264db77f061f16d9132b70c5a58e2461fb630 o default
250 64e264db77f061f16d9132b70c5a58e2461fb630 o default
251
251
252 $ hg strip 4
252 $ hg strip 4
253 saved backup bundle to $TESTTMP/branch-heads/.hg/strip-backup/4e4f9194f9f1-5ec4b5e6-backup.hg
253 saved backup bundle to $TESTTMP/branch-heads/.hg/strip-backup/4e4f9194f9f1-5ec4b5e6-backup.hg
254
254
255 $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served
255 $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served
256 11abe3fb10b8689b560681094b17fe161871d043 5
256 11abe3fb10b8689b560681094b17fe161871d043 5
257 dc0947a82db884575bb76ea10ac97b08536bfa03 o default
257 dc0947a82db884575bb76ea10ac97b08536bfa03 o default
258 575c4b5ec114d64b681d33f8792853568bfb2b2c o default
258 575c4b5ec114d64b681d33f8792853568bfb2b2c o default
259 11abe3fb10b8689b560681094b17fe161871d043 o default
259 11abe3fb10b8689b560681094b17fe161871d043 o default
260
260
261 $ hg heads --template="{rev}:{node} {branch}\n"
261 $ hg heads --template="{rev}:{node} {branch}\n"
262 5:11abe3fb10b8689b560681094b17fe161871d043 default
262 5:11abe3fb10b8689b560681094b17fe161871d043 default
263 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default
263 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default
264 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default
264 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default
265
265
266 $ cd ..
266 $ cd ..
267
267
268
268
269
269
270 Preserves external parent
270 Preserves external parent
271
271
272 $ hg init external-parent
272 $ hg init external-parent
273 $ cd external-parent
273 $ cd external-parent
274
274
275 $ hg debugdrawdag << 'EOF'
275 $ hg debugdrawdag << 'EOF'
276 > H
276 > H
277 > |\
277 > |\
278 > | G
278 > | G
279 > | |
279 > | |
280 > | F # F/E = F\n
280 > | F # F/E = F\n
281 > | |
281 > | |
282 > D E # D/D = D\n
282 > D E # D/D = D\n
283 > |\|
283 > |\|
284 > I C B
284 > I C B
285 > \|/
285 > \|/
286 > A
286 > A
287 > EOF
287 > EOF
288
288
289 $ hg rebase -s F --dest I --collapse # root (F) is not a merge
289 $ hg rebase -s F --dest I --collapse # root (F) is not a merge
290 rebasing 6:c82b08f646f1 "F" (F)
290 rebasing 6:c82b08f646f1 "F" (F)
291 rebasing 7:a6db7fa104e1 "G" (G)
291 rebasing 7:a6db7fa104e1 "G" (G)
292 rebasing 8:e1d201b72d91 "H" (H tip)
292 rebasing 8:e1d201b72d91 "H" (H tip)
293 saved backup bundle to $TESTTMP/external-parent/.hg/strip-backup/c82b08f646f1-f2721fbf-rebase.hg
293 saved backup bundle to $TESTTMP/external-parent/.hg/strip-backup/c82b08f646f1-f2721fbf-rebase.hg
294
294
295 $ hg tglog
295 $ hg tglog
296 o 6: 681daa3e686d 'Collapsed revision
296 o 6: 681daa3e686d 'Collapsed revision
297 |\ * F
297 |\ * F
298 | | * G
298 | | * G
299 | | * H'
299 | | * H'
300 | | o 5: 49cb92066bfd 'E'
300 | | o 5: 49cb92066bfd 'E'
301 | | |
301 | | |
302 | o | 4: 09143c0bf13e 'D'
302 | o | 4: 09143c0bf13e 'D'
303 | |\|
303 | |\|
304 o | | 3: 08ebfeb61bac 'I'
304 o | | 3: 08ebfeb61bac 'I'
305 | | |
305 | | |
306 | o | 2: dc0947a82db8 'C'
306 | o | 2: dc0947a82db8 'C'
307 |/ /
307 |/ /
308 | o 1: 112478962961 'B'
308 | o 1: 112478962961 'B'
309 |/
309 |/
310 o 0: 426bada5c675 'A'
310 o 0: 426bada5c675 'A'
311
311
312 $ hg manifest --rev tip
312 $ hg manifest --rev tip
313 A
313 A
314 C
314 C
315 D
315 D
316 E
316 E
317 F
317 F
318 G
318 G
319 I
319 I
320
320
321 $ hg up tip -q
321 $ hg up tip -q
322 $ cat E
322 $ cat E
323 F
323 F
324
324
325 $ cd ..
325 $ cd ..
326
326
327 Rebasing from multiple bases:
327 Rebasing from multiple bases:
328
328
329 $ hg init multiple-bases
329 $ hg init multiple-bases
330 $ cd multiple-bases
330 $ cd multiple-bases
331 $ hg debugdrawdag << 'EOF'
331 $ hg debugdrawdag << 'EOF'
332 > C B
332 > C B
333 > D |/
333 > D |/
334 > |/
334 > |/
335 > A
335 > A
336 > EOF
336 > EOF
337 $ hg rebase --collapse -r 'B+C' -d D
337 $ hg rebase --collapse -r 'B+C' -d D
338 rebasing 1:fc2b737bb2e5 "B" (B)
338 rebasing 1:fc2b737bb2e5 "B" (B)
339 rebasing 2:dc0947a82db8 "C" (C)
339 rebasing 2:dc0947a82db8 "C" (C)
340 saved backup bundle to $TESTTMP/multiple-bases/.hg/strip-backup/dc0947a82db8-b0c1a7ea-rebase.hg
340 saved backup bundle to $TESTTMP/multiple-bases/.hg/strip-backup/dc0947a82db8-b0c1a7ea-rebase.hg
341 $ hg tglog
341 $ hg tglog
342 o 2: 2127ae44d291 'Collapsed revision
342 o 2: 2127ae44d291 'Collapsed revision
343 | * B
343 | * B
344 | * C'
344 | * C'
345 o 1: b18e25de2cf5 'D'
345 o 1: b18e25de2cf5 'D'
346 |
346 |
347 o 0: 426bada5c675 'A'
347 o 0: 426bada5c675 'A'
348
348
349 $ cd ..
349 $ cd ..
350
350
351 With non-contiguous commits:
351 With non-contiguous commits:
352
352
353 $ hg init non-contiguous
353 $ hg init non-contiguous
354 $ cd non-contiguous
354 $ cd non-contiguous
355 $ cat >> .hg/hgrc <<EOF
355 $ cat >> .hg/hgrc <<EOF
356 > [experimental]
356 > [experimental]
357 > evolution=all
357 > evolution=all
358 > EOF
358 > EOF
359
359
360 $ hg debugdrawdag << 'EOF'
360 $ hg debugdrawdag << 'EOF'
361 > F
361 > F
362 > |
362 > |
363 > E
363 > E
364 > |
364 > |
365 > D
365 > D
366 > |
366 > |
367 > C
367 > C
368 > |
368 > |
369 > B G
369 > B G
370 > |/
370 > |/
371 > A
371 > A
372 > EOF
372 > EOF
373
373
374 BROKEN: should be allowed
374 BROKEN: should be allowed
375 $ hg rebase --collapse -r 'B+D+F' -d G
375 $ hg rebase --collapse -r 'B+D+F' -d G
376 abort: unable to collapse on top of 2, there is more than one external parent: 3, 5
376 abort: unable to collapse on top of 2, there is more than one external parent: 3, 5
377 [255]
377 [255]
378 $ cd ..
378 $ cd ..
379
379
380
380
381 $ hg init multiple-external-parents-2
381 $ hg init multiple-external-parents-2
382 $ cd multiple-external-parents-2
382 $ cd multiple-external-parents-2
383 $ hg debugdrawdag << 'EOF'
383 $ hg debugdrawdag << 'EOF'
384 > D G
384 > D G
385 > |\ /|
385 > |\ /|
386 > B C E F
386 > B C E F
387 > \| |/
387 > \| |/
388 > \ H /
388 > \ H /
389 > \|/
389 > \|/
390 > A
390 > A
391 > EOF
391 > EOF
392
392
393 $ hg rebase --collapse -d H -s 'B+F'
393 $ hg rebase --collapse -d H -s 'B+F'
394 abort: unable to collapse on top of 5, there is more than one external parent: 1, 3
394 abort: unable to collapse on top of 5, there is more than one external parent: 1, 3
395 [255]
395 [255]
396 $ cd ..
396 $ cd ..
397
397
398 With internal merge:
398 With internal merge:
399
399
400 $ hg init internal-merge
400 $ hg init internal-merge
401 $ cd internal-merge
401 $ cd internal-merge
402
402
403 $ hg debugdrawdag << 'EOF'
403 $ hg debugdrawdag << 'EOF'
404 > E
404 > E
405 > |\
405 > |\
406 > C D
406 > C D
407 > |/
407 > |/
408 > F B
408 > F B
409 > |/
409 > |/
410 > A
410 > A
411 > EOF
411 > EOF
412
412
413
413
414 $ hg rebase -s B --collapse --dest F
414 $ hg rebase -s B --collapse --dest F
415 rebasing 1:112478962961 "B" (B)
415 rebasing 1:112478962961 "B" (B)
416 rebasing 3:26805aba1e60 "C" (C)
416 rebasing 3:26805aba1e60 "C" (C)
417 rebasing 4:be0ef73c17ad "D" (D)
417 rebasing 4:be0ef73c17ad "D" (D)
418 rebasing 5:02c4367d6973 "E" (E tip)
418 rebasing 5:02c4367d6973 "E" (E tip)
419 saved backup bundle to $TESTTMP/internal-merge/.hg/strip-backup/112478962961-1dfb057b-rebase.hg
419 saved backup bundle to $TESTTMP/internal-merge/.hg/strip-backup/112478962961-1dfb057b-rebase.hg
420
420
421 $ hg tglog
421 $ hg tglog
422 o 2: c0512a1797b0 'Collapsed revision
422 o 2: c0512a1797b0 'Collapsed revision
423 | * B
423 | * B
424 | * C
424 | * C
425 | * D
425 | * D
426 | * E'
426 | * E'
427 o 1: 8908a377a434 'F'
427 o 1: 8908a377a434 'F'
428 |
428 |
429 o 0: 426bada5c675 'A'
429 o 0: 426bada5c675 'A'
430
430
431 $ hg manifest --rev tip
431 $ hg manifest --rev tip
432 A
432 A
433 B
433 B
434 C
434 C
435 D
435 D
436 F
436 F
437 $ cd ..
437 $ cd ..
438
438
439 Interactions between collapse and keepbranches
439 Interactions between collapse and keepbranches
440 $ hg init e
440 $ hg init e
441 $ cd e
441 $ cd e
442 $ echo 'a' > a
442 $ echo 'a' > a
443 $ hg ci -Am 'A'
443 $ hg ci -Am 'A'
444 adding a
444 adding a
445
445
446 $ hg branch 'one'
446 $ hg branch 'one'
447 marked working directory as branch one
447 marked working directory as branch one
448 (branches are permanent and global, did you want a bookmark?)
448 (branches are permanent and global, did you want a bookmark?)
449 $ echo 'b' > b
449 $ echo 'b' > b
450 $ hg ci -Am 'B'
450 $ hg ci -Am 'B'
451 adding b
451 adding b
452
452
453 $ hg branch 'two'
453 $ hg branch 'two'
454 marked working directory as branch two
454 marked working directory as branch two
455 $ echo 'c' > c
455 $ echo 'c' > c
456 $ hg ci -Am 'C'
456 $ hg ci -Am 'C'
457 adding c
457 adding c
458
458
459 $ hg up -q 0
459 $ hg up -q 0
460 $ echo 'd' > d
460 $ echo 'd' > d
461 $ hg ci -Am 'D'
461 $ hg ci -Am 'D'
462 adding d
462 adding d
463
463
464 $ hg tglog
464 $ hg tglog
465 @ 3: 41acb9dca9eb 'D'
465 @ 3: 41acb9dca9eb 'D'
466 |
466 |
467 | o 2: 8ac4a08debf1 'C' two
467 | o 2: 8ac4a08debf1 'C' two
468 | |
468 | |
469 | o 1: 1ba175478953 'B' one
469 | o 1: 1ba175478953 'B' one
470 |/
470 |/
471 o 0: 1994f17a630e 'A'
471 o 0: 1994f17a630e 'A'
472
472
473 $ hg rebase --keepbranches --collapse -s 1 -d 3
473 $ hg rebase --keepbranches --collapse -s 1 -d 3
474 abort: cannot collapse multiple named branches
474 abort: cannot collapse multiple named branches
475 [255]
475 [255]
476
476
477 $ repeatchange() {
477 $ repeatchange() {
478 > hg checkout $1
478 > hg checkout $1
479 > hg cp d z
479 > hg cp d z
480 > echo blah >> z
480 > echo blah >> z
481 > hg commit -Am "$2" --user "$3"
481 > hg commit -Am "$2" --user "$3"
482 > }
482 > }
483 $ repeatchange 3 "E" "user1"
483 $ repeatchange 3 "E" "user1"
484 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
484 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
485 $ repeatchange 3 "E" "user2"
485 $ repeatchange 3 "E" "user2"
486 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
486 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
487 created new head
487 created new head
488 $ hg tglog
488 $ hg tglog
489 @ 5: fbfb97b1089a 'E'
489 @ 5: fbfb97b1089a 'E'
490 |
490 |
491 | o 4: f338eb3c2c7c 'E'
491 | o 4: f338eb3c2c7c 'E'
492 |/
492 |/
493 o 3: 41acb9dca9eb 'D'
493 o 3: 41acb9dca9eb 'D'
494 |
494 |
495 | o 2: 8ac4a08debf1 'C' two
495 | o 2: 8ac4a08debf1 'C' two
496 | |
496 | |
497 | o 1: 1ba175478953 'B' one
497 | o 1: 1ba175478953 'B' one
498 |/
498 |/
499 o 0: 1994f17a630e 'A'
499 o 0: 1994f17a630e 'A'
500
500
501 $ hg rebase -s 5 -d 4
501 $ hg rebase -s 5 -d 4
502 rebasing 5:fbfb97b1089a "E" (tip)
502 rebasing 5:fbfb97b1089a "E" (tip)
503 note: not rebasing 5:fbfb97b1089a "E" (tip), its destination already has all its changes
503 note: not rebasing 5:fbfb97b1089a "E" (tip), its destination already has all its changes
504 saved backup bundle to $TESTTMP/e/.hg/strip-backup/fbfb97b1089a-553e1d85-rebase.hg
504 saved backup bundle to $TESTTMP/e/.hg/strip-backup/fbfb97b1089a-553e1d85-rebase.hg
505 $ hg tglog
505 $ hg tglog
506 @ 4: f338eb3c2c7c 'E'
506 @ 4: f338eb3c2c7c 'E'
507 |
507 |
508 o 3: 41acb9dca9eb 'D'
508 o 3: 41acb9dca9eb 'D'
509 |
509 |
510 | o 2: 8ac4a08debf1 'C' two
510 | o 2: 8ac4a08debf1 'C' two
511 | |
511 | |
512 | o 1: 1ba175478953 'B' one
512 | o 1: 1ba175478953 'B' one
513 |/
513 |/
514 o 0: 1994f17a630e 'A'
514 o 0: 1994f17a630e 'A'
515
515
516 $ hg export tip
516 $ hg export tip
517 # HG changeset patch
517 # HG changeset patch
518 # User user1
518 # User user1
519 # Date 0 0
519 # Date 0 0
520 # Thu Jan 01 00:00:00 1970 +0000
520 # Thu Jan 01 00:00:00 1970 +0000
521 # Node ID f338eb3c2c7cc5b5915676a2376ba7ac558c5213
521 # Node ID f338eb3c2c7cc5b5915676a2376ba7ac558c5213
522 # Parent 41acb9dca9eb976e84cd21fcb756b4afa5a35c09
522 # Parent 41acb9dca9eb976e84cd21fcb756b4afa5a35c09
523 E
523 E
524
524
525 diff -r 41acb9dca9eb -r f338eb3c2c7c z
525 diff -r 41acb9dca9eb -r f338eb3c2c7c z
526 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
526 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
527 +++ b/z Thu Jan 01 00:00:00 1970 +0000
527 +++ b/z Thu Jan 01 00:00:00 1970 +0000
528 @@ -0,0 +1,2 @@
528 @@ -0,0 +1,2 @@
529 +d
529 +d
530 +blah
530 +blah
531
531
532 $ cd ..
532 $ cd ..
533
533
534 Rebase, collapse and copies
534 Rebase, collapse and copies
535
535
536 $ hg init copies
536 $ hg init copies
537 $ cd copies
537 $ cd copies
538 $ hg unbundle "$TESTDIR/bundles/renames.hg"
538 $ hg unbundle "$TESTDIR/bundles/renames.hg"
539 adding changesets
539 adding changesets
540 adding manifests
540 adding manifests
541 adding file changes
541 adding file changes
542 added 4 changesets with 11 changes to 7 files (+1 heads)
542 added 4 changesets with 11 changes to 7 files (+1 heads)
543 new changesets f447d5abf5ea:338e84e2e558 (4 drafts)
543 new changesets f447d5abf5ea:338e84e2e558 (4 drafts)
544 (run 'hg heads' to see heads, 'hg merge' to merge)
544 (run 'hg heads' to see heads, 'hg merge' to merge)
545 $ hg up -q tip
545 $ hg up -q tip
546 $ hg tglog
546 $ hg tglog
547 @ 3: 338e84e2e558 'move2'
547 @ 3: 338e84e2e558 'move2'
548 |
548 |
549 o 2: 6e7340ee38c0 'move1'
549 o 2: 6e7340ee38c0 'move1'
550 |
550 |
551 | o 1: 1352765a01d4 'change'
551 | o 1: 1352765a01d4 'change'
552 |/
552 |/
553 o 0: f447d5abf5ea 'add'
553 o 0: f447d5abf5ea 'add'
554
554
555 $ hg rebase --collapse -d 1
555 $ hg rebase --collapse -d 1
556 rebasing 2:6e7340ee38c0 "move1"
556 rebasing 2:6e7340ee38c0 "move1"
557 merging a and d to d
557 merging a and d to d
558 merging b and e to e
558 merging b and e to e
559 merging c and f to f
559 merging c and f to f
560 rebasing 3:338e84e2e558 "move2" (tip)
560 rebasing 3:338e84e2e558 "move2" (tip)
561 merging f and c to c
561 merging f and c to c
562 merging e and g to g
562 merging e and g to g
563 saved backup bundle to $TESTTMP/copies/.hg/strip-backup/6e7340ee38c0-ef8ef003-rebase.hg
563 saved backup bundle to $TESTTMP/copies/.hg/strip-backup/6e7340ee38c0-ef8ef003-rebase.hg
564 $ hg st
564 $ hg st
565 $ hg st --copies --change tip
565 $ hg st --copies --change tip
566 A d
566 A d
567 a
567 a
568 A g
568 A g
569 b
569 b
570 R b
570 R b
571 $ hg up tip -q
571 $ hg up tip -q
572 $ cat c
572 $ cat c
573 c
573 c
574 c
574 c
575 $ cat d
575 $ cat d
576 a
576 a
577 a
577 a
578 $ cat g
578 $ cat g
579 b
579 b
580 b
580 b
581 $ hg log -r . --template "{file_copies}\n"
581 $ hg log -r . --template "{file_copies}\n"
582 d (a)g (b)
582 d (a)g (b)
583
583
584 Test collapsing a middle revision in-place
584 Test collapsing a middle revision in-place
585
585
586 $ hg tglog
586 $ hg tglog
587 @ 2: 64b456429f67 'Collapsed revision
587 @ 2: 64b456429f67 'Collapsed revision
588 | * move1
588 | * move1
589 | * move2'
589 | * move2'
590 o 1: 1352765a01d4 'change'
590 o 1: 1352765a01d4 'change'
591 |
591 |
592 o 0: f447d5abf5ea 'add'
592 o 0: f447d5abf5ea 'add'
593
593
594 $ hg rebase --collapse -r 1 -d 0
594 $ hg rebase --collapse -r 1 -d 0
595 abort: can't remove original changesets with unrebased descendants
595 abort: can't remove original changesets with unrebased descendants
596 (use --keep to keep original changesets)
596 (use --keep to keep original changesets)
597 [255]
597 [255]
598
598
599 Test collapsing in place
599 Test collapsing in place
600
600
601 $ hg rebase --collapse -b . -d 0
601 $ hg rebase --collapse -b . -d 0
602 rebasing 1:1352765a01d4 "change"
602 rebasing 1:1352765a01d4 "change"
603 rebasing 2:64b456429f67 "Collapsed revision" (tip)
603 rebasing 2:64b456429f67 "Collapsed revision" (tip)
604 saved backup bundle to $TESTTMP/copies/.hg/strip-backup/1352765a01d4-45a352ea-rebase.hg
604 saved backup bundle to $TESTTMP/copies/.hg/strip-backup/1352765a01d4-45a352ea-rebase.hg
605 $ hg st --change tip --copies
605 $ hg st --change tip --copies
606 M a
606 M a
607 M c
607 M c
608 A d
608 A d
609 a
609 a
610 A g
610 A g
611 b
611 b
612 R b
612 R b
613 $ hg up tip -q
613 $ hg up tip -q
614 $ cat a
614 $ cat a
615 a
615 a
616 a
616 a
617 $ cat c
617 $ cat c
618 c
618 c
619 c
619 c
620 $ cat d
620 $ cat d
621 a
621 a
622 a
622 a
623 $ cat g
623 $ cat g
624 b
624 b
625 b
625 b
626 $ cd ..
626 $ cd ..
627
627
628
628
629 Test stripping a revision with another child
629 Test stripping a revision with another child
630
630
631 $ hg init f
631 $ hg init f
632 $ cd f
632 $ cd f
633
633
634 $ hg debugdrawdag << 'EOF'
634 $ hg debugdrawdag << 'EOF'
635 > C B
635 > C B
636 > |/
636 > |/
637 > A
637 > A
638 > EOF
638 > EOF
639
639
640 $ hg heads --template="{rev}:{node} {branch}: {desc}\n"
640 $ hg heads --template="{rev}:{node} {branch}: {desc}\n"
641 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default: C
641 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default: C
642 1:112478962961147124edd43549aedd1a335e44bf default: B
642 1:112478962961147124edd43549aedd1a335e44bf default: B
643
643
644 $ hg strip C
644 $ hg strip C
645 saved backup bundle to $TESTTMP/f/.hg/strip-backup/dc0947a82db8-d21b92a4-backup.hg
645 saved backup bundle to $TESTTMP/f/.hg/strip-backup/dc0947a82db8-d21b92a4-backup.hg
646
646
647 $ hg tglog
647 $ hg tglog
648 o 1: 112478962961 'B'
648 o 1: 112478962961 'B'
649 |
649 |
650 o 0: 426bada5c675 'A'
650 o 0: 426bada5c675 'A'
651
651
652
652
653
653
654 $ hg heads --template="{rev}:{node} {branch}: {desc}\n"
654 $ hg heads --template="{rev}:{node} {branch}: {desc}\n"
655 1:112478962961147124edd43549aedd1a335e44bf default: B
655 1:112478962961147124edd43549aedd1a335e44bf default: B
656
656
657 $ cd ..
657 $ cd ..
658
658
659 Test collapsing changes that add then remove a file
659 Test collapsing changes that add then remove a file
660
660
661 $ hg init collapseaddremove
661 $ hg init collapseaddremove
662 $ cd collapseaddremove
662 $ cd collapseaddremove
663
663
664 $ touch base
664 $ touch base
665 $ hg commit -Am base
665 $ hg commit -Am base
666 adding base
666 adding base
667 $ touch a
667 $ touch a
668 $ hg commit -Am a
668 $ hg commit -Am a
669 adding a
669 adding a
670 $ hg rm a
670 $ hg rm a
671 $ touch b
671 $ touch b
672 $ hg commit -Am b
672 $ hg commit -Am b
673 adding b
673 adding b
674 $ hg book foo
674 $ hg book foo
675 $ hg rebase -d 0 -r "1::2" --collapse -m collapsed
675 $ hg rebase -d 0 -r "1::2" --collapse -m collapsed
676 rebasing 1:6d8d9f24eec3 "a"
676 rebasing 1:6d8d9f24eec3 "a"
677 rebasing 2:1cc73eca5ecc "b" (foo tip)
677 rebasing 2:1cc73eca5ecc "b" (foo tip)
678 saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-rebase.hg
678 saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-rebase.hg
679 $ hg log -G --template "{rev}: '{desc}' {bookmarks}"
679 $ hg log -G --template "{rev}: '{desc}' {bookmarks}"
680 @ 1: 'collapsed' foo
680 @ 1: 'collapsed' foo
681 |
681 |
682 o 0: 'base'
682 o 0: 'base'
683
683
684 $ hg manifest --rev tip
684 $ hg manifest --rev tip
685 b
685 b
686 base
686 base
687
687
688 $ cd ..
688 $ cd ..
689
689
690 Test that rebase --collapse will remember message after
690 Test that rebase --collapse will remember message after
691 running into merge conflict and invoking rebase --continue.
691 running into merge conflict and invoking rebase --continue.
692
692
693 $ hg init collapse_remember_message
693 $ hg init collapse_remember_message
694 $ cd collapse_remember_message
694 $ cd collapse_remember_message
695 $ hg debugdrawdag << 'EOF'
695 $ hg debugdrawdag << 'EOF'
696 > C B # B/A = B\n
696 > C B # B/A = B\n
697 > |/ # C/A = C\n
697 > |/ # C/A = C\n
698 > A
698 > A
699 > EOF
699 > EOF
700 $ hg rebase --collapse -m "new message" -b B -d C
700 $ hg rebase --collapse -m "new message" -b B -d C
701 rebasing 1:81e5401e4d37 "B" (B)
701 rebasing 1:81e5401e4d37 "B" (B)
702 merging A
702 merging A
703 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
703 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
704 unresolved conflicts (see hg resolve, then hg rebase --continue)
704 unresolved conflicts (see hg resolve, then hg rebase --continue)
705 [1]
705 [1]
706 $ rm A.orig
706 $ rm A.orig
707 $ hg resolve --mark A
707 $ hg resolve --mark A
708 (no more unresolved files)
708 (no more unresolved files)
709 continue: hg rebase --continue
709 continue: hg rebase --continue
710 $ hg rebase --continue
710 $ hg rebase --continue
711 rebasing 1:81e5401e4d37 "B" (B)
711 rebasing 1:81e5401e4d37 "B" (B)
712 saved backup bundle to $TESTTMP/collapse_remember_message/.hg/strip-backup/81e5401e4d37-96c3dd30-rebase.hg
712 saved backup bundle to $TESTTMP/collapse_remember_message/.hg/strip-backup/81e5401e4d37-96c3dd30-rebase.hg
713 $ hg log
713 $ hg log
714 changeset: 2:17186933e123
714 changeset: 2:17186933e123
715 tag: tip
715 tag: tip
716 user: test
716 user: test
717 date: Thu Jan 01 00:00:00 1970 +0000
717 date: Thu Jan 01 00:00:00 1970 +0000
718 summary: new message
718 summary: new message
719
719
720 changeset: 1:043039e9df84
720 changeset: 1:043039e9df84
721 tag: C
721 tag: C
722 user: test
722 user: test
723 date: Thu Jan 01 00:00:00 1970 +0000
723 date: Thu Jan 01 00:00:00 1970 +0000
724 summary: C
724 summary: C
725
725
726 changeset: 0:426bada5c675
726 changeset: 0:426bada5c675
727 tag: A
727 tag: A
728 user: test
728 user: test
729 date: Thu Jan 01 00:00:00 1970 +0000
729 date: Thu Jan 01 00:00:00 1970 +0000
730 summary: A
730 summary: A
731
731
732 $ cd ..
732 $ cd ..
733
733
734 Test aborted editor on final message
734 Test aborted editor on final message
735
735
736 $ HGMERGE=:merge3
736 $ HGMERGE=:merge3
737 $ export HGMERGE
737 $ export HGMERGE
738 $ hg init aborted-editor
738 $ hg init aborted-editor
739 $ cd aborted-editor
739 $ cd aborted-editor
740 $ hg debugdrawdag << 'EOF'
740 $ hg debugdrawdag << 'EOF'
741 > C # D/A = D\n
741 > C # D/A = D\n
742 > | # C/A = C\n
742 > | # C/A = C\n
743 > B D # B/A = B\n
743 > B D # B/A = B\n
744 > |/ # A/A = A\n
744 > |/ # A/A = A\n
745 > A
745 > A
746 > EOF
746 > EOF
747 $ hg rebase --collapse -t internal:merge3 -s B -d D
747 $ hg rebase --collapse -t internal:merge3 -s B -d D
748 rebasing 1:f899f3910ce7 "B" (B)
748 rebasing 1:f899f3910ce7 "B" (B)
749 merging A
749 merging A
750 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
750 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
751 unresolved conflicts (see hg resolve, then hg rebase --continue)
751 unresolved conflicts (see hg resolve, then hg rebase --continue)
752 [1]
752 [1]
753 $ hg tglog
753 $ hg tglog
754 o 3: 63668d570d21 'C'
754 o 3: 63668d570d21 'C'
755 |
755 |
756 | @ 2: 82b8abf9c185 'D'
756 | @ 2: 82b8abf9c185 'D'
757 | |
757 | |
758 @ | 1: f899f3910ce7 'B'
758 @ | 1: f899f3910ce7 'B'
759 |/
759 |/
760 o 0: 4a2df7238c3b 'A'
760 o 0: 4a2df7238c3b 'A'
761
761
762 $ cat A
762 $ cat A
763 <<<<<<< dest: 82b8abf9c185 D - test: D
763 <<<<<<< dest: 82b8abf9c185 D - test: D
764 D
764 D
765 ||||||| base
765 ||||||| base
766 A
766 A
767 =======
767 =======
768 B
768 B
769 >>>>>>> source: f899f3910ce7 B - test: B
769 >>>>>>> source: f899f3910ce7 B - test: B
770 $ echo BC > A
770 $ echo BC > A
771 $ hg resolve -m
771 $ hg resolve -m
772 (no more unresolved files)
772 (no more unresolved files)
773 continue: hg rebase --continue
773 continue: hg rebase --continue
774 $ hg rebase --continue
774 $ hg rebase --continue
775 rebasing 1:f899f3910ce7 "B" (B)
775 rebasing 1:f899f3910ce7 "B" (B)
776 rebasing 3:63668d570d21 "C" (C tip)
776 rebasing 3:63668d570d21 "C" (C tip)
777 merging A
777 merging A
778 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
778 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
779 unresolved conflicts (see hg resolve, then hg rebase --continue)
779 unresolved conflicts (see hg resolve, then hg rebase --continue)
780 [1]
780 [1]
781 $ hg tglog
781 $ hg tglog
782 @ 3: 63668d570d21 'C'
782 @ 3: 63668d570d21 'C'
783 |
783 |
784 | @ 2: 82b8abf9c185 'D'
784 | @ 2: 82b8abf9c185 'D'
785 | |
785 | |
786 o | 1: f899f3910ce7 'B'
786 o | 1: f899f3910ce7 'B'
787 |/
787 |/
788 o 0: 4a2df7238c3b 'A'
788 o 0: 4a2df7238c3b 'A'
789
789
790 $ cat A
790 $ cat A
791 <<<<<<< dest: 82b8abf9c185 D - test: D
791 <<<<<<< dest: 82b8abf9c185 D - test: D
792 BC
792 BC
793 ||||||| base
793 ||||||| base
794 B
794 B
795 =======
795 =======
796 C
796 C
797 >>>>>>> source: 63668d570d21 C tip - test: C
797 >>>>>>> source: 63668d570d21 C tip - test: C
798 $ echo BD > A
798 $ echo BD > A
799 $ hg resolve -m
799 $ hg resolve -m
800 (no more unresolved files)
800 (no more unresolved files)
801 continue: hg rebase --continue
801 continue: hg rebase --continue
802 $ HGEDITOR=false hg rebase --continue --config ui.interactive=1
802 $ HGEDITOR=false hg rebase --continue --config ui.interactive=1
803 already rebased 1:f899f3910ce7 "B" (B) as 82b8abf9c185
803 already rebased 1:f899f3910ce7 "B" (B) as 82b8abf9c185
804 rebasing 3:63668d570d21 "C" (C tip)
804 rebasing 3:63668d570d21 "C" (C tip)
805 abort: edit failed: false exited with status 1
805 abort: edit failed: false exited with status 1
806 [255]
806 [255]
807 $ hg tglog
807 $ hg tglog
808 o 3: 63668d570d21 'C'
808 o 3: 63668d570d21 'C'
809 |
809 |
810 | @ 2: 82b8abf9c185 'D'
810 | @ 2: 82b8abf9c185 'D'
811 | |
811 | |
812 o | 1: f899f3910ce7 'B'
812 o | 1: f899f3910ce7 'B'
813 |/
813 |/
814 o 0: 4a2df7238c3b 'A'
814 o 0: 4a2df7238c3b 'A'
815
815
816 $ hg rebase --continue
816 $ hg rebase --continue
817 already rebased 1:f899f3910ce7 "B" (B) as 82b8abf9c185
817 already rebased 1:f899f3910ce7 "B" (B) as 82b8abf9c185
818 already rebased 3:63668d570d21 "C" (C tip) as 82b8abf9c185
818 already rebased 3:63668d570d21 "C" (C tip) as 82b8abf9c185
819 saved backup bundle to $TESTTMP/aborted-editor/.hg/strip-backup/f899f3910ce7-7cab5e15-rebase.hg
819 saved backup bundle to $TESTTMP/aborted-editor/.hg/strip-backup/f899f3910ce7-7cab5e15-rebase.hg
General Comments 0
You need to be logged in to leave comments. Login now