Show More
@@ -408,7 +408,7 b' def _premerge(repo, fcd, fco, fca, toolc' | |||||
408 |
|
408 | |||
409 | ui = repo.ui |
|
409 | ui = repo.ui | |
410 |
|
410 | |||
411 | validkeep = [b'keep', b'keep-merge3'] |
|
411 | validkeep = [b'keep', b'keep-merge3', b'keep-mergediff'] | |
412 |
|
412 | |||
413 | # do we attempt to simplemerge first? |
|
413 | # do we attempt to simplemerge first? | |
414 | try: |
|
414 | try: | |
@@ -423,12 +423,17 b' def _premerge(repo, fcd, fco, fca, toolc' | |||||
423 | ) |
|
423 | ) | |
424 |
|
424 | |||
425 | if premerge: |
|
425 | if premerge: | |
426 | if premerge == b'keep-merge3': |
|
426 | mode = b'merge' | |
|
427 | if premerge in {b'keep-merge3', b'keep-mergediff'}: | |||
427 | if not labels: |
|
428 | if not labels: | |
428 | labels = _defaultconflictlabels |
|
429 | labels = _defaultconflictlabels | |
429 | if len(labels) < 3: |
|
430 | if len(labels) < 3: | |
430 | labels.append(b'base') |
|
431 | labels.append(b'base') | |
431 | r = simplemerge.simplemerge(ui, fcd, fca, fco, quiet=True, label=labels) |
|
432 | if premerge == b'keep-mergediff': | |
|
433 | mode = b'mergediff' | |||
|
434 | r = simplemerge.simplemerge( | |||
|
435 | ui, fcd, fca, fco, quiet=True, label=labels, mode=mode | |||
|
436 | ) | |||
432 | if not r: |
|
437 | if not r: | |
433 | ui.debug(b" premerge successful\n") |
|
438 | ui.debug(b" premerge successful\n") | |
434 | return 0 |
|
439 | return 0 |
@@ -1521,12 +1521,13 b' Supported arguments:' | |||||
1521 |
|
1521 | |||
1522 | ``premerge`` |
|
1522 | ``premerge`` | |
1523 | Attempt to run internal non-interactive 3-way merge tool before |
|
1523 | Attempt to run internal non-interactive 3-way merge tool before | |
1524 |
launching external tool. Options are ``true``, ``false``, ``keep`` |
|
1524 | launching external tool. Options are ``true``, ``false``, ``keep``, | |
1525 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the |
|
1525 | ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option | |
1526 | premerge fails. The ``keep-merge3`` will do the same but include information |
|
1526 | will leave markers in the file if the premerge fails. The ``keep-merge3`` | |
1527 | about the base of the merge in the marker (see internal :merge3 in |
|
1527 | will do the same but include information about the base of the merge in the | |
1528 | :hg:`help merge-tools`). |
|
1528 | marker (see internal :merge3 in :hg:`help merge-tools`). The | |
1529 | (default: True) |
|
1529 | ``keep-mergediff`` option is similar but uses a different marker style | |
|
1530 | (see internal :merge3 in :hg:`help merge-tools`). (default: True) | |||
1530 |
|
1531 | |||
1531 | ``binary`` |
|
1532 | ``binary`` | |
1532 | This tool can merge binary files. (default: False, unless tool |
|
1533 | This tool can merge binary files. (default: False, unless tool |
@@ -33,7 +33,9 b'' | |||||
33 | `internal:merge3`, but it shows conflicts differently. Instead of |
|
33 | `internal:merge3`, but it shows conflicts differently. Instead of | |
34 | showing 2 or 3 snapshots of the conflicting pieces of code, it |
|
34 | showing 2 or 3 snapshots of the conflicting pieces of code, it | |
35 | shows one snapshot and a diff. This may be useful when at least one |
|
35 | shows one snapshot and a diff. This may be useful when at least one | |
36 | side of the conflict is similar to the base. |
|
36 | side of the conflict is similar to the base. The new marker style | |
|
37 | is also supported by "premerge" as | |||
|
38 | `merge-tools.<tool>.premerge=keep-mergediff`. | |||
37 |
|
39 | |||
38 | == New Experimental Features == |
|
40 | == New Experimental Features == | |
39 |
|
41 |
@@ -1255,6 +1255,46 b' premerge=keep-merge3 keeps conflict mark' | |||||
1255 | # hg resolve --list |
|
1255 | # hg resolve --list | |
1256 | R f |
|
1256 | R f | |
1257 |
|
1257 | |||
|
1258 | premerge=keep-mergediff keeps conflict markers with base content: | |||
|
1259 | ||||
|
1260 | $ beforemerge | |||
|
1261 | [merge-tools] | |||
|
1262 | false.whatever= | |||
|
1263 | true.priority=1 | |||
|
1264 | true.executable=cat | |||
|
1265 | # hg update -C 1 | |||
|
1266 | $ hg merge -r 4 --config merge-tools.true.premerge=keep-mergediff | |||
|
1267 | merging f | |||
|
1268 | <<<<<<< | |||
|
1269 | ------- base | |||
|
1270 | +++++++ working copy: ef83787e2614 - test: revision 1 | |||
|
1271 | -revision 0 | |||
|
1272 | +revision 1 | |||
|
1273 | space | |||
|
1274 | ======= merge rev: 81448d39c9a0 - test: revision 4 | |||
|
1275 | revision 4 | |||
|
1276 | >>>>>>> | |||
|
1277 | revision 0 | |||
|
1278 | space | |||
|
1279 | revision 4 | |||
|
1280 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
1281 | (branch merge, don't forget to commit) | |||
|
1282 | $ aftermerge | |||
|
1283 | # cat f | |||
|
1284 | <<<<<<< | |||
|
1285 | ------- base | |||
|
1286 | +++++++ working copy: ef83787e2614 - test: revision 1 | |||
|
1287 | -revision 0 | |||
|
1288 | +revision 1 | |||
|
1289 | space | |||
|
1290 | ======= merge rev: 81448d39c9a0 - test: revision 4 | |||
|
1291 | revision 4 | |||
|
1292 | >>>>>>> | |||
|
1293 | # hg stat | |||
|
1294 | M f | |||
|
1295 | # hg resolve --list | |||
|
1296 | R f | |||
|
1297 | ||||
1258 | premerge=keep respects ui.mergemarkers=basic: |
|
1298 | premerge=keep respects ui.mergemarkers=basic: | |
1259 |
|
1299 | |||
1260 | $ beforemerge |
|
1300 | $ beforemerge |
General Comments 0
You need to be logged in to leave comments.
Login now