| 1 |
$ hg init repo |
| 2 |
$ cd repo |
| 3 |
$ cat << EOF > a |
| 4 |
> Small Mathematical Series. |
| 5 |
> One |
| 6 |
> Two |
| 7 |
> Three |
| 8 |
> Four |
| 9 |
> Five |
| 10 |
> Hop we are done. |
| 11 |
> EOF |
| 12 |
$ hg add a |
| 13 |
$ hg commit -m ancestor |
| 14 |
$ cat << EOF > a |
| 15 |
> Small Mathematical Series. |
| 16 |
> 1 |
| 17 |
> 2 |
| 18 |
> 3 |
| 19 |
> 4 |
| 20 |
> 5 |
| 21 |
> Hop we are done. |
| 22 |
> EOF |
| 23 |
$ hg commit -m branch1 |
| 24 |
$ hg co 0 |
| 25 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 26 |
$ cat << EOF > a |
| 27 |
> Small Mathematical Series. |
| 28 |
> 1 |
| 29 |
> 2 |
| 30 |
> 3 |
| 31 |
> 6 |
| 32 |
> 8 |
| 33 |
> Hop we are done. |
| 34 |
> EOF |
| 35 |
$ hg commit -m branch2 |
| 36 |
created new head |
| 37 |
|
| 38 |
$ hg merge 1 |
| 39 |
merging a |
| 40 |
warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
| 41 |
0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
| 42 |
use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
| 43 |
[1] |
| 44 |
|
| 45 |
$ hg id |
| 46 |
618808747361+c0c68e4fe667+ tip |
| 47 |
|
| 48 |
$ echo "[commands]" >> $HGRCPATH |
| 49 |
$ echo "status.verbose=true" >> $HGRCPATH |
| 50 |
$ hg status |
| 51 |
M a |
| 52 |
? a.orig |
| 53 |
# The repository is in an unfinished *merge* state. |
| 54 |
|
| 55 |
# Unresolved merge conflicts: |
| 56 |
# |
| 57 |
# a |
| 58 |
# |
| 59 |
# To mark files as resolved: hg resolve --mark FILE |
| 60 |
|
| 61 |
# To continue: hg commit |
| 62 |
# To abort: hg merge --abort |
| 63 |
|
| 64 |
$ hg status -Tjson |
| 65 |
[ |
| 66 |
{ |
| 67 |
"itemtype": "file", |
| 68 |
"path": "a", |
| 69 |
"status": "M", |
| 70 |
"unresolved": true |
| 71 |
}, |
| 72 |
{ |
| 73 |
"itemtype": "file", |
| 74 |
"path": "a.orig", |
| 75 |
"status": "?" |
| 76 |
}, |
| 77 |
{ |
| 78 |
"itemtype": "morestatus", |
| 79 |
"unfinished": "merge", |
| 80 |
"unfinishedmsg": "To continue: hg commit\nTo abort: hg merge --abort" |
| 81 |
} |
| 82 |
] |
| 83 |
|
| 84 |
$ hg status -0 |
| 85 |
M a\x00? a.orig\x00 (no-eol) (esc) |
| 86 |
$ cat a |
| 87 |
Small Mathematical Series. |
| 88 |
1 |
| 89 |
2 |
| 90 |
3 |
| 91 |
<<<<<<< working copy: 618808747361 - test: branch2 |
| 92 |
6 |
| 93 |
8 |
| 94 |
======= |
| 95 |
4 |
| 96 |
5 |
| 97 |
>>>>>>> merge rev: c0c68e4fe667 - test: branch1 |
| 98 |
Hop we are done. |
| 99 |
|
| 100 |
$ hg status --config commands.status.verbose=0 |
| 101 |
M a |
| 102 |
? a.orig |
| 103 |
|
| 104 |
Verify custom conflict markers |
| 105 |
|
| 106 |
$ hg up -q --clean . |
| 107 |
$ cat <<EOF >> .hg/hgrc |
| 108 |
> [command-templates] |
| 109 |
> mergemarker = '{author} {rev}' |
| 110 |
> EOF |
| 111 |
|
| 112 |
$ hg merge 1 |
| 113 |
merging a |
| 114 |
warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
| 115 |
0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
| 116 |
use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
| 117 |
[1] |
| 118 |
|
| 119 |
$ cat a |
| 120 |
Small Mathematical Series. |
| 121 |
1 |
| 122 |
2 |
| 123 |
3 |
| 124 |
<<<<<<< working copy: test 2 |
| 125 |
6 |
| 126 |
8 |
| 127 |
======= |
| 128 |
4 |
| 129 |
5 |
| 130 |
>>>>>>> merge rev: test 1 |
| 131 |
Hop we are done. |
| 132 |
|
| 133 |
Verify custom conflict markers with legacy config name |
| 134 |
|
| 135 |
$ hg up -q --clean . |
| 136 |
$ cat <<EOF >> .hg/hgrc |
| 137 |
> [ui] |
| 138 |
> mergemarkertemplate = '{author} {rev}' |
| 139 |
> EOF |
| 140 |
|
| 141 |
$ hg merge 1 |
| 142 |
merging a |
| 143 |
warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
| 144 |
0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
| 145 |
use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
| 146 |
[1] |
| 147 |
|
| 148 |
$ cat a |
| 149 |
Small Mathematical Series. |
| 150 |
1 |
| 151 |
2 |
| 152 |
3 |
| 153 |
<<<<<<< working copy: test 2 |
| 154 |
6 |
| 155 |
8 |
| 156 |
======= |
| 157 |
4 |
| 158 |
5 |
| 159 |
>>>>>>> merge rev: test 1 |
| 160 |
Hop we are done. |
| 161 |
|
| 162 |
Verify line splitting of custom conflict marker which causes multiple lines |
| 163 |
|
| 164 |
$ hg up -q --clean . |
| 165 |
$ cat >> .hg/hgrc <<EOF |
| 166 |
> [command-templates] |
| 167 |
> mergemarker={author} {rev}\nfoo\nbar\nbaz |
| 168 |
> EOF |
| 169 |
|
| 170 |
$ hg -q merge 1 |
| 171 |
warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
| 172 |
[1] |
| 173 |
|
| 174 |
$ cat a |
| 175 |
Small Mathematical Series. |
| 176 |
1 |
| 177 |
2 |
| 178 |
3 |
| 179 |
<<<<<<< working copy: test 2 |
| 180 |
6 |
| 181 |
8 |
| 182 |
======= |
| 183 |
4 |
| 184 |
5 |
| 185 |
>>>>>>> merge rev: test 1 |
| 186 |
Hop we are done. |
| 187 |
|
| 188 |
Verify line trimming of custom conflict marker using multi-byte characters |
| 189 |
|
| 190 |
$ hg up -q --clean . |
| 191 |
$ "$PYTHON" <<EOF |
| 192 |
> fp = open('logfile', 'wb') |
| 193 |
> fp.write(b'12345678901234567890123456789012345678901234567890' + |
| 194 |
> b'1234567890') # there are 5 more columns for 80 columns |
| 195 |
> |
| 196 |
> # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes |
| 197 |
> fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8')) |
| 198 |
> |
| 199 |
> fp.close() |
| 200 |
> EOF |
| 201 |
$ hg add logfile |
| 202 |
$ hg --encoding utf-8 commit --logfile logfile |
| 203 |
|
| 204 |
$ cat >> .hg/hgrc <<EOF |
| 205 |
> [command-templates] |
| 206 |
> mergemarker={desc|firstline} |
| 207 |
> EOF |
| 208 |
|
| 209 |
$ hg -q --encoding utf-8 merge 1 |
| 210 |
warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
| 211 |
[1] |
| 212 |
|
| 213 |
$ cat a |
| 214 |
Small Mathematical Series. |
| 215 |
1 |
| 216 |
2 |
| 217 |
3 |
| 218 |
<<<<<<< working copy: 1234567890123456789012345678901234567890123456789012345... |
| 219 |
6 |
| 220 |
8 |
| 221 |
======= |
| 222 |
4 |
| 223 |
5 |
| 224 |
>>>>>>> merge rev: branch1 |
| 225 |
Hop we are done. |
| 226 |
|
| 227 |
Verify basic conflict markers |
| 228 |
|
| 229 |
$ hg up -q --clean 2 |
| 230 |
$ printf "\n[ui]\nmergemarkers=basic\n" >> .hg/hgrc |
| 231 |
|
| 232 |
$ hg merge 1 |
| 233 |
merging a |
| 234 |
warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
| 235 |
0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
| 236 |
use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
| 237 |
[1] |
| 238 |
|
| 239 |
$ cat a |
| 240 |
Small Mathematical Series. |
| 241 |
1 |
| 242 |
2 |
| 243 |
3 |
| 244 |
<<<<<<< working copy |
| 245 |
6 |
| 246 |
8 |
| 247 |
======= |
| 248 |
4 |
| 249 |
5 |
| 250 |
>>>>>>> merge rev |
| 251 |
Hop we are done. |
| 252 |
|
| 253 |
internal:merge3 |
| 254 |
|
| 255 |
$ hg up -q --clean . |
| 256 |
|
| 257 |
$ hg merge 1 --tool internal:merge3 |
| 258 |
merging a |
| 259 |
warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
| 260 |
0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
| 261 |
use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
| 262 |
[1] |
| 263 |
$ cat a |
| 264 |
Small Mathematical Series. |
| 265 |
<<<<<<< working copy |
| 266 |
1 |
| 267 |
2 |
| 268 |
3 |
| 269 |
6 |
| 270 |
8 |
| 271 |
||||||| common ancestor |
| 272 |
One |
| 273 |
Two |
| 274 |
Three |
| 275 |
Four |
| 276 |
Five |
| 277 |
======= |
| 278 |
1 |
| 279 |
2 |
| 280 |
3 |
| 281 |
4 |
| 282 |
5 |
| 283 |
>>>>>>> merge rev |
| 284 |
Hop we are done. |
| 285 |
|
| 286 |
internal:mergediff |
| 287 |
|
| 288 |
$ hg co -C 1 |
| 289 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 290 |
$ cat << EOF > a |
| 291 |
> Small Mathematical Series. |
| 292 |
> 1 |
| 293 |
> 2 |
| 294 |
> 3 |
| 295 |
> 4 |
| 296 |
> 4.5 |
| 297 |
> 5 |
| 298 |
> Hop we are done. |
| 299 |
> EOF |
| 300 |
$ hg co -m 2 -t internal:mergediff |
| 301 |
merging a |
| 302 |
warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
| 303 |
0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
| 304 |
use 'hg resolve' to retry unresolved file merges |
| 305 |
[1] |
| 306 |
$ cat a |
| 307 |
Small Mathematical Series. |
| 308 |
1 |
| 309 |
2 |
| 310 |
3 |
| 311 |
<<<<<<< |
| 312 |
------- working copy parent |
| 313 |
+++++++ working copy |
| 314 |
4 |
| 315 |
+4.5 |
| 316 |
5 |
| 317 |
======= destination |
| 318 |
6 |
| 319 |
8 |
| 320 |
>>>>>>> |
| 321 |
Hop we are done. |
| 322 |
Test the same thing as above but modify a bit more so we instead get the working |
| 323 |
copy in full and the diff from base to destination. |
| 324 |
$ hg co -C 1 |
| 325 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 326 |
$ cat << EOF > a |
| 327 |
> Small Mathematical Series. |
| 328 |
> 1 |
| 329 |
> 2 |
| 330 |
> 3.5 |
| 331 |
> 4.5 |
| 332 |
> 5.5 |
| 333 |
> Hop we are done. |
| 334 |
> EOF |
| 335 |
$ hg co -m 2 -t internal:mergediff |
| 336 |
merging a |
| 337 |
warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
| 338 |
0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
| 339 |
use 'hg resolve' to retry unresolved file merges |
| 340 |
[1] |
| 341 |
$ cat a |
| 342 |
Small Mathematical Series. |
| 343 |
1 |
| 344 |
2 |
| 345 |
<<<<<<< |
| 346 |
======= working copy |
| 347 |
3.5 |
| 348 |
4.5 |
| 349 |
5.5 |
| 350 |
------- working copy parent |
| 351 |
+++++++ destination |
| 352 |
3 |
| 353 |
-4 |
| 354 |
-5 |
| 355 |
+6 |
| 356 |
+8 |
| 357 |
>>>>>>> |
| 358 |
Hop we are done. |
| 359 |
|
| 360 |
Add some unconflicting changes on each head, to make sure we really |
| 361 |
are merging, unlike :local and :other |
| 362 |
|
| 363 |
$ hg up -C |
| 364 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 365 |
updated to "e0693e20f496: 123456789012345678901234567890123456789012345678901234567890????" |
| 366 |
1 other heads for branch "default" |
| 367 |
$ printf "\n\nEnd of file\n" >> a |
| 368 |
$ hg ci -m "Add some stuff at the end" |
| 369 |
$ hg up -r 1 |
| 370 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 371 |
$ printf "Start of file\n\n\n" > tmp |
| 372 |
$ cat a >> tmp |
| 373 |
$ mv tmp a |
| 374 |
$ hg ci -m "Add some stuff at the beginning" |
| 375 |
|
| 376 |
Now test :merge-other and :merge-local |
| 377 |
|
| 378 |
$ hg merge |
| 379 |
merging a |
| 380 |
warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
| 381 |
1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
| 382 |
use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
| 383 |
[1] |
| 384 |
$ hg resolve --tool :merge-other a |
| 385 |
merging a |
| 386 |
(no more unresolved files) |
| 387 |
$ cat a |
| 388 |
Start of file |
| 389 |
|
| 390 |
|
| 391 |
Small Mathematical Series. |
| 392 |
1 |
| 393 |
2 |
| 394 |
3 |
| 395 |
6 |
| 396 |
8 |
| 397 |
Hop we are done. |
| 398 |
|
| 399 |
|
| 400 |
End of file |
| 401 |
|
| 402 |
$ hg up -C |
| 403 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 404 |
updated to "18b51d585961: Add some stuff at the beginning" |
| 405 |
1 other heads for branch "default" |
| 406 |
$ hg merge --tool :merge-local |
| 407 |
merging a |
| 408 |
1 files updated, 1 files merged, 0 files removed, 0 files unresolved |
| 409 |
(branch merge, don't forget to commit) |
| 410 |
$ cat a |
| 411 |
Start of file |
| 412 |
|
| 413 |
|
| 414 |
Small Mathematical Series. |
| 415 |
1 |
| 416 |
2 |
| 417 |
3 |
| 418 |
4 |
| 419 |
5 |
| 420 |
Hop we are done. |
| 421 |
|
| 422 |
|
| 423 |
End of file |