Mercurial > hg-stable
comparison mercurial/commands.py @ 6004:5af5f0f9d724
merge: allow smarter tool configuration
Add [merge-tool] hgrc section with:
<tool>.executable = name or path (<tool>)
<tool>.args = args with $local/base/other/output ($local $base $other)
<tool>.priority = priority (default 0)
<tool>.binary = handles binary (False)
<tool>.symlink = handles symlinks (False)
<tool>.checkconflict = check for conflict markers (False)
<tool>.premerge = try internal simplemerge (True if not binary or symlink)
Four built-in tools: internal:{merge,local,other,fail}
Add [merge-patterns] section of the form:
<pattern> = <tool>
Priority of settings is:
HGMERGE
merge-patterns
ui:merge
merge-tools by priority
hgmerge, if it can be found
Changes:
unsuccessful merges leave .orig files
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 03 Feb 2008 19:29:05 -0600 |
parents | 30d2fecaab76 |
children | 2da5b19a6460 |
comparison
equal
deleted
inserted
replaced
6003:7855b88ba838 | 6004:5af5f0f9d724 |
---|---|
810 " to http://www.selenic.com/mercurial/bts\n")) | 810 " to http://www.selenic.com/mercurial/bts\n")) |
811 problems += patchproblems | 811 problems += patchproblems |
812 | 812 |
813 os.unlink(fa) | 813 os.unlink(fa) |
814 os.unlink(fd) | 814 os.unlink(fd) |
815 | |
816 # merge helper | |
817 ui.status(_("Checking merge helper...\n")) | |
818 cmd = (os.environ.get("HGMERGE") or ui.config("ui", "merge") | |
819 or "hgmerge") | |
820 cmdpath = util.find_exe(cmd) or util.find_exe(cmd.split()[0]) | |
821 if not cmdpath: | |
822 if cmd == 'hgmerge': | |
823 ui.write(_(" No merge helper set and can't find default" | |
824 " hgmerge script in PATH\n")) | |
825 ui.write(_(" (specify a merge helper in your .hgrc file)\n")) | |
826 else: | |
827 ui.write(_(" Can't find merge helper '%s' in PATH\n") % cmd) | |
828 ui.write(_(" (specify a merge helper in your .hgrc file)\n")) | |
829 problems += 1 | |
830 else: | |
831 # actually attempt a patch here | |
832 fa = writetemp("1\n2\n3\n4\n") | |
833 fl = writetemp("1\n2\n3\ninsert\n4\n") | |
834 fr = writetemp("begin\n1\n2\n3\n4\n") | |
835 r = util.system('%s "%s" "%s" "%s"' % (cmd, fl, fa, fr)) | |
836 if r: | |
837 ui.write(_(" Got unexpected merge error %d!\n") % r) | |
838 problems += 1 | |
839 m = file(fl).read() | |
840 if m != "begin\n1\n2\n3\ninsert\n4\n": | |
841 ui.write(_(" Got unexpected merge results!\n")) | |
842 ui.write(_(" (your merge helper may have the" | |
843 " wrong argument order)\n")) | |
844 ui.write(_(" Result: %r\n") % m) | |
845 problems += 1 | |
846 os.unlink(fa) | |
847 os.unlink(fl) | |
848 os.unlink(fr) | |
849 | 815 |
850 # editor | 816 # editor |
851 ui.status(_("Checking commit editor...\n")) | 817 ui.status(_("Checking commit editor...\n")) |
852 editor = ui.geteditor() | 818 editor = ui.geteditor() |
853 cmdpath = util.find_exe(editor) or util.find_exe(editor.split()[0]) | 819 cmdpath = util.find_exe(editor) or util.find_exe(editor.split()[0]) |