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