##// END OF EJS Templates
copies: add tests for status -C/diff --git...
Matt Mackall -
r6278:81e7112b default
parent child Browse files
Show More
@@ -0,0 +1,63 b''
1 #!/bin/sh
2
3 add()
4 {
5 echo $2 >> $1
6 }
7
8 hg init t
9 cd t
10
11 # set up a boring main branch
12 add a a
13 hg add a
14 hg ci -m0
15
16 add a m1
17 hg ci -m1
18
19 add a m2
20 hg ci -m2
21
22 show()
23 {
24 echo "- $2: $1"
25 hg st -C $1
26 echo
27 hg diff --git $1
28 echo
29 }
30
31 # make a new branch and get diff/status output
32 # $1 - first commit
33 # $2 - second commit
34 # $3 - working dir action
35 # $4 - test description
36 tb()
37 {
38 hg co -q -C 0
39
40 $1
41 hg ci -m "t1"
42 $2
43 hg ci -m "t2"
44 $3
45
46 echo "** $4 **"
47 echo "** $1 / $2 / $3"
48 show "" "working to parent"
49 show "--rev 0" "working to root"
50 show "--rev 2" "working to branch"
51 show "--rev 0 --rev ." "root to parent"
52 show "--rev . --rev 0" "parent to root"
53 show "--rev 2 --rev ." "branch to parent"
54 show "--rev . --rev 2" "parent to branch"
55 echo
56 }
57
58 tb "add a a1" "add a a2" "hg mv a b" "rename in working dir"
59 tb "add a a1" "add a a2" "hg cp a b" "copy in working dir"
60 tb "hg mv a b" "add b b1" "add b w" "single rename"
61 tb "hg cp a b" "add b b1" "add a w" "single copy"
62 tb "hg mv a b" "hg mv b c" "hg mv c d" "rename chain"
63 tb "hg cp a b" "hg cp b c" "hg cp c d" "copy chain"
This diff has been collapsed as it changes many lines, (673 lines changed) Show them Hide them
@@ -0,0 +1,673 b''
1 ** rename in working dir **
2 ** add a a1 / add a a2 / hg mv a b
3 - working to parent:
4 A b
5 a
6 R a
7
8 diff --git a/a b/b
9 rename from a
10 rename to b
11
12 - working to root: --rev 0
13 A b
14 a
15 R a
16
17 diff --git a/a b/b
18 rename from a
19 rename to b
20 --- a/a
21 +++ b/b
22 @@ -1,1 +1,3 @@
23 a
24 +a1
25 +a2
26
27 - working to branch: --rev 2
28 A b
29 a
30 R a
31
32 diff --git a/a b/b
33 rename from a
34 rename to b
35 --- a/a
36 +++ b/b
37 @@ -1,3 +1,3 @@
38 a
39 -m1
40 -m2
41 +a1
42 +a2
43
44 - root to parent: --rev 0 --rev .
45 M a
46
47 diff --git a/a b/a
48 --- a/a
49 +++ b/a
50 @@ -1,1 +1,3 @@
51 a
52 +a1
53 +a2
54
55 - parent to root: --rev . --rev 0
56 M a
57
58 diff --git a/a b/a
59 --- a/a
60 +++ b/a
61 @@ -1,3 +1,1 @@
62 a
63 -a1
64 -a2
65
66 - branch to parent: --rev 2 --rev .
67 M a
68
69 diff --git a/a b/a
70 --- a/a
71 +++ b/a
72 @@ -1,3 +1,3 @@
73 a
74 -m1
75 -m2
76 +a1
77 +a2
78
79 - parent to branch: --rev . --rev 2
80 M a
81
82 diff --git a/a b/a
83 --- a/a
84 +++ b/a
85 @@ -1,3 +1,3 @@
86 a
87 -a1
88 -a2
89 +m1
90 +m2
91
92
93 ** copy in working dir **
94 ** add a a1 / add a a2 / hg cp a b
95 - working to parent:
96 A b
97 a
98
99 diff --git a/a b/b
100 copy from a
101 copy to b
102
103 - working to root: --rev 0
104 M a
105 A b
106 a
107
108 diff --git a/a b/a
109 --- a/a
110 +++ b/a
111 @@ -1,1 +1,3 @@
112 a
113 +a1
114 +a2
115 diff --git a/a b/b
116 copy from a
117 copy to b
118 --- a/a
119 +++ b/b
120 @@ -1,1 +1,3 @@
121 a
122 +a1
123 +a2
124
125 - working to branch: --rev 2
126 M a
127 A b
128 a
129
130 diff --git a/a b/a
131 --- a/a
132 +++ b/a
133 @@ -1,3 +1,3 @@
134 a
135 -m1
136 -m2
137 +a1
138 +a2
139 diff --git a/a b/b
140 copy from a
141 copy to b
142 --- a/a
143 +++ b/b
144 @@ -1,3 +1,3 @@
145 a
146 -m1
147 -m2
148 +a1
149 +a2
150
151 - root to parent: --rev 0 --rev .
152 M a
153
154 diff --git a/a b/a
155 --- a/a
156 +++ b/a
157 @@ -1,1 +1,3 @@
158 a
159 +a1
160 +a2
161
162 - parent to root: --rev . --rev 0
163 M a
164
165 diff --git a/a b/a
166 --- a/a
167 +++ b/a
168 @@ -1,3 +1,1 @@
169 a
170 -a1
171 -a2
172
173 - branch to parent: --rev 2 --rev .
174 M a
175
176 diff --git a/a b/a
177 --- a/a
178 +++ b/a
179 @@ -1,3 +1,3 @@
180 a
181 -m1
182 -m2
183 +a1
184 +a2
185
186 - parent to branch: --rev . --rev 2
187 M a
188
189 diff --git a/a b/a
190 --- a/a
191 +++ b/a
192 @@ -1,3 +1,3 @@
193 a
194 -a1
195 -a2
196 +m1
197 +m2
198
199
200 ** single rename **
201 ** hg mv a b / add b b1 / add b w
202 - working to parent:
203 M b
204
205 diff --git a/b b/b
206 --- a/b
207 +++ b/b
208 @@ -1,2 +1,3 @@
209 a
210 b1
211 +w
212
213 - working to root: --rev 0
214 A b
215 a
216 R a
217
218 diff --git a/a b/b
219 rename from a
220 rename to b
221 --- a/a
222 +++ b/b
223 @@ -1,1 +1,3 @@
224 a
225 +b1
226 +w
227
228 - working to branch: --rev 2
229 A b
230 a
231 R a
232
233 diff --git a/a b/b
234 rename from a
235 rename to b
236 --- a/a
237 +++ b/b
238 @@ -1,3 +1,3 @@
239 a
240 -m1
241 -m2
242 +b1
243 +w
244
245 - root to parent: --rev 0 --rev .
246 A b
247 a
248 R a
249
250 diff --git a/a b/b
251 rename from a
252 rename to b
253 --- a/a
254 +++ b/b
255 @@ -1,1 +1,2 @@
256 a
257 +b1
258
259 - parent to root: --rev . --rev 0
260 A a
261 b
262 R b
263
264 diff --git a/b b/a
265 rename from b
266 rename to a
267 --- a/b
268 +++ b/a
269 @@ -1,2 +1,1 @@
270 a
271 -b1
272
273 - branch to parent: --rev 2 --rev .
274 A b
275 a
276 R a
277
278 diff --git a/a b/b
279 rename from a
280 rename to b
281 --- a/a
282 +++ b/b
283 @@ -1,3 +1,2 @@
284 a
285 -m1
286 -m2
287 +b1
288
289 - parent to branch: --rev . --rev 2
290 A a
291 b
292 R b
293
294 diff --git a/b b/a
295 rename from b
296 rename to a
297 --- a/b
298 +++ b/a
299 @@ -1,2 +1,3 @@
300 a
301 -b1
302 +m1
303 +m2
304
305
306 ** single copy **
307 ** hg cp a b / add b b1 / add a w
308 - working to parent:
309 M a
310
311 diff --git a/a b/a
312 --- a/a
313 +++ b/a
314 @@ -1,1 +1,2 @@
315 a
316 +w
317
318 - working to root: --rev 0
319 M a
320 A b
321 a
322
323 diff --git a/a b/a
324 --- a/a
325 +++ b/a
326 @@ -1,1 +1,2 @@
327 a
328 +w
329 diff --git a/a b/b
330 copy from a
331 copy to b
332 --- a/a
333 +++ b/b
334 @@ -1,1 +1,2 @@
335 a
336 +b1
337
338 - working to branch: --rev 2
339 M a
340 A b
341 a
342
343 diff --git a/a b/a
344 --- a/a
345 +++ b/a
346 @@ -1,3 +1,2 @@
347 a
348 -m1
349 -m2
350 +w
351 diff --git a/a b/b
352 copy from a
353 copy to b
354 --- a/a
355 +++ b/b
356 @@ -1,3 +1,2 @@
357 a
358 -m1
359 -m2
360 +b1
361
362 - root to parent: --rev 0 --rev .
363 A b
364 a
365
366 diff --git a/a b/b
367 copy from a
368 copy to b
369 --- a/a
370 +++ b/b
371 @@ -1,1 +1,2 @@
372 a
373 +b1
374
375 - parent to root: --rev . --rev 0
376 R b
377
378 diff --git a/b b/b
379 deleted file mode 100644
380 --- a/b
381 +++ /dev/null
382 @@ -1,2 +0,0 @@
383 -a
384 -b1
385
386 - branch to parent: --rev 2 --rev .
387 M a
388 A b
389 a
390
391 diff --git a/a b/a
392 --- a/a
393 +++ b/a
394 @@ -1,3 +1,1 @@
395 a
396 -m1
397 -m2
398 diff --git a/a b/b
399 copy from a
400 copy to b
401 --- a/a
402 +++ b/b
403 @@ -1,3 +1,2 @@
404 a
405 -m1
406 -m2
407 +b1
408
409 - parent to branch: --rev . --rev 2
410 M a
411 R b
412
413 diff --git a/a b/a
414 --- a/a
415 +++ b/a
416 @@ -1,1 +1,3 @@
417 a
418 +m1
419 +m2
420 diff --git a/b b/b
421 deleted file mode 100644
422 --- a/b
423 +++ /dev/null
424 @@ -1,2 +0,0 @@
425 -a
426 -b1
427
428
429 ** rename chain **
430 ** hg mv a b / hg mv b c / hg mv c d
431 - working to parent:
432 A d
433 c
434 R c
435
436 diff --git a/c b/d
437 rename from c
438 rename to d
439
440 - working to root: --rev 0
441 A d
442 a
443 R a
444
445 diff --git a/a b/d
446 rename from a
447 rename to d
448
449 - working to branch: --rev 2
450 A d
451 a
452 R a
453
454 diff --git a/a b/d
455 rename from a
456 rename to d
457 --- a/a
458 +++ b/d
459 @@ -1,3 +1,1 @@
460 a
461 -m1
462 -m2
463
464 - root to parent: --rev 0 --rev .
465 A c
466 a
467 R a
468
469 diff --git a/a b/c
470 rename from a
471 rename to c
472
473 - parent to root: --rev . --rev 0
474 A a
475 c
476 R c
477
478 diff --git a/c b/a
479 rename from c
480 rename to a
481
482 - branch to parent: --rev 2 --rev .
483 A c
484 a
485 R a
486
487 diff --git a/a b/c
488 rename from a
489 rename to c
490 --- a/a
491 +++ b/c
492 @@ -1,3 +1,1 @@
493 a
494 -m1
495 -m2
496
497 - parent to branch: --rev . --rev 2
498 A a
499 c
500 R c
501
502 diff --git a/c b/a
503 rename from c
504 rename to a
505 --- a/c
506 +++ b/a
507 @@ -1,1 +1,3 @@
508 a
509 +m1
510 +m2
511
512
513 ** copy chain **
514 ** hg cp a b / hg cp b c / hg cp c d
515 - working to parent:
516 A d
517 c
518
519 diff --git a/c b/d
520 copy from c
521 copy to d
522
523 - working to root: --rev 0
524 A b
525 a
526 A c
527 a
528 A d
529 a
530
531 diff --git a/a b/b
532 copy from a
533 copy to b
534 diff --git a/a b/c
535 copy from a
536 copy to c
537 diff --git a/a b/d
538 copy from a
539 copy to d
540
541 - working to branch: --rev 2
542 M a
543 A b
544 a
545 A c
546 a
547 A d
548 a
549
550 diff --git a/a b/a
551 --- a/a
552 +++ b/a
553 @@ -1,3 +1,1 @@
554 a
555 -m1
556 -m2
557 diff --git a/a b/b
558 copy from a
559 copy to b
560 --- a/a
561 +++ b/b
562 @@ -1,3 +1,1 @@
563 a
564 -m1
565 -m2
566 diff --git a/a b/c
567 copy from a
568 copy to c
569 --- a/a
570 +++ b/c
571 @@ -1,3 +1,1 @@
572 a
573 -m1
574 -m2
575 diff --git a/a b/d
576 copy from a
577 copy to d
578 --- a/a
579 +++ b/d
580 @@ -1,3 +1,1 @@
581 a
582 -m1
583 -m2
584
585 - root to parent: --rev 0 --rev .
586 A b
587 a
588 A c
589 a
590
591 diff --git a/a b/b
592 copy from a
593 copy to b
594 diff --git a/a b/c
595 copy from a
596 copy to c
597
598 - parent to root: --rev . --rev 0
599 R b
600 R c
601
602 diff --git a/b b/b
603 deleted file mode 100644
604 --- a/b
605 +++ /dev/null
606 @@ -1,1 +0,0 @@
607 -a
608 diff --git a/c b/c
609 deleted file mode 100644
610 --- a/c
611 +++ /dev/null
612 @@ -1,1 +0,0 @@
613 -a
614
615 - branch to parent: --rev 2 --rev .
616 M a
617 A b
618 a
619 A c
620 a
621
622 diff --git a/a b/a
623 --- a/a
624 +++ b/a
625 @@ -1,3 +1,1 @@
626 a
627 -m1
628 -m2
629 diff --git a/a b/b
630 copy from a
631 copy to b
632 --- a/a
633 +++ b/b
634 @@ -1,3 +1,1 @@
635 a
636 -m1
637 -m2
638 diff --git a/a b/c
639 copy from a
640 copy to c
641 --- a/a
642 +++ b/c
643 @@ -1,3 +1,1 @@
644 a
645 -m1
646 -m2
647
648 - parent to branch: --rev . --rev 2
649 M a
650 R b
651 R c
652
653 diff --git a/a b/a
654 --- a/a
655 +++ b/a
656 @@ -1,1 +1,3 @@
657 a
658 +m1
659 +m2
660 diff --git a/b b/b
661 deleted file mode 100644
662 --- a/b
663 +++ /dev/null
664 @@ -1,1 +0,0 @@
665 -a
666 diff --git a/c b/c
667 deleted file mode 100644
668 --- a/c
669 +++ /dev/null
670 @@ -1,1 +0,0 @@
671 -a
672
673
General Comments 0
You need to be logged in to leave comments. Login now