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