comparison tests/test-evolve-abort-phasediv.t @ 3914:96945ea908df stable

branching: merge default into stable The stable branch of Mercurial core now contains Mercurial 4.7 so evolve branch policy requires this merge. The @ bookmark is in the right location, so people doing clone will get to the latest release.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 31 Jul 2018 12:52:06 +0200
parents 629558d09898
children d00f0c369bc7 d081528bb372
comparison
equal deleted inserted replaced
3901:f2b8429db565 3914:96945ea908df
1 Tests for the --abort flag for `hg evolve` command while phase-divergence resolution
2 ====================================================================================
3
4 The `--abort` flag aborts the interuppted evolve by undoing all the work which
5 was done during resolution i.e. stripping new changesets created, moving
6 bookmarks back, moving working directory back.
7
8 This test contains cases when `hg evolve` is doing phase-divergence resolution.
9
10 Setup
11 =====
12
13 $ cat >> $HGRCPATH <<EOF
14 > [phases]
15 > publish = False
16 > [alias]
17 > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
18 > [extensions]
19 > EOF
20 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
21
22 $ hg init abortrepo
23 $ cd abortrepo
24 $ echo ".*\.orig" > .hgignore
25 $ hg add .hgignore
26 $ hg ci -m "added hgignore"
27 $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
28
29 $ hg glog
30 @ 4:c41c793e0ef1 added d
31 | () draft
32 o 3:ca1b80f7960a added c
33 | () draft
34 o 2:b1661037fa25 added b
35 | () draft
36 o 1:c7586e2a9264 added a
37 | () draft
38 o 0:8fa14d15e168 added hgignore
39 () draft
40
41 Creating phase divergence, resolution of which will lead to conflicts
42 ----------------------------------------------------------------------
43
44 $ hg up .^^^
45 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
46 $ hg grab -r .~-3
47 grabbing 4:c41c793e0ef1 "added d"
48 $ echo foobar > c
49 $ hg add c
50 $ hg amend
51
52 $ hg glog --hidden
53 @ 6:ddba58020bc0 added d
54 | () draft
55 | x 5:cfe30edc6125 added d
56 |/ () draft
57 | x 4:c41c793e0ef1 added d
58 | | () draft
59 | o 3:ca1b80f7960a added c
60 | | () draft
61 | o 2:b1661037fa25 added b
62 |/ () draft
63 o 1:c7586e2a9264 added a
64 | () draft
65 o 0:8fa14d15e168 added hgignore
66 () draft
67
68 $ hg phase -r c41c793e0ef1 --public --hidden
69 1 new phase-divergent changesets
70
71 $ hg glog
72 @ 6:ddba58020bc0 added d
73 | () draft
74 | o 4:c41c793e0ef1 added d
75 | | () public
76 | o 3:ca1b80f7960a added c
77 | | () public
78 | o 2:b1661037fa25 added b
79 |/ () public
80 o 1:c7586e2a9264 added a
81 | () public
82 o 0:8fa14d15e168 added hgignore
83 () public
84 $ hg evolve --phase-divergent
85 recreate:[6] added d
86 atop:[4] added d
87 rebasing to destination parent: ca1b80f7960a
88 merging c
89 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
90 fix conflicts and see `hg help evolve.interrupted`
91 [1]
92
93 testing that interrupted evolve shows up in morestatus
94 $ hg status -v
95 M c
96 A d
97 # The repository is in an unfinished *evolve* state.
98
99 # Unresolved merge conflicts:
100 #
101 # c
102 #
103 # To mark files as resolved: hg resolve --mark FILE
104
105 # To continue: hg evolve --continue
106 # To abort: hg evolve --abort
107 # To stop: hg evolve --stop
108 # (also see `hg help evolve.interrupted`)
109
110
111 $ hg evolve --abort
112 evolve aborted
113 working directory is now at ddba58020bc0
114
115 $ hg glog
116 @ 6:ddba58020bc0 added d
117 | () draft
118 | o 4:c41c793e0ef1 added d
119 | | () public
120 | o 3:ca1b80f7960a added c
121 | | () public
122 | o 2:b1661037fa25 added b
123 |/ () public
124 o 1:c7586e2a9264 added a
125 | () public
126 o 0:8fa14d15e168 added hgignore
127 () public
128
129 When there are multiple phase-divergent changes, resolution of last one resulted
130 in conflicts
131 ---------------------------------------------------------------------------------
132
133 $ echo foo > c
134 $ hg amend
135 $ hg phase -r ca1b80f --draft --force
136 $ hg prev
137 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
138 [1] added a
139 $ hg grab -r ca1b80f
140 grabbing 3:ca1b80f7960a "added c"
141 $ echo foobar > b
142 $ hg add b
143 $ hg amend
144 $ hg phase -r c41c793e0ef1 --public --hidden
145 2 new phase-divergent changesets
146
147 $ hg evolve --list
148 e44ebefe4f54: added d
149 phase-divergent: c41c793e0ef1 (immutable precursor)
150
151 28cd06b3f801: added c
152 phase-divergent: ca1b80f7960a (immutable precursor)
153
154
155 $ hg evolve --dry-run --all --phase-divergent
156 recreate:[7] added d
157 atop:[4] added d
158 hg rebase --rev e44ebefe4f54 --dest ca1b80f7960a;
159 hg update c41c793e0ef1;
160 hg revert --all --rev e44ebefe4f54;
161 hg commit --msg "phase-divergent update to e44ebefe4f54"
162 recreate:[9] added c
163 atop:[3] added c
164 hg rebase --rev 28cd06b3f801 --dest b1661037fa25;
165 hg update ca1b80f7960a;
166 hg revert --all --rev 28cd06b3f801;
167 hg commit --msg "phase-divergent update to 28cd06b3f801"
168
169 $ hg glog --hidden
170 @ 9:28cd06b3f801 added c
171 | () draft
172 | x 8:9ff8adbe8a24 added c
173 |/ () draft
174 | * 7:e44ebefe4f54 added d
175 |/ () draft
176 | x 6:ddba58020bc0 added d
177 |/ () draft
178 | x 5:cfe30edc6125 added d
179 |/ () draft
180 | o 4:c41c793e0ef1 added d
181 | | () public
182 | o 3:ca1b80f7960a added c
183 | | () public
184 | o 2:b1661037fa25 added b
185 |/ () public
186 o 1:c7586e2a9264 added a
187 | () public
188 o 0:8fa14d15e168 added hgignore
189 () public
190
191 $ hg evolve --phase-divergent --all
192 recreate:[7] added d
193 atop:[4] added d
194 rebasing to destination parent: ca1b80f7960a
195 computing new diff
196 committed as c41c793e0ef1
197 recreate:[9] added c
198 atop:[3] added c
199 rebasing to destination parent: b1661037fa25
200 merging b
201 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
202 fix conflicts and see `hg help evolve.interrupted`
203 [1]
204
205 $ hg evolve --abort
206 1 new phase-divergent changesets
207 evolve aborted
208 working directory is now at 28cd06b3f801
209
210 $ hg glog --hidden
211 @ 9:28cd06b3f801 added c
212 | () draft
213 | x 8:9ff8adbe8a24 added c
214 |/ () draft
215 | * 7:e44ebefe4f54 added d
216 |/ () draft
217 | x 6:ddba58020bc0 added d
218 |/ () draft
219 | x 5:cfe30edc6125 added d
220 |/ () draft
221 | o 4:c41c793e0ef1 added d
222 | | () public
223 | o 3:ca1b80f7960a added c
224 | | () public
225 | o 2:b1661037fa25 added b
226 |/ () public
227 o 1:c7586e2a9264 added a
228 | () public
229 o 0:8fa14d15e168 added hgignore
230 () public
231
232 When there are multiple conflicted phase-divergence resolution and we abort
233 after resolving one of them
234 ----------------------------------------------------------------------------
235
236 $ hg up e44ebefe4f54
237 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
238 $ echo foobar > c
239 $ hg amend
240
241 $ hg glog --hidden
242 @ 10:ef9b72b9b42c added d
243 | () draft
244 | * 9:28cd06b3f801 added c
245 |/ () draft
246 | x 8:9ff8adbe8a24 added c
247 |/ () draft
248 | x 7:e44ebefe4f54 added d
249 |/ () draft
250 | x 6:ddba58020bc0 added d
251 |/ () draft
252 | x 5:cfe30edc6125 added d
253 |/ () draft
254 | o 4:c41c793e0ef1 added d
255 | | () public
256 | o 3:ca1b80f7960a added c
257 | | () public
258 | o 2:b1661037fa25 added b
259 |/ () public
260 o 1:c7586e2a9264 added a
261 | () public
262 o 0:8fa14d15e168 added hgignore
263 () public
264
265 $ hg evolve --phase-divergent --all
266 recreate:[9] added c
267 atop:[3] added c
268 rebasing to destination parent: b1661037fa25
269 merging b
270 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
271 fix conflicts and see `hg help evolve.interrupted`
272 [1]
273
274 $ echo watwat > c
275 $ hg resolve -m
276 (no more unresolved files)
277 continue: hg evolve --continue
278 $ hg evolve --continue
279 evolving 9:28cd06b3f801 "added c"
280 computing new diff
281 committed as 95d746965290
282 recreate:[10] added d
283 atop:[4] added d
284 rebasing to destination parent: ca1b80f7960a
285 merging c
286 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
287 fix conflicts and see `hg help evolve.interrupted`
288 [1]
289
290 $ hg evolve --abort
291 1 new phase-divergent changesets
292 evolve aborted
293 working directory is now at ef9b72b9b42c
294
295 $ hg glog --hidden
296 @ 10:ef9b72b9b42c added d
297 | () draft
298 | * 9:28cd06b3f801 added c
299 |/ () draft
300 | x 8:9ff8adbe8a24 added c
301 |/ () draft
302 | x 7:e44ebefe4f54 added d
303 |/ () draft
304 | x 6:ddba58020bc0 added d
305 |/ () draft
306 | x 5:cfe30edc6125 added d
307 |/ () draft
308 | o 4:c41c793e0ef1 added d
309 | | () public
310 | o 3:ca1b80f7960a added c
311 | | () public
312 | o 2:b1661037fa25 added b
313 |/ () public
314 o 1:c7586e2a9264 added a
315 | () public
316 o 0:8fa14d15e168 added hgignore
317 () public