##// END OF EJS Templates
copies: add test that makes both the merging csets dirty and run w/o error...
Sushil khanchi -
r42096:cbdd2b56 default
parent child Browse files
Show More
@@ -1,493 +1,554
1 #testcases filelog compatibility
1 #testcases filelog compatibility
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [alias]
4 > [alias]
5 > l = log -G -T '{rev} {desc}\n{files}\n'
5 > l = log -G -T '{rev} {desc}\n{files}\n'
6 > EOF
6 > EOF
7
7
8 #if compatibility
8 #if compatibility
9 $ cat >> $HGRCPATH << EOF
9 $ cat >> $HGRCPATH << EOF
10 > [experimental]
10 > [experimental]
11 > copies.read-from = compatibility
11 > copies.read-from = compatibility
12 > EOF
12 > EOF
13 #endif
13 #endif
14
14
15 $ REPONUM=0
15 $ REPONUM=0
16 $ newrepo() {
16 $ newrepo() {
17 > cd $TESTTMP
17 > cd $TESTTMP
18 > REPONUM=`expr $REPONUM + 1`
18 > REPONUM=`expr $REPONUM + 1`
19 > hg init repo-$REPONUM
19 > hg init repo-$REPONUM
20 > cd repo-$REPONUM
20 > cd repo-$REPONUM
21 > }
21 > }
22
22
23 Simple rename case
23 Simple rename case
24 $ newrepo
24 $ newrepo
25 $ echo x > x
25 $ echo x > x
26 $ hg ci -Aqm 'add x'
26 $ hg ci -Aqm 'add x'
27 $ hg mv x y
27 $ hg mv x y
28 $ hg debugp1copies
28 $ hg debugp1copies
29 x -> y
29 x -> y
30 $ hg debugp2copies
30 $ hg debugp2copies
31 $ hg ci -m 'rename x to y'
31 $ hg ci -m 'rename x to y'
32 $ hg l
32 $ hg l
33 @ 1 rename x to y
33 @ 1 rename x to y
34 | x y
34 | x y
35 o 0 add x
35 o 0 add x
36 x
36 x
37 $ hg debugp1copies -r 1
37 $ hg debugp1copies -r 1
38 x -> y
38 x -> y
39 $ hg debugpathcopies 0 1
39 $ hg debugpathcopies 0 1
40 x -> y
40 x -> y
41 $ hg debugpathcopies 1 0
41 $ hg debugpathcopies 1 0
42 y -> x
42 y -> x
43 Test filtering copies by path. We do filtering by destination.
43 Test filtering copies by path. We do filtering by destination.
44 $ hg debugpathcopies 0 1 x
44 $ hg debugpathcopies 0 1 x
45 $ hg debugpathcopies 1 0 x
45 $ hg debugpathcopies 1 0 x
46 y -> x
46 y -> x
47 $ hg debugpathcopies 0 1 y
47 $ hg debugpathcopies 0 1 y
48 x -> y
48 x -> y
49 $ hg debugpathcopies 1 0 y
49 $ hg debugpathcopies 1 0 y
50
50
51 Copy a file onto another file
51 Copy a file onto another file
52 $ newrepo
52 $ newrepo
53 $ echo x > x
53 $ echo x > x
54 $ echo y > y
54 $ echo y > y
55 $ hg ci -Aqm 'add x and y'
55 $ hg ci -Aqm 'add x and y'
56 $ hg cp -f x y
56 $ hg cp -f x y
57 $ hg debugp1copies
57 $ hg debugp1copies
58 x -> y
58 x -> y
59 $ hg debugp2copies
59 $ hg debugp2copies
60 $ hg ci -m 'copy x onto y'
60 $ hg ci -m 'copy x onto y'
61 $ hg l
61 $ hg l
62 @ 1 copy x onto y
62 @ 1 copy x onto y
63 | y
63 | y
64 o 0 add x and y
64 o 0 add x and y
65 x y
65 x y
66 $ hg debugp1copies -r 1
66 $ hg debugp1copies -r 1
67 x -> y
67 x -> y
68 Incorrectly doesn't show the rename
68 Incorrectly doesn't show the rename
69 $ hg debugpathcopies 0 1
69 $ hg debugpathcopies 0 1
70
70
71 Copy a file onto another file with same content. If metadata is stored in changeset, this does not
71 Copy a file onto another file with same content. If metadata is stored in changeset, this does not
72 produce a new filelog entry. The changeset's "files" entry should still list the file.
72 produce a new filelog entry. The changeset's "files" entry should still list the file.
73 $ newrepo
73 $ newrepo
74 $ echo x > x
74 $ echo x > x
75 $ echo x > x2
75 $ echo x > x2
76 $ hg ci -Aqm 'add x and x2 with same content'
76 $ hg ci -Aqm 'add x and x2 with same content'
77 $ hg cp -f x x2
77 $ hg cp -f x x2
78 $ hg ci -m 'copy x onto x2'
78 $ hg ci -m 'copy x onto x2'
79 $ hg l
79 $ hg l
80 @ 1 copy x onto x2
80 @ 1 copy x onto x2
81 | x2
81 | x2
82 o 0 add x and x2 with same content
82 o 0 add x and x2 with same content
83 x x2
83 x x2
84 $ hg debugp1copies -r 1
84 $ hg debugp1copies -r 1
85 x -> x2
85 x -> x2
86 Incorrectly doesn't show the rename
86 Incorrectly doesn't show the rename
87 $ hg debugpathcopies 0 1
87 $ hg debugpathcopies 0 1
88
88
89 Copy a file, then delete destination, then copy again. This does not create a new filelog entry.
89 Copy a file, then delete destination, then copy again. This does not create a new filelog entry.
90 $ newrepo
90 $ newrepo
91 $ echo x > x
91 $ echo x > x
92 $ hg ci -Aqm 'add x'
92 $ hg ci -Aqm 'add x'
93 $ hg cp x y
93 $ hg cp x y
94 $ hg ci -m 'copy x to y'
94 $ hg ci -m 'copy x to y'
95 $ hg rm y
95 $ hg rm y
96 $ hg ci -m 'remove y'
96 $ hg ci -m 'remove y'
97 $ hg cp -f x y
97 $ hg cp -f x y
98 $ hg ci -m 'copy x onto y (again)'
98 $ hg ci -m 'copy x onto y (again)'
99 $ hg l
99 $ hg l
100 @ 3 copy x onto y (again)
100 @ 3 copy x onto y (again)
101 | y
101 | y
102 o 2 remove y
102 o 2 remove y
103 | y
103 | y
104 o 1 copy x to y
104 o 1 copy x to y
105 | y
105 | y
106 o 0 add x
106 o 0 add x
107 x
107 x
108 $ hg debugp1copies -r 3
108 $ hg debugp1copies -r 3
109 x -> y
109 x -> y
110 $ hg debugpathcopies 0 3
110 $ hg debugpathcopies 0 3
111 x -> y
111 x -> y
112
112
113 Rename file in a loop: x->y->z->x
113 Rename file in a loop: x->y->z->x
114 $ newrepo
114 $ newrepo
115 $ echo x > x
115 $ echo x > x
116 $ hg ci -Aqm 'add x'
116 $ hg ci -Aqm 'add x'
117 $ hg mv x y
117 $ hg mv x y
118 $ hg debugp1copies
118 $ hg debugp1copies
119 x -> y
119 x -> y
120 $ hg debugp2copies
120 $ hg debugp2copies
121 $ hg ci -m 'rename x to y'
121 $ hg ci -m 'rename x to y'
122 $ hg mv y z
122 $ hg mv y z
123 $ hg ci -m 'rename y to z'
123 $ hg ci -m 'rename y to z'
124 $ hg mv z x
124 $ hg mv z x
125 $ hg ci -m 'rename z to x'
125 $ hg ci -m 'rename z to x'
126 $ hg l
126 $ hg l
127 @ 3 rename z to x
127 @ 3 rename z to x
128 | x z
128 | x z
129 o 2 rename y to z
129 o 2 rename y to z
130 | y z
130 | y z
131 o 1 rename x to y
131 o 1 rename x to y
132 | x y
132 | x y
133 o 0 add x
133 o 0 add x
134 x
134 x
135 $ hg debugpathcopies 0 3
135 $ hg debugpathcopies 0 3
136
136
137 Copy x to y, then remove y, then add back y. With copy metadata in the changeset, this could easily
137 Copy x to y, then remove y, then add back y. With copy metadata in the changeset, this could easily
138 end up reporting y as copied from x (if we don't unmark it as a copy when it's removed).
138 end up reporting y as copied from x (if we don't unmark it as a copy when it's removed).
139 $ newrepo
139 $ newrepo
140 $ echo x > x
140 $ echo x > x
141 $ hg ci -Aqm 'add x'
141 $ hg ci -Aqm 'add x'
142 $ hg mv x y
142 $ hg mv x y
143 $ hg ci -m 'rename x to y'
143 $ hg ci -m 'rename x to y'
144 $ hg rm y
144 $ hg rm y
145 $ hg ci -qm 'remove y'
145 $ hg ci -qm 'remove y'
146 $ echo x > y
146 $ echo x > y
147 $ hg ci -Aqm 'add back y'
147 $ hg ci -Aqm 'add back y'
148 $ hg l
148 $ hg l
149 @ 3 add back y
149 @ 3 add back y
150 | y
150 | y
151 o 2 remove y
151 o 2 remove y
152 | y
152 | y
153 o 1 rename x to y
153 o 1 rename x to y
154 | x y
154 | x y
155 o 0 add x
155 o 0 add x
156 x
156 x
157 $ hg debugp1copies -r 3
157 $ hg debugp1copies -r 3
158 $ hg debugpathcopies 0 3
158 $ hg debugpathcopies 0 3
159
159
160 Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the
160 Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the
161 changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point
161 changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point
162 to the first commit that added the file. We should still report the copy as being from x2.
162 to the first commit that added the file. We should still report the copy as being from x2.
163 $ newrepo
163 $ newrepo
164 $ echo x > x
164 $ echo x > x
165 $ echo x > x2
165 $ echo x > x2
166 $ hg ci -Aqm 'add x and x2 with same content'
166 $ hg ci -Aqm 'add x and x2 with same content'
167 $ hg cp x z
167 $ hg cp x z
168 $ hg ci -qm 'copy x to z'
168 $ hg ci -qm 'copy x to z'
169 $ hg rm z
169 $ hg rm z
170 $ hg ci -m 'remove z'
170 $ hg ci -m 'remove z'
171 $ hg cp x2 z
171 $ hg cp x2 z
172 $ hg ci -m 'copy x2 to z'
172 $ hg ci -m 'copy x2 to z'
173 $ hg l
173 $ hg l
174 @ 3 copy x2 to z
174 @ 3 copy x2 to z
175 | z
175 | z
176 o 2 remove z
176 o 2 remove z
177 | z
177 | z
178 o 1 copy x to z
178 o 1 copy x to z
179 | z
179 | z
180 o 0 add x and x2 with same content
180 o 0 add x and x2 with same content
181 x x2
181 x x2
182 $ hg debugp1copies -r 3
182 $ hg debugp1copies -r 3
183 x2 -> z
183 x2 -> z
184 $ hg debugpathcopies 0 3
184 $ hg debugpathcopies 0 3
185 x2 -> z
185 x2 -> z
186
186
187 Create x and y, then rename them both to the same name, but on different sides of a fork
187 Create x and y, then rename them both to the same name, but on different sides of a fork
188 $ newrepo
188 $ newrepo
189 $ echo x > x
189 $ echo x > x
190 $ echo y > y
190 $ echo y > y
191 $ hg ci -Aqm 'add x and y'
191 $ hg ci -Aqm 'add x and y'
192 $ hg mv x z
192 $ hg mv x z
193 $ hg ci -qm 'rename x to z'
193 $ hg ci -qm 'rename x to z'
194 $ hg co -q 0
194 $ hg co -q 0
195 $ hg mv y z
195 $ hg mv y z
196 $ hg ci -qm 'rename y to z'
196 $ hg ci -qm 'rename y to z'
197 $ hg l
197 $ hg l
198 @ 2 rename y to z
198 @ 2 rename y to z
199 | y z
199 | y z
200 | o 1 rename x to z
200 | o 1 rename x to z
201 |/ x z
201 |/ x z
202 o 0 add x and y
202 o 0 add x and y
203 x y
203 x y
204 $ hg debugpathcopies 1 2
204 $ hg debugpathcopies 1 2
205 z -> x
205 z -> x
206 y -> z
206 y -> z
207
207
208 Fork renames x to y on one side and removes x on the other
208 Fork renames x to y on one side and removes x on the other
209 $ newrepo
209 $ newrepo
210 $ echo x > x
210 $ echo x > x
211 $ hg ci -Aqm 'add x'
211 $ hg ci -Aqm 'add x'
212 $ hg mv x y
212 $ hg mv x y
213 $ hg ci -m 'rename x to y'
213 $ hg ci -m 'rename x to y'
214 $ hg co -q 0
214 $ hg co -q 0
215 $ hg rm x
215 $ hg rm x
216 $ hg ci -m 'remove x'
216 $ hg ci -m 'remove x'
217 created new head
217 created new head
218 $ hg l
218 $ hg l
219 @ 2 remove x
219 @ 2 remove x
220 | x
220 | x
221 | o 1 rename x to y
221 | o 1 rename x to y
222 |/ x y
222 |/ x y
223 o 0 add x
223 o 0 add x
224 x
224 x
225 $ hg debugpathcopies 1 2
225 $ hg debugpathcopies 1 2
226
226
227 Copies via null revision (there shouldn't be any)
227 Copies via null revision (there shouldn't be any)
228 $ newrepo
228 $ newrepo
229 $ echo x > x
229 $ echo x > x
230 $ hg ci -Aqm 'add x'
230 $ hg ci -Aqm 'add x'
231 $ hg cp x y
231 $ hg cp x y
232 $ hg ci -m 'copy x to y'
232 $ hg ci -m 'copy x to y'
233 $ hg co -q null
233 $ hg co -q null
234 $ echo x > x
234 $ echo x > x
235 $ hg ci -Aqm 'add x (again)'
235 $ hg ci -Aqm 'add x (again)'
236 $ hg l
236 $ hg l
237 @ 2 add x (again)
237 @ 2 add x (again)
238 x
238 x
239 o 1 copy x to y
239 o 1 copy x to y
240 | y
240 | y
241 o 0 add x
241 o 0 add x
242 x
242 x
243 $ hg debugpathcopies 1 2
243 $ hg debugpathcopies 1 2
244 $ hg debugpathcopies 2 1
244 $ hg debugpathcopies 2 1
245
245
246 Merge rename from other branch
246 Merge rename from other branch
247 $ newrepo
247 $ newrepo
248 $ echo x > x
248 $ echo x > x
249 $ hg ci -Aqm 'add x'
249 $ hg ci -Aqm 'add x'
250 $ hg mv x y
250 $ hg mv x y
251 $ hg ci -m 'rename x to y'
251 $ hg ci -m 'rename x to y'
252 $ hg co -q 0
252 $ hg co -q 0
253 $ echo z > z
253 $ echo z > z
254 $ hg ci -Aqm 'add z'
254 $ hg ci -Aqm 'add z'
255 $ hg merge -q 1
255 $ hg merge -q 1
256 $ hg debugp1copies
256 $ hg debugp1copies
257 $ hg debugp2copies
257 $ hg debugp2copies
258 $ hg ci -m 'merge rename from p2'
258 $ hg ci -m 'merge rename from p2'
259 $ hg l
259 $ hg l
260 @ 3 merge rename from p2
260 @ 3 merge rename from p2
261 |\ x
261 |\ x
262 | o 2 add z
262 | o 2 add z
263 | | z
263 | | z
264 o | 1 rename x to y
264 o | 1 rename x to y
265 |/ x y
265 |/ x y
266 o 0 add x
266 o 0 add x
267 x
267 x
268 Perhaps we should indicate the rename here, but `hg status` is documented to be weird during
268 Perhaps we should indicate the rename here, but `hg status` is documented to be weird during
269 merges, so...
269 merges, so...
270 $ hg debugp1copies -r 3
270 $ hg debugp1copies -r 3
271 $ hg debugp2copies -r 3
271 $ hg debugp2copies -r 3
272 $ hg debugpathcopies 0 3
272 $ hg debugpathcopies 0 3
273 x -> y
273 x -> y
274 $ hg debugpathcopies 1 2
274 $ hg debugpathcopies 1 2
275 y -> x
275 y -> x
276 $ hg debugpathcopies 1 3
276 $ hg debugpathcopies 1 3
277 $ hg debugpathcopies 2 3
277 $ hg debugpathcopies 2 3
278 x -> y
278 x -> y
279
279
280 Copy file from either side in a merge
280 Copy file from either side in a merge
281 $ newrepo
281 $ newrepo
282 $ echo x > x
282 $ echo x > x
283 $ hg ci -Aqm 'add x'
283 $ hg ci -Aqm 'add x'
284 $ hg co -q null
284 $ hg co -q null
285 $ echo y > y
285 $ echo y > y
286 $ hg ci -Aqm 'add y'
286 $ hg ci -Aqm 'add y'
287 $ hg merge -q 0
287 $ hg merge -q 0
288 $ hg cp y z
288 $ hg cp y z
289 $ hg debugp1copies
289 $ hg debugp1copies
290 y -> z
290 y -> z
291 $ hg debugp2copies
291 $ hg debugp2copies
292 $ hg ci -m 'copy file from p1 in merge'
292 $ hg ci -m 'copy file from p1 in merge'
293 $ hg co -q 1
293 $ hg co -q 1
294 $ hg merge -q 0
294 $ hg merge -q 0
295 $ hg cp x z
295 $ hg cp x z
296 $ hg debugp1copies
296 $ hg debugp1copies
297 $ hg debugp2copies
297 $ hg debugp2copies
298 x -> z
298 x -> z
299 $ hg ci -qm 'copy file from p2 in merge'
299 $ hg ci -qm 'copy file from p2 in merge'
300 $ hg l
300 $ hg l
301 @ 3 copy file from p2 in merge
301 @ 3 copy file from p2 in merge
302 |\ z
302 |\ z
303 +---o 2 copy file from p1 in merge
303 +---o 2 copy file from p1 in merge
304 | |/ z
304 | |/ z
305 | o 1 add y
305 | o 1 add y
306 | y
306 | y
307 o 0 add x
307 o 0 add x
308 x
308 x
309 $ hg debugp1copies -r 2
309 $ hg debugp1copies -r 2
310 y -> z
310 y -> z
311 $ hg debugp2copies -r 2
311 $ hg debugp2copies -r 2
312 $ hg debugpathcopies 1 2
312 $ hg debugpathcopies 1 2
313 y -> z
313 y -> z
314 $ hg debugpathcopies 0 2
314 $ hg debugpathcopies 0 2
315 $ hg debugp1copies -r 3
315 $ hg debugp1copies -r 3
316 $ hg debugp2copies -r 3
316 $ hg debugp2copies -r 3
317 x -> z
317 x -> z
318 $ hg debugpathcopies 1 3
318 $ hg debugpathcopies 1 3
319 $ hg debugpathcopies 0 3
319 $ hg debugpathcopies 0 3
320 x -> z
320 x -> z
321
321
322 Copy file that exists on both sides of the merge, same content on both sides
322 Copy file that exists on both sides of the merge, same content on both sides
323 $ newrepo
323 $ newrepo
324 $ echo x > x
324 $ echo x > x
325 $ hg ci -Aqm 'add x on branch 1'
325 $ hg ci -Aqm 'add x on branch 1'
326 $ hg co -q null
326 $ hg co -q null
327 $ echo x > x
327 $ echo x > x
328 $ hg ci -Aqm 'add x on branch 2'
328 $ hg ci -Aqm 'add x on branch 2'
329 $ hg merge -q 0
329 $ hg merge -q 0
330 $ hg cp x z
330 $ hg cp x z
331 $ hg debugp1copies
331 $ hg debugp1copies
332 x -> z
332 x -> z
333 $ hg debugp2copies
333 $ hg debugp2copies
334 $ hg ci -qm 'merge'
334 $ hg ci -qm 'merge'
335 $ hg l
335 $ hg l
336 @ 2 merge
336 @ 2 merge
337 |\ z
337 |\ z
338 | o 1 add x on branch 2
338 | o 1 add x on branch 2
339 | x
339 | x
340 o 0 add x on branch 1
340 o 0 add x on branch 1
341 x
341 x
342 $ hg debugp1copies -r 2
342 $ hg debugp1copies -r 2
343 x -> z
343 x -> z
344 $ hg debugp2copies -r 2
344 $ hg debugp2copies -r 2
345 It's a little weird that it shows up on both sides
345 It's a little weird that it shows up on both sides
346 $ hg debugpathcopies 1 2
346 $ hg debugpathcopies 1 2
347 x -> z
347 x -> z
348 $ hg debugpathcopies 0 2
348 $ hg debugpathcopies 0 2
349 x -> z (filelog !)
349 x -> z (filelog !)
350
350
351 Copy file that exists on both sides of the merge, different content
351 Copy file that exists on both sides of the merge, different content
352 $ newrepo
352 $ newrepo
353 $ echo branch1 > x
353 $ echo branch1 > x
354 $ hg ci -Aqm 'add x on branch 1'
354 $ hg ci -Aqm 'add x on branch 1'
355 $ hg co -q null
355 $ hg co -q null
356 $ echo branch2 > x
356 $ echo branch2 > x
357 $ hg ci -Aqm 'add x on branch 2'
357 $ hg ci -Aqm 'add x on branch 2'
358 $ hg merge -q 0
358 $ hg merge -q 0
359 warning: conflicts while merging x! (edit, then use 'hg resolve --mark')
359 warning: conflicts while merging x! (edit, then use 'hg resolve --mark')
360 [1]
360 [1]
361 $ echo resolved > x
361 $ echo resolved > x
362 $ hg resolve -m x
362 $ hg resolve -m x
363 (no more unresolved files)
363 (no more unresolved files)
364 $ hg cp x z
364 $ hg cp x z
365 $ hg debugp1copies
365 $ hg debugp1copies
366 x -> z
366 x -> z
367 $ hg debugp2copies
367 $ hg debugp2copies
368 $ hg ci -qm 'merge'
368 $ hg ci -qm 'merge'
369 $ hg l
369 $ hg l
370 @ 2 merge
370 @ 2 merge
371 |\ x z
371 |\ x z
372 | o 1 add x on branch 2
372 | o 1 add x on branch 2
373 | x
373 | x
374 o 0 add x on branch 1
374 o 0 add x on branch 1
375 x
375 x
376 $ hg debugp1copies -r 2
376 $ hg debugp1copies -r 2
377 $ hg debugp2copies -r 2
377 $ hg debugp2copies -r 2
378 x -> z
378 x -> z
379 $ hg debugpathcopies 1 2
379 $ hg debugpathcopies 1 2
380 $ hg debugpathcopies 0 2
380 $ hg debugpathcopies 0 2
381 x -> z
381 x -> z
382
382
383 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent
383 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent
384 of the merge to the merge should include the copy from the other side.
384 of the merge to the merge should include the copy from the other side.
385 $ newrepo
385 $ newrepo
386 $ echo x > x
386 $ echo x > x
387 $ hg ci -Aqm 'add x'
387 $ hg ci -Aqm 'add x'
388 $ hg cp x y
388 $ hg cp x y
389 $ hg ci -qm 'copy x to y'
389 $ hg ci -qm 'copy x to y'
390 $ hg co -q 0
390 $ hg co -q 0
391 $ hg cp x z
391 $ hg cp x z
392 $ hg ci -qm 'copy x to z'
392 $ hg ci -qm 'copy x to z'
393 $ hg merge -q 1
393 $ hg merge -q 1
394 $ hg ci -m 'merge copy x->y and copy x->z'
394 $ hg ci -m 'merge copy x->y and copy x->z'
395 $ hg l
395 $ hg l
396 @ 3 merge copy x->y and copy x->z
396 @ 3 merge copy x->y and copy x->z
397 |\
397 |\
398 | o 2 copy x to z
398 | o 2 copy x to z
399 | | z
399 | | z
400 o | 1 copy x to y
400 o | 1 copy x to y
401 |/ y
401 |/ y
402 o 0 add x
402 o 0 add x
403 x
403 x
404 $ hg debugp1copies -r 3
404 $ hg debugp1copies -r 3
405 $ hg debugp2copies -r 3
405 $ hg debugp2copies -r 3
406 $ hg debugpathcopies 2 3
406 $ hg debugpathcopies 2 3
407 x -> y
407 x -> y
408 $ hg debugpathcopies 1 3
408 $ hg debugpathcopies 1 3
409 x -> z
409 x -> z
410
410
411 Copy x to y on one side of merge, create y and rename to z on the other side. Pathcopies from the
411 Copy x to y on one side of merge, create y and rename to z on the other side. Pathcopies from the
412 first side should not include the y->z rename since y didn't exist in the merge base.
412 first side should not include the y->z rename since y didn't exist in the merge base.
413 $ newrepo
413 $ newrepo
414 $ echo x > x
414 $ echo x > x
415 $ hg ci -Aqm 'add x'
415 $ hg ci -Aqm 'add x'
416 $ hg cp x y
416 $ hg cp x y
417 $ hg ci -qm 'copy x to y'
417 $ hg ci -qm 'copy x to y'
418 $ hg co -q 0
418 $ hg co -q 0
419 $ echo y > y
419 $ echo y > y
420 $ hg ci -Aqm 'add y'
420 $ hg ci -Aqm 'add y'
421 $ hg mv y z
421 $ hg mv y z
422 $ hg ci -m 'rename y to z'
422 $ hg ci -m 'rename y to z'
423 $ hg merge -q 1
423 $ hg merge -q 1
424 $ hg ci -m 'merge'
424 $ hg ci -m 'merge'
425 $ hg l
425 $ hg l
426 @ 4 merge
426 @ 4 merge
427 |\
427 |\
428 | o 3 rename y to z
428 | o 3 rename y to z
429 | | y z
429 | | y z
430 | o 2 add y
430 | o 2 add y
431 | | y
431 | | y
432 o | 1 copy x to y
432 o | 1 copy x to y
433 |/ y
433 |/ y
434 o 0 add x
434 o 0 add x
435 x
435 x
436 $ hg debugp1copies -r 3
436 $ hg debugp1copies -r 3
437 y -> z
437 y -> z
438 $ hg debugp2copies -r 3
438 $ hg debugp2copies -r 3
439 $ hg debugpathcopies 2 3
439 $ hg debugpathcopies 2 3
440 y -> z
440 y -> z
441 $ hg debugpathcopies 1 3
441 $ hg debugpathcopies 1 3
442
442
443 Create x and y, then rename x to z on one side of merge, and rename y to z and modify z on the
443 Create x and y, then rename x to z on one side of merge, and rename y to z and modify z on the
444 other side.
444 other side.
445 $ newrepo
445 $ newrepo
446 $ echo x > x
446 $ echo x > x
447 $ echo y > y
447 $ echo y > y
448 $ hg ci -Aqm 'add x and y'
448 $ hg ci -Aqm 'add x and y'
449 $ hg mv x z
449 $ hg mv x z
450 $ hg ci -qm 'rename x to z'
450 $ hg ci -qm 'rename x to z'
451 $ hg co -q 0
451 $ hg co -q 0
452 $ hg mv y z
452 $ hg mv y z
453 $ hg ci -qm 'rename y to z'
453 $ hg ci -qm 'rename y to z'
454 $ echo z >> z
454 $ echo z >> z
455 $ hg ci -m 'modify z'
455 $ hg ci -m 'modify z'
456 $ hg merge -q 1
456 $ hg merge -q 1
457 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
457 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
458 [1]
458 [1]
459 $ echo z > z
459 $ echo z > z
460 $ hg resolve -qm z
460 $ hg resolve -qm z
461 $ hg ci -m 'merge 1 into 3'
461 $ hg ci -m 'merge 1 into 3'
462 Try merging the other direction too
462 Try merging the other direction too
463 $ hg co -q 1
463 $ hg co -q 1
464 $ hg merge -q 3
464 $ hg merge -q 3
465 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
465 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
466 [1]
466 [1]
467 $ echo z > z
467 $ echo z > z
468 $ hg resolve -qm z
468 $ hg resolve -qm z
469 $ hg ci -m 'merge 3 into 1'
469 $ hg ci -m 'merge 3 into 1'
470 created new head
470 created new head
471 $ hg l
471 $ hg l
472 @ 5 merge 3 into 1
472 @ 5 merge 3 into 1
473 |\ y z
473 |\ y z
474 +---o 4 merge 1 into 3
474 +---o 4 merge 1 into 3
475 | |/ x z
475 | |/ x z
476 | o 3 modify z
476 | o 3 modify z
477 | | z
477 | | z
478 | o 2 rename y to z
478 | o 2 rename y to z
479 | | y z
479 | | y z
480 o | 1 rename x to z
480 o | 1 rename x to z
481 |/ x z
481 |/ x z
482 o 0 add x and y
482 o 0 add x and y
483 x y
483 x y
484 $ hg debugpathcopies 1 4
484 $ hg debugpathcopies 1 4
485 $ hg debugpathcopies 2 4
485 $ hg debugpathcopies 2 4
486 $ hg debugpathcopies 0 4
486 $ hg debugpathcopies 0 4
487 x -> z (filelog !)
487 x -> z (filelog !)
488 y -> z (compatibility !)
488 y -> z (compatibility !)
489 $ hg debugpathcopies 1 5
489 $ hg debugpathcopies 1 5
490 $ hg debugpathcopies 2 5
490 $ hg debugpathcopies 2 5
491 $ hg debugpathcopies 0 5
491 $ hg debugpathcopies 0 5
492 x -> z
492 x -> z
493
493
494
495 Test for a case in fullcopytracing algorithm where both the merging csets are
496 "dirty"; where a dirty cset means that cset is descendant of merge base. This
497 test reflect that for this particular case this algorithm correctly find the copies:
498
499 $ cat >> $HGRCPATH << EOF
500 > [experimental]
501 > evolution.createmarkers=True
502 > evolution.allowunstable=True
503 > EOF
504
505 $ newrepo
506 $ echo a > a
507 $ hg add a
508 $ hg ci -m "added a"
509 $ echo b > b
510 $ hg add b
511 $ hg ci -m "added b"
512
513 $ hg mv b b1
514 $ hg ci -m "rename b to b1"
515
516 $ hg up ".^"
517 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
518 $ echo d > d
519 $ hg add d
520 $ hg ci -m "added d"
521 created new head
522
523 $ echo baba >> b
524 $ hg ci --amend -m "added d, modified b"
525
526 $ hg l --hidden
527 @ 4 added d, modified b
528 | b d
529 | x 3 added d
530 |/ d
531 | o 2 rename b to b1
532 |/ b b1
533 o 1 added b
534 | b
535 o 0 added a
536 a
537
538 Grafting revision 4 on top of revision 2, showing that it respect the rename:
539
540 $ hg up 2 -q
541 $ hg graft -r 4 --base 3 --hidden
542 grafting 4:af28412ec03c "added d, modified b" (tip)
543 merging b1 and b to b1
544
545 $ hg l -l1 -p
546 @ 5 added d, modified b
547 | b1
548 ~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1
549 --- a/b1 Thu Jan 01 00:00:00 1970 +0000
550 +++ b/b1 Thu Jan 01 00:00:00 1970 +0000
551 @@ -1,1 +1,2 @@
552 b
553 +baba
554
General Comments 0
You need to be logged in to leave comments. Login now