##// END OF EJS Templates
test-transplant.t: improve test coverage...
timeless -
r27666:cd2f691f default
parent child Browse files
Show More
@@ -1,918 +1,984 b''
1 #require killdaemons
1 #require killdaemons
2
2
3 $ cat <<EOF >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
4 > [extensions]
5 > transplant=
5 > transplant=
6 > EOF
6 > EOF
7
7
8 $ hg init t
8 $ hg init t
9 $ cd t
9 $ cd t
10 $ hg transplant
11 abort: no source URL, branch revision, or revision list provided
12 [255]
13 $ hg transplant --continue --all
14 abort: --continue is incompatible with --branch, --all and --merge
15 [255]
16 $ hg transplant --all tip
17 abort: --all requires a branch revision
18 [255]
19 $ hg transplant --all --branch default tip
20 abort: --all is incompatible with a revision list
21 [255]
10 $ echo r1 > r1
22 $ echo r1 > r1
11 $ hg ci -Amr1 -d'0 0'
23 $ hg ci -Amr1 -d'0 0'
12 adding r1
24 adding r1
25 $ hg co -q null
26 $ hg transplant tip
27 abort: no revision checked out
28 [255]
29 $ hg up -q
13 $ echo r2 > r2
30 $ echo r2 > r2
14 $ hg ci -Amr2 -d'1 0'
31 $ hg ci -Amr2 -d'1 0'
15 adding r2
32 adding r2
16 $ hg up 0
33 $ hg up 0
17 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
34 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
18
35
19 $ echo b1 > b1
36 $ echo b1 > b1
20 $ hg ci -Amb1 -d '0 0'
37 $ hg ci -Amb1 -d '0 0'
21 adding b1
38 adding b1
22 created new head
39 created new head
40 $ hg merge 1
41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 (branch merge, don't forget to commit)
43 $ hg transplant 1
44 abort: outstanding uncommitted merges
45 [255]
46 $ hg up -qC tip
47 $ echo b0 > b1
48 $ hg transplant 1
49 abort: outstanding local changes
50 [255]
51 $ hg up -qC tip
23 $ echo b2 > b2
52 $ echo b2 > b2
24 $ hg ci -Amb2 -d '1 0'
53 $ hg ci -Amb2 -d '1 0'
25 adding b2
54 adding b2
26 $ echo b3 > b3
55 $ echo b3 > b3
27 $ hg ci -Amb3 -d '2 0'
56 $ hg ci -Amb3 -d '2 0'
28 adding b3
57 adding b3
29
58
30 $ hg log --template '{rev} {parents} {desc}\n'
59 $ hg log --template '{rev} {parents} {desc}\n'
31 4 b3
60 4 b3
32 3 b2
61 3 b2
33 2 0:17ab29e464c6 b1
62 2 0:17ab29e464c6 b1
34 1 r2
63 1 r2
35 0 r1
64 0 r1
36
65
37 $ hg clone . ../rebase
66 $ hg clone . ../rebase
38 updating to branch default
67 updating to branch default
39 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
68 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 $ hg init ../emptydest
70 $ cd ../emptydest
71 $ hg transplant --source=../t > /dev/null
40 $ cd ../rebase
72 $ cd ../rebase
41
73
42 $ hg up -C 1
74 $ hg up -C 1
43 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
75 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
44
76
45 rebase b onto r1
77 rebase b onto r1
46 (this also tests that editor is not invoked if '--edit' is not specified)
78 (this also tests that editor is not invoked if '--edit' is not specified)
47
79
48 $ HGEDITOR=cat hg transplant -a -b tip
80 $ HGEDITOR=cat hg transplant -a -b tip
49 applying 37a1297eb21b
81 applying 37a1297eb21b
50 37a1297eb21b transplanted to e234d668f844
82 37a1297eb21b transplanted to e234d668f844
51 applying 722f4667af76
83 applying 722f4667af76
52 722f4667af76 transplanted to 539f377d78df
84 722f4667af76 transplanted to 539f377d78df
53 applying a53251cdf717
85 applying a53251cdf717
54 a53251cdf717 transplanted to ffd6818a3975
86 a53251cdf717 transplanted to ffd6818a3975
55 $ hg log --template '{rev} {parents} {desc}\n'
87 $ hg log --template '{rev} {parents} {desc}\n'
56 7 b3
88 7 b3
57 6 b2
89 6 b2
58 5 1:d11e3596cc1a b1
90 5 1:d11e3596cc1a b1
59 4 b3
91 4 b3
60 3 b2
92 3 b2
61 2 0:17ab29e464c6 b1
93 2 0:17ab29e464c6 b1
62 1 r2
94 1 r2
63 0 r1
95 0 r1
64
96
65 test transplanted revset
97 test transplanted revset
66
98
67 $ hg log -r 'transplanted()' --template '{rev} {parents} {desc}\n'
99 $ hg log -r 'transplanted()' --template '{rev} {parents} {desc}\n'
68 5 1:d11e3596cc1a b1
100 5 1:d11e3596cc1a b1
69 6 b2
101 6 b2
70 7 b3
102 7 b3
103 $ hg log -r 'transplanted(head())' --template '{rev} {parents} {desc}\n'
104 7 b3
71 $ hg help revsets | grep transplanted
105 $ hg help revsets | grep transplanted
72 "transplanted([set])"
106 "transplanted([set])"
73 Transplanted changesets in set, or all transplanted changesets.
107 Transplanted changesets in set, or all transplanted changesets.
74
108
75 test transplanted keyword
109 test transplanted keyword
76
110
77 $ hg log --template '{rev} {transplanted}\n'
111 $ hg log --template '{rev} {transplanted}\n'
78 7 a53251cdf717679d1907b289f991534be05c997a
112 7 a53251cdf717679d1907b289f991534be05c997a
79 6 722f4667af767100cb15b6a79324bf8abbfe1ef4
113 6 722f4667af767100cb15b6a79324bf8abbfe1ef4
80 5 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21
114 5 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21
81 4
115 4
82 3
116 3
83 2
117 2
84 1
118 1
85 0
119 0
86
120
87 test destination() revset predicate with a transplant of a transplant; new
121 test destination() revset predicate with a transplant of a transplant; new
88 clone so subsequent rollback isn't affected
122 clone so subsequent rollback isn't affected
89 (this also tests that editor is invoked if '--edit' is specified)
123 (this also tests that editor is invoked if '--edit' is specified)
90
124
91 $ hg clone -q . ../destination
125 $ hg clone -q . ../destination
92 $ cd ../destination
126 $ cd ../destination
93 $ hg up -Cq 0
127 $ hg up -Cq 0
94 $ hg branch -q b4
128 $ hg branch -q b4
95 $ hg ci -qm "b4"
129 $ hg ci -qm "b4"
96 $ hg status --rev "7^1" --rev 7
130 $ hg status --rev "7^1" --rev 7
97 A b3
131 A b3
98 $ cat > $TESTTMP/checkeditform.sh <<EOF
132 $ cat > $TESTTMP/checkeditform.sh <<EOF
99 > env | grep HGEDITFORM
133 > env | grep HGEDITFORM
100 > true
134 > true
101 > EOF
135 > EOF
102 $ cat > $TESTTMP/checkeditform-n-cat.sh <<EOF
136 $ cat > $TESTTMP/checkeditform-n-cat.sh <<EOF
103 > env | grep HGEDITFORM
137 > env | grep HGEDITFORM
104 > cat \$*
138 > cat \$*
105 > EOF
139 > EOF
106 $ HGEDITOR="sh $TESTTMP/checkeditform-n-cat.sh" hg transplant --edit 7
140 $ HGEDITOR="sh $TESTTMP/checkeditform-n-cat.sh" hg transplant --edit 7
107 applying ffd6818a3975
141 applying ffd6818a3975
108 HGEDITFORM=transplant.normal
142 HGEDITFORM=transplant.normal
109 b3
143 b3
110
144
111
145
112 HG: Enter commit message. Lines beginning with 'HG:' are removed.
146 HG: Enter commit message. Lines beginning with 'HG:' are removed.
113 HG: Leave message empty to abort commit.
147 HG: Leave message empty to abort commit.
114 HG: --
148 HG: --
115 HG: user: test
149 HG: user: test
116 HG: branch 'b4'
150 HG: branch 'b4'
117 HG: added b3
151 HG: added b3
118 ffd6818a3975 transplanted to 502236fa76bb
152 ffd6818a3975 transplanted to 502236fa76bb
119
153
120
154
121 $ hg log -r 'destination()'
155 $ hg log -r 'destination()'
122 changeset: 5:e234d668f844
156 changeset: 5:e234d668f844
123 parent: 1:d11e3596cc1a
157 parent: 1:d11e3596cc1a
124 user: test
158 user: test
125 date: Thu Jan 01 00:00:00 1970 +0000
159 date: Thu Jan 01 00:00:00 1970 +0000
126 summary: b1
160 summary: b1
127
161
128 changeset: 6:539f377d78df
162 changeset: 6:539f377d78df
129 user: test
163 user: test
130 date: Thu Jan 01 00:00:01 1970 +0000
164 date: Thu Jan 01 00:00:01 1970 +0000
131 summary: b2
165 summary: b2
132
166
133 changeset: 7:ffd6818a3975
167 changeset: 7:ffd6818a3975
134 user: test
168 user: test
135 date: Thu Jan 01 00:00:02 1970 +0000
169 date: Thu Jan 01 00:00:02 1970 +0000
136 summary: b3
170 summary: b3
137
171
138 changeset: 9:502236fa76bb
172 changeset: 9:502236fa76bb
139 branch: b4
173 branch: b4
140 tag: tip
174 tag: tip
141 user: test
175 user: test
142 date: Thu Jan 01 00:00:02 1970 +0000
176 date: Thu Jan 01 00:00:02 1970 +0000
143 summary: b3
177 summary: b3
144
178
145 $ hg log -r 'destination(a53251cdf717)'
179 $ hg log -r 'destination(a53251cdf717)'
146 changeset: 7:ffd6818a3975
180 changeset: 7:ffd6818a3975
147 user: test
181 user: test
148 date: Thu Jan 01 00:00:02 1970 +0000
182 date: Thu Jan 01 00:00:02 1970 +0000
149 summary: b3
183 summary: b3
150
184
151 changeset: 9:502236fa76bb
185 changeset: 9:502236fa76bb
152 branch: b4
186 branch: b4
153 tag: tip
187 tag: tip
154 user: test
188 user: test
155 date: Thu Jan 01 00:00:02 1970 +0000
189 date: Thu Jan 01 00:00:02 1970 +0000
156 summary: b3
190 summary: b3
157
191
158
192
159 test subset parameter in reverse order
193 test subset parameter in reverse order
160 $ hg log -r 'reverse(all()) and destination(a53251cdf717)'
194 $ hg log -r 'reverse(all()) and destination(a53251cdf717)'
161 changeset: 9:502236fa76bb
195 changeset: 9:502236fa76bb
162 branch: b4
196 branch: b4
163 tag: tip
197 tag: tip
164 user: test
198 user: test
165 date: Thu Jan 01 00:00:02 1970 +0000
199 date: Thu Jan 01 00:00:02 1970 +0000
166 summary: b3
200 summary: b3
167
201
168 changeset: 7:ffd6818a3975
202 changeset: 7:ffd6818a3975
169 user: test
203 user: test
170 date: Thu Jan 01 00:00:02 1970 +0000
204 date: Thu Jan 01 00:00:02 1970 +0000
171 summary: b3
205 summary: b3
172
206
173
207
174 back to the original dir
208 back to the original dir
175 $ cd ../rebase
209 $ cd ../rebase
176
210
177 rollback the transplant
211 rollback the transplant
178 $ hg rollback
212 $ hg rollback
179 repository tip rolled back to revision 4 (undo transplant)
213 repository tip rolled back to revision 4 (undo transplant)
180 working directory now based on revision 1
214 working directory now based on revision 1
181 $ hg tip -q
215 $ hg tip -q
182 4:a53251cdf717
216 4:a53251cdf717
183 $ hg parents -q
217 $ hg parents -q
184 1:d11e3596cc1a
218 1:d11e3596cc1a
185 $ hg status
219 $ hg status
186 ? b1
220 ? b1
187 ? b2
221 ? b2
188 ? b3
222 ? b3
189
223
190 $ hg clone ../t ../prune
224 $ hg clone ../t ../prune
191 updating to branch default
225 updating to branch default
192 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
226 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 $ cd ../prune
227 $ cd ../prune
194
228
195 $ hg up -C 1
229 $ hg up -C 1
196 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
230 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
197
231
198 rebase b onto r1, skipping b2
232 rebase b onto r1, skipping b2
199
233
200 $ hg transplant -a -b tip -p 3
234 $ hg transplant -a -b tip -p 3
201 applying 37a1297eb21b
235 applying 37a1297eb21b
202 37a1297eb21b transplanted to e234d668f844
236 37a1297eb21b transplanted to e234d668f844
203 applying a53251cdf717
237 applying a53251cdf717
204 a53251cdf717 transplanted to 7275fda4d04f
238 a53251cdf717 transplanted to 7275fda4d04f
205 $ hg log --template '{rev} {parents} {desc}\n'
239 $ hg log --template '{rev} {parents} {desc}\n'
206 6 b3
240 6 b3
207 5 1:d11e3596cc1a b1
241 5 1:d11e3596cc1a b1
208 4 b3
242 4 b3
209 3 b2
243 3 b2
210 2 0:17ab29e464c6 b1
244 2 0:17ab29e464c6 b1
211 1 r2
245 1 r2
212 0 r1
246 0 r1
213
247
214 test same-parent transplant with --log
248 test same-parent transplant with --log
215
249
216 $ hg clone -r 1 ../t ../sameparent
250 $ hg clone -r 1 ../t ../sameparent
217 adding changesets
251 adding changesets
218 adding manifests
252 adding manifests
219 adding file changes
253 adding file changes
220 added 2 changesets with 2 changes to 2 files
254 added 2 changesets with 2 changes to 2 files
221 updating to branch default
255 updating to branch default
222 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
256 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 $ cd ../sameparent
257 $ cd ../sameparent
224 $ hg transplant --log -s ../prune 5
258 $ hg transplant --log -s ../prune 5
225 searching for changes
259 searching for changes
226 applying e234d668f844
260 applying e234d668f844
227 e234d668f844 transplanted to e07aea8ecf9c
261 e234d668f844 transplanted to e07aea8ecf9c
228 $ hg log --template '{rev} {parents} {desc}\n'
262 $ hg log --template '{rev} {parents} {desc}\n'
229 2 b1
263 2 b1
230 (transplanted from e234d668f844e1b1a765f01db83a32c0c7bfa170)
264 (transplanted from e234d668f844e1b1a765f01db83a32c0c7bfa170)
231 1 r2
265 1 r2
232 0 r1
266 0 r1
233 remote transplant, and also test that transplant doesn't break with
267 remote transplant, and also test that transplant doesn't break with
234 format-breaking diffopts
268 format-breaking diffopts
235
269
236 $ hg clone -r 1 ../t ../remote
270 $ hg clone -r 1 ../t ../remote
237 adding changesets
271 adding changesets
238 adding manifests
272 adding manifests
239 adding file changes
273 adding file changes
240 added 2 changesets with 2 changes to 2 files
274 added 2 changesets with 2 changes to 2 files
241 updating to branch default
275 updating to branch default
242 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
276 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
243 $ cd ../remote
277 $ cd ../remote
244 $ hg --config diff.noprefix=True transplant --log -s ../t 2 4
278 $ hg --config diff.noprefix=True transplant --log -s ../t 2 4
245 searching for changes
279 searching for changes
246 applying 37a1297eb21b
280 applying 37a1297eb21b
247 37a1297eb21b transplanted to c19cf0ccb069
281 37a1297eb21b transplanted to c19cf0ccb069
248 applying a53251cdf717
282 applying a53251cdf717
249 a53251cdf717 transplanted to f7fe5bf98525
283 a53251cdf717 transplanted to f7fe5bf98525
250 $ hg log --template '{rev} {parents} {desc}\n'
284 $ hg log --template '{rev} {parents} {desc}\n'
251 3 b3
285 3 b3
252 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
286 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
253 2 b1
287 2 b1
254 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
288 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
255 1 r2
289 1 r2
256 0 r1
290 0 r1
257
291
258 skip previous transplants
292 skip previous transplants
259
293
260 $ hg transplant -s ../t -a -b 4
294 $ hg transplant -s ../t -a -b 4
261 searching for changes
295 searching for changes
262 applying 722f4667af76
296 applying 722f4667af76
263 722f4667af76 transplanted to 47156cd86c0b
297 722f4667af76 transplanted to 47156cd86c0b
264 $ hg log --template '{rev} {parents} {desc}\n'
298 $ hg log --template '{rev} {parents} {desc}\n'
265 4 b2
299 4 b2
266 3 b3
300 3 b3
267 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
301 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
268 2 b1
302 2 b1
269 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
303 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
270 1 r2
304 1 r2
271 0 r1
305 0 r1
272
306
273 skip local changes transplanted to the source
307 skip local changes transplanted to the source
274
308
275 $ echo b4 > b4
309 $ echo b4 > b4
276 $ hg ci -Amb4 -d '3 0'
310 $ hg ci -Amb4 -d '3 0'
277 adding b4
311 adding b4
278 $ hg clone ../t ../pullback
312 $ hg clone ../t ../pullback
279 updating to branch default
313 updating to branch default
280 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
314 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 $ cd ../pullback
315 $ cd ../pullback
282 $ hg transplant -s ../remote -a -b tip
316 $ hg transplant -s ../remote -a -b tip
283 searching for changes
317 searching for changes
284 applying 4333daefcb15
318 applying 4333daefcb15
285 4333daefcb15 transplanted to 5f42c04e07cc
319 4333daefcb15 transplanted to 5f42c04e07cc
286
320
287
321
288 remote transplant with pull
322 remote transplant with pull
289
323
290 $ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
324 $ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
291 $ cat ../t.pid >> $DAEMON_PIDS
325 $ cat ../t.pid >> $DAEMON_PIDS
292
326
293 $ hg clone -r 0 ../t ../rp
327 $ hg clone -r 0 ../t ../rp
294 adding changesets
328 adding changesets
295 adding manifests
329 adding manifests
296 adding file changes
330 adding file changes
297 added 1 changesets with 1 changes to 1 files
331 added 1 changesets with 1 changes to 1 files
298 updating to branch default
332 updating to branch default
299 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
333 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
300 $ cd ../rp
334 $ cd ../rp
301 $ hg transplant -s http://localhost:$HGPORT/ 37a1297eb21b a53251cdf717
335 $ hg transplant -s http://localhost:$HGPORT/ 37a1297eb21b a53251cdf717
302 searching for changes
336 searching for changes
303 searching for changes
337 searching for changes
304 adding changesets
338 adding changesets
305 adding manifests
339 adding manifests
306 adding file changes
340 adding file changes
307 added 1 changesets with 1 changes to 1 files
341 added 1 changesets with 1 changes to 1 files
308 applying a53251cdf717
342 applying a53251cdf717
309 a53251cdf717 transplanted to 8d9279348abb
343 a53251cdf717 transplanted to 8d9279348abb
310 $ hg log --template '{rev} {parents} {desc}\n'
344 $ hg log --template '{rev} {parents} {desc}\n'
311 2 b3
345 2 b3
312 1 b1
346 1 b1
313 0 r1
347 0 r1
314
348
315 remote transplant without pull
349 remote transplant without pull
316 (It was using "2" and "4" (as the previous transplant used to) which referenced
350 (It was using "2" and "4" (as the previous transplant used to) which referenced
317 revision different from one run to another)
351 revision different from one run to another)
318
352
319 $ hg pull -q http://localhost:$HGPORT/
353 $ hg pull -q http://localhost:$HGPORT/
320 $ hg transplant -s http://localhost:$HGPORT/ 8d9279348abb 722f4667af76
354 $ hg transplant -s http://localhost:$HGPORT/ 8d9279348abb 722f4667af76
321 skipping already applied revision 2:8d9279348abb
355 skipping already applied revision 2:8d9279348abb
322 applying 722f4667af76
356 applying 722f4667af76
323 722f4667af76 transplanted to 76e321915884
357 722f4667af76 transplanted to 76e321915884
324
358
325 transplant --continue
359 transplant --continue
326
360
327 $ hg init ../tc
361 $ hg init ../tc
328 $ cd ../tc
362 $ cd ../tc
329 $ cat <<EOF > foo
363 $ cat <<EOF > foo
330 > foo
364 > foo
331 > bar
365 > bar
332 > baz
366 > baz
333 > EOF
367 > EOF
334 $ echo toremove > toremove
368 $ echo toremove > toremove
335 $ echo baz > baz
369 $ echo baz > baz
336 $ hg ci -Amfoo
370 $ hg ci -Amfoo
337 adding baz
371 adding baz
338 adding foo
372 adding foo
339 adding toremove
373 adding toremove
340 $ cat <<EOF > foo
374 $ cat <<EOF > foo
341 > foo2
375 > foo2
342 > bar2
376 > bar2
343 > baz2
377 > baz2
344 > EOF
378 > EOF
345 $ rm toremove
379 $ rm toremove
346 $ echo added > added
380 $ echo added > added
347 $ hg ci -Amfoo2
381 $ hg ci -Amfoo2
348 adding added
382 adding added
349 removing toremove
383 removing toremove
350 $ echo bar > bar
384 $ echo bar > bar
351 $ cat > baz <<EOF
385 $ cat > baz <<EOF
352 > before baz
386 > before baz
353 > baz
387 > baz
354 > after baz
388 > after baz
355 > EOF
389 > EOF
356 $ hg ci -Ambar
390 $ hg ci -Ambar
357 adding bar
391 adding bar
358 $ echo bar2 >> bar
392 $ echo bar2 >> bar
359 $ hg ci -mbar2
393 $ hg ci -mbar2
360 $ hg up 0
394 $ hg up 0
361 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
395 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
362 $ echo foobar > foo
396 $ echo foobar > foo
363 $ hg ci -mfoobar
397 $ hg ci -mfoobar
364 created new head
398 created new head
365 $ hg transplant 1:3
399 $ hg transplant 1:3
366 applying 46ae92138f3c
400 applying 46ae92138f3c
367 patching file foo
401 patching file foo
368 Hunk #1 FAILED at 0
402 Hunk #1 FAILED at 0
369 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
403 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
370 patch failed to apply
404 patch failed to apply
371 abort: fix up the merge and run hg transplant --continue
405 abort: fix up the merge and run hg transplant --continue
372 [255]
406 [255]
373
407
374 transplant -c shouldn't use an old changeset
408 transplant -c shouldn't use an old changeset
375
409
376 $ hg up -C
410 $ hg up -C
377 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
411 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
378 $ rm added
412 $ rm added
379 $ hg transplant 1
413 $ hg transplant 1
380 applying 46ae92138f3c
414 applying 46ae92138f3c
381 patching file foo
415 patching file foo
382 Hunk #1 FAILED at 0
416 Hunk #1 FAILED at 0
383 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
417 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
384 patch failed to apply
418 patch failed to apply
385 abort: fix up the merge and run hg transplant --continue
419 abort: fix up the merge and run hg transplant --continue
386 [255]
420 [255]
421 $ cp .hg/transplant/journal .hg/transplant/journal.orig
422 $ cat .hg/transplant/journal
423 # User test
424 # Date 0 0
425 # Node ID 46ae92138f3ce0249f6789650403286ead052b6d
426 # Parent e8643552fde58f57515e19c4b373a57c96e62af3
427 foo2
428 $ grep -v 'Date' .hg/transplant/journal.orig > .hg/transplant/journal
429 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
430 abort: filter corrupted changeset (no user or date)
431 [255]
432 $ cp .hg/transplant/journal.orig .hg/transplant/journal
387 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
433 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
388 HGEDITFORM=transplant.normal
434 HGEDITFORM=transplant.normal
389 46ae92138f3c transplanted as 9159dada197d
435 46ae92138f3c transplanted as 9159dada197d
390 $ hg transplant 1:3
436 $ hg transplant 1:3
391 skipping already applied revision 1:46ae92138f3c
437 skipping already applied revision 1:46ae92138f3c
392 applying 9d6d6b5a8275
438 applying 9d6d6b5a8275
393 9d6d6b5a8275 transplanted to 2d17a10c922f
439 9d6d6b5a8275 transplanted to 2d17a10c922f
394 applying 1dab759070cf
440 applying 1dab759070cf
395 1dab759070cf transplanted to e06a69927eb0
441 1dab759070cf transplanted to e06a69927eb0
396 $ hg locate
442 $ hg locate
397 added
443 added
398 bar
444 bar
399 baz
445 baz
400 foo
446 foo
401
447
402 test multiple revisions and --continue
448 test multiple revisions and --continue
403
449
404 $ hg up -qC 0
450 $ hg up -qC 0
405 $ echo bazbaz > baz
451 $ echo bazbaz > baz
406 $ hg ci -Am anotherbaz baz
452 $ hg ci -Am anotherbaz baz
407 created new head
453 created new head
408 $ hg transplant 1:3
454 $ hg transplant 1:3
409 applying 46ae92138f3c
455 applying 46ae92138f3c
410 46ae92138f3c transplanted to 1024233ea0ba
456 46ae92138f3c transplanted to 1024233ea0ba
411 applying 9d6d6b5a8275
457 applying 9d6d6b5a8275
412 patching file baz
458 patching file baz
413 Hunk #1 FAILED at 0
459 Hunk #1 FAILED at 0
414 1 out of 1 hunks FAILED -- saving rejects to file baz.rej
460 1 out of 1 hunks FAILED -- saving rejects to file baz.rej
415 patch failed to apply
461 patch failed to apply
416 abort: fix up the merge and run hg transplant --continue
462 abort: fix up the merge and run hg transplant --continue
417 [255]
463 [255]
418 $ echo fixed > baz
464 $ echo fixed > baz
419 $ hg transplant --continue
465 $ hg transplant --continue
420 9d6d6b5a8275 transplanted as d80c49962290
466 9d6d6b5a8275 transplanted as d80c49962290
421 applying 1dab759070cf
467 applying 1dab759070cf
422 1dab759070cf transplanted to aa0ffe6bd5ae
468 1dab759070cf transplanted to aa0ffe6bd5ae
423
469
424 $ cd ..
470 $ cd ..
425
471
426 Issue1111: Test transplant --merge
472 Issue1111: Test transplant --merge
427
473
428 $ hg init t1111
474 $ hg init t1111
429 $ cd t1111
475 $ cd t1111
430 $ echo a > a
476 $ echo a > a
431 $ hg ci -Am adda
477 $ hg ci -Am adda
432 adding a
478 adding a
433 $ echo b >> a
479 $ echo b >> a
434 $ hg ci -m appendb
480 $ hg ci -m appendb
435 $ echo c >> a
481 $ echo c >> a
436 $ hg ci -m appendc
482 $ hg ci -m appendc
437 $ hg up -C 0
483 $ hg up -C 0
438 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
484 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
439 $ echo d >> a
485 $ echo d >> a
440 $ hg ci -m appendd
486 $ hg ci -m appendd
441 created new head
487 created new head
442
488
443 transplant
489 transplant
444
490
445 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant -m 1 -e
491 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant -m 1 -e
446 applying 42dc4432fd35
492 applying 42dc4432fd35
447 HGEDITFORM=transplant.merge
493 HGEDITFORM=transplant.merge
448 1:42dc4432fd35 merged at a9f4acbac129
494 1:42dc4432fd35 merged at a9f4acbac129
449 $ hg update -q -C 2
495 $ hg update -q -C 2
450 $ cat > a <<EOF
496 $ cat > a <<EOF
451 > x
497 > x
452 > y
498 > y
453 > z
499 > z
454 > EOF
500 > EOF
455 $ hg commit -m replace
501 $ hg commit -m replace
456 $ hg update -q -C 4
502 $ hg update -q -C 4
457 $ hg transplant -m 5
503 $ hg transplant -m 5
458 applying 600a3cdcb41d
504 applying 600a3cdcb41d
459 patching file a
505 patching file a
460 Hunk #1 FAILED at 0
506 Hunk #1 FAILED at 0
461 1 out of 1 hunks FAILED -- saving rejects to file a.rej
507 1 out of 1 hunks FAILED -- saving rejects to file a.rej
462 patch failed to apply
508 patch failed to apply
463 abort: fix up the merge and run hg transplant --continue
509 abort: fix up the merge and run hg transplant --continue
464 [255]
510 [255]
465 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
511 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
466 HGEDITFORM=transplant.merge
512 HGEDITFORM=transplant.merge
467 600a3cdcb41d transplanted as a3f88be652e0
513 600a3cdcb41d transplanted as a3f88be652e0
468
514
469 $ cd ..
515 $ cd ..
470
516
471 test transplant into empty repository
517 test transplant into empty repository
472
518
473 $ hg init empty
519 $ hg init empty
474 $ cd empty
520 $ cd empty
475 $ hg transplant -s ../t -b tip -a
521 $ hg transplant -s ../t -b tip -a
476 adding changesets
522 adding changesets
477 adding manifests
523 adding manifests
478 adding file changes
524 adding file changes
479 added 4 changesets with 4 changes to 4 files
525 added 4 changesets with 4 changes to 4 files
480
526
481 test "--merge" causing pull from source repository on local host
527 test "--merge" causing pull from source repository on local host
482
528
483 $ hg --config extensions.mq= -q strip 2
529 $ hg --config extensions.mq= -q strip 2
484 $ hg transplant -s ../t --merge tip
530 $ hg transplant -s ../t --merge tip
485 searching for changes
531 searching for changes
486 searching for changes
532 searching for changes
487 adding changesets
533 adding changesets
488 adding manifests
534 adding manifests
489 adding file changes
535 adding file changes
490 added 2 changesets with 2 changes to 2 files
536 added 2 changesets with 2 changes to 2 files
491 applying a53251cdf717
537 applying a53251cdf717
492 4:a53251cdf717 merged at 4831f4dc831a
538 4:a53251cdf717 merged at 4831f4dc831a
493
539
494 test interactive transplant
540 test interactive transplant
495
541
496 $ hg --config extensions.strip= -q strip 0
542 $ hg --config extensions.strip= -q strip 0
497 $ hg -R ../t log -G --template "{rev}:{node|short}"
543 $ hg -R ../t log -G --template "{rev}:{node|short}"
498 @ 4:a53251cdf717
544 @ 4:a53251cdf717
499 |
545 |
500 o 3:722f4667af76
546 o 3:722f4667af76
501 |
547 |
502 o 2:37a1297eb21b
548 o 2:37a1297eb21b
503 |
549 |
504 | o 1:d11e3596cc1a
550 | o 1:d11e3596cc1a
505 |/
551 |/
506 o 0:17ab29e464c6
552 o 0:17ab29e464c6
507
553
508 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
554 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
555 > ?
556 > x
557 > q
558 > EOF
559 0:17ab29e464c6
560 apply changeset? [ynmpcq?]: ?
561 y: yes, transplant this changeset
562 n: no, skip this changeset
563 m: merge at this changeset
564 p: show patch
565 c: commit selected changesets
566 q: quit and cancel transplant
567 ?: ? (show this help)
568 apply changeset? [ynmpcq?]: x
569 unrecognized response
570 apply changeset? [ynmpcq?]: q
571 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
509 > p
572 > p
510 > y
573 > y
511 > n
574 > n
512 > n
575 > n
513 > m
576 > m
514 > c
577 > c
515 > EOF
578 > EOF
516 0:17ab29e464c6
579 0:17ab29e464c6
517 apply changeset? [ynmpcq?]: p
580 apply changeset? [ynmpcq?]: p
518 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
581 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
519 +++ b/r1 Thu Jan 01 00:00:00 1970 +0000
582 +++ b/r1 Thu Jan 01 00:00:00 1970 +0000
520 @@ -0,0 +1,1 @@
583 @@ -0,0 +1,1 @@
521 +r1
584 +r1
522 apply changeset? [ynmpcq?]: y
585 apply changeset? [ynmpcq?]: y
523 1:d11e3596cc1a
586 1:d11e3596cc1a
524 apply changeset? [ynmpcq?]: n
587 apply changeset? [ynmpcq?]: n
525 2:37a1297eb21b
588 2:37a1297eb21b
526 apply changeset? [ynmpcq?]: n
589 apply changeset? [ynmpcq?]: n
527 3:722f4667af76
590 3:722f4667af76
528 apply changeset? [ynmpcq?]: m
591 apply changeset? [ynmpcq?]: m
529 4:a53251cdf717
592 4:a53251cdf717
530 apply changeset? [ynmpcq?]: c
593 apply changeset? [ynmpcq?]: c
531 $ hg log -G --template "{node|short}"
594 $ hg log -G --template "{node|short}"
532 @ 88be5dde5260
595 @ 88be5dde5260
533 |\
596 |\
534 | o 722f4667af76
597 | o 722f4667af76
535 | |
598 | |
536 | o 37a1297eb21b
599 | o 37a1297eb21b
537 |/
600 |/
538 o 17ab29e464c6
601 o 17ab29e464c6
539
602
540 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
603 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
541 > x
604 > x
542 > ?
605 > ?
543 > y
606 > y
544 > q
607 > q
545 > EOF
608 > EOF
546 1:d11e3596cc1a
609 1:d11e3596cc1a
547 apply changeset? [ynmpcq?]: x
610 apply changeset? [ynmpcq?]: x
548 unrecognized response
611 unrecognized response
549 apply changeset? [ynmpcq?]: ?
612 apply changeset? [ynmpcq?]: ?
550 y: yes, transplant this changeset
613 y: yes, transplant this changeset
551 n: no, skip this changeset
614 n: no, skip this changeset
552 m: merge at this changeset
615 m: merge at this changeset
553 p: show patch
616 p: show patch
554 c: commit selected changesets
617 c: commit selected changesets
555 q: quit and cancel transplant
618 q: quit and cancel transplant
556 ?: ? (show this help)
619 ?: ? (show this help)
557 apply changeset? [ynmpcq?]: y
620 apply changeset? [ynmpcq?]: y
558 4:a53251cdf717
621 4:a53251cdf717
559 apply changeset? [ynmpcq?]: q
622 apply changeset? [ynmpcq?]: q
560 $ hg heads --template "{node|short}\n"
623 $ hg heads --template "{node|short}\n"
561 88be5dde5260
624 88be5dde5260
562
625
563 $ cd ..
626 $ cd ..
564
627
565
628
566 #if unix-permissions system-sh
629 #if unix-permissions system-sh
567
630
568 test filter
631 test filter
569
632
570 $ hg init filter
633 $ hg init filter
571 $ cd filter
634 $ cd filter
572 $ cat <<'EOF' >test-filter
635 $ cat <<'EOF' >test-filter
573 > #!/bin/sh
636 > #!/bin/sh
574 > sed 's/r1/r2/' $1 > $1.new
637 > sed 's/r1/r2/' $1 > $1.new
575 > mv $1.new $1
638 > mv $1.new $1
576 > EOF
639 > EOF
577 $ chmod +x test-filter
640 $ chmod +x test-filter
578 $ hg transplant -s ../t -b tip -a --filter ./test-filter
641 $ hg transplant -s ../t -b tip -a --filter ./test-filter
579 filtering * (glob)
642 filtering * (glob)
580 applying 17ab29e464c6
643 applying 17ab29e464c6
581 17ab29e464c6 transplanted to e9ffc54ea104
644 17ab29e464c6 transplanted to e9ffc54ea104
582 filtering * (glob)
645 filtering * (glob)
583 applying 37a1297eb21b
646 applying 37a1297eb21b
584 37a1297eb21b transplanted to 348b36d0b6a5
647 37a1297eb21b transplanted to 348b36d0b6a5
585 filtering * (glob)
648 filtering * (glob)
586 applying 722f4667af76
649 applying 722f4667af76
587 722f4667af76 transplanted to 0aa6979afb95
650 722f4667af76 transplanted to 0aa6979afb95
588 filtering * (glob)
651 filtering * (glob)
589 applying a53251cdf717
652 applying a53251cdf717
590 a53251cdf717 transplanted to 14f8512272b5
653 a53251cdf717 transplanted to 14f8512272b5
591 $ hg log --template '{rev} {parents} {desc}\n'
654 $ hg log --template '{rev} {parents} {desc}\n'
592 3 b3
655 3 b3
593 2 b2
656 2 b2
594 1 b1
657 1 b1
595 0 r2
658 0 r2
596 $ cd ..
659 $ cd ..
597
660
598
661
599 test filter with failed patch
662 test filter with failed patch
600
663
601 $ cd filter
664 $ cd filter
602 $ hg up 0
665 $ hg up 0
603 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
666 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
604 $ echo foo > b1
667 $ echo foo > b1
605 $ hg ci -Am foo
668 $ hg ci -Am foo
606 adding b1
669 adding b1
607 adding test-filter
670 adding test-filter
608 created new head
671 created new head
609 $ hg transplant 1 --filter ./test-filter
672 $ hg transplant 1 --filter ./test-filter
610 filtering * (glob)
673 filtering * (glob)
611 applying 348b36d0b6a5
674 applying 348b36d0b6a5
612 file b1 already exists
675 file b1 already exists
613 1 out of 1 hunks FAILED -- saving rejects to file b1.rej
676 1 out of 1 hunks FAILED -- saving rejects to file b1.rej
614 patch failed to apply
677 patch failed to apply
615 abort: fix up the merge and run hg transplant --continue
678 abort: fix up the merge and run hg transplant --continue
616 [255]
679 [255]
617 $ cd ..
680 $ cd ..
618
681
619 test environment passed to filter
682 test environment passed to filter
620
683
621 $ hg init filter-environment
684 $ hg init filter-environment
622 $ cd filter-environment
685 $ cd filter-environment
623 $ cat <<'EOF' >test-filter-environment
686 $ cat <<'EOF' >test-filter-environment
624 > #!/bin/sh
687 > #!/bin/sh
625 > echo "Transplant by $HGUSER" >> $1
688 > echo "Transplant by $HGUSER" >> $1
626 > echo "Transplant from rev $HGREVISION" >> $1
689 > echo "Transplant from rev $HGREVISION" >> $1
627 > EOF
690 > EOF
628 $ chmod +x test-filter-environment
691 $ chmod +x test-filter-environment
629 $ hg transplant -s ../t --filter ./test-filter-environment 0
692 $ hg transplant -s ../t --filter ./test-filter-environment 0
630 filtering * (glob)
693 filtering * (glob)
631 applying 17ab29e464c6
694 applying 17ab29e464c6
632 17ab29e464c6 transplanted to 5190e68026a0
695 17ab29e464c6 transplanted to 5190e68026a0
633
696
634 $ hg log --template '{rev} {parents} {desc}\n'
697 $ hg log --template '{rev} {parents} {desc}\n'
635 0 r1
698 0 r1
636 Transplant by test
699 Transplant by test
637 Transplant from rev 17ab29e464c6ca53e329470efe2a9918ac617a6f
700 Transplant from rev 17ab29e464c6ca53e329470efe2a9918ac617a6f
638 $ cd ..
701 $ cd ..
639
702
640 test transplant with filter handles invalid changelog
703 test transplant with filter handles invalid changelog
641
704
642 $ hg init filter-invalid-log
705 $ hg init filter-invalid-log
643 $ cd filter-invalid-log
706 $ cd filter-invalid-log
644 $ cat <<'EOF' >test-filter-invalid-log
707 $ cat <<'EOF' >test-filter-invalid-log
645 > #!/bin/sh
708 > #!/bin/sh
646 > echo "" > $1
709 > echo "" > $1
647 > EOF
710 > EOF
648 $ chmod +x test-filter-invalid-log
711 $ chmod +x test-filter-invalid-log
649 $ hg transplant -s ../t --filter ./test-filter-invalid-log 0
712 $ hg transplant -s ../t --filter ./test-filter-invalid-log 0
650 filtering * (glob)
713 filtering * (glob)
651 abort: filter corrupted changeset (no user or date)
714 abort: filter corrupted changeset (no user or date)
652 [255]
715 [255]
653 $ cd ..
716 $ cd ..
654
717
655 #endif
718 #endif
656
719
657
720
658 test with a win32ext like setup (differing EOLs)
721 test with a win32ext like setup (differing EOLs)
659
722
660 $ hg init twin1
723 $ hg init twin1
661 $ cd twin1
724 $ cd twin1
662 $ echo a > a
725 $ echo a > a
663 $ echo b > b
726 $ echo b > b
664 $ echo b >> b
727 $ echo b >> b
665 $ hg ci -Am t
728 $ hg ci -Am t
666 adding a
729 adding a
667 adding b
730 adding b
668 $ echo a > b
731 $ echo a > b
669 $ echo b >> b
732 $ echo b >> b
670 $ hg ci -m changeb
733 $ hg ci -m changeb
671 $ cd ..
734 $ cd ..
672
735
673 $ hg init twin2
736 $ hg init twin2
674 $ cd twin2
737 $ cd twin2
675 $ echo '[patch]' >> .hg/hgrc
738 $ echo '[patch]' >> .hg/hgrc
676 $ echo 'eol = crlf' >> .hg/hgrc
739 $ echo 'eol = crlf' >> .hg/hgrc
677 $ $PYTHON -c "file('b', 'wb').write('b\r\nb\r\n')"
740 $ $PYTHON -c "file('b', 'wb').write('b\r\nb\r\n')"
678 $ hg ci -Am addb
741 $ hg ci -Am addb
679 adding b
742 adding b
680 $ hg transplant -s ../twin1 tip
743 $ hg transplant -s ../twin1 tip
681 searching for changes
744 searching for changes
682 warning: repository is unrelated
745 warning: repository is unrelated
683 applying 2e849d776c17
746 applying 2e849d776c17
684 2e849d776c17 transplanted to 8e65bebc063e
747 2e849d776c17 transplanted to 8e65bebc063e
685 $ cat b
748 $ cat b
686 a\r (esc)
749 a\r (esc)
687 b\r (esc)
750 b\r (esc)
688 $ cd ..
751 $ cd ..
689
752
690 test transplant with merge changeset is skipped
753 test transplant with merge changeset is skipped
691
754
692 $ hg init merge1a
755 $ hg init merge1a
693 $ cd merge1a
756 $ cd merge1a
694 $ echo a > a
757 $ echo a > a
695 $ hg ci -Am a
758 $ hg ci -Am a
696 adding a
759 adding a
697 $ hg branch b
760 $ hg branch b
698 marked working directory as branch b
761 marked working directory as branch b
699 (branches are permanent and global, did you want a bookmark?)
762 (branches are permanent and global, did you want a bookmark?)
700 $ hg ci -m branchb
763 $ hg ci -m branchb
701 $ echo b > b
764 $ echo b > b
702 $ hg ci -Am b
765 $ hg ci -Am b
703 adding b
766 adding b
704 $ hg update default
767 $ hg update default
705 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
768 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
706 $ hg merge b
769 $ hg merge b
707 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
770 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
708 (branch merge, don't forget to commit)
771 (branch merge, don't forget to commit)
709 $ hg ci -m mergeb
772 $ hg ci -m mergeb
710 $ cd ..
773 $ cd ..
711
774
712 $ hg init merge1b
775 $ hg init merge1b
713 $ cd merge1b
776 $ cd merge1b
714 $ hg transplant -s ../merge1a tip
777 $ hg transplant -s ../merge1a tip
715 $ cd ..
778 $ cd ..
716
779
717 test transplant with merge changeset accepts --parent
780 test transplant with merge changeset accepts --parent
718
781
719 $ hg init merge2a
782 $ hg init merge2a
720 $ cd merge2a
783 $ cd merge2a
721 $ echo a > a
784 $ echo a > a
722 $ hg ci -Am a
785 $ hg ci -Am a
723 adding a
786 adding a
724 $ hg branch b
787 $ hg branch b
725 marked working directory as branch b
788 marked working directory as branch b
726 (branches are permanent and global, did you want a bookmark?)
789 (branches are permanent and global, did you want a bookmark?)
727 $ hg ci -m branchb
790 $ hg ci -m branchb
728 $ echo b > b
791 $ echo b > b
729 $ hg ci -Am b
792 $ hg ci -Am b
730 adding b
793 adding b
731 $ hg update default
794 $ hg update default
732 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
795 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
733 $ hg merge b
796 $ hg merge b
734 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
797 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
735 (branch merge, don't forget to commit)
798 (branch merge, don't forget to commit)
736 $ hg ci -m mergeb
799 $ hg ci -m mergeb
737 $ cd ..
800 $ cd ..
738
801
739 $ hg init merge2b
802 $ hg init merge2b
740 $ cd merge2b
803 $ cd merge2b
804 $ hg transplant -s ../merge2a --parent tip tip
805 abort: be9f9b39483f is not a parent of be9f9b39483f
806 [255]
741 $ hg transplant -s ../merge2a --parent 0 tip
807 $ hg transplant -s ../merge2a --parent 0 tip
742 applying be9f9b39483f
808 applying be9f9b39483f
743 be9f9b39483f transplanted to 9959e51f94d1
809 be9f9b39483f transplanted to 9959e51f94d1
744 $ cd ..
810 $ cd ..
745
811
746 test transplanting a patch turning into a no-op
812 test transplanting a patch turning into a no-op
747
813
748 $ hg init binarysource
814 $ hg init binarysource
749 $ cd binarysource
815 $ cd binarysource
750 $ echo a > a
816 $ echo a > a
751 $ hg ci -Am adda a
817 $ hg ci -Am adda a
752 >>> file('b', 'wb').write('\0b1')
818 >>> file('b', 'wb').write('\0b1')
753 $ hg ci -Am addb b
819 $ hg ci -Am addb b
754 >>> file('b', 'wb').write('\0b2')
820 >>> file('b', 'wb').write('\0b2')
755 $ hg ci -m changeb b
821 $ hg ci -m changeb b
756 $ cd ..
822 $ cd ..
757
823
758 $ hg clone -r0 binarysource binarydest
824 $ hg clone -r0 binarysource binarydest
759 adding changesets
825 adding changesets
760 adding manifests
826 adding manifests
761 adding file changes
827 adding file changes
762 added 1 changesets with 1 changes to 1 files
828 added 1 changesets with 1 changes to 1 files
763 updating to branch default
829 updating to branch default
764 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
830 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
765 $ cd binarydest
831 $ cd binarydest
766 $ cp ../binarysource/b b
832 $ cp ../binarysource/b b
767 $ hg ci -Am addb2 b
833 $ hg ci -Am addb2 b
768 $ hg transplant -s ../binarysource 2
834 $ hg transplant -s ../binarysource 2
769 searching for changes
835 searching for changes
770 applying 7a7d57e15850
836 applying 7a7d57e15850
771 skipping emptied changeset 7a7d57e15850
837 skipping emptied changeset 7a7d57e15850
772
838
773 Test empty result in --continue
839 Test empty result in --continue
774
840
775 $ hg transplant -s ../binarysource 1
841 $ hg transplant -s ../binarysource 1
776 searching for changes
842 searching for changes
777 applying 645035761929
843 applying 645035761929
778 file b already exists
844 file b already exists
779 1 out of 1 hunks FAILED -- saving rejects to file b.rej
845 1 out of 1 hunks FAILED -- saving rejects to file b.rej
780 patch failed to apply
846 patch failed to apply
781 abort: fix up the merge and run hg transplant --continue
847 abort: fix up the merge and run hg transplant --continue
782 [255]
848 [255]
783 $ hg status
849 $ hg status
784 ? b.rej
850 ? b.rej
785 $ hg transplant --continue
851 $ hg transplant --continue
786 645035761929 skipped due to empty diff
852 645035761929 skipped due to empty diff
787
853
788 $ cd ..
854 $ cd ..
789
855
790 Explicitly kill daemons to let the test exit on Windows
856 Explicitly kill daemons to let the test exit on Windows
791
857
792 $ killdaemons.py
858 $ killdaemons.py
793
859
794 Test that patch-ed files are treated as "modified", when transplant is
860 Test that patch-ed files are treated as "modified", when transplant is
795 aborted by failure of patching, even if none of mode, size and
861 aborted by failure of patching, even if none of mode, size and
796 timestamp of them isn't changed on the filesystem (see also issue4583)
862 timestamp of them isn't changed on the filesystem (see also issue4583)
797
863
798 $ cd t
864 $ cd t
799
865
800 $ cat > $TESTTMP/abort.py <<EOF
866 $ cat > $TESTTMP/abort.py <<EOF
801 > # emulate that patch.patch() is aborted at patching on "abort" file
867 > # emulate that patch.patch() is aborted at patching on "abort" file
802 > from mercurial import extensions, patch as patchmod
868 > from mercurial import extensions, patch as patchmod
803 > def patch(orig, ui, repo, patchname,
869 > def patch(orig, ui, repo, patchname,
804 > strip=1, prefix='', files=None,
870 > strip=1, prefix='', files=None,
805 > eolmode='strict', similarity=0):
871 > eolmode='strict', similarity=0):
806 > if files is None:
872 > if files is None:
807 > files = set()
873 > files = set()
808 > r = orig(ui, repo, patchname,
874 > r = orig(ui, repo, patchname,
809 > strip=strip, prefix=prefix, files=files,
875 > strip=strip, prefix=prefix, files=files,
810 > eolmode=eolmode, similarity=similarity)
876 > eolmode=eolmode, similarity=similarity)
811 > if 'abort' in files:
877 > if 'abort' in files:
812 > raise patchmod.PatchError('intentional error while patching')
878 > raise patchmod.PatchError('intentional error while patching')
813 > return r
879 > return r
814 > def extsetup(ui):
880 > def extsetup(ui):
815 > extensions.wrapfunction(patchmod, 'patch', patch)
881 > extensions.wrapfunction(patchmod, 'patch', patch)
816 > EOF
882 > EOF
817
883
818 $ echo X1 > r1
884 $ echo X1 > r1
819 $ hg diff --nodates r1
885 $ hg diff --nodates r1
820 diff -r a53251cdf717 r1
886 diff -r a53251cdf717 r1
821 --- a/r1
887 --- a/r1
822 +++ b/r1
888 +++ b/r1
823 @@ -1,1 +1,1 @@
889 @@ -1,1 +1,1 @@
824 -r1
890 -r1
825 +X1
891 +X1
826 $ hg commit -m "X1 as r1"
892 $ hg commit -m "X1 as r1"
827
893
828 $ echo 'marking to abort patching' > abort
894 $ echo 'marking to abort patching' > abort
829 $ hg add abort
895 $ hg add abort
830 $ echo Y1 > r1
896 $ echo Y1 > r1
831 $ hg diff --nodates r1
897 $ hg diff --nodates r1
832 diff -r 22c515968f13 r1
898 diff -r 22c515968f13 r1
833 --- a/r1
899 --- a/r1
834 +++ b/r1
900 +++ b/r1
835 @@ -1,1 +1,1 @@
901 @@ -1,1 +1,1 @@
836 -X1
902 -X1
837 +Y1
903 +Y1
838 $ hg commit -m "Y1 as r1"
904 $ hg commit -m "Y1 as r1"
839
905
840 $ hg update -q -C d11e3596cc1a
906 $ hg update -q -C d11e3596cc1a
841 $ cat r1
907 $ cat r1
842 r1
908 r1
843
909
844 $ cat >> .hg/hgrc <<EOF
910 $ cat >> .hg/hgrc <<EOF
845 > [fakedirstatewritetime]
911 > [fakedirstatewritetime]
846 > # emulate invoking dirstate.write() via repo.status() or markcommitted()
912 > # emulate invoking dirstate.write() via repo.status() or markcommitted()
847 > # at 2000-01-01 00:00
913 > # at 2000-01-01 00:00
848 > fakenow = 200001010000
914 > fakenow = 200001010000
849 >
915 >
850 > # emulate invoking patch.internalpatch() at 2000-01-01 00:00
916 > # emulate invoking patch.internalpatch() at 2000-01-01 00:00
851 > [fakepatchtime]
917 > [fakepatchtime]
852 > fakenow = 200001010000
918 > fakenow = 200001010000
853 >
919 >
854 > [extensions]
920 > [extensions]
855 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
921 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
856 > fakepatchtime = $TESTDIR/fakepatchtime.py
922 > fakepatchtime = $TESTDIR/fakepatchtime.py
857 > abort = $TESTTMP/abort.py
923 > abort = $TESTTMP/abort.py
858 > EOF
924 > EOF
859 $ hg transplant "22c515968f13::"
925 $ hg transplant "22c515968f13::"
860 applying 22c515968f13
926 applying 22c515968f13
861 22c515968f13 transplanted to * (glob)
927 22c515968f13 transplanted to * (glob)
862 applying e38700ba9dd3
928 applying e38700ba9dd3
863 intentional error while patching
929 intentional error while patching
864 abort: fix up the merge and run hg transplant --continue
930 abort: fix up the merge and run hg transplant --continue
865 [255]
931 [255]
866 $ cat >> .hg/hgrc <<EOF
932 $ cat >> .hg/hgrc <<EOF
867 > [hooks]
933 > [hooks]
868 > fakedirstatewritetime = !
934 > fakedirstatewritetime = !
869 > fakepatchtime = !
935 > fakepatchtime = !
870 > [extensions]
936 > [extensions]
871 > abort = !
937 > abort = !
872 > EOF
938 > EOF
873
939
874 $ cat r1
940 $ cat r1
875 Y1
941 Y1
876 $ hg debugstate | grep ' r1$'
942 $ hg debugstate | grep ' r1$'
877 n 644 3 unset r1
943 n 644 3 unset r1
878 $ hg status -A r1
944 $ hg status -A r1
879 M r1
945 M r1
880
946
881 Test that rollback by unexpected failure after transplanting the first
947 Test that rollback by unexpected failure after transplanting the first
882 revision restores dirstate correctly.
948 revision restores dirstate correctly.
883
949
884 $ hg rollback -q
950 $ hg rollback -q
885 $ rm -f abort
951 $ rm -f abort
886 $ hg update -q -C d11e3596cc1a
952 $ hg update -q -C d11e3596cc1a
887 $ hg parents -T "{node|short}\n"
953 $ hg parents -T "{node|short}\n"
888 d11e3596cc1a
954 d11e3596cc1a
889 $ hg status -A
955 $ hg status -A
890 C r1
956 C r1
891 C r2
957 C r2
892
958
893 $ cat >> .hg/hgrc <<EOF
959 $ cat >> .hg/hgrc <<EOF
894 > [hooks]
960 > [hooks]
895 > # emulate failure at transplanting the 2nd revision
961 > # emulate failure at transplanting the 2nd revision
896 > pretxncommit.abort = test ! -f abort
962 > pretxncommit.abort = test ! -f abort
897 > EOF
963 > EOF
898 $ hg transplant "22c515968f13::"
964 $ hg transplant "22c515968f13::"
899 applying 22c515968f13
965 applying 22c515968f13
900 22c515968f13 transplanted to * (glob)
966 22c515968f13 transplanted to * (glob)
901 applying e38700ba9dd3
967 applying e38700ba9dd3
902 transaction abort!
968 transaction abort!
903 rollback completed
969 rollback completed
904 abort: pretxncommit.abort hook exited with status 1
970 abort: pretxncommit.abort hook exited with status 1
905 [255]
971 [255]
906 $ cat >> .hg/hgrc <<EOF
972 $ cat >> .hg/hgrc <<EOF
907 > [hooks]
973 > [hooks]
908 > pretxncommit.abort = !
974 > pretxncommit.abort = !
909 > EOF
975 > EOF
910
976
911 $ hg parents -T "{node|short}\n"
977 $ hg parents -T "{node|short}\n"
912 d11e3596cc1a
978 d11e3596cc1a
913 $ hg status -A
979 $ hg status -A
914 M r1
980 M r1
915 ? abort
981 ? abort
916 C r2
982 C r2
917
983
918 $ cd ..
984 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now