comparison tests/test-evolve-abort-contentdiv.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 796334340cad
children f7afd3a158e3 d081528bb372
comparison
equal deleted inserted replaced
3901:f2b8429db565 3914:96945ea908df
1 Tests for the --abort flag for `hg evolve` command while content-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 content-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 content divergence, resolution of which will lead to conflicts
42 -----------------------------------------------------------------------
43
44 $ echo bar > d
45 $ hg amend
46
47 $ hg up c41c793e0ef1 --hidden
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 updated to hidden changeset c41c793e0ef1
50 (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
51 working directory parent is obsolete! (c41c793e0ef1)
52 (use 'hg evolve' to update to its successor: e49523854bc8)
53
54 $ echo foobar > d
55 $ hg amend
56 2 new content-divergent changesets
57 $ hg glog --hidden
58 @ 6:9c1631e352d9 added d
59 | () draft
60 | * 5:e49523854bc8 added d
61 |/ () draft
62 | x 4:c41c793e0ef1 added d
63 |/ () draft
64 o 3:ca1b80f7960a added c
65 | () draft
66 o 2:b1661037fa25 added b
67 | () draft
68 o 1:c7586e2a9264 added a
69 | () draft
70 o 0:8fa14d15e168 added hgignore
71 () draft
72
73 $ hg evolve --content-divergent
74 merge:[6] added d
75 with: [5] added d
76 base: [4] added d
77 merging "other" content-divergent changeset 'e49523854bc8'
78 merging d
79 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
80 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
81 fix conflicts and see `hg help evolve.interrupted`
82 [1]
83
84 $ hg status -v
85 M d
86 # The repository is in an unfinished *evolve* state.
87
88 # Unresolved merge conflicts:
89 #
90 # d
91 #
92 # To mark files as resolved: hg resolve --mark FILE
93
94 # To continue: hg evolve --continue
95 # To abort: hg evolve --abort
96 # To stop: hg evolve --stop
97 # (also see `hg help evolve.interrupted`)
98
99
100 $ hg evolve --abort
101 evolve aborted
102 working directory is now at 9c1631e352d9
103
104 $ hg glog --hidden
105 @ 6:9c1631e352d9 added d
106 | () draft
107 | * 5:e49523854bc8 added d
108 |/ () draft
109 | x 4:c41c793e0ef1 added d
110 |/ () draft
111 o 3:ca1b80f7960a added c
112 | () draft
113 o 2:b1661037fa25 added b
114 | () draft
115 o 1:c7586e2a9264 added a
116 | () draft
117 o 0:8fa14d15e168 added hgignore
118 () draft
119
120 Creating multiple content-divergence where resolution of last one results in
121 conflicts and resolution of first one resulted in no new commit
122 -----------------------------------------------------------------------------
123
124 $ echo watbar > d
125 $ hg amend
126 $ hg up .^
127 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
128 $ echo bar > c
129 $ hg amend
130 2 new orphan changesets
131 $ hg up ca1b80f7960a --hidden
132 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
133 working directory parent is obsolete! (ca1b80f7960a)
134 (use 'hg evolve' to update to its successor: 2ba73e31f264)
135 $ echo foobar > c
136 $ hg amend
137 2 new content-divergent changesets
138 $ echo bar > c
139 $ hg amend
140
141 $ hg glog --hidden
142 @ 10:491e10505bae added c
143 | () draft
144 | x 9:7398f702a162 added c
145 |/ () draft
146 | * 8:2ba73e31f264 added c
147 |/ () draft
148 | * 7:f0f1694f123e added d
149 | | () draft
150 | | x 6:9c1631e352d9 added d
151 | |/ () draft
152 | | * 5:e49523854bc8 added d
153 | |/ () draft
154 | | x 4:c41c793e0ef1 added d
155 | |/ () draft
156 | x 3:ca1b80f7960a added c
157 |/ () draft
158 o 2:b1661037fa25 added b
159 | () draft
160 o 1:c7586e2a9264 added a
161 | () draft
162 o 0:8fa14d15e168 added hgignore
163 () draft
164
165 $ hg evolve --all --content-divergent
166 merge:[8] added c
167 with: [10] added c
168 base: [3] added c
169 updating to "local" side of the conflict: 2ba73e31f264
170 merging "other" content-divergent changeset '491e10505bae'
171 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
172 merge:[5] added d
173 with: [7] added d
174 base: [4] added d
175 updating to "local" side of the conflict: e49523854bc8
176 merging "other" content-divergent changeset 'f0f1694f123e'
177 merging d
178 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
179 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
180 fix conflicts and see `hg help evolve.interrupted`
181 [1]
182
183 $ hg evolve --abort
184 2 new content-divergent changesets
185 evolve aborted
186 working directory is now at 491e10505bae
187
188 $ hg glog --hidden
189 @ 10:491e10505bae added c
190 | () draft
191 | x 9:7398f702a162 added c
192 |/ () draft
193 | * 8:2ba73e31f264 added c
194 |/ () draft
195 | * 7:f0f1694f123e added d
196 | | () draft
197 | | x 6:9c1631e352d9 added d
198 | |/ () draft
199 | | * 5:e49523854bc8 added d
200 | |/ () draft
201 | | x 4:c41c793e0ef1 added d
202 | |/ () draft
203 | x 3:ca1b80f7960a added c
204 |/ () draft
205 o 2:b1661037fa25 added b
206 | () draft
207 o 1:c7586e2a9264 added a
208 | () draft
209 o 0:8fa14d15e168 added hgignore
210 () draft
211
212 $ hg obslog -r . --all
213 * 2ba73e31f264 (8) added c
214 |
215 | @ 491e10505bae (10) added c
216 | |
217 | x 7398f702a162 (9) added c
218 |/ rewritten(content) as 491e10505bae using amend by test (Thu Jan 01 00:00:00 1970 +0000)
219 |
220 x ca1b80f7960a (3) added c
221 rewritten(content) as 2ba73e31f264 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
222 rewritten(content) as 7398f702a162 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
223
224 $ cd ..
225
226 Creating content-divergence on multiple parents when gca of divergent changesets
227 is parent of one of the divergents and relocating leads to conflicts
228 ---------------------------------------------------------------------------------
229
230 $ hg init multiparent
231 $ cd multiparent
232 $ echo ".*\.orig" > .hgignore
233 $ hg add .hgignore
234 $ hg ci -m "added hgignore"
235 $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
236
237 $ hg glog
238 @ 4:c41c793e0ef1 added d
239 | () draft
240 o 3:ca1b80f7960a added c
241 | () draft
242 o 2:b1661037fa25 added b
243 | () draft
244 o 1:c7586e2a9264 added a
245 | () draft
246 o 0:8fa14d15e168 added hgignore
247 () draft
248
249 $ hg rebase -r . -d .^^^ --config extensions.rebase=
250 rebasing 4:c41c793e0ef1 "added d" (tip)
251 $ echo bar > c
252 $ hg add c
253 $ hg amend
254
255 $ hg up --hidden c41c793e0ef1
256 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 updated to hidden changeset c41c793e0ef1
258 (hidden revision 'c41c793e0ef1' was rewritten as: 69bdd23a9b0d)
259 working directory parent is obsolete! (c41c793e0ef1)
260 (use 'hg evolve' to update to its successor: 69bdd23a9b0d)
261 $ echo bar > d
262 $ hg amend
263 2 new content-divergent changesets
264
265 $ hg glog
266 @ 7:e49523854bc8 added d
267 | () draft
268 | * 6:69bdd23a9b0d added d
269 | | () draft
270 o | 3:ca1b80f7960a added c
271 | | () draft
272 o | 2:b1661037fa25 added b
273 |/ () draft
274 o 1:c7586e2a9264 added a
275 | () draft
276 o 0:8fa14d15e168 added hgignore
277 () draft
278
279 $ hg evolve --content-divergent
280 merge:[7] added d
281 with: [6] added d
282 base: [4] added d
283 rebasing "other" content-divergent changeset 69bdd23a9b0d on ca1b80f7960a
284 merging c
285 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
286 fix conflicts and see `hg help evolve.interrupted`
287 [1]
288
289 $ hg evolve --abort
290 evolve aborted
291 working directory is now at e49523854bc8
292
293 $ hg glog
294 @ 7:e49523854bc8 added d
295 | () draft
296 | * 6:69bdd23a9b0d added d
297 | | () draft
298 o | 3:ca1b80f7960a added c
299 | | () draft
300 o | 2:b1661037fa25 added b
301 |/ () draft
302 o 1:c7586e2a9264 added a
303 | () draft
304 o 0:8fa14d15e168 added hgignore
305 () draft
306
307 Creating content-divergence on multiple parents when gca of divergent changesets
308 is parent of one of the divergents and merging divergent leads to conflicts
309 ---------------------------------------------------------------------------------
310
311 $ hg up 69bdd23a9b0d
312 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
313 $ hg rm c
314 $ echo wat > d
315 $ hg amend
316
317 $ hg glog
318 @ 8:33e4442acf98 added d
319 | () draft
320 | * 7:e49523854bc8 added d
321 | | () draft
322 | o 3:ca1b80f7960a added c
323 | | () draft
324 | o 2:b1661037fa25 added b
325 |/ () draft
326 o 1:c7586e2a9264 added a
327 | () draft
328 o 0:8fa14d15e168 added hgignore
329 () draft
330
331 $ hg evolve --content-divergent
332 merge:[7] added d
333 with: [8] added d
334 base: [4] added d
335 rebasing "other" content-divergent changeset 33e4442acf98 on ca1b80f7960a
336 updating to "local" side of the conflict: e49523854bc8
337 merging "other" content-divergent changeset 'a663d1567f0b'
338 merging d
339 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
340 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
341 fix conflicts and see `hg help evolve.interrupted`
342 [1]
343
344 $ hg evolve --abort
345 evolve aborted
346 working directory is now at 33e4442acf98
347
348 $ hg glog
349 @ 8:33e4442acf98 added d
350 | () draft
351 | * 7:e49523854bc8 added d
352 | | () draft
353 | o 3:ca1b80f7960a added c
354 | | () draft
355 | o 2:b1661037fa25 added b
356 |/ () draft
357 o 1:c7586e2a9264 added a
358 | () draft
359 o 0:8fa14d15e168 added hgignore
360 () draft