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