diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -1132,7 +1132,9 @@ def _run_partial_resolution_tools(repo, patterns = ui.configlist(section, b'%s.patterns' % name, []) is_match = True if patterns: - m = match.match(repo.root, b'', patterns) + m = match.match( + repo.root, b'', patterns, ctx=local.fctx.changectx() + ) is_match = m(local.fctx.path()) if is_match: if ui.configbool(section, b'%s.disable' % name): diff --git a/tests/test-merge-partial-tool.t b/tests/test-merge-partial-tool.t --- a/tests/test-merge-partial-tool.t +++ b/tests/test-merge-partial-tool.t @@ -196,6 +196,30 @@ only `tail` should run >>>>>>> merge rev: 8c217da987be - test: a b c d e f2 +Filesets can be used to select which files to run partial merge tools on. + + $ hg up -C 4 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg merge 3 -t :merge3 --config partial-merge-tools.head.patterns=set:other + merging file + warning: conflicts while merging file! (edit, then use 'hg resolve --mark') + 0 files updated, 0 files merged, 0 files removed, 1 files unresolved + use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon + [1] + $ cat file + b + c + d + e + <<<<<<< working copy: d57edaa6e21a - test: a b c d e f3 + f3 + ||||||| common ancestor: 8ae8bb9cc43a - test: a b c d e f + f + ======= + f2 + >>>>>>> merge rev: 8c217da987be - test: a b c d e f2 + + If there are several matching tools, they are run in requested order. We move `head` after `tail` in order here so it has no effect (the conflict in "f" thus remains).