comparison tests/test-evolve-abort-phasediv.t @ 3752:6878d708500a

tests: add a test file `--abort` flag while resolving phase-divergence This patch adds a new test file test-evolve-abort-phasediv.t which will contain tests for `hg evolve --abort` flag while resolving phase-divergence. There is a case in this test which does not work right which will be fixed in upcoming patches.
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 23 May 2018 02:41:08 +0530
parents
children a19703c6d2bb
comparison
equal deleted inserted replaced
3750:85ad555d6ff7 3752:6878d708500a
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 evolution failed!
91 fix conflict then run 'hg evolve --continue' or use `hg evolve --abort`
92 abort: unresolved merge conflicts (see hg help resolve)
93 [255]
94
95 $ hg evolve --abort
96 evolve aborted
97 working directory is now at ddba58020bc0
98
99 $ hg glog
100 @ 6:ddba58020bc0 added d
101 | () draft
102 | o 4:c41c793e0ef1 added d
103 | | () public
104 | o 3:ca1b80f7960a added c
105 | | () public
106 | o 2:b1661037fa25 added b
107 |/ () public
108 o 1:c7586e2a9264 added a
109 | () public
110 o 0:8fa14d15e168 added hgignore
111 () public
112
113 When there are multiple phase-divergent changes, resolution of last one resulted
114 in conflicts
115 ---------------------------------------------------------------------------------
116
117 $ echo foo > c
118 $ hg amend
119 $ hg phase -r ca1b80f --draft --force
120 $ hg prev
121 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
122 [1] added a
123 $ hg grab -r ca1b80f
124 grabbing 3:ca1b80f7960a "added c"
125 $ echo foobar > b
126 $ hg add b
127 $ hg amend
128 $ hg phase -r c41c793e0ef1 --public --hidden
129 2 new phase-divergent changesets
130
131 $ hg evolve --list
132 e44ebefe4f54: added d
133 phase-divergent: c41c793e0ef1 (immutable precursor)
134
135 28cd06b3f801: added c
136 phase-divergent: ca1b80f7960a (immutable precursor)
137
138
139 $ hg evolve --dry-run --all --phase-divergent
140 recreate:[7] added d
141 atop:[4] added d
142 hg rebase --rev e44ebefe4f54 --dest ca1b80f7960a;
143 hg update c41c793e0ef1;
144 hg revert --all --rev e44ebefe4f54;
145 hg commit --msg "phase-divergent update to e44ebefe4f54"
146 recreate:[9] added c
147 atop:[3] added c
148 hg rebase --rev 28cd06b3f801 --dest b1661037fa25;
149 hg update ca1b80f7960a;
150 hg revert --all --rev 28cd06b3f801;
151 hg commit --msg "phase-divergent update to 28cd06b3f801"
152
153 $ hg glog --hidden
154 @ 9:28cd06b3f801 added c
155 | () draft
156 | x 8:9ff8adbe8a24 added c
157 |/ () draft
158 | * 7:e44ebefe4f54 added d
159 |/ () draft
160 | x 6:ddba58020bc0 added d
161 |/ () draft
162 | x 5:cfe30edc6125 added d
163 |/ () draft
164 | o 4:c41c793e0ef1 added d
165 | | () public
166 | o 3:ca1b80f7960a added c
167 | | () public
168 | o 2:b1661037fa25 added b
169 |/ () public
170 o 1:c7586e2a9264 added a
171 | () public
172 o 0:8fa14d15e168 added hgignore
173 () public
174
175 $ hg evolve --phase-divergent --all
176 recreate:[7] added d
177 atop:[4] added d
178 rebasing to destination parent: ca1b80f7960a
179 computing new diff
180 committed as c41c793e0ef1
181 recreate:[9] added c
182 atop:[3] added c
183 rebasing to destination parent: b1661037fa25
184 merging b
185 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
186 evolution failed!
187 fix conflict then run 'hg evolve --continue' or use `hg evolve --abort`
188 abort: unresolved merge conflicts (see hg help resolve)
189 [255]
190
191 $ hg evolve --abort
192 cannot clean up public changesets: c41c793e0ef1
193 abort: unable to abort interrupted evolve, use 'hg evolve --stop' to stop evolve
194 [255]
195
196 $ hg glog --hidden
197 x 10:b7aedbe61ce6 added d
198 | () draft
199 | * 9:28cd06b3f801 added c
200 | | () draft
201 | | x 8:9ff8adbe8a24 added c
202 | |/ () draft
203 | | x 7:e44ebefe4f54 added d
204 | |/ () draft
205 | | x 6:ddba58020bc0 added d
206 | |/ () draft
207 | | x 5:cfe30edc6125 added d
208 | |/ () draft
209 +---o 4:c41c793e0ef1 added d
210 | | () public
211 o | 3:ca1b80f7960a added c
212 | | () public
213 @ | 2:b1661037fa25 added b
214 |/ () public
215 o 1:c7586e2a9264 added a
216 | () public
217 o 0:8fa14d15e168 added hgignore
218 () public