Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/test-rename-merge2 @ 5338:f87685355c9c
revlog: fix revlogio.packentry corner case
We want to store version information about the revlog in the first
entry of its index. The code in packentry was using some heuristics
to detect whether this was the first entry, but these heuristics could
fail in some cases (e.g. rev 0 was empty; rev 1 descends directly from
the nullid and is stored as a delta).
We now give the revision number to packentry to avoid heuristics.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Wed, 26 Sep 2007 01:58:45 -0300 |
parents | 7a7d4937272b |
children |
rev | line source |
---|---|
3280 | 1 #!/bin/sh |
2 | |
3 mkdir -p t | |
4 cd t | |
5 | |
4296
c2c8491a30d6
test-rename-merge2: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
6 cat <<EOF > merge |
c2c8491a30d6
test-rename-merge2: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
7 import sys, os |
c2c8491a30d6
test-rename-merge2: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
8 f = open(sys.argv[1], "wb") |
c2c8491a30d6
test-rename-merge2: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
9 f.write("merge %s %s %s" % (sys.argv[1], sys.argv[2], sys.argv[3])) |
c2c8491a30d6
test-rename-merge2: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
10 f.close() |
3280 | 11 EOF |
4296
c2c8491a30d6
test-rename-merge2: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
12 HGMERGE="python ../merge"; export HGMERGE |
3280 | 13 |
14 # perform a test merge with possible renaming | |
4659
7a7d4937272b
Kill trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4296
diff
changeset
|
15 # |
3280 | 16 # args: |
17 # $1 = action in local branch | |
18 # $2 = action in remote branch | |
19 # $3 = action in working dir | |
20 # $4 = expected result | |
21 tm() | |
22 { | |
23 mkdir t | |
24 cd t | |
25 hg init | |
26 echo "[merge]" >> .hg/hgrc | |
27 echo "followcopies = 1" >> .hg/hgrc | |
28 | |
29 # base | |
30 echo base > a | |
31 echo base > rev # used to force commits | |
32 hg add a rev | |
33 hg ci -m "base" -d "0 0" | |
34 | |
35 # remote | |
36 echo remote > rev | |
37 if [ "$2" != "" ] ; then $2 ; fi | |
38 hg ci -m "remote" -d "0 0" | |
39 | |
40 # local | |
41 hg co -q 0 | |
42 echo local > rev | |
43 if [ "$1" != "" ] ; then $1 ; fi | |
44 hg ci -m "local" -d "0 0" | |
45 | |
46 # working dir | |
47 echo local > rev | |
48 if [ "$3" != "" ] ; then $3 ; fi | |
49 | |
50 # merge | |
51 echo "--------------" | |
52 echo "test L:$1 R:$2 W:$3 - $4" | |
53 echo "--------------" | |
4296
c2c8491a30d6
test-rename-merge2: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
54 hg merge -y --debug --traceback |
3280 | 55 |
56 echo "--------------" | |
57 hg status -camC -X rev | |
58 | |
59 hg ci -m "merge" -d "0 0" | |
4659
7a7d4937272b
Kill trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4296
diff
changeset
|
60 |
3280 | 61 echo "--------------" |
62 echo | |
63 | |
64 cd .. | |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3288
diff
changeset
|
65 rm -r t |
3280 | 66 } |
67 | |
4659
7a7d4937272b
Kill trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4296
diff
changeset
|
68 up() { |
3280 | 69 cp rev $1 |
70 hg add $1 2> /dev/null | |
4659
7a7d4937272b
Kill trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4296
diff
changeset
|
71 if [ "$2" != "" ] ; then |
3280 | 72 cp rev $2 |
73 hg add $2 2> /dev/null | |
74 fi | |
75 } | |
76 | |
77 uc() { up $1; hg cp $1 $2; } # update + copy | |
78 um() { up $1; hg mv $1 $2; } | |
79 nc() { hg cp $1 $2; } # just copy | |
80 nm() { hg mv $1 $2; } # just move | |
81 | |
82 tm "up a " "nc a b" " " "1 get local a to b" | |
83 tm "nc a b" "up a " " " "2 get rem change to a and b" | |
84 tm "up a " "nm a b" " " "3 get local a change to b, remove a" | |
85 tm "nm a b" "up a " " " "4 get remote change to b" | |
86 tm " " "nc a b" " " "5 get b" | |
87 tm "nc a b" " " " " "6 nothing" | |
88 tm " " "nm a b" " " "7 get b" | |
89 tm "nm a b" " " " " "8 nothing" | |
90 tm "um a b" "um a b" " " "9 do merge with ancestor in a" | |
91 #tm "um a c" "um x c" " " "10 do merge with no ancestor" | |
92 tm "nm a b" "nm a c" " " "11 get c, keep b" | |
93 tm "nc a b" "up b " " " "12 merge b no ancestor" | |
94 tm "up b " "nm a b" " " "13 merge b no ancestor" | |
95 tm "nc a b" "up a b" " " "14 merge b no ancestor" | |
96 tm "up b " "nm a b" " " "15 merge b no ancestor, remove a" | |
97 tm "nc a b" "up a b" " " "16 get a, merge b no ancestor" | |
4659
7a7d4937272b
Kill trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4296
diff
changeset
|
98 tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor" |
3280 | 99 tm "nm a b" "up a b" " " "18 merge b no ancestor" |
100 tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a" | |
101 tm "up a " "um a b" " " "20 merge a and b to b, remove a" | |
102 tm "um a b" "up a " " " "21 merge a and b to b" | |
103 #tm "nm a b" "um x a" " " "22 get a, keep b" | |
104 tm "nm a b" "up a c" " " "23 get c, keep b" |