comparison tests/test-obsolete-divergent.t @ 18068:4bec77e62c00

obsolete: compute successors set Successors set are an important part of obsolescence. It is necessary to detect and solve divergence situation. This changeset add a core function to compute them, a debug command to audit them and solid test on the concept. Check function docstring for details about the concept.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Thu, 13 Dec 2012 15:38:43 +0100
parents
children f84e731cbd20
comparison
equal deleted inserted replaced
18067:6f62e005781d 18068:4bec77e62c00
1 Test file dedicated to testing the divergent troubles from obsolete changeset.
2
3 This is the most complexe troubles from far so we isolate it in a dedicated
4 file.
5
6 Enable obsolete
7
8 $ cat > obs.py << EOF
9 > import mercurial.obsolete
10 > mercurial.obsolete._enabled = True
11 > EOF
12 $ cat >> $HGRCPATH << EOF
13 > [ui]
14 > logtemplate = {rev}:{node|short} {desc}\n
15 > [extensions]
16 > obs=${TESTTMP}/obs.py
17 > [alias]
18 > debugobsolete = debugobsolete -d '0 0'
19 > [phases]
20 > publish=False
21 > EOF
22
23
24 $ mkcommit() {
25 > echo "$1" > "$1"
26 > hg add "$1"
27 > hg ci -m "$1"
28 > }
29 $ getid() {
30 > hg id --debug -ir "desc('$1')"
31 > }
32
33 setup repo
34
35 $ hg init reference
36 $ cd reference
37 $ mkcommit base
38 $ mkcommit A_0
39 $ hg up 0
40 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
41 $ mkcommit A_1
42 created new head
43 $ hg up 0
44 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
45 $ mkcommit A_2
46 created new head
47 $ hg up 0
48 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
49 $ cd ..
50
51
52 $ newcase() {
53 > hg clone -u 0 -q reference $1
54 > cd $1
55 > }
56
57 direct divergence
58 -----------------
59
60 A_1 have two direct and divergent successors A_1 and A_1
61
62 $ newcase direct
63 $ hg debugobsolete `getid A_0` `getid A_1`
64 $ hg debugobsolete `getid A_0` `getid A_2`
65 $ hg log -G --hidden
66 o 3:392fd25390da A_2
67 |
68 | o 2:82623d38b9ba A_1
69 |/
70 | x 1:007dc284c1f8 A_0
71 |/
72 @ 0:d20a80d4def3 base
73
74 $ hg debugsuccessorssets 'all()'
75 d20a80d4def3
76 d20a80d4def3
77 007dc284c1f8
78 82623d38b9ba
79 392fd25390da
80 82623d38b9ba
81 82623d38b9ba
82 392fd25390da
83 392fd25390da
84 $ cd ..
85
86
87 indirect divergence with known changeset
88 -------------------------------------------
89
90 $ newcase indirect_known
91 $ hg debugobsolete `getid A_0` `getid A_1`
92 $ hg debugobsolete `getid A_0` `getid A_2`
93 $ mkcommit A_3
94 created new head
95 $ hg debugobsolete `getid A_2` `getid A_3`
96 $ hg log -G --hidden
97 @ 4:01f36c5a8fda A_3
98 |
99 | x 3:392fd25390da A_2
100 |/
101 | o 2:82623d38b9ba A_1
102 |/
103 | x 1:007dc284c1f8 A_0
104 |/
105 o 0:d20a80d4def3 base
106
107 $ hg debugsuccessorssets 'all()'
108 d20a80d4def3
109 d20a80d4def3
110 007dc284c1f8
111 01f36c5a8fda
112 82623d38b9ba
113 82623d38b9ba
114 82623d38b9ba
115 392fd25390da
116 01f36c5a8fda
117 01f36c5a8fda
118 01f36c5a8fda
119 $ cd ..
120
121
122 indirect divergence with known changeset
123 -------------------------------------------
124
125 $ newcase indirect_unknown
126 $ hg debugobsolete `getid A_0` aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
127 $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid A_1`
128 $ hg debugobsolete `getid A_0` `getid A_2`
129 $ hg log -G --hidden
130 o 3:392fd25390da A_2
131 |
132 | o 2:82623d38b9ba A_1
133 |/
134 | x 1:007dc284c1f8 A_0
135 |/
136 @ 0:d20a80d4def3 base
137
138 $ hg debugsuccessorssets 'all()'
139 d20a80d4def3
140 d20a80d4def3
141 007dc284c1f8
142 82623d38b9ba
143 392fd25390da
144 82623d38b9ba
145 82623d38b9ba
146 392fd25390da
147 392fd25390da
148 $ cd ..
149
150 do not take unknown node in account if they are final
151 -----------------------------------------------------
152
153 $ newcase final-unknown
154 $ hg debugobsolete `getid A_0` `getid A_1`
155 $ hg debugobsolete `getid A_1` `getid A_2`
156 $ hg debugobsolete `getid A_0` bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
157 $ hg debugobsolete bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccc
158 $ hg debugobsolete `getid A_1` dddddddddddddddddddddddddddddddddddddddd
159
160 $ hg debugsuccessorssets 'desc('A_0')'
161 007dc284c1f8
162 392fd25390da
163
164 $ cd ..
165
166 divergence that converge again is not divergence anymore
167 -----------------------------------------------------
168
169 $ newcase converged_divergence
170 $ hg debugobsolete `getid A_0` `getid A_1`
171 $ hg debugobsolete `getid A_0` `getid A_2`
172 $ mkcommit A_3
173 created new head
174 $ hg debugobsolete `getid A_1` `getid A_3`
175 $ hg debugobsolete `getid A_2` `getid A_3`
176 $ hg log -G --hidden
177 @ 4:01f36c5a8fda A_3
178 |
179 | x 3:392fd25390da A_2
180 |/
181 | x 2:82623d38b9ba A_1
182 |/
183 | x 1:007dc284c1f8 A_0
184 |/
185 o 0:d20a80d4def3 base
186
187 $ hg debugsuccessorssets 'all()'
188 d20a80d4def3
189 d20a80d4def3
190 007dc284c1f8
191 01f36c5a8fda
192 82623d38b9ba
193 01f36c5a8fda
194 392fd25390da
195 01f36c5a8fda
196 01f36c5a8fda
197 01f36c5a8fda
198 $ cd ..
199
200 split is not divergences
201 -----------------------------
202
203 $ newcase split
204 $ hg debugobsolete `getid A_0` `getid A_1` `getid A_2`
205 $ hg log -G --hidden
206 o 3:392fd25390da A_2
207 |
208 | o 2:82623d38b9ba A_1
209 |/
210 | x 1:007dc284c1f8 A_0
211 |/
212 @ 0:d20a80d4def3 base
213
214 $ hg debugsuccessorssets 'all()'
215 d20a80d4def3
216 d20a80d4def3
217 007dc284c1f8
218 82623d38b9ba 392fd25390da
219 82623d38b9ba
220 82623d38b9ba
221 392fd25390da
222 392fd25390da
223
224 Even when subsequente rewriting happen
225
226 $ mkcommit A_3
227 created new head
228 $ hg debugobsolete `getid A_1` `getid A_3`
229 $ hg up 0
230 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
231 $ mkcommit A_4
232 created new head
233 $ hg debugobsolete `getid A_2` `getid A_4`
234 $ hg up 0
235 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
236 $ mkcommit A_5
237 created new head
238 $ hg debugobsolete `getid A_4` `getid A_5`
239 $ hg log -G --hidden
240 @ 6:e442cfc57690 A_5
241 |
242 | x 5:6a411f0d7a0a A_4
243 |/
244 | o 4:01f36c5a8fda A_3
245 |/
246 | x 3:392fd25390da A_2
247 |/
248 | x 2:82623d38b9ba A_1
249 |/
250 | x 1:007dc284c1f8 A_0
251 |/
252 o 0:d20a80d4def3 base
253
254 $ hg debugsuccessorssets 'all()'
255 d20a80d4def3
256 d20a80d4def3
257 007dc284c1f8
258 01f36c5a8fda e442cfc57690
259 82623d38b9ba
260 01f36c5a8fda
261 392fd25390da
262 e442cfc57690
263 01f36c5a8fda
264 01f36c5a8fda
265 6a411f0d7a0a
266 e442cfc57690
267 e442cfc57690
268 e442cfc57690
269
270 Check more complexe obsolescence graft (with divergence)
271
272 $ mkcommit B_0; hg up 0
273 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
274 $ hg debugobsolete `getid B_0` `getid A_2`
275 $ mkcommit A_7; hg up 0
276 created new head
277 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
278 $ mkcommit A_8; hg up 0
279 created new head
280 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
281 $ hg debugobsolete `getid A_5` `getid A_7` `getid A_8`
282 $ mkcommit A_9; hg up 0
283 created new head
284 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
285 $ hg debugobsolete `getid A_5` `getid A_9`
286 $ hg log -G --hidden
287 o 10:bed64f5d2f5a A_9
288 |
289 | o 9:14608b260df8 A_8
290 |/
291 | o 8:7ae126973a96 A_7
292 |/
293 | x 7:3750ebee865d B_0
294 | |
295 | x 6:e442cfc57690 A_5
296 |/
297 | x 5:6a411f0d7a0a A_4
298 |/
299 | o 4:01f36c5a8fda A_3
300 |/
301 | x 3:392fd25390da A_2
302 |/
303 | x 2:82623d38b9ba A_1
304 |/
305 | x 1:007dc284c1f8 A_0
306 |/
307 @ 0:d20a80d4def3 base
308
309 $ hg debugsuccessorssets 'all()'
310 d20a80d4def3
311 d20a80d4def3
312 007dc284c1f8
313 01f36c5a8fda bed64f5d2f5a
314 01f36c5a8fda 7ae126973a96 14608b260df8
315 82623d38b9ba
316 01f36c5a8fda
317 392fd25390da
318 bed64f5d2f5a
319 7ae126973a96 14608b260df8
320 01f36c5a8fda
321 01f36c5a8fda
322 6a411f0d7a0a
323 bed64f5d2f5a
324 7ae126973a96 14608b260df8
325 e442cfc57690
326 bed64f5d2f5a
327 7ae126973a96 14608b260df8
328 3750ebee865d
329 bed64f5d2f5a
330 7ae126973a96 14608b260df8
331 7ae126973a96
332 7ae126973a96
333 14608b260df8
334 14608b260df8
335 bed64f5d2f5a
336 bed64f5d2f5a
337
338 fix the divergence
339
340 $ mkcommit A_A; hg up 0
341 created new head
342 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
343 $ hg debugobsolete `getid A_9` `getid A_A`
344 $ hg debugobsolete `getid A_7` `getid A_A`
345 $ hg debugobsolete `getid A_8` `getid A_A`
346 $ hg log -G --hidden
347 o 11:a139f71be9da A_A
348 |
349 | x 10:bed64f5d2f5a A_9
350 |/
351 | x 9:14608b260df8 A_8
352 |/
353 | x 8:7ae126973a96 A_7
354 |/
355 | x 7:3750ebee865d B_0
356 | |
357 | x 6:e442cfc57690 A_5
358 |/
359 | x 5:6a411f0d7a0a A_4
360 |/
361 | o 4:01f36c5a8fda A_3
362 |/
363 | x 3:392fd25390da A_2
364 |/
365 | x 2:82623d38b9ba A_1
366 |/
367 | x 1:007dc284c1f8 A_0
368 |/
369 @ 0:d20a80d4def3 base
370
371 $ hg debugsuccessorssets 'all()'
372 d20a80d4def3
373 d20a80d4def3
374 007dc284c1f8
375 01f36c5a8fda a139f71be9da
376 82623d38b9ba
377 01f36c5a8fda
378 392fd25390da
379 a139f71be9da
380 01f36c5a8fda
381 01f36c5a8fda
382 6a411f0d7a0a
383 a139f71be9da
384 e442cfc57690
385 a139f71be9da
386 3750ebee865d
387 a139f71be9da
388 7ae126973a96
389 a139f71be9da
390 14608b260df8
391 a139f71be9da
392 bed64f5d2f5a
393 a139f71be9da
394 a139f71be9da
395 a139f71be9da
396
397 $ cd ..
398