comparison tests/test-mv-cp-st-diff @ 6278:81e7112b07ae

copies: add tests for status -C/diff --git This goes through 42 combinations of copy/rename branch/parent/working dir.
author Matt Mackall <mpm@selenic.com>
date Sat, 15 Mar 2008 16:49:27 -0500
parents
children 709652cd7bff
comparison
equal deleted inserted replaced
6277:cfebb175704f 6278:81e7112b07ae
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"