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