# HG changeset patch # User Siddharth Agarwal # Date 1444278523 25200 # Node ID 7833b13b001f35a99bf63ac36d3b272e74b65384 # Parent 8bfef57373214a37fe2121f77414bf0bb88ba484 filemerge: move precheck to before files are written out This is much simpler, and also avoids unnecessary disk IO. diff -r 8bfef5737321 -r 7833b13b001f mercurial/filemerge.py --- a/mercurial/filemerge.py Wed Oct 07 22:58:52 2015 -0700 +++ b/mercurial/filemerge.py Wed Oct 07 21:28:43 2015 -0700 @@ -500,6 +500,12 @@ ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) + if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, + toolconf): + if onfailure: + ui.warn(onfailure % fd) + return 1 + a = repo.wjoin(fd) b = temp("base", fca) c = temp("other", fco) @@ -507,21 +513,14 @@ util.copyfile(a, back) files = (a, b, c, back) - r = 0 - if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, - toolconf): - r = 1 - needcheck = False + markerstyle = ui.config('ui', 'mergemarkers', 'basic') + if not labels: + labels = _defaultconflictlabels + if markerstyle != 'basic': + labels = _formatlabels(repo, fcd, fco, fca, labels) - if not r: # precheck passed - markerstyle = ui.config('ui', 'mergemarkers', 'basic') - if not labels: - labels = _defaultconflictlabels - if markerstyle != 'basic': - labels = _formatlabels(repo, fcd, fco, fca, labels) - - needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf, - files, labels=labels) + needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf, files, + labels=labels) if not needcheck: if r: