Mercurial > public > mercurial-scm > hg
comparison mercurial/filemerge.py @ 26529:7833b13b001f
filemerge: move precheck to before files are written out
This is much simpler, and also avoids unnecessary disk IO.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 07 Oct 2015 21:28:43 -0700 |
parents | 8bfef5737321 |
children | f18646cf0e93 |
comparison
equal
deleted
inserted
replaced
26528:8bfef5737321 | 26529:7833b13b001f |
---|---|
498 else: | 498 else: |
499 ui.status(_("merging %s\n") % fd) | 499 ui.status(_("merging %s\n") % fd) |
500 | 500 |
501 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) | 501 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) |
502 | 502 |
503 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, | |
504 toolconf): | |
505 if onfailure: | |
506 ui.warn(onfailure % fd) | |
507 return 1 | |
508 | |
503 a = repo.wjoin(fd) | 509 a = repo.wjoin(fd) |
504 b = temp("base", fca) | 510 b = temp("base", fca) |
505 c = temp("other", fco) | 511 c = temp("other", fco) |
506 back = a + ".orig" | 512 back = a + ".orig" |
507 util.copyfile(a, back) | 513 util.copyfile(a, back) |
508 files = (a, b, c, back) | 514 files = (a, b, c, back) |
509 | 515 |
510 r = 0 | 516 markerstyle = ui.config('ui', 'mergemarkers', 'basic') |
511 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, | 517 if not labels: |
512 toolconf): | 518 labels = _defaultconflictlabels |
513 r = 1 | 519 if markerstyle != 'basic': |
514 needcheck = False | 520 labels = _formatlabels(repo, fcd, fco, fca, labels) |
515 | 521 |
516 if not r: # precheck passed | 522 needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf, files, |
517 markerstyle = ui.config('ui', 'mergemarkers', 'basic') | 523 labels=labels) |
518 if not labels: | |
519 labels = _defaultconflictlabels | |
520 if markerstyle != 'basic': | |
521 labels = _formatlabels(repo, fcd, fco, fca, labels) | |
522 | |
523 needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf, | |
524 files, labels=labels) | |
525 | 524 |
526 if not needcheck: | 525 if not needcheck: |
527 if r: | 526 if r: |
528 if onfailure: | 527 if onfailure: |
529 ui.warn(onfailure % fd) | 528 ui.warn(onfailure % fd) |