| 1 |
$ cat <<'EOF' >> "$HGRCPATH" |
| 2 |
> [extensions] |
| 3 |
> convert = |
| 4 |
> [templates] |
| 5 |
> l = '{rev}:{node|short} p={p1rev},{p2rev} m={manifest} f={files|json}' |
| 6 |
> EOF |
| 7 |
|
| 8 |
$ check_convert_identity () { |
| 9 |
> hg convert -q "$1" "$1.converted" |
| 10 |
> hg outgoing -q -R "$1.converted" "$1" |
| 11 |
> if [ "$?" != 1 ]; then |
| 12 |
> echo '*** BUG: hash changes on convert ***' |
| 13 |
> hg log -R "$1.converted" -GTl |
| 14 |
> fi |
| 15 |
> } |
| 16 |
|
| 17 |
Files added at both parents: |
| 18 |
|
| 19 |
$ hg init added-both |
| 20 |
$ cd added-both |
| 21 |
$ touch a b c |
| 22 |
$ hg ci -qAm0 a |
| 23 |
$ hg ci -qAm1 b |
| 24 |
$ hg up -q 0 |
| 25 |
$ hg ci -qAm2 c |
| 26 |
|
| 27 |
$ hg merge |
| 28 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 29 |
(branch merge, don't forget to commit) |
| 30 |
$ hg ci --debug -m merge |
| 31 |
committing files: |
| 32 |
b |
| 33 |
not reusing manifest (no file change in changelog, but manifest differs) |
| 34 |
committing manifest |
| 35 |
committing changelog |
| 36 |
updating the branch cache |
| 37 |
committed changeset 3:7aa8a293f5d97377037afc21e871e036e718d659 |
| 38 |
$ hg log -GTl |
| 39 |
@ 3:7aa8a293f5d9 p=2,1 m=3:8667461869a1 f=[] |
| 40 |
|\ |
| 41 |
| o 2:e0ea47086fce p=0,-1 m=2:b2e5b07f9374 f=["c"] |
| 42 |
| | |
| 43 |
o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
| 44 |
|/ |
| 45 |
o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
| 46 |
|
| 47 |
|
| 48 |
$ cd .. |
| 49 |
$ check_convert_identity added-both |
| 50 |
|
| 51 |
Files added at both parents, but the other removed at the merge: |
| 52 |
(In this case, ctx.files() after the commit contains the removed file "b", but |
| 53 |
its manifest does not differ from p1.) |
| 54 |
|
| 55 |
$ hg init added-both-removed-at-merge |
| 56 |
$ cd added-both-removed-at-merge |
| 57 |
$ touch a b c |
| 58 |
$ hg ci -qAm0 a |
| 59 |
$ hg ci -qAm1 b |
| 60 |
$ hg up -q 0 |
| 61 |
$ hg ci -qAm2 c |
| 62 |
|
| 63 |
$ hg merge |
| 64 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 65 |
(branch merge, don't forget to commit) |
| 66 |
$ hg rm -f b |
| 67 |
$ hg ci --debug -m merge |
| 68 |
committing files: |
| 69 |
committing manifest |
| 70 |
committing changelog |
| 71 |
updating the branch cache |
| 72 |
committed changeset 3:915745f3ca3d9d699925269474c2d0a9526e8dfa |
| 73 |
$ hg log -GTl |
| 74 |
@ 3:915745f3ca3d p=2,1 m=3:8e9cf3456921 f=["b"] |
| 75 |
|\ |
| 76 |
| o 2:e0ea47086fce p=0,-1 m=2:b2e5b07f9374 f=["c"] |
| 77 |
| | |
| 78 |
o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
| 79 |
|/ |
| 80 |
o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
| 81 |
|
| 82 |
|
| 83 |
$ cd .. |
| 84 |
$ check_convert_identity added-both |
| 85 |
|
| 86 |
An identical file added at both parents: |
| 87 |
|
| 88 |
$ hg init added-identical |
| 89 |
$ cd added-identical |
| 90 |
$ touch a b |
| 91 |
$ hg ci -qAm0 a |
| 92 |
$ hg ci -qAm1 b |
| 93 |
$ hg up -q 0 |
| 94 |
$ touch b |
| 95 |
$ hg ci -qAm2 b |
| 96 |
|
| 97 |
$ hg merge |
| 98 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 99 |
(branch merge, don't forget to commit) |
| 100 |
$ hg ci --debug -m merge |
| 101 |
reusing manifest from p1 (no file change) |
| 102 |
committing changelog |
| 103 |
updating the branch cache |
| 104 |
committed changeset 3:de26182cd210f0c3fb175ca7616704ab963d3024 |
| 105 |
$ hg log -GTl |
| 106 |
@ 3:de26182cd210 p=2,1 m=1:686dbf0aeca4 f=[] |
| 107 |
|\ |
| 108 |
| o 2:f00991f11eca p=0,-1 m=1:686dbf0aeca4 f=["b"] |
| 109 |
| | |
| 110 |
o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
| 111 |
|/ |
| 112 |
o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
| 113 |
|
| 114 |
|
| 115 |
$ cd .. |
| 116 |
$ check_convert_identity added-identical |
| 117 |
|
| 118 |
#if execbit |
| 119 |
|
| 120 |
An identical file added at both parents, but the flag differs. Take local: |
| 121 |
|
| 122 |
$ hg init flag-change-take-p1 |
| 123 |
$ cd flag-change-take-p1 |
| 124 |
$ touch a b |
| 125 |
$ hg ci -qAm0 a |
| 126 |
$ hg ci -qAm1 b |
| 127 |
$ hg up -q 0 |
| 128 |
$ touch b |
| 129 |
$ chmod +x b |
| 130 |
$ hg ci -qAm2 b |
| 131 |
|
| 132 |
$ hg merge |
| 133 |
warning: cannot merge flags for b without common ancestor - keeping local flags |
| 134 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 135 |
(branch merge, don't forget to commit) |
| 136 |
$ chmod +x b |
| 137 |
$ hg ci --debug -m merge |
| 138 |
committing files: |
| 139 |
b |
| 140 |
reusing manifest from p1 (listed files actually unchanged) |
| 141 |
committing changelog |
| 142 |
updating the branch cache |
| 143 |
committed changeset 3:c8d50407916ef8a5a97cb6e36ca9bc844a6ee13e |
| 144 |
$ hg log -GTl |
| 145 |
@ 3:c8d50407916e p=2,1 m=2:36b69ba4b24b f=[] |
| 146 |
|\ |
| 147 |
| o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"] |
| 148 |
| | |
| 149 |
o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
| 150 |
|/ |
| 151 |
o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
| 152 |
|
| 153 |
$ hg files -vr3 |
| 154 |
0 a |
| 155 |
0 x b |
| 156 |
|
| 157 |
$ cd .. |
| 158 |
$ check_convert_identity flag-change-take-p1 |
| 159 |
|
| 160 |
An identical file added at both parents, but the flag differs. Take other: |
| 161 |
|
| 162 |
$ hg init flag-change-take-p2 |
| 163 |
$ cd flag-change-take-p2 |
| 164 |
$ touch a b |
| 165 |
$ hg ci -qAm0 a |
| 166 |
$ hg ci -qAm1 b |
| 167 |
$ hg up -q 0 |
| 168 |
$ touch b |
| 169 |
$ chmod +x b |
| 170 |
$ hg ci -qAm2 b |
| 171 |
|
| 172 |
$ hg merge |
| 173 |
warning: cannot merge flags for b without common ancestor - keeping local flags |
| 174 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 175 |
(branch merge, don't forget to commit) |
| 176 |
$ chmod -x b |
| 177 |
$ hg ci --debug -m merge |
| 178 |
committing files: |
| 179 |
b |
| 180 |
committing manifest |
| 181 |
committing changelog |
| 182 |
updating the branch cache |
| 183 |
committed changeset 3:06a62a687d87c7d8944743dee1ee9d8c66b3f6e3 |
| 184 |
$ hg log -GTl |
| 185 |
@ 3:06a62a687d87 p=2,1 m=3:2a315ba1aa45 f=["b"] |
| 186 |
|\ |
| 187 |
| o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"] |
| 188 |
| | |
| 189 |
o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
| 190 |
|/ |
| 191 |
o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
| 192 |
|
| 193 |
$ hg files -vr3 |
| 194 |
0 a |
| 195 |
0 b |
| 196 |
|
| 197 |
$ cd .. |
| 198 |
$ check_convert_identity flag-change-take-p2 |
| 199 |
|
| 200 |
#endif |
| 201 |
|
| 202 |
An identical file added at both parents, one more file added at p2: |
| 203 |
|
| 204 |
$ hg init added-some-p2 |
| 205 |
$ cd added-some-p2 |
| 206 |
$ touch a b c |
| 207 |
$ hg ci -qAm0 a |
| 208 |
$ hg ci -qAm1 b |
| 209 |
$ hg ci -qAm2 c |
| 210 |
$ hg up -q 0 |
| 211 |
$ touch b |
| 212 |
$ hg ci -qAm3 b |
| 213 |
|
| 214 |
$ hg merge |
| 215 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 216 |
(branch merge, don't forget to commit) |
| 217 |
$ hg ci --debug -m merge |
| 218 |
committing files: |
| 219 |
c |
| 220 |
not reusing manifest (no file change in changelog, but manifest differs) |
| 221 |
committing manifest |
| 222 |
committing changelog |
| 223 |
updating the branch cache |
| 224 |
committed changeset 4:f7fbc4e4d9a8fde03ba475adad675578c8bf472d |
| 225 |
$ hg log -GTl |
| 226 |
@ 4:f7fbc4e4d9a8 p=3,2 m=3:92acd5bfd716 f=[] |
| 227 |
|\ |
| 228 |
| o 3:e9d9f3cc981f p=0,-1 m=1:686dbf0aeca4 f=["b"] |
| 229 |
| | |
| 230 |
o | 2:93c5529a4ec7 p=1,-1 m=2:ae25a31b30b3 f=["c"] |
| 231 |
| | |
| 232 |
o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
| 233 |
|/ |
| 234 |
o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
| 235 |
|
| 236 |
|
| 237 |
$ cd .. |
| 238 |
$ check_convert_identity added-some-p2 |
| 239 |
|
| 240 |
An identical file added at both parents, one more file added at p1: |
| 241 |
(In this case, p1 manifest is reused at the merge commit, which means the |
| 242 |
manifest DAG does not have the same shape as the changelog.) |
| 243 |
|
| 244 |
$ hg init added-some-p1 |
| 245 |
$ cd added-some-p1 |
| 246 |
$ touch a b |
| 247 |
$ hg ci -qAm0 a |
| 248 |
$ hg ci -qAm1 b |
| 249 |
$ hg up -q 0 |
| 250 |
$ touch b c |
| 251 |
$ hg ci -qAm2 b |
| 252 |
$ hg ci -qAm3 c |
| 253 |
|
| 254 |
$ hg merge |
| 255 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 256 |
(branch merge, don't forget to commit) |
| 257 |
$ hg ci --debug -m merge |
| 258 |
reusing manifest from p1 (no file change) |
| 259 |
committing changelog |
| 260 |
updating the branch cache |
| 261 |
committed changeset 4:a9f0f589a913f5a149dc10dfbd5af726977c36c4 |
| 262 |
$ hg log -GTl |
| 263 |
@ 4:a9f0f589a913 p=3,1 m=2:ae25a31b30b3 f=[] |
| 264 |
|\ |
| 265 |
| o 3:b8dc385241b5 p=2,-1 m=2:ae25a31b30b3 f=["c"] |
| 266 |
| | |
| 267 |
| o 2:f00991f11eca p=0,-1 m=1:686dbf0aeca4 f=["b"] |
| 268 |
| | |
| 269 |
o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
| 270 |
|/ |
| 271 |
o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
| 272 |
|
| 273 |
|
| 274 |
$ cd .. |
| 275 |
$ check_convert_identity added-some-p1 |
| 276 |
|
| 277 |
A file added at p2, a named branch created at p1: |
| 278 |
|
| 279 |
$ hg init named-branch-p1 |
| 280 |
$ cd named-branch-p1 |
| 281 |
$ touch a b |
| 282 |
$ hg ci -qAm0 a |
| 283 |
$ hg ci -qAm1 b |
| 284 |
$ hg up -q 0 |
| 285 |
$ hg branch -q foo |
| 286 |
$ hg ci -m2 |
| 287 |
|
| 288 |
$ hg merge default |
| 289 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 290 |
(branch merge, don't forget to commit) |
| 291 |
$ hg ci --debug -m merge |
| 292 |
committing files: |
| 293 |
b |
| 294 |
not reusing manifest (no file change in changelog, but manifest differs) |
| 295 |
committing manifest |
| 296 |
committing changelog |
| 297 |
updating the branch cache |
| 298 |
committed changeset 3:fb97d83b02fd072295cfc2171f21b7d38509bfd7 |
| 299 |
$ hg log -GT'{l} branch={branch}' |
| 300 |
@ 3:fb97d83b02fd p=2,1 m=2:9091c64f4ea1 f=[] branch=foo |
| 301 |
|\ |
| 302 |
| o 2:a3a9fa6587e5 p=0,-1 m=0:8515d4bfda76 f=[] branch=foo |
| 303 |
| | |
| 304 |
o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] branch=default |
| 305 |
|/ |
| 306 |
o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default |
| 307 |
|
| 308 |
|
| 309 |
$ cd .. |
| 310 |
$ check_convert_identity named-branch-p1 |
| 311 |
|
| 312 |
A file added at p1, a named branch created at p2: |
| 313 |
(In this case, p1 manifest is reused at the merge commit, which means the |
| 314 |
manifest DAG does not have the same shape as the changelog.) |
| 315 |
|
| 316 |
$ hg init named-branch-p2 |
| 317 |
$ cd named-branch-p2 |
| 318 |
$ touch a b |
| 319 |
$ hg ci -qAm0 a |
| 320 |
$ hg branch -q foo |
| 321 |
$ hg ci -m1 |
| 322 |
$ hg up -q 0 |
| 323 |
$ hg ci -qAm1 b |
| 324 |
|
| 325 |
$ hg merge foo |
| 326 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 327 |
(branch merge, don't forget to commit) |
| 328 |
$ hg ci --debug -m merge |
| 329 |
reusing manifest from p1 (no file change) |
| 330 |
committing changelog |
| 331 |
updating the branch cache |
| 332 |
committed changeset 3:036823e24692218324d4af43b07ff89f8a000096 |
| 333 |
$ hg log -GT'{l} branch={branch}' |
| 334 |
@ 3:036823e24692 p=2,1 m=1:686dbf0aeca4 f=[] branch=default |
| 335 |
|\ |
| 336 |
| o 2:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] branch=default |
| 337 |
| | |
| 338 |
o | 1:da38c8e00727 p=0,-1 m=0:8515d4bfda76 f=[] branch=foo |
| 339 |
|/ |
| 340 |
o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default |
| 341 |
|
| 342 |
|
| 343 |
$ cd .. |
| 344 |
$ check_convert_identity named-branch-p2 |
| 345 |
|
| 346 |
A file changed once at both parents, but amended to have identical content: |
| 347 |
|
| 348 |
$ hg init amend-p1 |
| 349 |
$ cd amend-p1 |
| 350 |
$ touch a |
| 351 |
$ hg ci -qAm0 a |
| 352 |
$ echo foo > a |
| 353 |
$ hg ci -m1 |
| 354 |
$ hg up -q 0 |
| 355 |
$ echo bar > a |
| 356 |
$ hg ci -qm2 |
| 357 |
$ echo foo > a |
| 358 |
$ hg ci -qm3 --amend |
| 359 |
|
| 360 |
$ hg merge |
| 361 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 362 |
(branch merge, don't forget to commit) |
| 363 |
$ hg ci --debug -m merge |
| 364 |
reusing manifest from p1 (no file change) |
| 365 |
committing changelog |
| 366 |
updating the branch cache |
| 367 |
committed changeset 3:314e5bc5adf5c58ea571efabe33eedba20a201aa |
| 368 |
$ hg log -GT'{l} branch={branch}' |
| 369 |
@ 3:314e5bc5adf5 p=2,1 m=1:d33ea248bd73 f=[] branch=default |
| 370 |
|\ |
| 371 |
| o 2:de9c64f226a3 p=0,-1 m=1:d33ea248bd73 f=["a"] branch=default |
| 372 |
| | |
| 373 |
o | 1:6a74aec01b3c p=0,-1 m=1:d33ea248bd73 f=["a"] branch=default |
| 374 |
|/ |
| 375 |
o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default |
| 376 |
|
| 377 |
|
| 378 |
$ cd .. |
| 379 |
$ check_convert_identity amend-p1 |