##// END OF EJS Templates
merge: add tests for commit with no content change...
Yuya Nishihara -
r39146:f0c2653c default
parent child Browse files
Show More
@@ -0,0 +1,386
1 $ cat <<'EOF' >> "$HGRCPATH"
2 > [extensions]
3 > convert =
4 > [templates]
5 > l = '{rev}:{node|short} p={p1rev},{p2rev} m={manifest} f={files|json}'
6 > EOF
7
8 $ check_convert_identity () {
9 > hg convert -q "$1" "$1.converted"
10 > hg outgoing -q -R "$1.converted" "$1"
11 > if [ "$?" != 1 ]; then
12 > echo '*** BUG: hash changes on convert ***'
13 > hg log -R "$1.converted" -GTl
14 > fi
15 > }
16
17 Files added at both parents:
18
19 $ hg init added-both
20 $ cd added-both
21 $ touch a b c
22 $ hg ci -qAm0 a
23 $ hg ci -qAm1 b
24 $ hg up -q 0
25 $ hg ci -qAm2 c
26
27 $ hg merge
28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 (branch merge, don't forget to commit)
30 $ hg ci --debug -m merge
31 committing files:
32 b
33 committing manifest
34 committing changelog
35 updating the branch cache
36 committed changeset 3:7aa8a293f5d97377037afc21e871e036e718d659
37 $ hg log -GTl
38 @ 3:7aa8a293f5d9 p=2,1 m=3:8667461869a1 f=[]
39 |\
40 | o 2:e0ea47086fce p=0,-1 m=2:b2e5b07f9374 f=["c"]
41 | |
42 o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"]
43 |/
44 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"]
45
46
47 $ cd ..
48 $ check_convert_identity added-both
49
50 Files added at both parents, but the other removed at the merge:
51 (In this case, ctx.files() after the commit contains the removed file "b", but
52 its manifest does not differ from p1.)
53
54 $ hg init added-both-removed-at-merge
55 $ cd added-both-removed-at-merge
56 $ touch a b c
57 $ hg ci -qAm0 a
58 $ hg ci -qAm1 b
59 $ hg up -q 0
60 $ hg ci -qAm2 c
61
62 $ hg merge
63 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 (branch merge, don't forget to commit)
65 $ hg rm -f b
66 $ hg ci --debug -m merge
67 committing files:
68 committing manifest
69 committing changelog
70 updating the branch cache
71 committed changeset 3:915745f3ca3d9d699925269474c2d0a9526e8dfa
72 $ hg log -GTl
73 @ 3:915745f3ca3d p=2,1 m=3:8e9cf3456921 f=["b"]
74 |\
75 | o 2:e0ea47086fce p=0,-1 m=2:b2e5b07f9374 f=["c"]
76 | |
77 o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"]
78 |/
79 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"]
80
81
82 $ cd ..
83 $ check_convert_identity added-both
84
85 An identical file added at both parents:
86
87 $ hg init added-identical
88 $ cd added-identical
89 $ touch a b
90 $ hg ci -qAm0 a
91 $ hg ci -qAm1 b
92 $ hg up -q 0
93 $ touch b
94 $ hg ci -qAm2 b
95
96 $ hg merge
97 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 (branch merge, don't forget to commit)
99 $ hg ci --debug -m merge
100 reusing manifest from p1 (no file change)
101 committing changelog
102 updating the branch cache
103 committed changeset 3:de26182cd210f0c3fb175ca7616704ab963d3024
104 $ hg log -GTl
105 @ 3:de26182cd210 p=2,1 m=1:686dbf0aeca4 f=[]
106 |\
107 | o 2:f00991f11eca p=0,-1 m=1:686dbf0aeca4 f=["b"]
108 | |
109 o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"]
110 |/
111 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"]
112
113
114 $ cd ..
115 $ check_convert_identity added-identical
116
117 #if execbit
118
119 An identical file added at both parents, but the flag differs. Take local:
120
121 $ hg init flag-change-take-p1
122 $ cd flag-change-take-p1
123 $ touch a b
124 $ hg ci -qAm0 a
125 $ hg ci -qAm1 b
126 $ hg up -q 0
127 $ touch b
128 $ chmod +x b
129 $ hg ci -qAm2 b
130
131 $ hg merge
132 warning: cannot merge flags for b without common ancestor - keeping local flags
133 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
134 (branch merge, don't forget to commit)
135 $ chmod +x b
136 $ hg ci --debug -m merge
137 committing files:
138 b
139 committing manifest
140 committing changelog
141 updating the branch cache
142 committed changeset 3:4bfaad7f925b7f17f60524dc5d4e605f7bfbba3f
143 $ hg log -GTl
144 @ 3:4bfaad7f925b p=2,1 m=3:a3a9fe23a5b8 f=[]
145 |\
146 | o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"]
147 | |
148 o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"]
149 |/
150 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"]
151
152 $ hg files -vr3
153 0 a
154 0 x b
155
156 $ cd ..
157 $ check_convert_identity flag-change-take-p1
158 3:c8d50407916e
159 *** BUG: hash changes on convert ***
160 o 3:c8d50407916e p=2,1 m=2:36b69ba4b24b f=[]
161 |\
162 | o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"]
163 | |
164 o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"]
165 |/
166 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"]
167
168
169 An identical file added at both parents, but the flag differs. Take other:
170
171 $ hg init flag-change-take-p2
172 $ cd flag-change-take-p2
173 $ touch a b
174 $ hg ci -qAm0 a
175 $ hg ci -qAm1 b
176 $ hg up -q 0
177 $ touch b
178 $ chmod +x b
179 $ hg ci -qAm2 b
180
181 $ hg merge
182 warning: cannot merge flags for b without common ancestor - keeping local flags
183 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
184 (branch merge, don't forget to commit)
185 $ chmod -x b
186 $ hg ci --debug -m merge
187 committing files:
188 b
189 committing manifest
190 committing changelog
191 updating the branch cache
192 committed changeset 3:06a62a687d87c7d8944743dee1ee9d8c66b3f6e3
193 $ hg log -GTl
194 @ 3:06a62a687d87 p=2,1 m=3:2a315ba1aa45 f=["b"]
195 |\
196 | o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"]
197 | |
198 o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"]
199 |/
200 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"]
201
202 $ hg files -vr3
203 0 a
204 0 b
205
206 $ cd ..
207 $ check_convert_identity flag-change-take-p2
208
209 #endif
210
211 An identical file added at both parents, one more file added at p2:
212
213 $ hg init added-some-p2
214 $ cd added-some-p2
215 $ touch a b c
216 $ hg ci -qAm0 a
217 $ hg ci -qAm1 b
218 $ hg ci -qAm2 c
219 $ hg up -q 0
220 $ touch b
221 $ hg ci -qAm3 b
222
223 $ hg merge
224 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
225 (branch merge, don't forget to commit)
226 $ hg ci --debug -m merge
227 committing files:
228 c
229 committing manifest
230 committing changelog
231 updating the branch cache
232 committed changeset 4:f7fbc4e4d9a8fde03ba475adad675578c8bf472d
233 $ hg log -GTl
234 @ 4:f7fbc4e4d9a8 p=3,2 m=3:92acd5bfd716 f=[]
235 |\
236 | o 3:e9d9f3cc981f p=0,-1 m=1:686dbf0aeca4 f=["b"]
237 | |
238 o | 2:93c5529a4ec7 p=1,-1 m=2:ae25a31b30b3 f=["c"]
239 | |
240 o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"]
241 |/
242 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"]
243
244
245 $ cd ..
246 $ check_convert_identity added-some-p2
247
248 An identical file added at both parents, one more file added at p1:
249 (In this case, p1 manifest is reused at the merge commit, which means the
250 manifest DAG does not have the same shape as the changelog.)
251
252 $ hg init added-some-p1
253 $ cd added-some-p1
254 $ touch a b
255 $ hg ci -qAm0 a
256 $ hg ci -qAm1 b
257 $ hg up -q 0
258 $ touch b c
259 $ hg ci -qAm2 b
260 $ hg ci -qAm3 c
261
262 $ hg merge
263 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
264 (branch merge, don't forget to commit)
265 $ hg ci --debug -m merge
266 reusing manifest from p1 (no file change)
267 committing changelog
268 updating the branch cache
269 committed changeset 4:a9f0f589a913f5a149dc10dfbd5af726977c36c4
270 $ hg log -GTl
271 @ 4:a9f0f589a913 p=3,1 m=2:ae25a31b30b3 f=[]
272 |\
273 | o 3:b8dc385241b5 p=2,-1 m=2:ae25a31b30b3 f=["c"]
274 | |
275 | o 2:f00991f11eca p=0,-1 m=1:686dbf0aeca4 f=["b"]
276 | |
277 o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"]
278 |/
279 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"]
280
281
282 $ cd ..
283 $ check_convert_identity added-some-p1
284
285 A file added at p2, a named branch created at p1:
286
287 $ hg init named-branch-p1
288 $ cd named-branch-p1
289 $ touch a b
290 $ hg ci -qAm0 a
291 $ hg ci -qAm1 b
292 $ hg up -q 0
293 $ hg branch -q foo
294 $ hg ci -m2
295
296 $ hg merge default
297 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
298 (branch merge, don't forget to commit)
299 $ hg ci --debug -m merge
300 committing files:
301 b
302 committing manifest
303 committing changelog
304 updating the branch cache
305 committed changeset 3:fb97d83b02fd072295cfc2171f21b7d38509bfd7
306 $ hg log -GT'{l} branch={branch}'
307 @ 3:fb97d83b02fd p=2,1 m=2:9091c64f4ea1 f=[] branch=foo
308 |\
309 | o 2:a3a9fa6587e5 p=0,-1 m=0:8515d4bfda76 f=[] branch=foo
310 | |
311 o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] branch=default
312 |/
313 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default
314
315
316 $ cd ..
317 $ check_convert_identity named-branch-p1
318
319 A file added at p1, a named branch created at p2:
320 (In this case, p1 manifest is reused at the merge commit, which means the
321 manifest DAG does not have the same shape as the changelog.)
322
323 $ hg init named-branch-p2
324 $ cd named-branch-p2
325 $ touch a b
326 $ hg ci -qAm0 a
327 $ hg branch -q foo
328 $ hg ci -m1
329 $ hg up -q 0
330 $ hg ci -qAm1 b
331
332 $ hg merge foo
333 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
334 (branch merge, don't forget to commit)
335 $ hg ci --debug -m merge
336 reusing manifest from p1 (no file change)
337 committing changelog
338 updating the branch cache
339 committed changeset 3:036823e24692218324d4af43b07ff89f8a000096
340 $ hg log -GT'{l} branch={branch}'
341 @ 3:036823e24692 p=2,1 m=1:686dbf0aeca4 f=[] branch=default
342 |\
343 | o 2:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] branch=default
344 | |
345 o | 1:da38c8e00727 p=0,-1 m=0:8515d4bfda76 f=[] branch=foo
346 |/
347 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default
348
349
350 $ cd ..
351 $ check_convert_identity named-branch-p2
352
353 A file changed once at both parents, but amended to have identical content:
354
355 $ hg init amend-p1
356 $ cd amend-p1
357 $ touch a
358 $ hg ci -qAm0 a
359 $ echo foo > a
360 $ hg ci -m1
361 $ hg up -q 0
362 $ echo bar > a
363 $ hg ci -qm2
364 $ echo foo > a
365 $ hg ci -qm3 --amend
366
367 $ hg merge
368 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
369 (branch merge, don't forget to commit)
370 $ hg ci --debug -m merge
371 reusing manifest from p1 (no file change)
372 committing changelog
373 updating the branch cache
374 committed changeset 3:314e5bc5adf5c58ea571efabe33eedba20a201aa
375 $ hg log -GT'{l} branch={branch}'
376 @ 3:314e5bc5adf5 p=2,1 m=1:d33ea248bd73 f=[] branch=default
377 |\
378 | o 2:de9c64f226a3 p=0,-1 m=1:d33ea248bd73 f=["a"] branch=default
379 | |
380 o | 1:6a74aec01b3c p=0,-1 m=1:d33ea248bd73 f=["a"] branch=default
381 |/
382 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default
383
384
385 $ cd ..
386 $ check_convert_identity amend-p1
General Comments 0
You need to be logged in to leave comments. Login now