Debian Codegraph @

tests/test-copies-unrelated.t

raw
1 #testcases filelog compatibility changeset sidedata
2
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
5 > rebase=
6 > [alias]
7 > l = log -G -T '{rev} {desc}\n{files}\n'
8 > EOF
9
10 #if compatibility
11 $ cat >> $HGRCPATH << EOF
12 > [experimental]
13 > copies.read-from = compatibility
14 > EOF
15 #endif
16
17 #if changeset
18 $ cat >> $HGRCPATH << EOF
19 > [experimental]
20 > copies.read-from = changeset-only
21 > copies.write-to = changeset-only
22 > EOF
23 #endif
24
25 #if sidedata
26 $ cat >> $HGRCPATH << EOF
27 > [format]
28 > exp-use-copies-side-data-changeset = yes
29 > EOF
30 #endif
31
32 $ REPONUM=0
33 $ newrepo() {
34 > cd $TESTTMP
35 > REPONUM=`expr $REPONUM + 1`
36 > hg init repo-$REPONUM
37 > cd repo-$REPONUM
38 > }
39
40 Copy a file, then delete destination, then copy again. This does not create a new filelog entry.
41 $ newrepo
42 $ echo x > x
43 $ hg ci -Aqm 'add x'
44 $ echo x2 > x
45 $ hg ci -m 'modify x'
46 $ hg co -q 0
47 $ hg cp x y
48 $ hg ci -qm 'copy x to y'
49 $ hg rm y
50 $ hg ci -m 'remove y'
51 $ hg cp -f x y
52 $ hg ci -m 'copy x onto y (again)'
53 $ hg l
54 @ 4 copy x onto y (again)
55 | y
56 o 3 remove y
57 | y
58 o 2 copy x to y
59 | y
60 | o 1 modify x
61 |/ x
62 o 0 add x
63 x
64 $ hg debugp1copies -r 4
65 x -> y
66 $ hg debugpathcopies 0 4
67 x -> y
68 $ hg graft -r 1
69 grafting 1:* "modify x" (glob)
70 merging y and x to y
71 $ hg co -qC 1
72 $ hg graft -r 4
73 grafting 4:* "copy x onto y (again)" (glob)
74 merging x and y to y
75
76 Copy x to y, then remove y, then add back y. With copy metadata in the
77 changeset, this could easily end up reporting y as copied from x (if we don't
78 unmark it as a copy when it's removed). Despite x and y not being related, we
79 want grafts to propagate across the rename.
80 $ newrepo
81 $ echo x > x
82 $ hg ci -Aqm 'add x'
83 $ echo x2 > x
84 $ hg ci -m 'modify x'
85 $ hg co -q 0
86 $ hg mv x y
87 $ hg ci -qm 'rename x to y'
88 $ hg rm y
89 $ hg ci -qm 'remove y'
90 $ echo x > y
91 $ hg ci -Aqm 'add back y'
92 $ hg l
93 @ 4 add back y
94 | y
95 o 3 remove y
96 | y
97 o 2 rename x to y
98 | x y
99 | o 1 modify x
100 |/ x
101 o 0 add x
102 x
103 $ hg debugpathcopies 0 4
104 BROKEN: This should succeed and merge the changes from x into y
105 $ hg graft -r 1
106 grafting 1:* "modify x" (glob)
107 file 'x' was deleted in local [local] but was modified in other [graft].
108 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
109 What do you want to do? u
110 abort: unresolved conflicts, can't continue
111 (use 'hg resolve' and 'hg graft --continue')
112 [1]
113
114 Add x, remove it, then add it back, then rename x to y. Similar to the case
115 above, but here the break in history is before the rename.
116 $ newrepo
117 $ echo x > x
118 $ hg ci -Aqm 'add x'
119 $ echo x2 > x
120 $ hg ci -m 'modify x'
121 $ hg co -q 0
122 $ hg rm x
123 $ hg ci -qm 'remove x'
124 $ echo x > x
125 $ hg ci -Aqm 'add x again'
126 $ hg mv x y
127 $ hg ci -m 'rename x to y'
128 $ hg l
129 @ 4 rename x to y
130 | x y
131 o 3 add x again
132 | x
133 o 2 remove x
134 | x
135 | o 1 modify x
136 |/ x
137 o 0 add x
138 x
139 $ hg debugpathcopies 0 4
140 x -> y
141 $ hg graft -r 1
142 grafting 1:* "modify x" (glob)
143 merging y and x to y
144 $ hg co -qC 1
145 $ hg graft -r 4
146 grafting 4:* "rename x to y" (glob)
147 merging x and y to y
148
149 Add x, modify it, remove it, then add it back, then rename x to y. Similar to
150 the case above, but here the re-added file's nodeid is different from before
151 the break.
152
153 $ newrepo
154 $ echo x > x
155 $ hg ci -Aqm 'add x'
156 $ echo x2 > x
157 $ hg ci -m 'modify x'
158 $ echo x3 > x
159 $ hg ci -qm 'modify x again'
160 $ hg co -q 1
161 $ hg rm x
162 $ hg ci -qm 'remove x'
163 # Same content to avoid conflicts
164 $ hg revert -r 1 x
165 $ hg ci -Aqm 'add x again'
166 $ hg mv x y
167 $ hg ci -m 'rename x to y'
168 $ hg l
169 @ 5 rename x to y
170 | x y
171 o 4 add x again
172 | x
173 o 3 remove x
174 | x
175 | o 2 modify x again
176 |/ x
177 o 1 modify x
178 | x
179 o 0 add x
180 x
181 $ hg debugpathcopies 0 5
182 x -> y (no-filelog !)
183 #if no-filelog
184 $ hg graft -r 2
185 grafting 2:* "modify x again" (glob)
186 merging y and x to y
187 #else
188 BROKEN: This should succeed and merge the changes from x into y
189 $ hg graft -r 2
190 grafting 2:* "modify x again" (glob)
191 file 'x' was deleted in local [local] but was modified in other [graft].
192 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
193 What do you want to do? u
194 abort: unresolved conflicts, can't continue
195 (use 'hg resolve' and 'hg graft --continue')
196 [1]
197 #endif
198 $ hg co -qC 2
199 BROKEN: This should succeed and merge the changes from x into y
200 $ hg graft -r 5
201 grafting 5:* "rename x to y"* (glob)
202 file 'x' was deleted in other [graft] but was modified in local [local].
203 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
204 What do you want to do? u
205 abort: unresolved conflicts, can't continue
206 (use 'hg resolve' and 'hg graft --continue')
207 [1]
208
209 Add x, remove it, then add it back, rename x to y from the first commit.
210 Similar to the case above, but here the break in history is parallel to the
211 rename.
212 $ newrepo
213 $ echo x > x
214 $ hg ci -Aqm 'add x'
215 $ hg rm x
216 $ hg ci -qm 'remove x'
217 $ echo x > x
218 $ hg ci -Aqm 'add x again'
219 $ echo x2 > x
220 $ hg ci -m 'modify x'
221 $ hg co -q 0
222 $ hg mv x y
223 $ hg ci -qm 'rename x to y'
224 $ hg l
225 @ 4 rename x to y
226 | x y
227 | o 3 modify x
228 | | x
229 | o 2 add x again
230 | | x
231 | o 1 remove x
232 |/ x
233 o 0 add x
234 x
235 $ hg debugpathcopies 2 4
236 x -> y
237 $ hg graft -r 3
238 grafting 3:* "modify x" (glob)
239 merging y and x to y
240 $ hg co -qC 3
241 $ hg graft -r 4
242 grafting 4:* "rename x to y" (glob)
243 merging x and y to y
244
245 Add x, remove it, then add it back, rename x to y from the first commit.
246 Similar to the case above, but here the re-added file's nodeid is different
247 from the base.
248 $ newrepo
249 $ echo x > x
250 $ hg ci -Aqm 'add x'
251 $ hg rm x
252 $ hg ci -qm 'remove x'
253 $ echo x2 > x
254 $ hg ci -Aqm 'add x again with different content'
255 $ hg co -q 0
256 $ hg mv x y
257 $ hg ci -qm 'rename x to y'
258 $ hg l
259 @ 3 rename x to y
260 | x y
261 | o 2 add x again with different content
262 | | x
263 | o 1 remove x
264 |/ x
265 o 0 add x
266 x
267 $ hg debugpathcopies 2 3
268 x -> y
269 BROKEN: This should merge the changes from x into y
270 $ hg graft -r 2
271 grafting 2:* "add x again with different content" (glob)
272 $ hg co -qC 2
273 BROKEN: This should succeed and merge the changes from x into y
274 $ hg graft -r 3
275 grafting 3:* "rename x to y" (glob)
276 file 'x' was deleted in other [graft] but was modified in local [local].
277 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
278 What do you want to do? u
279 abort: unresolved conflicts, can't continue
280 (use 'hg resolve' and 'hg graft --continue')
281 [1]
282
283 Add x on two branches, then rename x to y on one side. Similar to the case
284 above, but here the break in history is via the base commit.
285 $ newrepo
286 $ echo a > a
287 $ hg ci -Aqm 'base'
288 $ echo x > x
289 $ hg ci -Aqm 'add x'
290 $ echo x2 > x
291 $ hg ci -m 'modify x'
292 $ hg co -q 0
293 $ echo x > x
294 $ hg ci -Aqm 'add x again'
295 $ hg mv x y
296 $ hg ci -qm 'rename x to y'
297 $ hg l
298 @ 4 rename x to y
299 | x y
300 o 3 add x again
301 | x
302 | o 2 modify x
303 | | x
304 | o 1 add x
305 |/ x
306 o 0 base
307 a
308 $ hg debugpathcopies 1 4
309 x -> y
310 $ hg graft -r 2
311 grafting 2:* "modify x" (glob)
312 merging y and x to y
313 $ hg co -qC 2
314 $ hg graft -r 4
315 grafting 4:* "rename x to y"* (glob)
316 merging x and y to y
317
318 Add x on two branches, with same content but different history, then rename x
319 to y on one side. Similar to the case above, here the file's nodeid is
320 different between the branches.
321 $ newrepo
322 $ echo a > a
323 $ hg ci -Aqm 'base'
324 $ echo x > x
325 $ hg ci -Aqm 'add x'
326 $ echo x2 > x
327 $ hg ci -m 'modify x'
328 $ hg co -q 0
329 $ touch x
330 $ hg ci -Aqm 'add empty x'
331 # Same content to avoid conflicts
332 $ hg revert -r 1 x
333 $ hg ci -m 'modify x to match commit 1'
334 $ hg mv x y
335 $ hg ci -qm 'rename x to y'
336 $ hg l
337 @ 5 rename x to y
338 | x y
339 o 4 modify x to match commit 1
340 | x
341 o 3 add empty x
342 | x
343 | o 2 modify x
344 | | x
345 | o 1 add x
346 |/ x
347 o 0 base
348 a
349 $ hg debugpathcopies 1 5
350 x -> y (no-filelog !)
351 #if no-filelog
352 $ hg graft -r 2
353 grafting 2:* "modify x" (glob)
354 merging y and x to y
355 #else
356 BROKEN: This should succeed and merge the changes from x into y
357 $ hg graft -r 2
358 grafting 2:* "modify x" (glob)
359 file 'x' was deleted in local [local] but was modified in other [graft].
360 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
361 What do you want to do? u
362 abort: unresolved conflicts, can't continue
363 (use 'hg resolve' and 'hg graft --continue')
364 [1]
365 #endif
366 $ hg co -qC 2
367 BROKEN: This should succeed and merge the changes from x into y
368 $ hg graft -r 5
369 grafting 5:* "rename x to y"* (glob)
370 file 'x' was deleted in other [graft] but was modified in local [local].
371 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
372 What do you want to do? u
373 abort: unresolved conflicts, can't continue
374 (use 'hg resolve' and 'hg graft --continue')
375 [1]
376
377 Copies via null revision (there shouldn't be any)
378 $ newrepo
379 $ echo x > x
380 $ hg ci -Aqm 'add x'
381 $ hg cp x y
382 $ hg ci -m 'copy x to y'
383 $ hg co -q null
384 $ echo x > x
385 $ hg ci -Aqm 'add x (again)'
386 $ hg l
387 @ 2 add x (again)
388 x
389 o 1 copy x to y
390 | y
391 o 0 add x
392 x
393 $ hg debugpathcopies 1 2
394 $ hg debugpathcopies 2 1
395 $ hg graft -r 1
396 grafting 1:* "copy x to y" (glob)
397
398 Copies involving a merge of multiple roots.
399
400 $ newrepo
401 $ echo a > a
402 $ hg ci -Aqm 'add a'
403 $ echo a >> a
404 $ hg ci -Aqm 'update a'
405 $ echo a >> a
406 $ hg ci -Aqm 'update a'
407
408 $ hg up null
409 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
410 $ echo b > a
411 $ hg ci -Aqm 'add a'
412 $ hg mv a b
413 $ hg ci -Aqm 'move a to b'
414 $ echo b >> b
415 $ hg ci -Aqm 'update b'
416 $ hg merge 0
417 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
418 (branch merge, don't forget to commit)
419 $ hg ci -m "merge with other branch"
420 $ echo a >> a
421 $ echo a >> a
422 $ echo b >> b
423 $ hg ci -Aqm 'update a and b'
424 $ hg l
425 @ 7 update a and b
426 | a b
427 o 6 merge with other branch
428 |\
429 | o 5 update b
430 | | b
431 | o 4 move a to b
432 | | a b
433 | o 3 add a
434 | a
435 | o 2 update a
436 | | a
437 | o 1 update a
438 |/ a
439 o 0 add a
440 a
441 $ hg cat a -r 7
442 a
443 a
444 a
445 $ hg cat a -r 2
446 a
447 a
448 a
449 $ hg cat a -r 0
450 a
451 $ hg debugpathcopies 7 2
452 $ hg debugpathcopies 2 7
453 $ hg merge 2
454 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
455 (branch merge, don't forget to commit)
456