annotate tests/test-rename-merge2 @ 3862:46abbed02b2d

Use UTF-8 in .hg/branch
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sun, 10 Dec 2006 20:35:28 -0200
parents 438b0638dbf5
children 9dcf9d45cab8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3252
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
1 #!/bin/sh
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
2
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
3 mkdir -p t
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
4 cd t
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
5
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
6 cat <<'EOF' > merge
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
7 #!/bin/sh
3282
438b0638dbf5 Fix undetected change bug in rename tests
Matt Mackall <mpm@selenic.com>
parents: 3252
diff changeset
8 echo merge $1 $2 $3 > $1
3252
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
9 EOF
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
10 chmod +x merge
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
11
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
12 # perform a test merge with possible renaming
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
13 #
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
14 # args:
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
15 # $1 = action in local branch
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
16 # $2 = action in remote branch
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
17 # $3 = action in working dir
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
18 # $4 = expected result
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
19 tm()
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
20 {
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
21 mkdir t
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
22 cd t
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
23 hg init
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
24 echo "[merge]" >> .hg/hgrc
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
25 echo "followcopies = 1" >> .hg/hgrc
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
26
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
27 # base
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
28 echo base > a
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
29 echo base > rev # used to force commits
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
30 hg add a rev
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
31 hg ci -m "base" -d "0 0"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
32
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
33 # remote
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
34 echo remote > rev
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
35 if [ "$2" != "" ] ; then $2 ; fi
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
36 hg ci -m "remote" -d "0 0"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
37
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
38 # local
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
39 hg co -q 0
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
40 echo local > rev
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
41 if [ "$1" != "" ] ; then $1 ; fi
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
42 hg ci -m "local" -d "0 0"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
43
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
44 # working dir
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
45 echo local > rev
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
46 if [ "$3" != "" ] ; then $3 ; fi
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
47
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
48 # merge
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
49 echo "--------------"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
50 echo "test L:$1 R:$2 W:$3 - $4"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
51 echo "--------------"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
52 env HGMERGE=../merge hg merge -y --debug --traceback
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
53
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
54 echo "--------------"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
55 hg status -camC -X rev
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
56
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
57 hg ci -m "merge" -d "0 0"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
58
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
59 echo "--------------"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
60 echo
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
61
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
62 cd ..
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
63 rm -rf t
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
64 }
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
65
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
66 up() {
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
67 cp rev $1
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
68 hg add $1 2> /dev/null
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
69 if [ "$2" != "" ] ; then
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
70 cp rev $2
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
71 hg add $2 2> /dev/null
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
72 fi
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
73 }
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
74
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
75 uc() { up $1; hg cp $1 $2; } # update + copy
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
76 um() { up $1; hg mv $1 $2; }
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
77 nc() { hg cp $1 $2; } # just copy
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
78 nm() { hg mv $1 $2; } # just move
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
79
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
80 tm "up a " "nc a b" " " "1 get local a to b"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
81 tm "nc a b" "up a " " " "2 get rem change to a and b"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
82 tm "up a " "nm a b" " " "3 get local a change to b, remove a"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
83 tm "nm a b" "up a " " " "4 get remote change to b"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
84 tm " " "nc a b" " " "5 get b"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
85 tm "nc a b" " " " " "6 nothing"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
86 tm " " "nm a b" " " "7 get b"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
87 tm "nm a b" " " " " "8 nothing"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
88 tm "um a b" "um a b" " " "9 do merge with ancestor in a"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
89 #tm "um a c" "um x c" " " "10 do merge with no ancestor"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
90 tm "nm a b" "nm a c" " " "11 get c, keep b"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
91 tm "nc a b" "up b " " " "12 merge b no ancestor"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
92 tm "up b " "nm a b" " " "13 merge b no ancestor"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
93 tm "nc a b" "up a b" " " "14 merge b no ancestor"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
94 tm "up b " "nm a b" " " "15 merge b no ancestor, remove a"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
95 tm "nc a b" "up a b" " " "16 get a, merge b no ancestor"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
96 tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
97 tm "nm a b" "up a b" " " "18 merge b no ancestor"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
98 tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
99 tm "up a " "um a b" " " "20 merge a and b to b, remove a"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
100 tm "um a b" "up a " " " "21 merge a and b to b"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
101 #tm "nm a b" "um x a" " " "22 get a, keep b"
ae85272b59a4 merge: copy fixes and tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
102 tm "nm a b" "up a c" " " "23 get c, keep b"