diff --git a/doc/hgrc.5.txt b/doc/hgrc.5.txt --- a/doc/hgrc.5.txt +++ b/doc/hgrc.5.txt @@ -463,13 +463,19 @@ Supported arguments: ``symlink`` This tool can merge symlinks. Defaults to False, even if tool was selected by file pattern match. -``checkconflicts`` - Check whether there are conflicts even though the tool reported - success. +``check`` + A list of merge success-checking options: + + ``changed`` + Ask whether merge was successful when the merged file shows no changes. + ``conflicts`` + Check whether there are conflicts even though the tool reported success. + +``checkchanged`` + True is equivalent to ``check = changed``. Default: False -``checkchanged`` - Check whether outputs were written even though the tool reported - success. +``checkconflicts`` + True is equivalent to ``check = conflicts``. Default: False ``fixeol`` Attempt to fix up EOL changes caused by the merge tool. diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -16,6 +16,9 @@ def _toolstr(ui, tool, part, default="") def _toolbool(ui, tool, part, default=False): return ui.configbool("merge-tools", tool + "." + part, default) +def _toollist(ui, tool, part, default=[]): + return ui.configlist("merge-tools", tool + "." + part, default) + _internal = ['internal:' + s for s in 'fail local other merge prompt dump'.split()] @@ -223,11 +226,13 @@ def filemerge(repo, mynode, orig, fcd, f lambda x: '"%s"' % util.localpath(replace[x.group()[1:]]), args) r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env) - if not r and _toolbool(ui, tool, "checkconflicts"): + if not r and (_toolbool(ui, tool, "checkconflicts") or + 'conflicts' in _toollist(ui, tool, "check")): if re.match("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcd.data()): r = 1 - if not r and _toolbool(ui, tool, "checkchanged"): + if not r and (_toolbool(ui, tool, "checkchanged") or + 'changed' in _toollist(ui, tool, "check")): if filecmp.cmp(repo.wjoin(fd), back): if ui.promptchoice(_(" output file %s appears unchanged\n" "was merge successful (yn)?") % fd,