Show More
@@ -1,159 +1,255 b'' | |||||
1 | #!/bin/sh |
|
1 | $ HGMERGE=true; export HGMERGE | |
|
2 | ||||
|
3 | $ hg init basic | |||
|
4 | $ cd basic | |||
2 |
|
5 | |||
3 | HGMERGE=true; export HGMERGE |
|
6 | # should complain | |
4 |
|
7 | |||
5 | hg init basic |
|
8 | $ hg backout | |
6 | cd basic |
|
9 | abort: please specify a revision to backout | |
|
10 | $ hg backout -r 0 0 | |||
|
11 | abort: please specify just one revision | |||
7 |
|
12 | |||
8 | echo '# should complain' |
|
13 | # basic operation | |
9 | hg backout |
|
|||
10 | hg backout -r 0 0 |
|
|||
11 |
|
14 | |||
12 | echo '# basic operation' |
|
15 | $ echo a > a | |
13 | echo a > a |
|
16 | $ hg commit -d '0 0' -A -m a | |
14 | hg commit -d '0 0' -A -m a |
|
17 | adding a | |
15 | echo b >> a |
|
18 | $ echo b >> a | |
16 | hg commit -d '1 0' -m b |
|
19 | $ hg commit -d '1 0' -m b | |
|
20 | ||||
|
21 | $ hg backout -d '2 0' tip | |||
|
22 | reverting a | |||
|
23 | changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57 | |||
|
24 | $ cat a | |||
|
25 | a | |||
17 |
|
26 | |||
18 | hg backout -d '2 0' tip |
|
27 | # file that was removed is recreated | |
19 | cat a |
|
28 | ||
|
29 | $ cd .. | |||
|
30 | $ hg init remove | |||
|
31 | $ cd remove | |||
20 |
|
32 | |||
21 | echo '# file that was removed is recreated' |
|
33 | $ echo content > a | |
22 | cd .. |
|
34 | $ hg commit -d '0 0' -A -m a | |
23 | hg init remove |
|
35 | adding a | |
24 | cd remove |
|
36 | ||
|
37 | $ hg rm a | |||
|
38 | $ hg commit -d '1 0' -m b | |||
25 |
|
39 | |||
26 | echo content > a |
|
40 | $ hg backout -d '2 0' --merge tip | |
27 | hg commit -d '0 0' -A -m a |
|
41 | adding a | |
|
42 | changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372 | |||
|
43 | $ cat a | |||
|
44 | content | |||
|
45 | ||||
|
46 | # backout of backout is as if nothing happened | |||
28 |
|
47 | |||
29 | hg rm a |
|
48 | $ hg backout -d '3 0' --merge tip | |
30 | hg commit -d '1 0' -m b |
|
49 | removing a | |
|
50 | changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d | |||
|
51 | $ cat a 2>/dev/null || echo cat: a: No such file or directory | |||
|
52 | cat: a: No such file or directory | |||
31 |
|
53 | |||
32 | hg backout -d '2 0' --merge tip |
|
54 | # across branch | |
33 | cat a |
|
|||
34 |
|
||||
35 | echo '# backout of backout is as if nothing happened' |
|
|||
36 |
|
55 | |||
37 | hg backout -d '3 0' --merge tip |
|
56 | $ cd .. | |
38 | cat a 2>/dev/null || echo cat: a: No such file or directory |
|
57 | $ hg init branch | |
|
58 | $ cd branch | |||
|
59 | $ echo a > a | |||
|
60 | $ hg ci -Am0 | |||
|
61 | adding a | |||
|
62 | $ echo b > b | |||
|
63 | $ hg ci -Am1 | |||
|
64 | adding b | |||
|
65 | $ hg co -C 0 | |||
|
66 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
67 | ||||
|
68 | should fail | |||
39 |
|
69 | |||
40 | echo '# across branch' |
|
70 | $ hg backout 1 | |
41 | cd .. |
|
71 | abort: cannot backout change on a different branch | |
42 | hg init branch |
|
72 | $ echo c > c | |
43 | cd branch |
|
73 | $ hg ci -Am2 | |
44 | echo a > a |
|
74 | adding c | |
45 | hg ci -Am0 |
|
75 | created new head | |
46 | echo b > b |
|
76 | ||
47 | hg ci -Am1 |
|
77 | should fail | |
48 | hg co -C 0 |
|
78 | ||
49 | # should fail |
|
79 | $ hg backout 1 | |
50 | hg backout 1 |
|
80 | abort: cannot backout change on a different branch | |
51 | echo c > c |
|
81 | ||
52 | hg ci -Am2 |
|
82 | # backout with merge | |
53 | # should fail |
|
83 | ||
54 | hg backout 1 |
|
84 | $ cd .. | |
|
85 | $ hg init merge | |||
|
86 | $ cd merge | |||
55 |
|
87 | |||
56 | echo '# backout with merge' |
|
88 | $ echo line 1 > a | |
57 | cd .. |
|
89 | $ echo line 2 >> a | |
58 | hg init merge |
|
90 | $ hg commit -d '0 0' -A -m a | |
59 | cd merge |
|
91 | adding a | |
|
92 | ||||
|
93 | remove line 1 | |||
|
94 | ||||
|
95 | $ echo line 2 > a | |||
|
96 | $ hg commit -d '1 0' -m b | |||
|
97 | ||||
|
98 | $ echo line 3 >> a | |||
|
99 | $ hg commit -d '2 0' -m c | |||
60 |
|
100 | |||
61 | echo line 1 > a |
|
101 | $ hg backout --merge -d '3 0' 1 | |
62 | echo line 2 >> a |
|
102 | reverting a | |
63 | hg commit -d '0 0' -A -m a |
|
103 | created new head | |
64 | # remove line 1 |
|
104 | changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182 | |
65 | echo line 2 > a |
|
105 | merging with changeset 3:26b8ccb9ad91 | |
66 | hg commit -d '1 0' -m b |
|
106 | merging a | |
|
107 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
108 | (branch merge, don't forget to commit) | |||
|
109 | $ hg commit -d '4 0' -m d | |||
67 |
|
110 | |||
68 |
|
|
111 | check line 1 is back | |
69 | hg commit -d '2 0' -m c |
|
|||
70 |
|
112 | |||
71 | hg backout --merge -d '3 0' 1 |
|
113 | $ cat a | |
72 | hg commit -d '4 0' -m d |
|
114 | line 1 | |
73 | # check line 1 is back |
|
115 | line 2 | |
74 | cat a |
|
116 | line 3 | |
|
117 | ||||
|
118 | # backout should not back out subsequent changesets | |||
75 |
|
119 | |||
76 | echo '# backout should not back out subsequent changesets' |
|
120 | $ hg init onecs | |
77 | hg init onecs |
|
121 | $ cd onecs | |
78 | cd onecs |
|
122 | $ echo 1 > a | |
79 | echo 1 > a |
|
123 | $ hg commit -d '0 0' -A -m a | |
80 | hg commit -d '0 0' -A -m a |
|
124 | adding a | |
81 | echo 2 >> a |
|
125 | $ echo 2 >> a | |
82 | hg commit -d '1 0' -m b |
|
126 | $ hg commit -d '1 0' -m b | |
83 | echo 1 > b |
|
127 | $ echo 1 > b | |
84 | hg commit -d '2 0' -A -m c |
|
128 | $ hg commit -d '2 0' -A -m c | |
85 | hg backout -d '3 0' 1 |
|
129 | adding b | |
86 | hg locate b |
|
130 | $ hg backout -d '3 0' 1 | |
87 | hg update -C tip |
|
131 | reverting a | |
88 | hg locate b |
|
132 | created new head | |
|
133 | changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5 | |||
|
134 | the backout changeset is a new head - do not forget to merge | |||
|
135 | (use "backout --merge" if you want to auto-merge) | |||
|
136 | $ hg locate b | |||
|
137 | b | |||
|
138 | $ hg update -C tip | |||
|
139 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
140 | $ hg locate b | |||
89 |
|
141 | |||
90 | cd .. |
|
142 | $ cd .. | |
91 | hg init m |
|
143 | $ hg init m | |
92 | cd m |
|
144 | $ cd m | |
93 | echo a > a |
|
145 | $ echo a > a | |
94 | hg commit -d '0 0' -A -m a |
|
146 | $ hg commit -d '0 0' -A -m a | |
95 | echo b > b |
|
147 | adding a | |
96 | hg commit -d '1 0' -A -m b |
|
148 | $ echo b > b | |
97 | echo c > c |
|
149 | $ hg commit -d '1 0' -A -m b | |
98 | hg commit -d '2 0' -A -m b |
|
150 | adding b | |
99 | hg update 1 |
|
151 | $ echo c > c | |
100 | echo d > d |
|
152 | $ hg commit -d '2 0' -A -m b | |
101 | hg commit -d '3 0' -A -m c |
|
153 | adding c | |
102 | hg merge 2 |
|
154 | $ hg update 1 | |
103 | hg commit -d '4 0' -A -m d |
|
155 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
|
156 | $ echo d > d | |||
|
157 | $ hg commit -d '3 0' -A -m c | |||
|
158 | adding d | |||
|
159 | created new head | |||
|
160 | $ hg merge 2 | |||
|
161 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
162 | (branch merge, don't forget to commit) | |||
|
163 | $ hg commit -d '4 0' -A -m d | |||
104 |
|
164 | |||
105 |
|
|
165 | # backout of merge should fail | |
|
166 | ||||
|
167 | $ hg backout 4 | |||
|
168 | abort: cannot backout a merge changeset without --parent | |||
106 |
|
169 | |||
107 | hg backout 4 |
|
170 | # backout of merge with bad parent should fail | |
108 |
|
171 | |||
109 | echo '# backout of merge with bad parent should fail' |
|
172 | $ hg backout --parent 0 4 | |
|
173 | abort: cb9a9f314b8b is not a parent of b2f3bb92043e | |||
110 |
|
174 | |||
111 | hg backout --parent 0 4 |
|
175 | # backout of non-merge with parent should fail | |
|
176 | ||||
|
177 | $ hg backout --parent 0 3 | |||
|
178 | abort: cannot use --parent on non-merge changeset | |||
112 |
|
179 | |||
113 |
|
|
180 | # backout with valid parent should be ok | |
114 |
|
181 | |||
115 |
hg backout --parent |
|
182 | $ hg backout -d '5 0' --parent 2 4 | |
|
183 | removing d | |||
|
184 | changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e | |||
116 |
|
185 | |||
117 | echo '# backout with valid parent should be ok' |
|
186 | $ hg rollback | |
118 |
|
187 | rolling back to revision 4 (undo commit) | ||
119 | hg backout -d '5 0' --parent 2 4 |
|
188 | $ hg update -C | |
120 |
|
189 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||
121 | hg rollback |
|
|||
122 | hg update -C |
|
|||
123 |
|
190 | |||
124 | hg backout -d '6 0' --parent 3 4 |
|
191 | $ hg backout -d '6 0' --parent 3 4 | |
125 |
|
192 | removing c | ||
126 | cd .. |
|
193 | changeset 5:033590168430 backs out changeset 4:b2f3bb92043e | |
127 |
|
194 | |||
128 | echo '# named branches' |
|
195 | $ cd .. | |
129 |
|
196 | |||
130 |
|
|
197 | # named branches | |
131 | cd named_branches |
|
198 | ||
|
199 | $ hg init named_branches | |||
|
200 | $ cd named_branches | |||
132 |
|
201 | |||
133 | echo default > default |
|
202 | $ echo default > default | |
134 | hg ci -d '0 0' -Am default |
|
203 | $ hg ci -d '0 0' -Am default | |
135 | hg branch branch1 |
|
204 | adding default | |
136 | echo branch1 > file1 |
|
205 | $ hg branch branch1 | |
137 | hg ci -d '1 0' -Am file1 |
|
206 | marked working directory as branch branch1 | |
138 | hg branch branch2 |
|
207 | $ echo branch1 > file1 | |
139 | echo branch2 > file2 |
|
208 | $ hg ci -d '1 0' -Am file1 | |
140 | hg ci -d '2 0' -Am file2 |
|
209 | adding file1 | |
141 | hg backout -d '3 0' -r 1 -m 'backout on branch1' |
|
210 | $ hg branch branch2 | |
142 | # XXX maybe backout shouldn't suggest a merge here as it is a different branch? |
|
211 | marked working directory as branch branch2 | |
|
212 | $ echo branch2 > file2 | |||
|
213 | $ hg ci -d '2 0' -Am file2 | |||
|
214 | adding file2 | |||
|
215 | $ hg backout -d '3 0' -r 1 -m 'backout on branch1' | |||
|
216 | removing file1 | |||
|
217 | created new head | |||
|
218 | changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3 | |||
|
219 | the backout changeset is a new head - do not forget to merge | |||
|
220 | (use "backout --merge" if you want to auto-merge) | |||
|
221 | ||||
|
222 | XXX maybe backout shouldn't suggest a merge here as it is a different branch? | |||
|
223 | ||||
|
224 | on branch2 with branch1 not merged, so file1 should still exist: | |||
143 |
|
225 | |||
144 | echo '% on branch2 with branch1 not merged, so file1 should still exist:' |
|
226 | $ hg id | |
145 | hg id |
|
227 | 45bbcd363bf0 (branch2) | |
146 | hg st -A |
|
228 | $ hg st -A | |
|
229 | C default | |||
|
230 | C file1 | |||
|
231 | C file2 | |||
|
232 | ||||
|
233 | on branch2 with branch1 merged, so file1 should be gone: | |||
147 |
|
234 | |||
148 | echo '% on branch2 with branch1 merged, so file1 should be gone:' |
|
235 | $ hg merge | |
149 | hg merge |
|
236 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
150 | hg ci -d '4 0' -m 'merge backout of branch1' |
|
237 | (branch merge, don't forget to commit) | |
151 | hg id |
|
238 | $ hg ci -d '4 0' -m 'merge backout of branch1' | |
152 | hg st -A |
|
239 | $ hg id | |
|
240 | 22149cdde76d (branch2) tip | |||
|
241 | $ hg st -A | |||
|
242 | C default | |||
|
243 | C file2 | |||
153 |
|
244 | |||
154 |
|
|
245 | on branch1, so no file1 and file2: | |
155 | hg co -C branch1 |
|
|||
156 | hg id |
|
|||
157 | hg st -A |
|
|||
158 |
|
246 | |||
159 | exit 0 |
|
247 | $ hg co -C branch1 | |
|
248 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
249 | $ hg id | |||
|
250 | bf1602f437f3 (branch1) | |||
|
251 | $ hg st -A | |||
|
252 | C default | |||
|
253 | C file1 | |||
|
254 | ||||
|
255 | $ exit 0 |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now