Show More
@@ -1601,6 +1601,14 b' coreconfigitem(' | |||||
1601 | experimental=True, |
|
1601 | experimental=True, | |
1602 | ) |
|
1602 | ) | |
1603 | coreconfigitem( |
|
1603 | coreconfigitem( | |
|
1604 | b'partial-merge-tools', | |||
|
1605 | br'.*\.args', | |||
|
1606 | default=b"$local $base $other", | |||
|
1607 | generic=True, | |||
|
1608 | priority=-1, | |||
|
1609 | experimental=True, | |||
|
1610 | ) | |||
|
1611 | coreconfigitem( | |||
1604 | b'merge-tools', |
|
1612 | b'merge-tools', | |
1605 | b'.*', |
|
1613 | b'.*', | |
1606 | default=None, |
|
1614 | default=None, |
@@ -1119,7 +1119,7 b' def filemerge(repo, wctx, mynode, orig, ' | |||||
1119 | def _run_partial_resolution_tools(repo, local, other, base): |
|
1119 | def _run_partial_resolution_tools(repo, local, other, base): | |
1120 | """Runs partial-resolution tools on the three inputs and updates them.""" |
|
1120 | """Runs partial-resolution tools on the three inputs and updates them.""" | |
1121 | ui = repo.ui |
|
1121 | ui = repo.ui | |
1122 | # Tuples of (order, name, executable path) |
|
1122 | # Tuples of (order, name, executable path, args) | |
1123 | tools = [] |
|
1123 | tools = [] | |
1124 | seen = set() |
|
1124 | seen = set() | |
1125 | section = b"partial-merge-tools" |
|
1125 | section = b"partial-merge-tools" | |
@@ -1135,7 +1135,8 b' def _run_partial_resolution_tools(repo, ' | |||||
1135 | if is_match: |
|
1135 | if is_match: | |
1136 | order = ui.configint(section, b'%s.order' % name, 0) |
|
1136 | order = ui.configint(section, b'%s.order' % name, 0) | |
1137 | executable = ui.config(section, b'%s.executable' % name, name) |
|
1137 | executable = ui.config(section, b'%s.executable' % name, name) | |
1138 | tools.append((order, name, executable)) |
|
1138 | args = ui.config(section, b'%s.args' % name) | |
|
1139 | tools.append((order, name, executable, args)) | |||
1139 |
|
1140 | |||
1140 | if not tools: |
|
1141 | if not tools: | |
1141 | return |
|
1142 | return | |
@@ -1151,11 +1152,21 b' def _run_partial_resolution_tools(repo, ' | |||||
1151 | with _maketempfiles(files) as temppaths: |
|
1152 | with _maketempfiles(files) as temppaths: | |
1152 | localpath, basepath, otherpath = temppaths |
|
1153 | localpath, basepath, otherpath = temppaths | |
1153 |
|
1154 | |||
1154 | for order, name, executable in tools: |
|
1155 | for order, name, executable, args in tools: | |
1155 | cmd = procutil.shellquote(executable) |
|
1156 | cmd = procutil.shellquote(executable) | |
1156 | # TODO: Allow the user to configure the command line using |
|
1157 | replace = { | |
1157 |
|
|
1158 | b'local': localpath, | |
1158 | cmd = b'%s %s %s %s' % (cmd, localpath, basepath, otherpath) |
|
1159 | b'base': basepath, | |
|
1160 | b'other': otherpath, | |||
|
1161 | } | |||
|
1162 | args = util.interpolate( | |||
|
1163 | br'\$', | |||
|
1164 | replace, | |||
|
1165 | args, | |||
|
1166 | lambda s: procutil.shellquote(util.localpath(s)), | |||
|
1167 | ) | |||
|
1168 | ||||
|
1169 | cmd = b'%s %s' % (cmd, args) | |||
1159 | r = ui.system(cmd, cwd=repo.root, blockedtag=b'partial-mergetool') |
|
1170 | r = ui.system(cmd, cwd=repo.root, blockedtag=b'partial-mergetool') | |
1160 | if r: |
|
1171 | if r: | |
1161 | raise error.StateError( |
|
1172 | raise error.StateError( |
@@ -207,3 +207,35 b' merge the rest, then the regular merge t' | |||||
207 | c |
|
207 | c | |
208 | d |
|
208 | d | |
209 | e3 |
|
209 | e3 | |
|
210 | ||||
|
211 | Test that arguments get passed as expected. | |||
|
212 | ||||
|
213 | $ cat >> "$TESTTMP/log-args.sh" <<'EOF' | |||
|
214 | > #!/bin/sh | |||
|
215 | > echo "$@" > args.log | |||
|
216 | > EOF | |||
|
217 | $ chmod +x "$TESTTMP/log-args.sh" | |||
|
218 | $ cat >> "$HGRCPATH" <<EOF | |||
|
219 | > [partial-merge-tools] | |||
|
220 | > log-args.executable=$TESTTMP/log-args.sh | |||
|
221 | > EOF | |||
|
222 | $ hg up -C 2 | |||
|
223 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
224 | $ hg merge 1 | |||
|
225 | merging file | |||
|
226 | warning: conflicts while merging file! (edit, then use 'hg resolve --mark') | |||
|
227 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
228 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |||
|
229 | [1] | |||
|
230 | $ cat args.log | |||
|
231 | */hgmerge-*/file~local */hgmerge-*/file~base */hgmerge-*/file~other (glob) | |||
|
232 | $ hg up -C 2 | |||
|
233 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
234 | $ hg merge 1 --config partial-merge-tools.log-args.args='--other $other $base --foo --local $local --also-other $other' | |||
|
235 | merging file | |||
|
236 | warning: conflicts while merging file! (edit, then use 'hg resolve --mark') | |||
|
237 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
238 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |||
|
239 | [1] | |||
|
240 | $ cat args.log | |||
|
241 | --other */hgmerge-*/file~other */hgmerge-*/file~base --foo --local */hgmerge-*/file~local --also-other */hgmerge-*/file~other (glob) |
General Comments 0
You need to be logged in to leave comments.
Login now