Show More
@@ -454,7 +454,8 b' Supported arguments:' | |||||
454 | Default: ``$local $base $other`` |
|
454 | Default: ``$local $base $other`` | |
455 | ``premerge`` |
|
455 | ``premerge`` | |
456 | Attempt to run internal non-interactive 3-way merge tool before |
|
456 | Attempt to run internal non-interactive 3-way merge tool before | |
457 | launching external tool. |
|
457 | launching external tool. Options are ``true``, ``false``, or ``keep`` | |
|
458 | to leave markers in the file if the premerge fails. | |||
458 | Default: True |
|
459 | Default: True | |
459 | ``binary`` |
|
460 | ``binary`` | |
460 | This tool can merge binary files. Defaults to False, unless tool |
|
461 | This tool can merge binary files. Defaults to False, unless tool |
@@ -7,7 +7,7 b'' | |||||
7 |
|
7 | |||
8 | from node import short |
|
8 | from node import short | |
9 | from i18n import _ |
|
9 | from i18n import _ | |
10 | import util, simplemerge, match |
|
10 | import util, simplemerge, match, error | |
11 | import os, tempfile, re, filecmp |
|
11 | import os, tempfile, re, filecmp | |
12 |
|
12 | |||
13 | def _toolstr(ui, tool, part, default=""): |
|
13 | def _toolstr(ui, tool, part, default=""): | |
@@ -176,7 +176,18 b' def filemerge(repo, mynode, orig, fcd, f' | |||||
176 | ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) |
|
176 | ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) | |
177 |
|
177 | |||
178 | # do we attempt to simplemerge first? |
|
178 | # do we attempt to simplemerge first? | |
179 | if _toolbool(ui, tool, "premerge", not (binary or symlink)): |
|
179 | try: | |
|
180 | premerge = _toolbool(ui, tool, "premerge", not (binary or symlink)) | |||
|
181 | except error.ConfigError: | |||
|
182 | premerge = _toolstr(ui, tool, "premerge").lower() | |||
|
183 | valid = 'keep'.split() | |||
|
184 | if premerge not in valid: | |||
|
185 | _valid = ', '.join(["'" + v + "'" for v in valid]) | |||
|
186 | raise error.ConfigError(_("%s.premerge not valid " | |||
|
187 | "('%s' is neither boolean nor %s)") % | |||
|
188 | (tool, premerge, _valid)) | |||
|
189 | ||||
|
190 | if premerge: | |||
180 | r = simplemerge.simplemerge(ui, a, b, c, quiet=True) |
|
191 | r = simplemerge.simplemerge(ui, a, b, c, quiet=True) | |
181 | if not r: |
|
192 | if not r: | |
182 | ui.debug(" premerge successful\n") |
|
193 | ui.debug(" premerge successful\n") | |
@@ -184,7 +195,8 b' def filemerge(repo, mynode, orig, fcd, f' | |||||
184 | os.unlink(b) |
|
195 | os.unlink(b) | |
185 | os.unlink(c) |
|
196 | os.unlink(c) | |
186 | return 0 |
|
197 | return 0 | |
187 | util.copyfile(back, a) # restore from backup and try again |
|
198 | if premerge != 'keep': | |
|
199 | util.copyfile(back, a) # restore from backup and try again | |||
188 |
|
200 | |||
189 | env = dict(HG_FILE=fd, |
|
201 | env = dict(HG_FILE=fd, | |
190 | HG_MY_NODE=short(mynode), |
|
202 | HG_MY_NODE=short(mynode), |
General Comments 0
You need to be logged in to leave comments.
Login now