Mercurial > hg
annotate tests/test-backout @ 7429:dbc40381620e
tests: Skip tests if they will fail because of outer repo
For different reasons these tests will fail if run in a tmpdir which is in a hg
repo.
The following three tests assumes no .hg in path dirs - I don't know how to
work around that:
* test-dispatch explicitly tests for no repo and expects "abort: There is no
Mercurial repository here (.hg not found)!"
* test-extension expects parentui to be None when not cd'ed to a repo dir
* test-globalopts tests that implicit -R works correctly - that could perhaps be
done from another repo instead of assuming no repo
The following two might be worth investigating further:
* test-convert-svn-sink fails for unknown reasons, starting with "abort:
unresolved merge conflicts (see hg resolve)"
* test-glog gets strange failures when testing "from outer space"
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 27 Nov 2008 00:57:31 +0100 |
parents | 554715e584e6 |
children | 6c82beaaa11a |
rev | line source |
---|---|
2158 | 1 #!/bin/sh |
2 | |
4365
46280c004f22
change tests to use simplemerge by default
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2614
diff
changeset
|
3 HGMERGE=true; export HGMERGE |
46280c004f22
change tests to use simplemerge by default
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2614
diff
changeset
|
4 |
2158 | 5 hg init basic |
6 cd basic | |
4726
f6e961c0155b
Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4365
diff
changeset
|
7 |
f6e961c0155b
Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4365
diff
changeset
|
8 echo '# should complain' |
f6e961c0155b
Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4365
diff
changeset
|
9 hg backout |
f6e961c0155b
Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4365
diff
changeset
|
10 hg backout -r 0 0 |
f6e961c0155b
Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4365
diff
changeset
|
11 |
f6e961c0155b
Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4365
diff
changeset
|
12 echo '# basic operation' |
2158 | 13 echo a > a |
14 hg commit -d '0 0' -A -m a | |
15 echo b >> a | |
16 hg commit -d '1 0' -m b | |
17 | |
18 hg backout -d '2 0' tip | |
19 cat a | |
20 | |
21 echo '# file that was removed is recreated' | |
22 cd .. | |
23 hg init remove | |
24 cd remove | |
25 | |
26 echo content > a | |
27 hg commit -d '0 0' -A -m a | |
28 | |
29 hg rm a | |
30 hg commit -d '1 0' -m b | |
31 | |
32 hg backout -d '2 0' --merge tip | |
33 cat a | |
34 | |
35 echo '# backout of backout is as if nothing happened' | |
36 | |
37 hg backout -d '3 0' --merge tip | |
2186
1092533fd11c
tests: fix compatibility on Solaris
TK Soh <teekaysoh@yahoo.com>
parents:
2158
diff
changeset
|
38 cat a 2>/dev/null || echo cat: a: No such file or directory |
2158 | 39 |
5568
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
40 echo '# across branch' |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
41 cd .. |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
42 hg init branch |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
43 cd branch |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
44 echo a > a |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
45 hg ci -Am0 -d '0 0' |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
46 echo b > b |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
47 hg ci -Am1 -d '0 0' |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
48 hg co -C 0 |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
49 # should fail |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
50 hg backout -d '0 0' 1 |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
51 echo c > c |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
52 hg ci -Am2 -d '0 0' |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
53 # should fail |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
54 hg backout -d '0 0' 1 |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
4726
diff
changeset
|
55 |
2158 | 56 echo '# backout with merge' |
57 cd .. | |
58 hg init merge | |
59 cd merge | |
60 | |
61 echo line 1 > a | |
6161
bc1ba9124799
Reverse the way backout is doing the merge
Gilles Moris <gilles.moris@free.fr>
parents:
5568
diff
changeset
|
62 echo line 2 >> a |
2158 | 63 hg commit -d '0 0' -A -m a |
6161
bc1ba9124799
Reverse the way backout is doing the merge
Gilles Moris <gilles.moris@free.fr>
parents:
5568
diff
changeset
|
64 # remove line 1 |
bc1ba9124799
Reverse the way backout is doing the merge
Gilles Moris <gilles.moris@free.fr>
parents:
5568
diff
changeset
|
65 echo line 2 > a |
2158 | 66 hg commit -d '1 0' -m b |
67 | |
68 echo line 3 >> a | |
69 hg commit -d '2 0' -m c | |
70 | |
71 hg backout --merge -d '3 0' 1 | |
72 hg commit -d '4 0' -m d | |
6161
bc1ba9124799
Reverse the way backout is doing the merge
Gilles Moris <gilles.moris@free.fr>
parents:
5568
diff
changeset
|
73 # check line 1 is back |
2158 | 74 cat a |
75 | |
2492 | 76 echo '# backout should not back out subsequent changesets' |
77 hg init onecs | |
78 cd onecs | |
79 echo 1 > a | |
80 hg commit -d '0 0' -A -m a | |
81 echo 2 >> a | |
82 hg commit -d '1 0' -m b | |
83 echo 1 > b | |
84 hg commit -d '2 0' -A -m c | |
85 hg backout -d '3 0' 1 | |
86 hg locate b | |
6161
bc1ba9124799
Reverse the way backout is doing the merge
Gilles Moris <gilles.moris@free.fr>
parents:
5568
diff
changeset
|
87 hg update -C tip |
bc1ba9124799
Reverse the way backout is doing the merge
Gilles Moris <gilles.moris@free.fr>
parents:
5568
diff
changeset
|
88 hg locate b |
2492 | 89 |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
90 cd .. |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
91 hg init m |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
92 cd m |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
93 echo a > a |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
94 hg commit -d '0 0' -A -m a |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
95 echo b > b |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
96 hg commit -d '1 0' -A -m b |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
97 echo c > c |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
98 hg commit -d '2 0' -A -m b |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
99 hg update 1 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
100 echo d > d |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
101 hg commit -d '3 0' -A -m c |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
102 hg merge 2 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
103 hg commit -d '4 0' -A -m d |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
104 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
105 echo '# backout of merge should fail' |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
106 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
107 hg backout 4 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
108 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
109 echo '# backout of merge with bad parent should fail' |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
110 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
111 hg backout --parent 0 4 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
112 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
113 echo '# backout of non-merge with parent should fail' |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
114 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
115 hg backout --parent 0 3 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
116 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
117 echo '# backout with valid parent should be ok' |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
118 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
119 hg backout -d '5 0' --parent 2 4 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
120 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
121 hg rollback |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
122 hg update -C |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
123 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
124 hg backout -d '6 0' --parent 3 4 |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2492
diff
changeset
|
125 |
6162
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
126 cd .. |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
127 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
128 echo '# named branches' |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
129 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
130 hg init named_branches |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
131 cd named_branches |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
132 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
133 echo default > default |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
134 hg ci -d '0 0' -Am default |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
135 hg branch branch1 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
136 echo branch1 > file1 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
137 hg ci -d '1 0' -Am file1 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
138 hg branch branch2 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
139 echo branch2 > file2 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
140 hg ci -d '2 0' -Am file2 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
141 hg backout -d '3 0' -r 1 -m 'backout on branch1' |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
142 # XXX maybe backout shouldn't suggest a merge here as it is a different branch? |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
143 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
144 echo '% on branch2 with branch1 not merged, so file1 should still exist:' |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
145 hg id |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
146 hg st -A |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
147 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
148 echo '% on branch2 with branch1 merged, so file1 should be gone:' |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
149 hg merge |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
150 hg ci -d '4 0' -m 'merge backout of branch1' |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
151 hg id |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
152 hg st -A |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
153 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
154 echo '% on branch1, so no file1 and file2:' |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
155 hg co -C branch1 |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
156 hg id |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
157 hg st -A |
554715e584e6
Add test case for backout on named branches (issue665)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
158 |
2158 | 159 exit 0 |