|
1 Tests for the fix extension's behavior around non-trivial history topologies. |
|
2 Looks for correct incremental fixing and reproduction of parent/child |
|
3 relationships. We indicate fixed file content by uppercasing it. |
|
4 |
|
5 $ cat >> $HGRCPATH <<EOF |
|
6 > [extensions] |
|
7 > fix = |
|
8 > [fix] |
|
9 > uppercase-whole-file:command=sed -e 's/.*/\U&/' |
|
10 > uppercase-whole-file:fileset=set:** |
|
11 > EOF |
|
12 |
|
13 This tests the only behavior that should really be affected by obsolescence, so |
|
14 we'll test it with evolution off and on. This only changes the revision |
|
15 numbers, if all is well. |
|
16 |
|
17 #testcases obsstore-off obsstore-on |
|
18 #if obsstore-on |
|
19 $ cat >> $HGRCPATH <<EOF |
|
20 > [experimental] |
|
21 > evolution.createmarkers=True |
|
22 > evolution.allowunstable=True |
|
23 > EOF |
|
24 #endif |
|
25 |
|
26 Setting up the test topology. Scroll down to see the graph produced. We make it |
|
27 clear which files were modified in each revision. It's enough to test at the |
|
28 file granularity, because that demonstrates which baserevs were diffed against. |
|
29 The computation of changed lines is orthogonal and tested separately. |
|
30 |
|
31 $ hg init repo |
|
32 $ cd repo |
|
33 |
|
34 $ printf "aaaa\n" > a |
|
35 $ hg commit -Am "change A" |
|
36 adding a |
|
37 $ printf "bbbb\n" > b |
|
38 $ hg commit -Am "change B" |
|
39 adding b |
|
40 $ printf "cccc\n" > c |
|
41 $ hg commit -Am "change C" |
|
42 adding c |
|
43 $ hg checkout 0 |
|
44 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
45 $ printf "dddd\n" > d |
|
46 $ hg commit -Am "change D" |
|
47 adding d |
|
48 created new head |
|
49 $ hg merge -r 2 |
|
50 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
51 (branch merge, don't forget to commit) |
|
52 $ printf "eeee\n" > e |
|
53 $ hg commit -Am "change E" |
|
54 adding e |
|
55 $ hg checkout 0 |
|
56 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
57 $ printf "ffff\n" > f |
|
58 $ hg commit -Am "change F" |
|
59 adding f |
|
60 created new head |
|
61 $ hg checkout 0 |
|
62 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
63 $ printf "gggg\n" > g |
|
64 $ hg commit -Am "change G" |
|
65 adding g |
|
66 created new head |
|
67 $ hg merge -r 5 |
|
68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
69 (branch merge, don't forget to commit) |
|
70 $ printf "hhhh\n" > h |
|
71 $ hg commit -Am "change H" |
|
72 adding h |
|
73 $ hg merge -r 4 |
|
74 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
75 (branch merge, don't forget to commit) |
|
76 $ printf "iiii\n" > i |
|
77 $ hg commit -Am "change I" |
|
78 adding i |
|
79 $ hg checkout 2 |
|
80 0 files updated, 0 files merged, 6 files removed, 0 files unresolved |
|
81 $ printf "jjjj\n" > j |
|
82 $ hg commit -Am "change J" |
|
83 adding j |
|
84 created new head |
|
85 $ hg checkout 7 |
|
86 3 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
87 $ printf "kkkk\n" > k |
|
88 $ hg add |
|
89 adding k |
|
90 |
|
91 $ hg log --graph --template '{rev} {desc}\n' |
|
92 o 9 change J |
|
93 | |
|
94 | o 8 change I |
|
95 | |\ |
|
96 | | @ 7 change H |
|
97 | | |\ |
|
98 | | | o 6 change G |
|
99 | | | | |
|
100 | | o | 5 change F |
|
101 | | |/ |
|
102 | o | 4 change E |
|
103 |/| | |
|
104 | o | 3 change D |
|
105 | |/ |
|
106 o | 2 change C |
|
107 | | |
|
108 o | 1 change B |
|
109 |/ |
|
110 o 0 change A |
|
111 |
|
112 |
|
113 Fix all but the root revision and its four children. |
|
114 |
|
115 #if obsstore-on |
|
116 $ hg fix -r '2|4|7|8|9' --working-dir |
|
117 #else |
|
118 $ hg fix -r '2|4|7|8|9' --working-dir |
|
119 saved backup bundle to * (glob) |
|
120 #endif |
|
121 |
|
122 The five revisions remain, but the other revisions were fixed and replaced. All |
|
123 parent pointers have been accurately set to reproduce the previous topology |
|
124 (though it is rendered in a slightly different order now). |
|
125 |
|
126 #if obsstore-on |
|
127 $ hg log --graph --template '{rev} {desc}\n' |
|
128 o 14 change J |
|
129 | |
|
130 | o 13 change I |
|
131 | |\ |
|
132 | | @ 12 change H |
|
133 | | |\ |
|
134 | o | | 11 change E |
|
135 |/| | | |
|
136 o | | | 10 change C |
|
137 | | | | |
|
138 | | | o 6 change G |
|
139 | | | | |
|
140 | | o | 5 change F |
|
141 | | |/ |
|
142 | o / 3 change D |
|
143 | |/ |
|
144 o / 1 change B |
|
145 |/ |
|
146 o 0 change A |
|
147 |
|
148 $ C=10 |
|
149 $ E=11 |
|
150 $ H=12 |
|
151 $ I=13 |
|
152 $ J=14 |
|
153 #else |
|
154 $ hg log --graph --template '{rev} {desc}\n' |
|
155 o 9 change J |
|
156 | |
|
157 | o 8 change I |
|
158 | |\ |
|
159 | | @ 7 change H |
|
160 | | |\ |
|
161 | o | | 6 change E |
|
162 |/| | | |
|
163 o | | | 5 change C |
|
164 | | | | |
|
165 | | | o 4 change G |
|
166 | | | | |
|
167 | | o | 3 change F |
|
168 | | |/ |
|
169 | o / 2 change D |
|
170 | |/ |
|
171 o / 1 change B |
|
172 |/ |
|
173 o 0 change A |
|
174 |
|
175 $ C=5 |
|
176 $ E=6 |
|
177 $ H=7 |
|
178 $ I=8 |
|
179 $ J=9 |
|
180 #endif |
|
181 |
|
182 Change C is a root of the set being fixed, so all we fix is what has changed |
|
183 since its parent. That parent, change B, is its baserev. |
|
184 |
|
185 $ hg cat -r $C 'set:**' |
|
186 aaaa |
|
187 bbbb |
|
188 CCCC |
|
189 |
|
190 Change E is a merge with only one parent being fixed. Its baserevs are the |
|
191 unfixed parent plus the baserevs of the other parent. This evaluates to changes |
|
192 B and D. We now have to decide what it means to incrementally fix a merge |
|
193 commit. We choose to fix anything that has changed versus any baserev. Only the |
|
194 undisturbed content of the common ancestor, change A, is unfixed. |
|
195 |
|
196 $ hg cat -r $E 'set:**' |
|
197 aaaa |
|
198 BBBB |
|
199 CCCC |
|
200 DDDD |
|
201 EEEE |
|
202 |
|
203 Change H is a merge with neither parent being fixed. This is essentially |
|
204 equivalent to the previous case because there is still only one baserev for |
|
205 each parent of the merge. |
|
206 |
|
207 $ hg cat -r $H 'set:**' |
|
208 aaaa |
|
209 FFFF |
|
210 GGGG |
|
211 HHHH |
|
212 |
|
213 Change I is a merge that has four baserevs; two from each parent. We handle |
|
214 multiple baserevs in the same way regardless of how many came from each parent. |
|
215 So, fixing change H will fix any files that were not exactly the same in each |
|
216 baserev. |
|
217 |
|
218 $ hg cat -r $I 'set:**' |
|
219 aaaa |
|
220 BBBB |
|
221 CCCC |
|
222 DDDD |
|
223 EEEE |
|
224 FFFF |
|
225 GGGG |
|
226 HHHH |
|
227 IIII |
|
228 |
|
229 Change J is a simple case with one baserev, but its baserev is not its parent, |
|
230 change C. Its baserev is its grandparent, change B. |
|
231 |
|
232 $ hg cat -r $J 'set:**' |
|
233 aaaa |
|
234 bbbb |
|
235 CCCC |
|
236 JJJJ |
|
237 |
|
238 The working copy was dirty, so it is treated much like a revision. The baserevs |
|
239 for the working copy are inherited from its parent, change H, because it is |
|
240 also being fixed. |
|
241 |
|
242 $ cat * |
|
243 aaaa |
|
244 FFFF |
|
245 GGGG |
|
246 HHHH |
|
247 KKKK |
|
248 |
|
249 Change A was never a baserev because none of its children were to be fixed. |
|
250 |
|
251 $ cd .. |
|
252 |