Mercurial > hg
annotate tests/test-split.t @ 37615:f3dc8239e3a9
peer: scatter module to the wind (API)
peer.py hardly contained any code. The code it did contain was
generic to the version 1 peer interface or specific to the
local repository peer.
So code has been moved to wireprotov1peer and localrepo, as
appropriate.
Differential Revision: https://phab.mercurial-scm.org/D3260
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 11 Apr 2018 12:51:09 -0700 |
parents | 7bc33d677c0c |
children | a0e185f10454 |
rev | line source |
---|---|
35455 | 1 #testcases obsstore-on obsstore-off |
2 | |
3 $ cat > $TESTTMP/editor.py <<EOF | |
4 > #!$PYTHON | |
36645
7bc33d677c0c
tests: fix various test-check-module-imports.t violations
Augie Fackler <augie@google.com>
parents:
35709
diff
changeset
|
5 > import os |
7bc33d677c0c
tests: fix various test-check-module-imports.t violations
Augie Fackler <augie@google.com>
parents:
35709
diff
changeset
|
6 > import sys |
35455 | 7 > path = os.path.join(os.environ['TESTTMP'], 'messages') |
8 > messages = open(path).read().split('--\n') | |
9 > prompt = open(sys.argv[1]).read() | |
10 > sys.stdout.write(''.join('EDITOR: %s' % l for l in prompt.splitlines(True))) | |
11 > sys.stdout.flush() | |
12 > with open(sys.argv[1], 'w') as f: | |
13 > f.write(messages[0]) | |
14 > with open(path, 'w') as f: | |
15 > f.write('--\n'.join(messages[1:])) | |
16 > EOF | |
17 | |
18 $ cat >> $HGRCPATH <<EOF | |
19 > [extensions] | |
20 > drawdag=$TESTDIR/drawdag.py | |
21 > split= | |
22 > [ui] | |
23 > interactive=1 | |
35479
8d05705bde0a
test-split: stabilize for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
35455
diff
changeset
|
24 > color=no |
8d05705bde0a
test-split: stabilize for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
35455
diff
changeset
|
25 > paginate=never |
35455 | 26 > [diff] |
27 > git=1 | |
28 > unified=0 | |
29 > [alias] | |
30 > glog=log -G -T '{rev}:{node|short} {desc} {bookmarks}\n' | |
31 > EOF | |
32 | |
33 #if obsstore-on | |
34 $ cat >> $HGRCPATH <<EOF | |
35 > [experimental] | |
36 > evolution=all | |
37 > EOF | |
38 #endif | |
39 | |
40 $ hg init a | |
41 $ cd a | |
42 | |
43 Nothing to split | |
44 | |
45 $ hg split | |
46 nothing to split | |
47 [1] | |
48 | |
49 $ hg commit -m empty --config ui.allowemptycommit=1 | |
50 $ hg split | |
51 abort: cannot split an empty revision | |
52 [255] | |
53 | |
54 $ rm -rf .hg | |
55 $ hg init | |
56 | |
57 Cannot split working directory | |
58 | |
59 $ hg split -r 'wdir()' | |
60 abort: cannot split working directory | |
61 [255] | |
62 | |
35479
8d05705bde0a
test-split: stabilize for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
35455
diff
changeset
|
63 Generate some content. The sed filter drop CR on Windows, which is dropped in |
8d05705bde0a
test-split: stabilize for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
35455
diff
changeset
|
64 the a > b line. |
35455 | 65 |
35479
8d05705bde0a
test-split: stabilize for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
35455
diff
changeset
|
66 $ $TESTDIR/seq.py 1 5 | sed 's/\r$//' >> a |
35455 | 67 $ hg ci -m a1 -A a -q |
68 $ hg bookmark -i r1 | |
69 $ sed 's/1/11/;s/3/33/;s/5/55/' a > b | |
70 $ mv b a | |
71 $ hg ci -m a2 -q | |
72 $ hg bookmark -i r2 | |
73 | |
74 Cannot split a public changeset | |
75 | |
76 $ hg phase --public -r 'all()' | |
77 $ hg split . | |
78 abort: cannot split public changeset | |
79 (see 'hg help phases' for details) | |
80 [255] | |
81 | |
82 $ hg phase --draft -f -r 'all()' | |
83 | |
84 Cannot split while working directory is dirty | |
85 | |
86 $ touch dirty | |
87 $ hg add dirty | |
88 $ hg split . | |
89 abort: uncommitted changes | |
90 [255] | |
91 $ hg forget dirty | |
92 $ rm dirty | |
93 | |
94 Split a head | |
95 | |
96 $ cp -R . ../b | |
97 $ cp -R . ../c | |
98 | |
99 $ hg bookmark r3 | |
100 | |
101 $ hg split 'all()' | |
102 abort: cannot split multiple revisions | |
103 [255] | |
104 | |
105 $ runsplit() { | |
106 > cat > $TESTTMP/messages <<EOF | |
107 > split 1 | |
108 > -- | |
109 > split 2 | |
110 > -- | |
111 > split 3 | |
112 > EOF | |
113 > cat <<EOF | hg split "$@" | |
114 > y | |
115 > y | |
116 > y | |
117 > y | |
118 > y | |
119 > y | |
120 > EOF | |
121 > } | |
122 | |
123 $ HGEDITOR=false runsplit | |
124 diff --git a/a b/a | |
125 1 hunks, 1 lines changed | |
126 examine changes to 'a'? [Ynesfdaq?] y | |
127 | |
128 @@ -5,1 +5,1 @@ 4 | |
129 -5 | |
130 +55 | |
131 record this change to 'a'? [Ynesfdaq?] y | |
132 | |
133 transaction abort! | |
134 rollback completed | |
135 abort: edit failed: false exited with status 1 | |
136 [255] | |
137 $ hg status | |
138 | |
35479
8d05705bde0a
test-split: stabilize for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
35455
diff
changeset
|
139 $ HGEDITOR="\"$PYTHON\" $TESTTMP/editor.py" |
35455 | 140 $ runsplit |
141 diff --git a/a b/a | |
142 1 hunks, 1 lines changed | |
143 examine changes to 'a'? [Ynesfdaq?] y | |
144 | |
145 @@ -5,1 +5,1 @@ 4 | |
146 -5 | |
147 +55 | |
148 record this change to 'a'? [Ynesfdaq?] y | |
149 | |
150 EDITOR: HG: Splitting 1df0d5c5a3ab. Write commit message for the first split changeset. | |
151 EDITOR: a2 | |
152 EDITOR: | |
153 EDITOR: | |
154 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
155 EDITOR: HG: Leave message empty to abort commit. | |
156 EDITOR: HG: -- | |
157 EDITOR: HG: user: test | |
158 EDITOR: HG: branch 'default' | |
159 EDITOR: HG: changed a | |
160 created new head | |
161 diff --git a/a b/a | |
162 1 hunks, 1 lines changed | |
163 examine changes to 'a'? [Ynesfdaq?] y | |
164 | |
165 @@ -3,1 +3,1 @@ 2 | |
166 -3 | |
167 +33 | |
168 record this change to 'a'? [Ynesfdaq?] y | |
169 | |
170 EDITOR: HG: Splitting 1df0d5c5a3ab. So far it has been split into: | |
171 EDITOR: HG: - e704349bd21b: split 1 | |
172 EDITOR: HG: Write commit message for the next split changeset. | |
173 EDITOR: a2 | |
174 EDITOR: | |
175 EDITOR: | |
176 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
177 EDITOR: HG: Leave message empty to abort commit. | |
178 EDITOR: HG: -- | |
179 EDITOR: HG: user: test | |
180 EDITOR: HG: branch 'default' | |
181 EDITOR: HG: changed a | |
182 diff --git a/a b/a | |
183 1 hunks, 1 lines changed | |
184 examine changes to 'a'? [Ynesfdaq?] y | |
185 | |
186 @@ -1,1 +1,1 @@ | |
187 -1 | |
188 +11 | |
189 record this change to 'a'? [Ynesfdaq?] y | |
190 | |
191 EDITOR: HG: Splitting 1df0d5c5a3ab. So far it has been split into: | |
192 EDITOR: HG: - e704349bd21b: split 1 | |
193 EDITOR: HG: - a09ad58faae3: split 2 | |
194 EDITOR: HG: Write commit message for the next split changeset. | |
195 EDITOR: a2 | |
196 EDITOR: | |
197 EDITOR: | |
198 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
199 EDITOR: HG: Leave message empty to abort commit. | |
200 EDITOR: HG: -- | |
201 EDITOR: HG: user: test | |
202 EDITOR: HG: branch 'default' | |
203 EDITOR: HG: changed a | |
35479
8d05705bde0a
test-split: stabilize for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
35455
diff
changeset
|
204 saved backup bundle to $TESTTMP/a/.hg/strip-backup/1df0d5c5a3ab-8341b760-split.hg (obsstore-off !) |
35455 | 205 |
206 #if obsstore-off | |
207 $ hg bookmark | |
208 r1 0:a61bcde8c529 | |
209 r2 3:00eebaf8d2e2 | |
210 * r3 3:00eebaf8d2e2 | |
211 $ hg glog -p | |
212 @ 3:00eebaf8d2e2 split 3 r2 r3 | |
213 | diff --git a/a b/a | |
214 | --- a/a | |
215 | +++ b/a | |
216 | @@ -1,1 +1,1 @@ | |
217 | -1 | |
218 | +11 | |
219 | | |
220 o 2:a09ad58faae3 split 2 | |
221 | diff --git a/a b/a | |
222 | --- a/a | |
223 | +++ b/a | |
224 | @@ -3,1 +3,1 @@ | |
225 | -3 | |
226 | +33 | |
227 | | |
228 o 1:e704349bd21b split 1 | |
229 | diff --git a/a b/a | |
230 | --- a/a | |
231 | +++ b/a | |
232 | @@ -5,1 +5,1 @@ | |
233 | -5 | |
234 | +55 | |
235 | | |
236 o 0:a61bcde8c529 a1 r1 | |
237 diff --git a/a b/a | |
238 new file mode 100644 | |
239 --- /dev/null | |
240 +++ b/a | |
241 @@ -0,0 +1,5 @@ | |
242 +1 | |
243 +2 | |
244 +3 | |
245 +4 | |
246 +5 | |
247 | |
248 #else | |
249 $ hg bookmark | |
250 r1 0:a61bcde8c529 | |
251 r2 4:00eebaf8d2e2 | |
252 * r3 4:00eebaf8d2e2 | |
253 $ hg glog | |
254 @ 4:00eebaf8d2e2 split 3 r2 r3 | |
255 | | |
256 o 3:a09ad58faae3 split 2 | |
257 | | |
258 o 2:e704349bd21b split 1 | |
259 | | |
260 o 0:a61bcde8c529 a1 r1 | |
261 | |
262 #endif | |
263 | |
264 Split a head while working parent is not that head | |
265 | |
266 $ cd $TESTTMP/b | |
267 | |
268 $ hg up 0 -q | |
269 $ hg bookmark r3 | |
270 | |
271 $ runsplit tip >/dev/null | |
272 | |
273 #if obsstore-off | |
274 $ hg bookmark | |
275 r1 0:a61bcde8c529 | |
276 r2 3:00eebaf8d2e2 | |
277 * r3 0:a61bcde8c529 | |
278 $ hg glog | |
279 o 3:00eebaf8d2e2 split 3 r2 | |
280 | | |
281 o 2:a09ad58faae3 split 2 | |
282 | | |
283 o 1:e704349bd21b split 1 | |
284 | | |
285 @ 0:a61bcde8c529 a1 r1 r3 | |
286 | |
287 #else | |
288 $ hg bookmark | |
289 r1 0:a61bcde8c529 | |
290 r2 4:00eebaf8d2e2 | |
291 * r3 0:a61bcde8c529 | |
292 $ hg glog | |
293 o 4:00eebaf8d2e2 split 3 r2 | |
294 | | |
295 o 3:a09ad58faae3 split 2 | |
296 | | |
297 o 2:e704349bd21b split 1 | |
298 | | |
299 @ 0:a61bcde8c529 a1 r1 r3 | |
300 | |
301 #endif | |
302 | |
303 Split a non-head | |
304 | |
305 $ cd $TESTTMP/c | |
306 $ echo d > d | |
307 $ hg ci -m d1 -A d | |
308 $ hg bookmark -i d1 | |
309 $ echo 2 >> d | |
310 $ hg ci -m d2 | |
311 $ echo 3 >> d | |
312 $ hg ci -m d3 | |
313 $ hg bookmark -i d3 | |
314 $ hg up '.^' -q | |
315 $ hg bookmark d2 | |
316 $ cp -R . ../d | |
317 | |
318 $ runsplit -r 1 | grep rebasing | |
319 rebasing 2:b5c5ea414030 "d1" (d1) | |
320 rebasing 3:f4a0a8d004cc "d2" (d2) | |
321 rebasing 4:777940761eba "d3" (d3) | |
322 #if obsstore-off | |
323 $ hg bookmark | |
324 d1 4:c4b449ef030e | |
325 * d2 5:c9dd00ab36a3 | |
326 d3 6:19f476bc865c | |
327 r1 0:a61bcde8c529 | |
328 r2 3:00eebaf8d2e2 | |
329 $ hg glog -p | |
330 o 6:19f476bc865c d3 d3 | |
331 | diff --git a/d b/d | |
332 | --- a/d | |
333 | +++ b/d | |
334 | @@ -2,0 +3,1 @@ | |
335 | +3 | |
336 | | |
337 @ 5:c9dd00ab36a3 d2 d2 | |
338 | diff --git a/d b/d | |
339 | --- a/d | |
340 | +++ b/d | |
341 | @@ -1,0 +2,1 @@ | |
342 | +2 | |
343 | | |
344 o 4:c4b449ef030e d1 d1 | |
345 | diff --git a/d b/d | |
346 | new file mode 100644 | |
347 | --- /dev/null | |
348 | +++ b/d | |
349 | @@ -0,0 +1,1 @@ | |
350 | +d | |
351 | | |
352 o 3:00eebaf8d2e2 split 3 r2 | |
353 | diff --git a/a b/a | |
354 | --- a/a | |
355 | +++ b/a | |
356 | @@ -1,1 +1,1 @@ | |
357 | -1 | |
358 | +11 | |
359 | | |
360 o 2:a09ad58faae3 split 2 | |
361 | diff --git a/a b/a | |
362 | --- a/a | |
363 | +++ b/a | |
364 | @@ -3,1 +3,1 @@ | |
365 | -3 | |
366 | +33 | |
367 | | |
368 o 1:e704349bd21b split 1 | |
369 | diff --git a/a b/a | |
370 | --- a/a | |
371 | +++ b/a | |
372 | @@ -5,1 +5,1 @@ | |
373 | -5 | |
374 | +55 | |
375 | | |
376 o 0:a61bcde8c529 a1 r1 | |
377 diff --git a/a b/a | |
378 new file mode 100644 | |
379 --- /dev/null | |
380 +++ b/a | |
381 @@ -0,0 +1,5 @@ | |
382 +1 | |
383 +2 | |
384 +3 | |
385 +4 | |
386 +5 | |
387 | |
388 #else | |
389 $ hg bookmark | |
390 d1 8:c4b449ef030e | |
391 * d2 9:c9dd00ab36a3 | |
392 d3 10:19f476bc865c | |
393 r1 0:a61bcde8c529 | |
394 r2 7:00eebaf8d2e2 | |
395 $ hg glog | |
396 o 10:19f476bc865c d3 d3 | |
397 | | |
398 @ 9:c9dd00ab36a3 d2 d2 | |
399 | | |
400 o 8:c4b449ef030e d1 d1 | |
401 | | |
402 o 7:00eebaf8d2e2 split 3 r2 | |
403 | | |
404 o 6:a09ad58faae3 split 2 | |
405 | | |
406 o 5:e704349bd21b split 1 | |
407 | | |
408 o 0:a61bcde8c529 a1 r1 | |
409 | |
410 #endif | |
411 | |
412 Split a non-head without rebase | |
413 | |
414 $ cd $TESTTMP/d | |
415 #if obsstore-off | |
416 $ runsplit -r 1 --no-rebase | |
417 abort: cannot split changeset with children without rebase | |
418 [255] | |
419 #else | |
420 $ runsplit -r 1 --no-rebase >/dev/null | |
35709
1a09dad8b85a
evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents:
35508
diff
changeset
|
421 3 new orphan changesets |
35455 | 422 $ hg bookmark |
423 d1 2:b5c5ea414030 | |
424 * d2 3:f4a0a8d004cc | |
425 d3 4:777940761eba | |
426 r1 0:a61bcde8c529 | |
427 r2 7:00eebaf8d2e2 | |
428 | |
429 $ hg glog | |
430 o 7:00eebaf8d2e2 split 3 r2 | |
431 | | |
432 o 6:a09ad58faae3 split 2 | |
433 | | |
434 o 5:e704349bd21b split 1 | |
435 | | |
35508
9b3f95d9783d
graphlog: add another graph node type, unstable, using character "*" (BC)
Anton Shestakov <av6@dwimlabs.net>
parents:
35479
diff
changeset
|
436 | * 4:777940761eba d3 d3 |
35455 | 437 | | |
438 | @ 3:f4a0a8d004cc d2 d2 | |
439 | | | |
35508
9b3f95d9783d
graphlog: add another graph node type, unstable, using character "*" (BC)
Anton Shestakov <av6@dwimlabs.net>
parents:
35479
diff
changeset
|
440 | * 2:b5c5ea414030 d1 d1 |
35455 | 441 | | |
442 | x 1:1df0d5c5a3ab a2 | |
443 |/ | |
444 o 0:a61bcde8c529 a1 r1 | |
445 | |
446 #endif | |
447 | |
448 Split a non-head with obsoleted descendants | |
449 | |
450 #if obsstore-on | |
451 $ hg init $TESTTMP/e | |
452 $ cd $TESTTMP/e | |
453 $ hg debugdrawdag <<'EOS' | |
454 > H I J | |
455 > | | | | |
456 > F G1 G2 # amend: G1 -> G2 | |
457 > | | / # prune: F | |
458 > C D E | |
459 > \|/ | |
460 > B | |
461 > | | |
462 > A | |
463 > EOS | |
35709
1a09dad8b85a
evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents:
35508
diff
changeset
|
464 2 new orphan changesets |
35455 | 465 $ eval `hg tags -T '{tag}={node}\n'` |
466 $ rm .hg/localtags | |
467 $ hg split $B --config experimental.evolution=createmarkers | |
468 abort: split would leave orphaned changesets behind | |
469 [255] | |
470 $ cat > $TESTTMP/messages <<EOF | |
471 > Split B | |
472 > EOF | |
473 $ cat <<EOF | hg split $B | |
474 > y | |
475 > y | |
476 > EOF | |
477 diff --git a/B b/B | |
478 new file mode 100644 | |
479 examine changes to 'B'? [Ynesfdaq?] y | |
480 | |
481 @@ -0,0 +1,1 @@ | |
482 +B | |
483 \ No newline at end of file | |
484 record this change to 'B'? [Ynesfdaq?] y | |
485 | |
486 EDITOR: HG: Splitting 112478962961. Write commit message for the first split changeset. | |
487 EDITOR: B | |
488 EDITOR: | |
489 EDITOR: | |
490 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
491 EDITOR: HG: Leave message empty to abort commit. | |
492 EDITOR: HG: -- | |
493 EDITOR: HG: user: test | |
494 EDITOR: HG: branch 'default' | |
495 EDITOR: HG: added B | |
496 created new head | |
497 rebasing 2:26805aba1e60 "C" | |
498 rebasing 3:be0ef73c17ad "D" | |
499 rebasing 4:49cb92066bfd "E" | |
500 rebasing 7:97a6268cc7ef "G2" | |
501 rebasing 10:e2f1e425c0db "J" | |
502 $ hg glog -r 'sort(all(), topo)' | |
503 o 16:556c085f8b52 J | |
504 | | |
505 o 15:8761f6c9123f G2 | |
506 | | |
507 o 14:a7aeffe59b65 E | |
508 | | |
509 | o 13:e1e914ede9ab D | |
510 |/ | |
511 | o 12:01947e9b98aa C | |
512 |/ | |
513 o 11:0947baa74d47 Split B | |
514 | | |
35508
9b3f95d9783d
graphlog: add another graph node type, unstable, using character "*" (BC)
Anton Shestakov <av6@dwimlabs.net>
parents:
35479
diff
changeset
|
515 | * 9:88ede1d5ee13 I |
35455 | 516 | | |
517 | x 6:af8cbf225b7b G1 | |
518 | | | |
519 | x 3:be0ef73c17ad D | |
520 | | | |
35508
9b3f95d9783d
graphlog: add another graph node type, unstable, using character "*" (BC)
Anton Shestakov <av6@dwimlabs.net>
parents:
35479
diff
changeset
|
521 | | * 8:74863e5b5074 H |
35455 | 522 | | | |
523 | | x 5:ee481a2a1e69 F | |
524 | | | | |
525 | | x 2:26805aba1e60 C | |
526 | |/ | |
527 | x 1:112478962961 B | |
528 |/ | |
529 o 0:426bada5c675 A | |
530 | |
531 #endif |