Mercurial > public > mercurial-scm > hg
comparison mercurial/filemerge.py @ 26514:d5d8cd0e0d58
filemerge: call precheck if available
In upcoming patches we'll define a precheck function for some merge tools.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 06 Oct 2015 22:55:21 -0700 |
parents | 01224c28e0ed |
children | 0ffa7fe1076b |
comparison
equal
deleted
inserted
replaced
26513:01224c28e0ed | 26514:d5d8cd0e0d58 |
---|---|
465 | 465 |
466 if tool in internals: | 466 if tool in internals: |
467 func = internals[tool] | 467 func = internals[tool] |
468 trymerge = func.trymerge | 468 trymerge = func.trymerge |
469 onfailure = func.onfailure | 469 onfailure = func.onfailure |
470 precheck = func.precheck | |
470 else: | 471 else: |
471 func = _xmerge | 472 func = _xmerge |
472 trymerge = True | 473 trymerge = True |
473 onfailure = _("merging %s failed!\n") | 474 onfailure = _("merging %s failed!\n") |
475 precheck = None | |
474 | 476 |
475 toolconf = tool, toolpath, binary, symlink | 477 toolconf = tool, toolpath, binary, symlink |
476 | 478 |
477 if not trymerge: | 479 if not trymerge: |
478 return func(repo, mynode, orig, fcd, fco, fca, toolconf) | 480 return func(repo, mynode, orig, fcd, fco, fca, toolconf) |
488 else: | 490 else: |
489 ui.status(_("merging %s\n") % fd) | 491 ui.status(_("merging %s\n") % fd) |
490 | 492 |
491 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) | 493 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) |
492 | 494 |
493 markerstyle = ui.config('ui', 'mergemarkers', 'basic') | 495 r = 0 |
494 if not labels: | 496 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, |
495 labels = _defaultconflictlabels | 497 toolconf): |
496 if markerstyle != 'basic': | 498 r = 1 |
497 labels = _formatlabels(repo, fcd, fco, fca, labels) | 499 needcheck = False |
498 | 500 |
499 needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf, | 501 if not r: # precheck passed |
500 (a, b, c, back), labels=labels) | 502 markerstyle = ui.config('ui', 'mergemarkers', 'basic') |
503 if not labels: | |
504 labels = _defaultconflictlabels | |
505 if markerstyle != 'basic': | |
506 labels = _formatlabels(repo, fcd, fco, fca, labels) | |
507 | |
508 needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf, | |
509 (a, b, c, back), labels=labels) | |
510 | |
501 if not needcheck: | 511 if not needcheck: |
502 if r: | 512 if r: |
503 if onfailure: | 513 if onfailure: |
504 ui.warn(onfailure % fd) | 514 ui.warn(onfailure % fd) |
505 else: | 515 else: |