##// END OF EJS Templates
tests: test more cases where a file got replaced by a copy...
Martin von Zweigbergk -
r46420:4b79e92a default
parent child Browse files
Show More
@@ -1,653 +1,720 b''
1 #testcases filelog compatibility changeset sidedata
1 #testcases filelog compatibility changeset sidedata
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
4 > [extensions]
5 > rebase=
5 > rebase=
6 > [alias]
6 > [alias]
7 > l = log -G -T '{rev} {desc}\n{files}\n'
7 > l = log -G -T '{rev} {desc}\n{files}\n'
8 > EOF
8 > EOF
9
9
10 #if compatibility
10 #if compatibility
11 $ cat >> $HGRCPATH << EOF
11 $ cat >> $HGRCPATH << EOF
12 > [experimental]
12 > [experimental]
13 > copies.read-from = compatibility
13 > copies.read-from = compatibility
14 > EOF
14 > EOF
15 #endif
15 #endif
16
16
17 #if changeset
17 #if changeset
18 $ cat >> $HGRCPATH << EOF
18 $ cat >> $HGRCPATH << EOF
19 > [experimental]
19 > [experimental]
20 > copies.read-from = changeset-only
20 > copies.read-from = changeset-only
21 > copies.write-to = changeset-only
21 > copies.write-to = changeset-only
22 > EOF
22 > EOF
23 #endif
23 #endif
24
24
25 #if sidedata
25 #if sidedata
26 $ cat >> $HGRCPATH << EOF
26 $ cat >> $HGRCPATH << EOF
27 > [format]
27 > [format]
28 > exp-use-copies-side-data-changeset = yes
28 > exp-use-copies-side-data-changeset = yes
29 > EOF
29 > EOF
30 #endif
30 #endif
31
31
32 $ REPONUM=0
32 $ REPONUM=0
33 $ newrepo() {
33 $ newrepo() {
34 > cd $TESTTMP
34 > cd $TESTTMP
35 > REPONUM=`expr $REPONUM + 1`
35 > REPONUM=`expr $REPONUM + 1`
36 > hg init repo-$REPONUM
36 > hg init repo-$REPONUM
37 > cd repo-$REPONUM
37 > cd repo-$REPONUM
38 > }
38 > }
39
39
40 Simple rename case
40 Simple rename case
41 $ newrepo
41 $ newrepo
42 $ echo x > x
42 $ echo x > x
43 $ hg ci -Aqm 'add x'
43 $ hg ci -Aqm 'add x'
44 $ hg mv x y
44 $ hg mv x y
45 $ hg debugp1copies
45 $ hg debugp1copies
46 x -> y
46 x -> y
47 $ hg debugp2copies
47 $ hg debugp2copies
48 $ hg ci -m 'rename x to y'
48 $ hg ci -m 'rename x to y'
49 $ hg l
49 $ hg l
50 @ 1 rename x to y
50 @ 1 rename x to y
51 | x y
51 | x y
52 o 0 add x
52 o 0 add x
53 x
53 x
54 $ hg debugp1copies -r 1
54 $ hg debugp1copies -r 1
55 x -> y
55 x -> y
56 $ hg debugpathcopies 0 1
56 $ hg debugpathcopies 0 1
57 x -> y
57 x -> y
58 $ hg debugpathcopies 1 0
58 $ hg debugpathcopies 1 0
59 y -> x
59 y -> x
60 Test filtering copies by path. We do filtering by destination.
60 Test filtering copies by path. We do filtering by destination.
61 $ hg debugpathcopies 0 1 x
61 $ hg debugpathcopies 0 1 x
62 $ hg debugpathcopies 1 0 x
62 $ hg debugpathcopies 1 0 x
63 y -> x
63 y -> x
64 $ hg debugpathcopies 0 1 y
64 $ hg debugpathcopies 0 1 y
65 x -> y
65 x -> y
66 $ hg debugpathcopies 1 0 y
66 $ hg debugpathcopies 1 0 y
67
67
68 Copies not including commit changes
68 Copies not including commit changes
69 $ newrepo
69 $ newrepo
70 $ echo x > x
70 $ echo x > x
71 $ hg ci -Aqm 'add x'
71 $ hg ci -Aqm 'add x'
72 $ hg mv x y
72 $ hg mv x y
73 $ hg debugpathcopies . .
73 $ hg debugpathcopies . .
74 $ hg debugpathcopies . 'wdir()'
74 $ hg debugpathcopies . 'wdir()'
75 x -> y
75 x -> y
76 $ hg debugpathcopies 'wdir()' .
76 $ hg debugpathcopies 'wdir()' .
77 y -> x
77 y -> x
78
78
79 Copy a file onto another file
79 Copy a file onto another file
80 $ newrepo
80 $ newrepo
81 $ echo x > x
81 $ echo x > x
82 $ echo y > y
82 $ echo y > y
83 $ hg ci -Aqm 'add x and y'
83 $ hg ci -Aqm 'add x and y'
84 $ hg cp -f x y
84 $ hg cp -f x y
85 $ hg debugp1copies
85 $ hg debugp1copies
86 x -> y
86 x -> y
87 $ hg debugp2copies
87 $ hg debugp2copies
88 $ hg ci -m 'copy x onto y'
88 $ hg ci -m 'copy x onto y'
89 $ hg l
89 $ hg l
90 @ 1 copy x onto y
90 @ 1 copy x onto y
91 | y
91 | y
92 o 0 add x and y
92 o 0 add x and y
93 x y
93 x y
94 $ hg debugp1copies -r 1
94 $ hg debugp1copies -r 1
95 x -> y
95 x -> y
96 Incorrectly doesn't show the rename
96 Incorrectly doesn't show the rename
97 $ hg debugpathcopies 0 1
97 $ hg debugpathcopies 0 1
98
98
99 Copy a file onto another file with same content. If metadata is stored in changeset, this does not
99 Copy a file onto another file with same content. If metadata is stored in changeset, this does not
100 produce a new filelog entry. The changeset's "files" entry should still list the file.
100 produce a new filelog entry. The changeset's "files" entry should still list the file.
101 $ newrepo
101 $ newrepo
102 $ echo x > x
102 $ echo x > x
103 $ echo x > x2
103 $ echo x > x2
104 $ hg ci -Aqm 'add x and x2 with same content'
104 $ hg ci -Aqm 'add x and x2 with same content'
105 $ hg cp -f x x2
105 $ hg cp -f x x2
106 $ hg ci -m 'copy x onto x2'
106 $ hg ci -m 'copy x onto x2'
107 $ hg l
107 $ hg l
108 @ 1 copy x onto x2
108 @ 1 copy x onto x2
109 | x2
109 | x2
110 o 0 add x and x2 with same content
110 o 0 add x and x2 with same content
111 x x2
111 x x2
112 $ hg debugp1copies -r 1
112 $ hg debugp1copies -r 1
113 x -> x2
113 x -> x2
114 Incorrectly doesn't show the rename
114 Incorrectly doesn't show the rename
115 $ hg debugpathcopies 0 1
115 $ hg debugpathcopies 0 1
116
116
117 Rename file in a loop: x->y->z->x
117 Rename file in a loop: x->y->z->x
118 $ newrepo
118 $ newrepo
119 $ echo x > x
119 $ echo x > x
120 $ hg ci -Aqm 'add x'
120 $ hg ci -Aqm 'add x'
121 $ hg mv x y
121 $ hg mv x y
122 $ hg debugp1copies
122 $ hg debugp1copies
123 x -> y
123 x -> y
124 $ hg debugp2copies
124 $ hg debugp2copies
125 $ hg ci -m 'rename x to y'
125 $ hg ci -m 'rename x to y'
126 $ hg mv y z
126 $ hg mv y z
127 $ hg ci -m 'rename y to z'
127 $ hg ci -m 'rename y to z'
128 $ hg mv z x
128 $ hg mv z x
129 $ hg ci -m 'rename z to x'
129 $ hg ci -m 'rename z to x'
130 $ hg l
130 $ hg l
131 @ 3 rename z to x
131 @ 3 rename z to x
132 | x z
132 | x z
133 o 2 rename y to z
133 o 2 rename y to z
134 | y z
134 | y z
135 o 1 rename x to y
135 o 1 rename x to y
136 | x y
136 | x y
137 o 0 add x
137 o 0 add x
138 x
138 x
139 $ hg debugpathcopies 0 3
139 $ hg debugpathcopies 0 3
140
140
141 Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the
141 Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the
142 changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point
142 changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point
143 to the first commit that added the file. We should still report the copy as being from x2.
143 to the first commit that added the file. We should still report the copy as being from x2.
144 $ newrepo
144 $ newrepo
145 $ echo x > x
145 $ echo x > x
146 $ echo x > x2
146 $ echo x > x2
147 $ hg ci -Aqm 'add x and x2 with same content'
147 $ hg ci -Aqm 'add x and x2 with same content'
148 $ hg cp x z
148 $ hg cp x z
149 $ hg ci -qm 'copy x to z'
149 $ hg ci -qm 'copy x to z'
150 $ hg rm z
150 $ hg rm z
151 $ hg ci -m 'remove z'
151 $ hg ci -m 'remove z'
152 $ hg cp x2 z
152 $ hg cp x2 z
153 $ hg ci -m 'copy x2 to z'
153 $ hg ci -m 'copy x2 to z'
154 $ hg l
154 $ hg l
155 @ 3 copy x2 to z
155 @ 3 copy x2 to z
156 | z
156 | z
157 o 2 remove z
157 o 2 remove z
158 | z
158 | z
159 o 1 copy x to z
159 o 1 copy x to z
160 | z
160 | z
161 o 0 add x and x2 with same content
161 o 0 add x and x2 with same content
162 x x2
162 x x2
163 $ hg debugp1copies -r 3
163 $ hg debugp1copies -r 3
164 x2 -> z
164 x2 -> z
165 $ hg debugpathcopies 0 3
165 $ hg debugpathcopies 0 3
166 x2 -> z
166 x2 -> z
167
167
168 Create x and y, then rename them both to the same name, but on different sides of a fork
168 Create x and y, then rename them both to the same name, but on different sides of a fork
169 $ newrepo
169 $ newrepo
170 $ echo x > x
170 $ echo x > x
171 $ echo y > y
171 $ echo y > y
172 $ hg ci -Aqm 'add x and y'
172 $ hg ci -Aqm 'add x and y'
173 $ hg mv x z
173 $ hg mv x z
174 $ hg ci -qm 'rename x to z'
174 $ hg ci -qm 'rename x to z'
175 $ hg co -q 0
175 $ hg co -q 0
176 $ hg mv y z
176 $ hg mv y z
177 $ hg ci -qm 'rename y to z'
177 $ hg ci -qm 'rename y to z'
178 $ hg l
178 $ hg l
179 @ 2 rename y to z
179 @ 2 rename y to z
180 | y z
180 | y z
181 | o 1 rename x to z
181 | o 1 rename x to z
182 |/ x z
182 |/ x z
183 o 0 add x and y
183 o 0 add x and y
184 x y
184 x y
185 $ hg debugpathcopies 1 2
185 $ hg debugpathcopies 1 2
186 z -> x
186 z -> x
187 y -> z
187 y -> z
188
188
189 Fork renames x to y on one side and removes x on the other
189 Fork renames x to y on one side and removes x on the other
190 $ newrepo
190 $ newrepo
191 $ echo x > x
191 $ echo x > x
192 $ hg ci -Aqm 'add x'
192 $ hg ci -Aqm 'add x'
193 $ hg mv x y
193 $ hg mv x y
194 $ hg ci -m 'rename x to y'
194 $ hg ci -m 'rename x to y'
195 $ hg co -q 0
195 $ hg co -q 0
196 $ hg rm x
196 $ hg rm x
197 $ hg ci -m 'remove x'
197 $ hg ci -m 'remove x'
198 created new head
198 created new head
199 $ hg l
199 $ hg l
200 @ 2 remove x
200 @ 2 remove x
201 | x
201 | x
202 | o 1 rename x to y
202 | o 1 rename x to y
203 |/ x y
203 |/ x y
204 o 0 add x
204 o 0 add x
205 x
205 x
206 $ hg debugpathcopies 1 2
206 $ hg debugpathcopies 1 2
207
207
208 Merge rename from other branch
208 Merge rename from other branch
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 $ echo z > z
215 $ echo z > z
216 $ hg ci -Aqm 'add z'
216 $ hg ci -Aqm 'add z'
217 $ hg merge -q 1
217 $ hg merge -q 1
218 $ hg debugp1copies
218 $ hg debugp1copies
219 $ hg debugp2copies
219 $ hg debugp2copies
220 $ hg ci -m 'merge rename from p2'
220 $ hg ci -m 'merge rename from p2'
221 $ hg l
221 $ hg l
222 @ 3 merge rename from p2
222 @ 3 merge rename from p2
223 |\
223 |\
224 | o 2 add z
224 | o 2 add z
225 | | z
225 | | z
226 o | 1 rename x to y
226 o | 1 rename x to y
227 |/ x y
227 |/ x y
228 o 0 add x
228 o 0 add x
229 x
229 x
230 Perhaps we should indicate the rename here, but `hg status` is documented to be weird during
230 Perhaps we should indicate the rename here, but `hg status` is documented to be weird during
231 merges, so...
231 merges, so...
232 $ hg debugp1copies -r 3
232 $ hg debugp1copies -r 3
233 $ hg debugp2copies -r 3
233 $ hg debugp2copies -r 3
234 $ hg debugpathcopies 0 3
234 $ hg debugpathcopies 0 3
235 x -> y
235 x -> y
236 $ hg debugpathcopies 1 2
236 $ hg debugpathcopies 1 2
237 y -> x
237 y -> x
238 $ hg debugpathcopies 1 3
238 $ hg debugpathcopies 1 3
239 $ hg debugpathcopies 2 3
239 $ hg debugpathcopies 2 3
240 x -> y
240 x -> y
241
241
242 Copy file from either side in a merge
242 Copy file from either side in a merge
243 $ newrepo
243 $ newrepo
244 $ echo x > x
244 $ echo x > x
245 $ hg ci -Aqm 'add x'
245 $ hg ci -Aqm 'add x'
246 $ hg co -q null
246 $ hg co -q null
247 $ echo y > y
247 $ echo y > y
248 $ hg ci -Aqm 'add y'
248 $ hg ci -Aqm 'add y'
249 $ hg merge -q 0
249 $ hg merge -q 0
250 $ hg cp y z
250 $ hg cp y z
251 $ hg debugp1copies
251 $ hg debugp1copies
252 y -> z
252 y -> z
253 $ hg debugp2copies
253 $ hg debugp2copies
254 $ hg ci -m 'copy file from p1 in merge'
254 $ hg ci -m 'copy file from p1 in merge'
255 $ hg co -q 1
255 $ hg co -q 1
256 $ hg merge -q 0
256 $ hg merge -q 0
257 $ hg cp x z
257 $ hg cp x z
258 $ hg debugp1copies
258 $ hg debugp1copies
259 $ hg debugp2copies
259 $ hg debugp2copies
260 x -> z
260 x -> z
261 $ hg ci -qm 'copy file from p2 in merge'
261 $ hg ci -qm 'copy file from p2 in merge'
262 $ hg l
262 $ hg l
263 @ 3 copy file from p2 in merge
263 @ 3 copy file from p2 in merge
264 |\ z
264 |\ z
265 +---o 2 copy file from p1 in merge
265 +---o 2 copy file from p1 in merge
266 | |/ z
266 | |/ z
267 | o 1 add y
267 | o 1 add y
268 | y
268 | y
269 o 0 add x
269 o 0 add x
270 x
270 x
271 $ hg debugp1copies -r 2
271 $ hg debugp1copies -r 2
272 y -> z
272 y -> z
273 $ hg debugp2copies -r 2
273 $ hg debugp2copies -r 2
274 $ hg debugpathcopies 1 2
274 $ hg debugpathcopies 1 2
275 y -> z
275 y -> z
276 $ hg debugpathcopies 0 2
276 $ hg debugpathcopies 0 2
277 $ hg debugp1copies -r 3
277 $ hg debugp1copies -r 3
278 $ hg debugp2copies -r 3
278 $ hg debugp2copies -r 3
279 x -> z
279 x -> z
280 $ hg debugpathcopies 1 3
280 $ hg debugpathcopies 1 3
281 $ hg debugpathcopies 0 3
281 $ hg debugpathcopies 0 3
282 x -> z
282 x -> z
283
283
284 Copy file that exists on both sides of the merge, same content on both sides
284 Copy file that exists on both sides of the merge, same content on both sides
285 $ newrepo
285 $ newrepo
286 $ echo x > x
286 $ echo x > x
287 $ hg ci -Aqm 'add x on branch 1'
287 $ hg ci -Aqm 'add x on branch 1'
288 $ hg co -q null
288 $ hg co -q null
289 $ echo x > x
289 $ echo x > x
290 $ hg ci -Aqm 'add x on branch 2'
290 $ hg ci -Aqm 'add x on branch 2'
291 $ hg merge -q 0
291 $ hg merge -q 0
292 $ hg cp x z
292 $ hg cp x z
293 $ hg debugp1copies
293 $ hg debugp1copies
294 x -> z
294 x -> z
295 $ hg debugp2copies
295 $ hg debugp2copies
296 $ hg ci -qm 'merge'
296 $ hg ci -qm 'merge'
297 $ hg l
297 $ hg l
298 @ 2 merge
298 @ 2 merge
299 |\ z
299 |\ z
300 | o 1 add x on branch 2
300 | o 1 add x on branch 2
301 | x
301 | x
302 o 0 add x on branch 1
302 o 0 add x on branch 1
303 x
303 x
304 $ hg debugp1copies -r 2
304 $ hg debugp1copies -r 2
305 x -> z
305 x -> z
306 $ hg debugp2copies -r 2
306 $ hg debugp2copies -r 2
307 It's a little weird that it shows up on both sides
307 It's a little weird that it shows up on both sides
308 $ hg debugpathcopies 1 2
308 $ hg debugpathcopies 1 2
309 x -> z
309 x -> z
310 $ hg debugpathcopies 0 2
310 $ hg debugpathcopies 0 2
311 x -> z (filelog !)
311 x -> z (filelog !)
312
312
313 Copy file that exists on both sides of the merge, different content
313 Copy file that exists on both sides of the merge, different content
314 $ newrepo
314 $ newrepo
315 $ echo branch1 > x
315 $ echo branch1 > x
316 $ hg ci -Aqm 'add x on branch 1'
316 $ hg ci -Aqm 'add x on branch 1'
317 $ hg co -q null
317 $ hg co -q null
318 $ echo branch2 > x
318 $ echo branch2 > x
319 $ hg ci -Aqm 'add x on branch 2'
319 $ hg ci -Aqm 'add x on branch 2'
320 $ hg merge -q 0
320 $ hg merge -q 0
321 warning: conflicts while merging x! (edit, then use 'hg resolve --mark')
321 warning: conflicts while merging x! (edit, then use 'hg resolve --mark')
322 [1]
322 [1]
323 $ echo resolved > x
323 $ echo resolved > x
324 $ hg resolve -m x
324 $ hg resolve -m x
325 (no more unresolved files)
325 (no more unresolved files)
326 $ hg cp x z
326 $ hg cp x z
327 $ hg debugp1copies
327 $ hg debugp1copies
328 x -> z
328 x -> z
329 $ hg debugp2copies
329 $ hg debugp2copies
330 $ hg ci -qm 'merge'
330 $ hg ci -qm 'merge'
331 $ hg l
331 $ hg l
332 @ 2 merge
332 @ 2 merge
333 |\ x z
333 |\ x z
334 | o 1 add x on branch 2
334 | o 1 add x on branch 2
335 | x
335 | x
336 o 0 add x on branch 1
336 o 0 add x on branch 1
337 x
337 x
338 $ hg debugp1copies -r 2
338 $ hg debugp1copies -r 2
339 x -> z (changeset !)
339 x -> z (changeset !)
340 x -> z (sidedata !)
340 x -> z (sidedata !)
341 $ hg debugp2copies -r 2
341 $ hg debugp2copies -r 2
342 x -> z (no-changeset no-sidedata !)
342 x -> z (no-changeset no-sidedata !)
343 $ hg debugpathcopies 1 2
343 $ hg debugpathcopies 1 2
344 x -> z (changeset !)
344 x -> z (changeset !)
345 x -> z (sidedata !)
345 x -> z (sidedata !)
346 $ hg debugpathcopies 0 2
346 $ hg debugpathcopies 0 2
347 x -> z (no-changeset no-sidedata !)
347 x -> z (no-changeset no-sidedata !)
348
348
349 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent
349 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent
350 of the merge to the merge should include the copy from the other side.
350 of the merge to the merge should include the copy from the other side.
351 $ newrepo
351 $ newrepo
352 $ echo x > x
352 $ echo x > x
353 $ hg ci -Aqm 'add x'
353 $ hg ci -Aqm 'add x'
354 $ hg cp x y
354 $ hg cp x y
355 $ hg ci -qm 'copy x to y'
355 $ hg ci -qm 'copy x to y'
356 $ hg co -q 0
356 $ hg co -q 0
357 $ hg cp x z
357 $ hg cp x z
358 $ hg ci -qm 'copy x to z'
358 $ hg ci -qm 'copy x to z'
359 $ hg merge -q 1
359 $ hg merge -q 1
360 $ hg ci -m 'merge copy x->y and copy x->z'
360 $ hg ci -m 'merge copy x->y and copy x->z'
361 $ hg l
361 $ hg l
362 @ 3 merge copy x->y and copy x->z
362 @ 3 merge copy x->y and copy x->z
363 |\
363 |\
364 | o 2 copy x to z
364 | o 2 copy x to z
365 | | z
365 | | z
366 o | 1 copy x to y
366 o | 1 copy x to y
367 |/ y
367 |/ y
368 o 0 add x
368 o 0 add x
369 x
369 x
370 $ hg debugp1copies -r 3
370 $ hg debugp1copies -r 3
371 $ hg debugp2copies -r 3
371 $ hg debugp2copies -r 3
372 $ hg debugpathcopies 2 3
372 $ hg debugpathcopies 2 3
373 x -> y
373 x -> y
374 $ hg debugpathcopies 1 3
374 $ hg debugpathcopies 1 3
375 x -> z
375 x -> z
376
376
377 Copy x to y on one side of merge, create y and rename to z on the other side.
377 Copy x to y on one side of merge, create y and rename to z on the other side.
378 $ newrepo
378 $ newrepo
379 $ echo x > x
379 $ echo x > x
380 $ hg ci -Aqm 'add x'
380 $ hg ci -Aqm 'add x'
381 $ hg cp x y
381 $ hg cp x y
382 $ hg ci -qm 'copy x to y'
382 $ hg ci -qm 'copy x to y'
383 $ hg co -q 0
383 $ hg co -q 0
384 $ echo y > y
384 $ echo y > y
385 $ hg ci -Aqm 'add y'
385 $ hg ci -Aqm 'add y'
386 $ hg mv y z
386 $ hg mv y z
387 $ hg ci -m 'rename y to z'
387 $ hg ci -m 'rename y to z'
388 $ hg merge -q 1
388 $ hg merge -q 1
389 $ hg ci -m 'merge'
389 $ hg ci -m 'merge'
390 $ hg l
390 $ hg l
391 @ 4 merge
391 @ 4 merge
392 |\
392 |\
393 | o 3 rename y to z
393 | o 3 rename y to z
394 | | y z
394 | | y z
395 | o 2 add y
395 | o 2 add y
396 | | y
396 | | y
397 o | 1 copy x to y
397 o | 1 copy x to y
398 |/ y
398 |/ y
399 o 0 add x
399 o 0 add x
400 x
400 x
401 $ hg debugp1copies -r 3
401 $ hg debugp1copies -r 3
402 y -> z
402 y -> z
403 $ hg debugp2copies -r 3
403 $ hg debugp2copies -r 3
404 $ hg debugpathcopies 2 3
404 $ hg debugpathcopies 2 3
405 y -> z
405 y -> z
406 $ hg debugpathcopies 1 3
406 $ hg debugpathcopies 1 3
407 y -> z (no-filelog !)
407 y -> z (no-filelog !)
408
408
409 Create x and y, then rename x to z on one side of merge, and rename y to z and
409 Create x and y, then rename x to z on one side of merge, and rename y to z and
410 modify z on the other side. When storing copies in the changeset, we don't
410 modify z on the other side. When storing copies in the changeset, we don't
411 filter out copies whose target was created on the other side of the merge.
411 filter out copies whose target was created on the other side of the merge.
412 $ newrepo
412 $ newrepo
413 $ echo x > x
413 $ echo x > x
414 $ echo y > y
414 $ echo y > y
415 $ hg ci -Aqm 'add x and y'
415 $ hg ci -Aqm 'add x and y'
416 $ hg mv x z
416 $ hg mv x z
417 $ hg ci -qm 'rename x to z'
417 $ hg ci -qm 'rename x to z'
418 $ hg co -q 0
418 $ hg co -q 0
419 $ hg mv y z
419 $ hg mv y z
420 $ hg ci -qm 'rename y to z'
420 $ hg ci -qm 'rename y to z'
421 $ echo z >> z
421 $ echo z >> z
422 $ hg ci -m 'modify z'
422 $ hg ci -m 'modify z'
423 $ hg merge -q 1
423 $ hg merge -q 1
424 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
424 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
425 [1]
425 [1]
426 $ echo z > z
426 $ echo z > z
427 $ hg resolve -qm z
427 $ hg resolve -qm z
428 $ hg ci -m 'merge 1 into 3'
428 $ hg ci -m 'merge 1 into 3'
429 Try merging the other direction too
429 Try merging the other direction too
430 $ hg co -q 1
430 $ hg co -q 1
431 $ hg merge -q 3
431 $ hg merge -q 3
432 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
432 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
433 [1]
433 [1]
434 $ echo z > z
434 $ echo z > z
435 $ hg resolve -qm z
435 $ hg resolve -qm z
436 $ hg ci -m 'merge 3 into 1'
436 $ hg ci -m 'merge 3 into 1'
437 created new head
437 created new head
438 $ hg l
438 $ hg l
439 @ 5 merge 3 into 1
439 @ 5 merge 3 into 1
440 |\ z
440 |\ z
441 +---o 4 merge 1 into 3
441 +---o 4 merge 1 into 3
442 | |/ z
442 | |/ z
443 | o 3 modify z
443 | o 3 modify z
444 | | z
444 | | z
445 | o 2 rename y to z
445 | o 2 rename y to z
446 | | y z
446 | | y z
447 o | 1 rename x to z
447 o | 1 rename x to z
448 |/ x z
448 |/ x z
449 o 0 add x and y
449 o 0 add x and y
450 x y
450 x y
451 $ hg debugpathcopies 1 4
451 $ hg debugpathcopies 1 4
452 y -> z (no-filelog !)
452 y -> z (no-filelog !)
453 $ hg debugpathcopies 2 4
453 $ hg debugpathcopies 2 4
454 x -> z (no-filelog !)
454 x -> z (no-filelog !)
455 $ hg debugpathcopies 0 4
455 $ hg debugpathcopies 0 4
456 x -> z (filelog !)
456 x -> z (filelog !)
457 y -> z (no-filelog !)
457 y -> z (no-filelog !)
458 $ hg debugpathcopies 1 5
458 $ hg debugpathcopies 1 5
459 y -> z (no-filelog !)
459 y -> z (no-filelog !)
460 $ hg debugpathcopies 2 5
460 $ hg debugpathcopies 2 5
461 x -> z (no-filelog !)
461 x -> z (no-filelog !)
462 $ hg debugpathcopies 0 5
462 $ hg debugpathcopies 0 5
463 x -> z
463 x -> z
464
464
465 Create x and y, then remove y and rename x to y on one side of merge, and
466 modify x on the other side. The modification to x from the second side
467 should be propagated to y.
468 $ newrepo
469 $ echo original > x
470 $ hg add x
471 $ echo unrelated > y
472 $ hg add y
473 $ hg commit -m 'add x and y'
474 $ hg remove y
475 $ hg commit -m 'remove y'
476 $ hg rename x y
477 $ hg commit -m 'rename x to y'
478 $ hg checkout -q 0
479 $ echo modified > x
480 $ hg commit -m 'modify x'
481 created new head
482 $ hg l
483 @ 3 modify x
484 | x
485 | o 2 rename x to y
486 | | x y
487 | o 1 remove y
488 |/ y
489 o 0 add x and y
490 x y
491 #if filelog
492 $ hg merge 2
493 file 'x' was deleted in other [merge rev] but was modified in local [working copy].
494 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
495 What do you want to do? u
496 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
497 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
498 [1]
499 BROKEN: should be "modified"
500 $ cat y
501 original
502 #else
503 $ hg merge 2
504 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
505 (branch merge, don't forget to commit)
506 BROKEN: should be "modified"
507 $ cat y
508 original
509 #endif
510 Same as above, but in the opposite direction
511 #if filelog
512 $ hg co -qC 2
513 $ hg merge 3
514 file 'x' was deleted in local [working copy] but was modified in other [merge rev].
515 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
516 What do you want to do? u
517 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
518 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
519 [1]
520 BROKEN: should be "modified"
521 $ cat y
522 original
523 #else
524 $ hg co -qC 2
525 $ hg merge 3
526 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
527 (branch merge, don't forget to commit)
528 BROKEN: should be "modified"
529 $ cat y
530 original
531 #endif
465
532
466 Create x and y, then rename x to z on one side of merge, and rename y to z and
533 Create x and y, then rename x to z on one side of merge, and rename y to z and
467 then delete z on the other side.
534 then delete z on the other side.
468 $ newrepo
535 $ newrepo
469 $ echo x > x
536 $ echo x > x
470 $ echo y > y
537 $ echo y > y
471 $ hg ci -Aqm 'add x and y'
538 $ hg ci -Aqm 'add x and y'
472 $ hg mv x z
539 $ hg mv x z
473 $ hg ci -qm 'rename x to z'
540 $ hg ci -qm 'rename x to z'
474 $ hg co -q 0
541 $ hg co -q 0
475 $ hg mv y z
542 $ hg mv y z
476 $ hg ci -qm 'rename y to z'
543 $ hg ci -qm 'rename y to z'
477 $ hg rm z
544 $ hg rm z
478 $ hg ci -m 'delete z'
545 $ hg ci -m 'delete z'
479 $ hg merge -q 1
546 $ hg merge -q 1
480 $ echo z > z
547 $ echo z > z
481 $ hg ci -m 'merge 1 into 3'
548 $ hg ci -m 'merge 1 into 3'
482 Try merging the other direction too
549 Try merging the other direction too
483 $ hg co -q 1
550 $ hg co -q 1
484 $ hg merge -q 3
551 $ hg merge -q 3
485 $ echo z > z
552 $ echo z > z
486 $ hg ci -m 'merge 3 into 1'
553 $ hg ci -m 'merge 3 into 1'
487 created new head
554 created new head
488 $ hg l
555 $ hg l
489 @ 5 merge 3 into 1
556 @ 5 merge 3 into 1
490 |\ z
557 |\ z
491 +---o 4 merge 1 into 3
558 +---o 4 merge 1 into 3
492 | |/ z
559 | |/ z
493 | o 3 delete z
560 | o 3 delete z
494 | | z
561 | | z
495 | o 2 rename y to z
562 | o 2 rename y to z
496 | | y z
563 | | y z
497 o | 1 rename x to z
564 o | 1 rename x to z
498 |/ x z
565 |/ x z
499 o 0 add x and y
566 o 0 add x and y
500 x y
567 x y
501 $ hg debugpathcopies 1 4
568 $ hg debugpathcopies 1 4
502 $ hg debugpathcopies 2 4
569 $ hg debugpathcopies 2 4
503 x -> z (no-filelog !)
570 x -> z (no-filelog !)
504 $ hg debugpathcopies 0 4
571 $ hg debugpathcopies 0 4
505 x -> z (no-changeset no-compatibility !)
572 x -> z (no-changeset no-compatibility !)
506 $ hg debugpathcopies 1 5
573 $ hg debugpathcopies 1 5
507 $ hg debugpathcopies 2 5
574 $ hg debugpathcopies 2 5
508 x -> z (no-filelog !)
575 x -> z (no-filelog !)
509 $ hg debugpathcopies 0 5
576 $ hg debugpathcopies 0 5
510 x -> z
577 x -> z
511
578
512
579
513 Test for a case in fullcopytracing algorithm where neither of the merging csets
580 Test for a case in fullcopytracing algorithm where neither of the merging csets
514 is a descendant of the merge base. This test reflects that the algorithm
581 is a descendant of the merge base. This test reflects that the algorithm
515 correctly finds the copies:
582 correctly finds the copies:
516
583
517 $ cat >> $HGRCPATH << EOF
584 $ cat >> $HGRCPATH << EOF
518 > [experimental]
585 > [experimental]
519 > evolution.createmarkers=True
586 > evolution.createmarkers=True
520 > evolution.allowunstable=True
587 > evolution.allowunstable=True
521 > EOF
588 > EOF
522
589
523 $ newrepo
590 $ newrepo
524 $ echo a > a
591 $ echo a > a
525 $ hg add a
592 $ hg add a
526 $ hg ci -m "added a"
593 $ hg ci -m "added a"
527 $ echo b > b
594 $ echo b > b
528 $ hg add b
595 $ hg add b
529 $ hg ci -m "added b"
596 $ hg ci -m "added b"
530
597
531 $ hg mv b b1
598 $ hg mv b b1
532 $ hg ci -m "rename b to b1"
599 $ hg ci -m "rename b to b1"
533
600
534 $ hg up ".^"
601 $ hg up ".^"
535 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
602 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
536 $ echo d > d
603 $ echo d > d
537 $ hg add d
604 $ hg add d
538 $ hg ci -m "added d"
605 $ hg ci -m "added d"
539 created new head
606 created new head
540
607
541 $ echo baba >> b
608 $ echo baba >> b
542 $ hg ci --amend -m "added d, modified b"
609 $ hg ci --amend -m "added d, modified b"
543
610
544 $ hg l --hidden
611 $ hg l --hidden
545 @ 4 added d, modified b
612 @ 4 added d, modified b
546 | b d
613 | b d
547 | x 3 added d
614 | x 3 added d
548 |/ d
615 |/ d
549 | o 2 rename b to b1
616 | o 2 rename b to b1
550 |/ b b1
617 |/ b b1
551 o 1 added b
618 o 1 added b
552 | b
619 | b
553 o 0 added a
620 o 0 added a
554 a
621 a
555
622
556 Grafting revision 4 on top of revision 2, showing that it respect the rename:
623 Grafting revision 4 on top of revision 2, showing that it respect the rename:
557
624
558 $ hg up 2 -q
625 $ hg up 2 -q
559 $ hg graft -r 4 --base 3 --hidden
626 $ hg graft -r 4 --base 3 --hidden
560 grafting 4:af28412ec03c "added d, modified b" (tip) (no-changeset !)
627 grafting 4:af28412ec03c "added d, modified b" (tip) (no-changeset !)
561 grafting 4:6325ca0b7a1c "added d, modified b" (tip) (changeset !)
628 grafting 4:6325ca0b7a1c "added d, modified b" (tip) (changeset !)
562 merging b1 and b to b1
629 merging b1 and b to b1
563
630
564 $ hg l -l1 -p
631 $ hg l -l1 -p
565 @ 5 added d, modified b
632 @ 5 added d, modified b
566 | b1
633 | b1
567 ~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1 (no-changeset !)
634 ~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1 (no-changeset !)
568 ~ diff -r 0a0ed3b3251c -r d544fb655520 b1 (changeset !)
635 ~ diff -r 0a0ed3b3251c -r d544fb655520 b1 (changeset !)
569 --- a/b1 Thu Jan 01 00:00:00 1970 +0000
636 --- a/b1 Thu Jan 01 00:00:00 1970 +0000
570 +++ b/b1 Thu Jan 01 00:00:00 1970 +0000
637 +++ b/b1 Thu Jan 01 00:00:00 1970 +0000
571 @@ -1,1 +1,2 @@
638 @@ -1,1 +1,2 @@
572 b
639 b
573 +baba
640 +baba
574
641
575 Test to make sure that fullcopytracing algorithm doesn't fail when neither of the
642 Test to make sure that fullcopytracing algorithm doesn't fail when neither of the
576 merging csets is a descendant of the base.
643 merging csets is a descendant of the base.
577 -------------------------------------------------------------------------------------------------
644 -------------------------------------------------------------------------------------------------
578
645
579 $ newrepo
646 $ newrepo
580 $ echo a > a
647 $ echo a > a
581 $ hg add a
648 $ hg add a
582 $ hg ci -m "added a"
649 $ hg ci -m "added a"
583 $ echo b > b
650 $ echo b > b
584 $ hg add b
651 $ hg add b
585 $ hg ci -m "added b"
652 $ hg ci -m "added b"
586
653
587 $ echo foobar > willconflict
654 $ echo foobar > willconflict
588 $ hg add willconflict
655 $ hg add willconflict
589 $ hg ci -m "added willconflict"
656 $ hg ci -m "added willconflict"
590 $ echo c > c
657 $ echo c > c
591 $ hg add c
658 $ hg add c
592 $ hg ci -m "added c"
659 $ hg ci -m "added c"
593
660
594 $ hg l
661 $ hg l
595 @ 3 added c
662 @ 3 added c
596 | c
663 | c
597 o 2 added willconflict
664 o 2 added willconflict
598 | willconflict
665 | willconflict
599 o 1 added b
666 o 1 added b
600 | b
667 | b
601 o 0 added a
668 o 0 added a
602 a
669 a
603
670
604 $ hg up ".^^"
671 $ hg up ".^^"
605 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
672 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
606 $ echo d > d
673 $ echo d > d
607 $ hg add d
674 $ hg add d
608 $ hg ci -m "added d"
675 $ hg ci -m "added d"
609 created new head
676 created new head
610
677
611 $ echo barfoo > willconflict
678 $ echo barfoo > willconflict
612 $ hg add willconflict
679 $ hg add willconflict
613 $ hg ci --amend -m "added willconflict and d"
680 $ hg ci --amend -m "added willconflict and d"
614
681
615 $ hg l
682 $ hg l
616 @ 5 added willconflict and d
683 @ 5 added willconflict and d
617 | d willconflict
684 | d willconflict
618 | o 3 added c
685 | o 3 added c
619 | | c
686 | | c
620 | o 2 added willconflict
687 | o 2 added willconflict
621 |/ willconflict
688 |/ willconflict
622 o 1 added b
689 o 1 added b
623 | b
690 | b
624 o 0 added a
691 o 0 added a
625 a
692 a
626
693
627 $ hg rebase -r . -d 2 -t :other
694 $ hg rebase -r . -d 2 -t :other
628 rebasing 5:5018b1509e94 tip "added willconflict and d" (no-changeset !)
695 rebasing 5:5018b1509e94 tip "added willconflict and d" (no-changeset !)
629 rebasing 5:af8d273bf580 tip "added willconflict and d" (changeset !)
696 rebasing 5:af8d273bf580 tip "added willconflict and d" (changeset !)
630
697
631 $ hg up 3 -q
698 $ hg up 3 -q
632 $ hg l --hidden
699 $ hg l --hidden
633 o 6 added willconflict and d
700 o 6 added willconflict and d
634 | d willconflict
701 | d willconflict
635 | x 5 added willconflict and d
702 | x 5 added willconflict and d
636 | | d willconflict
703 | | d willconflict
637 | | x 4 added d
704 | | x 4 added d
638 | |/ d
705 | |/ d
639 +---@ 3 added c
706 +---@ 3 added c
640 | | c
707 | | c
641 o | 2 added willconflict
708 o | 2 added willconflict
642 |/ willconflict
709 |/ willconflict
643 o 1 added b
710 o 1 added b
644 | b
711 | b
645 o 0 added a
712 o 0 added a
646 a
713 a
647
714
648 Now if we trigger a merge between revision 3 and 6 using base revision 4,
715 Now if we trigger a merge between revision 3 and 6 using base revision 4,
649 neither of the merging csets will be a descendant of the base revision:
716 neither of the merging csets will be a descendant of the base revision:
650
717
651 $ hg graft -r 6 --base 4 --hidden -t :other
718 $ hg graft -r 6 --base 4 --hidden -t :other
652 grafting 6:99802e4f1e46 "added willconflict and d" (tip) (no-changeset !)
719 grafting 6:99802e4f1e46 "added willconflict and d" (tip) (no-changeset !)
653 grafting 6:b19f0df72728 "added willconflict and d" (tip) (changeset !)
720 grafting 6:b19f0df72728 "added willconflict and d" (tip) (changeset !)
General Comments 0
You need to be logged in to leave comments. Login now