changeset 49840:59466b13a3ae stable 6.3.2

filemerge: fix crash when using filesets in [partial-merge-tools] Without this patch, you'd get `mercurial.error.ProgrammingError: fileset expression with no context`.
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 03 Jan 2023 13:38:56 -0800
parents 3d7bf111f01e
children 72e208414f81
files mercurial/filemerge.py tests/test-merge-partial-tool.t
diffstat 2 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/filemerge.py	Tue Dec 06 17:12:59 2022 -0500
+++ b/mercurial/filemerge.py	Tue Jan 03 13:38:56 2023 -0800
@@ -1132,7 +1132,9 @@
         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):
--- a/tests/test-merge-partial-tool.t	Tue Dec 06 17:12:59 2022 -0500
+++ b/tests/test-merge-partial-tool.t	Tue Jan 03 13:38:56 2023 -0800
@@ -196,6 +196,30 @@
   >>>>>>> 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).