##// END OF EJS Templates
tests: add more tests of copy tracing with removed and re-added files...
Martin von Zweigbergk -
r42793:ab416b5d default
parent child Browse files
Show More
@@ -34,48 +34,336 b' Copy a file, then delete destination, th'
34 $ newrepo
34 $ newrepo
35 $ echo x > x
35 $ echo x > x
36 $ hg ci -Aqm 'add x'
36 $ hg ci -Aqm 'add x'
37 $ echo x2 > x
38 $ hg ci -m 'modify x'
39 $ hg co -q 0
37 $ hg cp x y
40 $ hg cp x y
38 $ hg ci -m 'copy x to y'
41 $ hg ci -qm 'copy x to y'
39 $ hg rm y
42 $ hg rm y
40 $ hg ci -m 'remove y'
43 $ hg ci -m 'remove y'
41 $ hg cp -f x y
44 $ hg cp -f x y
42 $ hg ci -m 'copy x onto y (again)'
45 $ hg ci -m 'copy x onto y (again)'
43 $ hg l
46 $ hg l
44 @ 3 copy x onto y (again)
47 @ 4 copy x onto y (again)
48 | y
49 o 3 remove y
45 | y
50 | y
46 o 2 remove y
51 o 2 copy x to y
47 | y
52 | y
48 o 1 copy x to y
53 | o 1 modify x
49 | y
54 |/ x
50 o 0 add x
55 o 0 add x
51 x
56 x
52 $ hg debugp1copies -r 3
57 $ hg debugp1copies -r 4
53 x -> y
58 x -> y
54 $ hg debugpathcopies 0 3
59 $ hg debugpathcopies 0 4
55 x -> y
60 x -> y
61 $ hg graft -r 1
62 grafting 1:* "modify x" (glob)
63 merging y and x to y
64 $ hg co -qC 1
65 $ hg graft -r 4
66 grafting 4:* "copy x onto y (again)" (glob)
67 merging x and y to y
56
68
57 Copy x to y, then remove y, then add back y. With copy metadata in the changeset, this could easily
69 Copy x to y, then remove y, then add back y. With copy metadata in the
58 end up reporting y as copied from x (if we don't unmark it as a copy when it's removed).
70 changeset, this could easily end up reporting y as copied from x (if we don't
71 unmark it as a copy when it's removed). Despite x and y not being related, we
72 want grafts to propagate across the rename.
59 $ newrepo
73 $ newrepo
60 $ echo x > x
74 $ echo x > x
61 $ hg ci -Aqm 'add x'
75 $ hg ci -Aqm 'add x'
76 $ echo x2 > x
77 $ hg ci -m 'modify x'
78 $ hg co -q 0
62 $ hg mv x y
79 $ hg mv x y
63 $ hg ci -m 'rename x to y'
80 $ hg ci -qm 'rename x to y'
64 $ hg rm y
81 $ hg rm y
65 $ hg ci -qm 'remove y'
82 $ hg ci -qm 'remove y'
66 $ echo x > y
83 $ echo x > y
67 $ hg ci -Aqm 'add back y'
84 $ hg ci -Aqm 'add back y'
68 $ hg l
85 $ hg l
69 @ 3 add back y
86 @ 4 add back y
87 | y
88 o 3 remove y
70 | y
89 | y
71 o 2 remove y
90 o 2 rename x to y
72 | y
91 | x y
73 o 1 rename x to y
92 | o 1 modify x
93 |/ x
94 o 0 add x
95 x
96 $ hg debugpathcopies 0 4
97 BROKEN: This should succeed and merge the changes from x into y
98 $ hg graft -r 1
99 grafting 1:* "modify x" (glob)
100 file 'x' was deleted in local [local] but was modified in other [graft].
101 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
102 What do you want to do? u
103 abort: unresolved conflicts, can't continue
104 (use 'hg resolve' and 'hg graft --continue')
105 [255]
106
107 Add x, remove it, then add it back, then rename x to y. Similar to the case
108 above, but here the break in history is before the rename.
109 $ newrepo
110 $ echo x > x
111 $ hg ci -Aqm 'add x'
112 $ echo x2 > x
113 $ hg ci -m 'modify x'
114 $ hg co -q 0
115 $ hg rm x
116 $ hg ci -qm 'remove x'
117 $ echo x > x
118 $ hg ci -Aqm 'add x again'
119 $ hg mv x y
120 $ hg ci -m 'rename x to y'
121 $ hg l
122 @ 4 rename x to y
74 | x y
123 | x y
124 o 3 add x again
125 | x
126 o 2 remove x
127 | x
128 | o 1 modify x
129 |/ x
130 o 0 add x
131 x
132 $ hg debugpathcopies 0 4
133 x -> y
134 $ hg graft -r 1
135 grafting 1:* "modify x" (glob)
136 merging y and x to y
137 $ hg co -qC 1
138 $ hg graft -r 4
139 grafting 4:* "rename x to y" (glob)
140 merging x and y to y
141
142 Add x, modify it, remove it, then add it back, then rename x to y. Similar to
143 the case above, but here the re-added file's nodeid is different from before
144 the break.
145
146 $ newrepo
147 $ echo x > x
148 $ hg ci -Aqm 'add x'
149 $ echo x2 > x
150 $ hg ci -m 'modify x'
151 $ echo x3 > x
152 $ hg ci -qm 'modify x again'
153 $ hg co -q 1
154 $ hg rm x
155 $ hg ci -qm 'remove x'
156 # Same content to avoid conflicts
157 $ hg revert -r 1 x
158 $ hg ci -Aqm 'add x again'
159 $ hg mv x y
160 $ hg ci -m 'rename x to y'
161 $ hg l
162 @ 5 rename x to y
163 | x y
164 o 4 add x again
165 | x
166 o 3 remove x
167 | x
168 | o 2 modify x again
169 |/ x
170 o 1 modify x
171 | x
75 o 0 add x
172 o 0 add x
76 x
173 x
77 $ hg debugp1copies -r 3
174 $ hg debugpathcopies 0 5
78 $ hg debugpathcopies 0 3
175 x -> y (no-filelog !)
176 #if no-filelog
177 $ hg graft -r 2
178 grafting 2:* "modify x again" (glob)
179 merging y and x to y
180 #else
181 BROKEN: This should succeed and merge the changes from x into y
182 $ hg graft -r 2
183 grafting 2:* "modify x again" (glob)
184 file 'x' was deleted in local [local] but was modified in other [graft].
185 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
186 What do you want to do? u
187 abort: unresolved conflicts, can't continue
188 (use 'hg resolve' and 'hg graft --continue')
189 [255]
190 #endif
191 $ hg co -qC 2
192 BROKEN: This should succeed and merge the changes from x into y
193 $ hg graft -r 5
194 grafting 5:* "rename x to y"* (glob)
195 file 'x' was deleted in other [graft] but was modified in local [local].
196 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
197 What do you want to do? u
198 abort: unresolved conflicts, can't continue
199 (use 'hg resolve' and 'hg graft --continue')
200 [255]
201
202 Add x, remove it, then add it back, rename x to y from the first commit.
203 Similar to the case above, but here the break in history is parallel to the
204 rename.
205 $ newrepo
206 $ echo x > x
207 $ hg ci -Aqm 'add x'
208 $ hg rm x
209 $ hg ci -qm 'remove x'
210 $ echo x > x
211 $ hg ci -Aqm 'add x again'
212 $ echo x2 > x
213 $ hg ci -m 'modify x'
214 $ hg co -q 0
215 $ hg mv x y
216 $ hg ci -qm 'rename x to y'
217 $ hg l
218 @ 4 rename x to y
219 | x y
220 | o 3 modify x
221 | | x
222 | o 2 add x again
223 | | x
224 | o 1 remove x
225 |/ x
226 o 0 add x
227 x
228 $ hg debugpathcopies 2 4
229 x -> y
230 $ hg graft -r 3
231 grafting 3:* "modify x" (glob)
232 merging y and x to y
233 $ hg co -qC 3
234 $ hg graft -r 4
235 grafting 4:* "rename x to y" (glob)
236 merging x and y to y
237
238 Add x, remove it, then add it back, rename x to y from the first commit.
239 Similar to the case above, but here the re-added file's nodeid is different
240 from the base.
241 $ newrepo
242 $ echo x > x
243 $ hg ci -Aqm 'add x'
244 $ hg rm x
245 $ hg ci -qm 'remove x'
246 $ echo x2 > x
247 $ hg ci -Aqm 'add x again with different content'
248 $ hg co -q 0
249 $ hg mv x y
250 $ hg ci -qm 'rename x to y'
251 $ hg l
252 @ 3 rename x to y
253 | x y
254 | o 2 add x again with different content
255 | | x
256 | o 1 remove x
257 |/ x
258 o 0 add x
259 x
260 $ hg debugpathcopies 2 3
261 x -> y
262 BROKEN: This should merge the changes from x into y
263 $ hg graft -r 2
264 grafting 2:* "add x again with different content" (glob)
265 $ hg co -qC 2
266 BROKEN: This should succeed and merge the changes from x into y
267 $ hg graft -r 3
268 grafting 3:* "rename x to y" (glob)
269 file 'x' was deleted in other [graft] but was modified in local [local].
270 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
271 What do you want to do? u
272 abort: unresolved conflicts, can't continue
273 (use 'hg resolve' and 'hg graft --continue')
274 [255]
275
276 Add x on two branches, then rename x to y on one side. Similar to the case
277 above, but here the break in history is via the base commit.
278 $ newrepo
279 $ echo a > a
280 $ hg ci -Aqm 'base'
281 $ echo x > x
282 $ hg ci -Aqm 'add x'
283 $ echo x2 > x
284 $ hg ci -m 'modify x'
285 $ hg co -q 0
286 $ echo x > x
287 $ hg ci -Aqm 'add x again'
288 $ hg mv x y
289 $ hg ci -qm 'rename x to y'
290 $ hg l
291 @ 4 rename x to y
292 | x y
293 o 3 add x again
294 | x
295 | o 2 modify x
296 | | x
297 | o 1 add x
298 |/ x
299 o 0 base
300 a
301 $ hg debugpathcopies 1 4
302 BROKEN: This should succeed and merge the changes from x into y
303 $ hg graft -r 2
304 grafting 2:* "modify x" (glob)
305 file 'x' was deleted in local [local] but was modified in other [graft].
306 What do you want to do?
307 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
308 abort: unresolved conflicts, can't continue
309 (use 'hg resolve' and 'hg graft --continue')
310 [255]
311 $ hg co -qC 2
312 $ hg graft -r 4
313 grafting 4:* "rename x to y"* (glob)
314 merging x and y to y
315
316 Add x on two branches, with same content but different history, then rename x
317 to y on one side. Similar to the case above, here the file's nodeid is
318 different between the branches.
319 $ newrepo
320 $ echo a > a
321 $ hg ci -Aqm 'base'
322 $ echo x > x
323 $ hg ci -Aqm 'add x'
324 $ echo x2 > x
325 $ hg ci -m 'modify x'
326 $ hg co -q 0
327 $ touch x
328 $ hg ci -Aqm 'add empty x'
329 # Same content to avoid conflicts
330 $ hg revert -r 1 x
331 $ hg ci -m 'modify x to match commit 1'
332 $ hg mv x y
333 $ hg ci -qm 'rename x to y'
334 $ hg l
335 @ 5 rename x to y
336 | x y
337 o 4 modify x to match commit 1
338 | x
339 o 3 add empty x
340 | x
341 | o 2 modify x
342 | | x
343 | o 1 add x
344 |/ x
345 o 0 base
346 a
347 $ hg debugpathcopies 1 5
348 BROKEN: This should succeed and merge the changes from x into y
349 $ hg graft -r 2
350 grafting 2:* "modify x" (glob)
351 file 'x' was deleted in local [local] but was modified in other [graft].
352 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
353 What do you want to do? u
354 abort: unresolved conflicts, can't continue
355 (use 'hg resolve' and 'hg graft --continue')
356 [255]
357 $ hg co -qC 2
358 BROKEN: This should succeed and merge the changes from x into y
359 $ hg graft -r 5
360 grafting 5:* "rename x to y"* (glob)
361 file 'x' was deleted in other [graft] but was modified in local [local].
362 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
363 What do you want to do? u
364 abort: unresolved conflicts, can't continue
365 (use 'hg resolve' and 'hg graft --continue')
366 [255]
79
367
80 Copies via null revision (there shouldn't be any)
368 Copies via null revision (there shouldn't be any)
81 $ newrepo
369 $ newrepo
@@ -95,3 +383,5 b" Copies via null revision (there shouldn'"
95 x
383 x
96 $ hg debugpathcopies 1 2
384 $ hg debugpathcopies 1 2
97 $ hg debugpathcopies 2 1
385 $ hg debugpathcopies 2 1
386 $ hg graft -r 1
387 grafting 1:* "copy x to y" (glob)
@@ -184,52 +184,3 b' Check for issue3074'
184 $ hg status
184 $ hg status
185 M newfile
185 M newfile
186 $ cd ..
186 $ cd ..
187
188 Check that file is considered unrelated when deleted and recreated
189
190 $ hg init unrelated
191 $ cd unrelated
192 $ echo foo > file
193 $ hg add file
194 $ hg commit -m "added file"
195 $ hg cp file newfile
196 $ hg commit -m "copy file"
197 $ hg update 0
198 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
199 $ hg rm file
200 $ hg commit -m "deleted file"
201 created new head
202 $ echo bar > file
203 $ hg add file
204 $ hg ci -m 'recreate file'
205 $ hg log -G -T '{rev} {desc}\n'
206 @ 3 recreate file
207 |
208 o 2 deleted file
209 |
210 | o 1 copy file
211 |/
212 o 0 added file
213
214 BROKEN: this is inconsistent with `hg merge` (below), which doesn't consider
215 'file' renamed same since it was deleted for a while
216 $ hg st --copies --rev 3 --rev 1
217 M file
218 A newfile
219 file
220 $ hg merge --debug 1
221 unmatched files in other:
222 newfile
223 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
224 src: 'file' -> dst: 'newfile'
225 checking for directory renames
226 resolving manifests
227 branchmerge: True, force: False, partial: False
228 ancestor: 19d7f95df299, local: 4e4a42b1cbdf+, remote: 45b14aae7432
229 newfile: remote created -> g
230 getting newfile
231 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
232 (branch merge, don't forget to commit)
233 $ hg status
234 M newfile
235 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now