| 1 |
|
| 2 |
Graft from behind a move or rename |
| 3 |
================================== |
| 4 |
|
| 5 |
NOTE: This is affected by issue5343, and will need updating when it's fixed |
| 6 |
|
| 7 |
Consider this topology for a regular graft: |
| 8 |
|
| 9 |
o c1 |
| 10 |
| |
| 11 |
| o c2 |
| 12 |
| | |
| 13 |
| o ca # stands for "common ancestor" |
| 14 |
|/ |
| 15 |
o cta # stands for "common topological ancestor" |
| 16 |
|
| 17 |
Note that in issue5343, ca==cta. |
| 18 |
|
| 19 |
The following table shows the possible cases. Here, "x->y" and, equivalently, |
| 20 |
"y<-x", where x is an ancestor of y, means that some copy happened from x to y. |
| 21 |
|
| 22 |
name | c1<-cta | cta<->ca | ca->c2 |
| 23 |
A.0 | | | |
| 24 |
A.1 | X | | |
| 25 |
A.2 | | X | |
| 26 |
A.3 | | | X |
| 27 |
A.4 | X | X | |
| 28 |
A.5 | X | | X |
| 29 |
A.6 | | X | X |
| 30 |
A.7 | X | X | X |
| 31 |
|
| 32 |
A.0 is trivial, and doesn't need copy tracking. |
| 33 |
For A.1, a forward rename is recorded in the c1 pass, to be followed later. |
| 34 |
In A.2, the rename is recorded in the c2 pass and followed backwards. |
| 35 |
A.3 is recorded in the c2 pass as a forward rename to be duplicated on target. |
| 36 |
In A.4, both passes of checkcopies record incomplete renames, which are |
| 37 |
then joined in mergecopies to record a rename to be followed. |
| 38 |
In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass |
| 39 |
records an incomplete divergence. The incomplete rename is then joined to the |
| 40 |
appropriate side of the incomplete divergence, and the result is recorded as a |
| 41 |
divergence. The code doesn't distinguish at all between these two cases, since |
| 42 |
the end result of them is the same: an incomplete divergence joined with an |
| 43 |
incomplete rename into a divergence. |
| 44 |
Finally, A.6 records a divergence entirely in the c2 pass. |
| 45 |
|
| 46 |
A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all. |
| 47 |
A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge. |
| 48 |
A.5 has issue5343 as a special case. |
| 49 |
A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious |
| 50 |
incomplete divergence, which is in fact complete. This is handled later in |
| 51 |
mergecopies. |
| 52 |
A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b, |
| 53 |
a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting, |
| 54 |
the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base |
| 55 |
case, a<-b<-c->a is treated the same as a<-b<-b->a). |
| 56 |
|
| 57 |
f5a therefore tests the "ping-pong" rename case, where a file is renamed to the |
| 58 |
same name on both branches, then the rename is backed out on one branch, and |
| 59 |
the backout is grafted to the other branch. This creates a challenging rename |
| 60 |
sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft |
| 61 |
source, respectively. Since rename detection will run on the c1 side for such a |
| 62 |
sequence (as for technical reasons, we split the c1 and c2 sides not at the |
| 63 |
graft CA, but rather at the topological CA), it will pick up a false rename, |
| 64 |
and cause a spurious merge conflict. This false rename is always exactly the |
| 65 |
reverse of the true rename that would be detected on the c2 side, so we can |
| 66 |
correct for it by detecting this condition and reversing as necessary. |
| 67 |
|
| 68 |
First, set up the repository with commits to be grafted |
| 69 |
|
| 70 |
$ hg init graftmove |
| 71 |
$ cd graftmove |
| 72 |
$ echo c1a > f1a |
| 73 |
$ echo c2a > f2a |
| 74 |
$ echo c3a > f3a |
| 75 |
$ echo c4a > f4a |
| 76 |
$ echo c5a > f5a |
| 77 |
$ hg ci -qAm A0 |
| 78 |
$ hg mv f1a f1b |
| 79 |
$ hg mv f3a f3b |
| 80 |
$ hg mv f5a f5b |
| 81 |
$ hg ci -qAm B0 |
| 82 |
$ echo c1c > f1b |
| 83 |
$ hg mv f2a f2c |
| 84 |
$ hg mv f5b f5a |
| 85 |
$ echo c5c > f5a |
| 86 |
$ hg ci -qAm C0 |
| 87 |
$ hg mv f3b f3d |
| 88 |
$ echo c4d > f4a |
| 89 |
$ hg ci -qAm D0 |
| 90 |
$ hg log -G |
| 91 |
@ changeset: 3:b69f5839d2d9 |
| 92 |
| tag: tip |
| 93 |
| user: test |
| 94 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 95 |
| summary: D0 |
| 96 |
| |
| 97 |
o changeset: 2:f58c7e2b28fa |
| 98 |
| user: test |
| 99 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 100 |
| summary: C0 |
| 101 |
| |
| 102 |
o changeset: 1:3d7bba921b5d |
| 103 |
| user: test |
| 104 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 105 |
| summary: B0 |
| 106 |
| |
| 107 |
o changeset: 0:11f7a1b56675 |
| 108 |
user: test |
| 109 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 110 |
summary: A0 |
| 111 |
|
| 112 |
|
| 113 |
Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the |
| 114 |
two renames actually converge to the same name (thus no actual divergence). |
| 115 |
|
| 116 |
$ hg up -q 'desc("A0")' |
| 117 |
$ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit |
| 118 |
grafting 2:f58c7e2b28fa "C0" |
| 119 |
merging f1a and f1b to f1a |
| 120 |
merging f5a |
| 121 |
$ hg status --change . |
| 122 |
M f1a |
| 123 |
M f5a |
| 124 |
A f2c |
| 125 |
R f2a |
| 126 |
$ hg cat f1a |
| 127 |
c1c |
| 128 |
$ hg cat f1b |
| 129 |
f1b: no such file in rev c9763722f9bd |
| 130 |
[1] |
| 131 |
|
| 132 |
Test the cases A.0 (f4x) and A.6 (f3x) |
| 133 |
|
| 134 |
$ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit |
| 135 |
grafting 3:b69f5839d2d9 "D0" |
| 136 |
note: possible conflict - f3b was renamed multiple times to: |
| 137 |
f3a |
| 138 |
f3d |
| 139 |
|
| 140 |
Set up the repository for some further tests |
| 141 |
|
| 142 |
$ hg up -q "min(desc("A0"))" |
| 143 |
$ hg mv f1a f1e |
| 144 |
$ echo c2e > f2a |
| 145 |
$ hg mv f3a f3e |
| 146 |
$ hg mv f4a f4e |
| 147 |
$ hg mv f5a f5b |
| 148 |
$ hg ci -qAm "E0" |
| 149 |
$ hg up -q "min(desc("A0"))" |
| 150 |
$ hg cp f1a f1f |
| 151 |
$ hg ci -qAm "F0" |
| 152 |
$ hg up -q "min(desc("A0"))" |
| 153 |
$ hg cp f1a f1g |
| 154 |
$ echo c1g > f1g |
| 155 |
$ hg ci -qAm "G0" |
| 156 |
$ hg log -G |
| 157 |
@ changeset: 8:ba67f08fb15a |
| 158 |
| tag: tip |
| 159 |
| parent: 0:11f7a1b56675 |
| 160 |
| user: test |
| 161 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 162 |
| summary: G0 |
| 163 |
| |
| 164 |
| o changeset: 7:d376ab0d7fda |
| 165 |
|/ parent: 0:11f7a1b56675 |
| 166 |
| user: test |
| 167 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 168 |
| summary: F0 |
| 169 |
| |
| 170 |
| o changeset: 6:6bd1736cab86 |
| 171 |
|/ parent: 0:11f7a1b56675 |
| 172 |
| user: test |
| 173 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 174 |
| summary: E0 |
| 175 |
| |
| 176 |
| o changeset: 5:560daee679da |
| 177 |
| | user: test |
| 178 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 179 |
| | summary: D1 |
| 180 |
| | |
| 181 |
| o changeset: 4:c9763722f9bd |
| 182 |
|/ parent: 0:11f7a1b56675 |
| 183 |
| user: test |
| 184 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 185 |
| summary: C1 |
| 186 |
| |
| 187 |
| o changeset: 3:b69f5839d2d9 |
| 188 |
| | user: test |
| 189 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 190 |
| | summary: D0 |
| 191 |
| | |
| 192 |
| o changeset: 2:f58c7e2b28fa |
| 193 |
| | user: test |
| 194 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 195 |
| | summary: C0 |
| 196 |
| | |
| 197 |
| o changeset: 1:3d7bba921b5d |
| 198 |
|/ user: test |
| 199 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 200 |
| summary: B0 |
| 201 |
| |
| 202 |
o changeset: 0:11f7a1b56675 |
| 203 |
user: test |
| 204 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 205 |
summary: A0 |
| 206 |
|
| 207 |
|
| 208 |
Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x), |
| 209 |
and A.3 with a local content change to be preserved (f2x). |
| 210 |
|
| 211 |
$ hg up -q "desc("E0")" |
| 212 |
$ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit |
| 213 |
grafting 2:f58c7e2b28fa "C0" |
| 214 |
merging f1e and f1b to f1e |
| 215 |
merging f2a and f2c to f2c |
| 216 |
|
| 217 |
Test the cases A.1 (f4x) and A.7 (f3x). |
| 218 |
|
| 219 |
$ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit |
| 220 |
grafting 3:b69f5839d2d9 "D0" |
| 221 |
note: possible conflict - f3b was renamed multiple times to: |
| 222 |
f3d |
| 223 |
f3e |
| 224 |
merging f4e and f4a to f4e |
| 225 |
|
| 226 |
$ hg cat f2c |
| 227 |
c2e |
| 228 |
|
| 229 |
Test the case A.5 (move case, f1x). |
| 230 |
|
| 231 |
$ hg up -q "desc("C0")" |
| 232 |
$ HGEDITOR="echo E1 >" hg graft -r 'desc("E0")' --edit |
| 233 |
grafting 6:6bd1736cab86 "E0" |
| 234 |
note: possible conflict - f1a was renamed multiple times to: |
| 235 |
f1b |
| 236 |
f1e |
| 237 |
note: possible conflict - f3a was renamed multiple times to: |
| 238 |
f3b |
| 239 |
f3e |
| 240 |
merging f2c and f2a to f2c |
| 241 |
merging f5a and f5b to f5b |
| 242 |
$ cat f1e |
| 243 |
c1a |
| 244 |
|
| 245 |
Test the case A.5 (copy case, f1x). |
| 246 |
|
| 247 |
$ hg up -q "desc("C0")" |
| 248 |
$ HGEDITOR="echo F1 >" hg graft -r 'desc("F0")' --edit |
| 249 |
grafting 7:d376ab0d7fda "F0" |
| 250 |
BROKEN: f1f should be marked a copy from f1b |
| 251 |
$ hg st --copies --change . |
| 252 |
A f1f |
| 253 |
BROKEN: f1f should have the new content from f1b (i.e. "c1c") |
| 254 |
$ cat f1f |
| 255 |
c1a |
| 256 |
|
| 257 |
Test the case A.5 (copy+modify case, f1x). |
| 258 |
|
| 259 |
$ hg up -q "desc("C0")" |
| 260 |
BROKEN: We should get a merge conflict from the 3-way merge between f1b in C0 |
| 261 |
(content "c1c") and f1g in G0 (content "c1g") with f1a in A0 as base (content |
| 262 |
"c1a") |
| 263 |
$ HGEDITOR="echo G1 >" hg graft -r 'desc("G0")' --edit |
| 264 |
grafting 8:ba67f08fb15a "G0" |
| 265 |
|
| 266 |
Check the results of the grafts tested |
| 267 |
|
| 268 |
$ hg log -CGv --patch --git |
| 269 |
@ changeset: 13:ef3adf6c20a4 |
| 270 |
| tag: tip |
| 271 |
| parent: 2:f58c7e2b28fa |
| 272 |
| user: test |
| 273 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 274 |
| files: f1g |
| 275 |
| description: |
| 276 |
| G1 |
| 277 |
| |
| 278 |
| |
| 279 |
| diff --git a/f1g b/f1g |
| 280 |
| new file mode 100644 |
| 281 |
| --- /dev/null |
| 282 |
| +++ b/f1g |
| 283 |
| @@ -0,0 +1,1 @@ |
| 284 |
| +c1g |
| 285 |
| |
| 286 |
| o changeset: 12:b5542d755b54 |
| 287 |
|/ parent: 2:f58c7e2b28fa |
| 288 |
| user: test |
| 289 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 290 |
| files: f1f |
| 291 |
| description: |
| 292 |
| F1 |
| 293 |
| |
| 294 |
| |
| 295 |
| diff --git a/f1f b/f1f |
| 296 |
| new file mode 100644 |
| 297 |
| --- /dev/null |
| 298 |
| +++ b/f1f |
| 299 |
| @@ -0,0 +1,1 @@ |
| 300 |
| +c1a |
| 301 |
| |
| 302 |
| o changeset: 11:f8a162271246 |
| 303 |
|/ parent: 2:f58c7e2b28fa |
| 304 |
| user: test |
| 305 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 306 |
| files: f1e f2c f3e f4a f4e f5a f5b |
| 307 |
| copies: f4e (f4a) f5b (f5a) |
| 308 |
| description: |
| 309 |
| E1 |
| 310 |
| |
| 311 |
| |
| 312 |
| diff --git a/f1e b/f1e |
| 313 |
| new file mode 100644 |
| 314 |
| --- /dev/null |
| 315 |
| +++ b/f1e |
| 316 |
| @@ -0,0 +1,1 @@ |
| 317 |
| +c1a |
| 318 |
| diff --git a/f2c b/f2c |
| 319 |
| --- a/f2c |
| 320 |
| +++ b/f2c |
| 321 |
| @@ -1,1 +1,1 @@ |
| 322 |
| -c2a |
| 323 |
| +c2e |
| 324 |
| diff --git a/f3e b/f3e |
| 325 |
| new file mode 100644 |
| 326 |
| --- /dev/null |
| 327 |
| +++ b/f3e |
| 328 |
| @@ -0,0 +1,1 @@ |
| 329 |
| +c3a |
| 330 |
| diff --git a/f4a b/f4e |
| 331 |
| rename from f4a |
| 332 |
| rename to f4e |
| 333 |
| diff --git a/f5a b/f5b |
| 334 |
| rename from f5a |
| 335 |
| rename to f5b |
| 336 |
| |
| 337 |
| o changeset: 10:93ee502e8b0a |
| 338 |
| | user: test |
| 339 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 340 |
| | files: f3d f4e |
| 341 |
| | description: |
| 342 |
| | D2 |
| 343 |
| | |
| 344 |
| | |
| 345 |
| | diff --git a/f3d b/f3d |
| 346 |
| | new file mode 100644 |
| 347 |
| | --- /dev/null |
| 348 |
| | +++ b/f3d |
| 349 |
| | @@ -0,0 +1,1 @@ |
| 350 |
| | +c3a |
| 351 |
| | diff --git a/f4e b/f4e |
| 352 |
| | --- a/f4e |
| 353 |
| | +++ b/f4e |
| 354 |
| | @@ -1,1 +1,1 @@ |
| 355 |
| | -c4a |
| 356 |
| | +c4d |
| 357 |
| | |
| 358 |
| o changeset: 9:539cf145f496 |
| 359 |
| | parent: 6:6bd1736cab86 |
| 360 |
| | user: test |
| 361 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 362 |
| | files: f1e f2a f2c f5a f5b |
| 363 |
| | copies: f2c (f2a) f5a (f5b) |
| 364 |
| | description: |
| 365 |
| | C2 |
| 366 |
| | |
| 367 |
| | |
| 368 |
| | diff --git a/f1e b/f1e |
| 369 |
| | --- a/f1e |
| 370 |
| | +++ b/f1e |
| 371 |
| | @@ -1,1 +1,1 @@ |
| 372 |
| | -c1a |
| 373 |
| | +c1c |
| 374 |
| | diff --git a/f2a b/f2c |
| 375 |
| | rename from f2a |
| 376 |
| | rename to f2c |
| 377 |
| | diff --git a/f5b b/f5a |
| 378 |
| | rename from f5b |
| 379 |
| | rename to f5a |
| 380 |
| | --- a/f5b |
| 381 |
| | +++ b/f5a |
| 382 |
| | @@ -1,1 +1,1 @@ |
| 383 |
| | -c5a |
| 384 |
| | +c5c |
| 385 |
| | |
| 386 |
| | o changeset: 8:ba67f08fb15a |
| 387 |
| | | parent: 0:11f7a1b56675 |
| 388 |
| | | user: test |
| 389 |
| | | date: Thu Jan 01 00:00:00 1970 +0000 |
| 390 |
| | | files: f1g |
| 391 |
| | | copies: f1g (f1a) |
| 392 |
| | | description: |
| 393 |
| | | G0 |
| 394 |
| | | |
| 395 |
| | | |
| 396 |
| | | diff --git a/f1a b/f1g |
| 397 |
| | | copy from f1a |
| 398 |
| | | copy to f1g |
| 399 |
| | | --- a/f1a |
| 400 |
| | | +++ b/f1g |
| 401 |
| | | @@ -1,1 +1,1 @@ |
| 402 |
| | | -c1a |
| 403 |
| | | +c1g |
| 404 |
| | | |
| 405 |
| | | o changeset: 7:d376ab0d7fda |
| 406 |
| | |/ parent: 0:11f7a1b56675 |
| 407 |
| | | user: test |
| 408 |
| | | date: Thu Jan 01 00:00:00 1970 +0000 |
| 409 |
| | | files: f1f |
| 410 |
| | | copies: f1f (f1a) |
| 411 |
| | | description: |
| 412 |
| | | F0 |
| 413 |
| | | |
| 414 |
| | | |
| 415 |
| | | diff --git a/f1a b/f1f |
| 416 |
| | | copy from f1a |
| 417 |
| | | copy to f1f |
| 418 |
| | | |
| 419 |
| o | changeset: 6:6bd1736cab86 |
| 420 |
| |/ parent: 0:11f7a1b56675 |
| 421 |
| | user: test |
| 422 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 423 |
| | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b |
| 424 |
| | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a) |
| 425 |
| | description: |
| 426 |
| | E0 |
| 427 |
| | |
| 428 |
| | |
| 429 |
| | diff --git a/f1a b/f1e |
| 430 |
| | rename from f1a |
| 431 |
| | rename to f1e |
| 432 |
| | diff --git a/f2a b/f2a |
| 433 |
| | --- a/f2a |
| 434 |
| | +++ b/f2a |
| 435 |
| | @@ -1,1 +1,1 @@ |
| 436 |
| | -c2a |
| 437 |
| | +c2e |
| 438 |
| | diff --git a/f3a b/f3e |
| 439 |
| | rename from f3a |
| 440 |
| | rename to f3e |
| 441 |
| | diff --git a/f4a b/f4e |
| 442 |
| | rename from f4a |
| 443 |
| | rename to f4e |
| 444 |
| | diff --git a/f5a b/f5b |
| 445 |
| | rename from f5a |
| 446 |
| | rename to f5b |
| 447 |
| | |
| 448 |
| | o changeset: 5:560daee679da |
| 449 |
| | | user: test |
| 450 |
| | | date: Thu Jan 01 00:00:00 1970 +0000 |
| 451 |
| | | files: f3d f4a |
| 452 |
| | | description: |
| 453 |
| | | D1 |
| 454 |
| | | |
| 455 |
| | | |
| 456 |
| | | diff --git a/f3d b/f3d |
| 457 |
| | | new file mode 100644 |
| 458 |
| | | --- /dev/null |
| 459 |
| | | +++ b/f3d |
| 460 |
| | | @@ -0,0 +1,1 @@ |
| 461 |
| | | +c3a |
| 462 |
| | | diff --git a/f4a b/f4a |
| 463 |
| | | --- a/f4a |
| 464 |
| | | +++ b/f4a |
| 465 |
| | | @@ -1,1 +1,1 @@ |
| 466 |
| | | -c4a |
| 467 |
| | | +c4d |
| 468 |
| | | |
| 469 |
| | o changeset: 4:c9763722f9bd |
| 470 |
| |/ parent: 0:11f7a1b56675 |
| 471 |
| | user: test |
| 472 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 473 |
| | files: f1a f2a f2c f5a |
| 474 |
| | copies: f2c (f2a) |
| 475 |
| | description: |
| 476 |
| | C1 |
| 477 |
| | |
| 478 |
| | |
| 479 |
| | diff --git a/f1a b/f1a |
| 480 |
| | --- a/f1a |
| 481 |
| | +++ b/f1a |
| 482 |
| | @@ -1,1 +1,1 @@ |
| 483 |
| | -c1a |
| 484 |
| | +c1c |
| 485 |
| | diff --git a/f2a b/f2c |
| 486 |
| | rename from f2a |
| 487 |
| | rename to f2c |
| 488 |
| | diff --git a/f5a b/f5a |
| 489 |
| | --- a/f5a |
| 490 |
| | +++ b/f5a |
| 491 |
| | @@ -1,1 +1,1 @@ |
| 492 |
| | -c5a |
| 493 |
| | +c5c |
| 494 |
| | |
| 495 |
+---o changeset: 3:b69f5839d2d9 |
| 496 |
| | user: test |
| 497 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 498 |
| | files: f3b f3d f4a |
| 499 |
| | copies: f3d (f3b) |
| 500 |
| | description: |
| 501 |
| | D0 |
| 502 |
| | |
| 503 |
| | |
| 504 |
| | diff --git a/f3b b/f3d |
| 505 |
| | rename from f3b |
| 506 |
| | rename to f3d |
| 507 |
| | diff --git a/f4a b/f4a |
| 508 |
| | --- a/f4a |
| 509 |
| | +++ b/f4a |
| 510 |
| | @@ -1,1 +1,1 @@ |
| 511 |
| | -c4a |
| 512 |
| | +c4d |
| 513 |
| | |
| 514 |
o | changeset: 2:f58c7e2b28fa |
| 515 |
| | user: test |
| 516 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 517 |
| | files: f1b f2a f2c f5a f5b |
| 518 |
| | copies: f2c (f2a) f5a (f5b) |
| 519 |
| | description: |
| 520 |
| | C0 |
| 521 |
| | |
| 522 |
| | |
| 523 |
| | diff --git a/f1b b/f1b |
| 524 |
| | --- a/f1b |
| 525 |
| | +++ b/f1b |
| 526 |
| | @@ -1,1 +1,1 @@ |
| 527 |
| | -c1a |
| 528 |
| | +c1c |
| 529 |
| | diff --git a/f2a b/f2c |
| 530 |
| | rename from f2a |
| 531 |
| | rename to f2c |
| 532 |
| | diff --git a/f5b b/f5a |
| 533 |
| | rename from f5b |
| 534 |
| | rename to f5a |
| 535 |
| | --- a/f5b |
| 536 |
| | +++ b/f5a |
| 537 |
| | @@ -1,1 +1,1 @@ |
| 538 |
| | -c5a |
| 539 |
| | +c5c |
| 540 |
| | |
| 541 |
o | changeset: 1:3d7bba921b5d |
| 542 |
|/ user: test |
| 543 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 544 |
| files: f1a f1b f3a f3b f5a f5b |
| 545 |
| copies: f1b (f1a) f3b (f3a) f5b (f5a) |
| 546 |
| description: |
| 547 |
| B0 |
| 548 |
| |
| 549 |
| |
| 550 |
| diff --git a/f1a b/f1b |
| 551 |
| rename from f1a |
| 552 |
| rename to f1b |
| 553 |
| diff --git a/f3a b/f3b |
| 554 |
| rename from f3a |
| 555 |
| rename to f3b |
| 556 |
| diff --git a/f5a b/f5b |
| 557 |
| rename from f5a |
| 558 |
| rename to f5b |
| 559 |
| |
| 560 |
o changeset: 0:11f7a1b56675 |
| 561 |
user: test |
| 562 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 563 |
files: f1a f2a f3a f4a f5a |
| 564 |
description: |
| 565 |
A0 |
| 566 |
|
| 567 |
|
| 568 |
diff --git a/f1a b/f1a |
| 569 |
new file mode 100644 |
| 570 |
--- /dev/null |
| 571 |
+++ b/f1a |
| 572 |
@@ -0,0 +1,1 @@ |
| 573 |
+c1a |
| 574 |
diff --git a/f2a b/f2a |
| 575 |
new file mode 100644 |
| 576 |
--- /dev/null |
| 577 |
+++ b/f2a |
| 578 |
@@ -0,0 +1,1 @@ |
| 579 |
+c2a |
| 580 |
diff --git a/f3a b/f3a |
| 581 |
new file mode 100644 |
| 582 |
--- /dev/null |
| 583 |
+++ b/f3a |
| 584 |
@@ -0,0 +1,1 @@ |
| 585 |
+c3a |
| 586 |
diff --git a/f4a b/f4a |
| 587 |
new file mode 100644 |
| 588 |
--- /dev/null |
| 589 |
+++ b/f4a |
| 590 |
@@ -0,0 +1,1 @@ |
| 591 |
+c4a |
| 592 |
diff --git a/f5a b/f5a |
| 593 |
new file mode 100644 |
| 594 |
--- /dev/null |
| 595 |
+++ b/f5a |
| 596 |
@@ -0,0 +1,1 @@ |
| 597 |
+c5a |
| 598 |
|
| 599 |
Check superfluous filemerge of files renamed in the past but untouched by graft |
| 600 |
|
| 601 |
$ echo a > a |
| 602 |
$ hg ci -qAma |
| 603 |
$ hg mv a b |
| 604 |
$ echo b > b |
| 605 |
$ hg ci -qAmb |
| 606 |
$ echo c > c |
| 607 |
$ hg ci -qAmc |
| 608 |
$ hg up -q .~2 |
| 609 |
$ hg graft tip -qt:fail |
| 610 |
|
| 611 |
$ cd .. |
| 612 |
|
| 613 |
Graft a change into a new file previously grafted into a renamed directory |
| 614 |
|
| 615 |
$ hg init dirmovenewfile |
| 616 |
$ cd dirmovenewfile |
| 617 |
$ mkdir a |
| 618 |
$ echo a > a/a |
| 619 |
$ hg ci -qAma |
| 620 |
$ echo x > a/x |
| 621 |
$ hg ci -qAmx |
| 622 |
$ hg up -q 0 |
| 623 |
$ hg mv -q a b |
| 624 |
$ hg ci -qAmb |
| 625 |
$ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded |
| 626 |
$ hg up -q 1 |
| 627 |
$ echo y > a/x |
| 628 |
$ hg ci -qAmy |
| 629 |
$ hg up -q 3 |
| 630 |
$ hg graft -q 4 |
| 631 |
$ hg status --change . |
| 632 |
M b/x |
| 633 |
|
| 634 |
Prepare for test of skipped changesets and how merges can influence it: |
| 635 |
|
| 636 |
$ hg merge -q -r 1 --tool :local |
| 637 |
$ hg ci -m m |
| 638 |
$ echo xx >> b/x |
| 639 |
$ hg ci -m xx |
| 640 |
|
| 641 |
$ hg log -G -T '{rev} {desc|firstline}' |
| 642 |
@ 7 xx |
| 643 |
| |
| 644 |
o 6 m |
| 645 |
|\ |
| 646 |
| o 5 y |
| 647 |
| | |
| 648 |
+---o 4 y |
| 649 |
| | |
| 650 |
| o 3 x |
| 651 |
| | |
| 652 |
| o 2 b |
| 653 |
| | |
| 654 |
o | 1 x |
| 655 |
|/ |
| 656 |
o 0 a |
| 657 |
|
| 658 |
Grafting of plain changes correctly detects that 3 and 5 should be skipped: |
| 659 |
|
| 660 |
$ hg up -qCr 4 |
| 661 |
$ hg graft --tool :local -r 2::5 |
| 662 |
skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a) |
| 663 |
skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1) |
| 664 |
grafting 2:42127f193bcd "b" |
| 665 |
|
| 666 |
Extending the graft range to include a (skipped) merge of 3 will not prevent us from |
| 667 |
also detecting that both 3 and 5 should be skipped: |
| 668 |
|
| 669 |
$ hg up -qCr 4 |
| 670 |
$ hg graft --tool :local -r 2::7 |
| 671 |
skipping ungraftable merge revision 6 |
| 672 |
skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a) |
| 673 |
skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1) |
| 674 |
grafting 2:42127f193bcd "b" |
| 675 |
grafting 7:d3c3f2b38ecc "xx" |
| 676 |
note: graft of 7:d3c3f2b38ecc created no changes to commit |
| 677 |
|
| 678 |
$ cd .. |
| 679 |
|
| 680 |
Grafted revision should be warned and skipped only once. (issue6024) |
| 681 |
|
| 682 |
$ mkdir issue6024 |
| 683 |
$ cd issue6024 |
| 684 |
|
| 685 |
$ hg init base |
| 686 |
$ cd base |
| 687 |
$ touch x |
| 688 |
$ hg commit -qAminit |
| 689 |
$ echo a > x |
| 690 |
$ hg commit -mchange |
| 691 |
$ hg update -q 0 |
| 692 |
$ hg graft -r 1 |
| 693 |
grafting 1:a0b923c546aa "change" (tip) |
| 694 |
$ cd .. |
| 695 |
|
| 696 |
$ hg clone -qr 2 base clone |
| 697 |
$ cd clone |
| 698 |
$ hg pull -q |
| 699 |
$ hg merge -q 2 |
| 700 |
$ hg commit -mmerge |
| 701 |
$ hg update -q 0 |
| 702 |
$ hg graft -r 1 |
| 703 |
grafting 1:04fc6d444368 "change" |
| 704 |
$ hg update -q 3 |
| 705 |
$ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n' |
| 706 |
o 4:4e16 <- a0b9 |
| 707 |
| |
| 708 |
| @ 3:f0ac <- |
| 709 |
| |\ |
| 710 |
+---o 2:a0b9 <- |
| 711 |
| | |
| 712 |
| o 1:04fc <- a0b9 |
| 713 |
|/ |
| 714 |
o 0:7848 <- |
| 715 |
|
| 716 |
|
| 717 |
the source of rev 4 is an ancestor of the working parent, and was also |
| 718 |
grafted as rev 1. it should be stripped from the target revisions only once. |
| 719 |
|
| 720 |
$ hg graft -r 4 |
| 721 |
skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa) |
| 722 |
[255] |
| 723 |
|
| 724 |
$ cd ../.. |