git-gui: Support more merge tools.
Add native support for Araxis Merge, WinMerge and Perforce merge. Custom merge tools are not implemented by mergetool.tcl; besides, native support allows constructing the command lines in a more intelligent way. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Alexander Gavrilov committed
Aug 31, 2008 at 00:59 UTC
48c74a58b129e7230d74b2fba5c2d29eaa1f11dc
1 file changed
+27
lib/mergetool.tcl
+27
@@ -131,6 +131,7 @@ proc merge_resolve_tool2 {} {
131
if {$merge_tool_path eq {}} {
132
switch -- $tool {
133
emerge { set merge_tool_path "emacs" }
134
+ araxis { set merge_tool_path "compare" }
135
default { set merge_tool_path $tool }
136
}
137
}
@@ -210,6 +211,31 @@ proc merge_resolve_tool2 {} {
211
"$LOCAL" "$REMOTE" "$basename"]
212
}
213
}
214
+ winmerge {
215
+ if {$base_stage ne {}} {
216
+ # This tool does not support 3-way merges.
217
+ # Use the 'conflict file' resolution feature instead.
218
+ set cmdline [list "$merge_tool_path" -e -ub "$MERGED"]
219
+ } else {
220
+ set cmdline [list "$merge_tool_path" -e -ub -wl \
221
+ -dl "Theirs File" -dr "Mine File" "$REMOTE" "$LOCAL" "$MERGED"]
222
+ }
223
+ }
224
+ araxis {
225
+ if {$base_stage ne {}} {
226
+ set cmdline [list "$merge_tool_path" -wait -merge -3 -a1 \
227
+ -title1:"'$MERGED (Base)'" -title2:"'$MERGED (Local)'" \
228
+ -title3:"'$MERGED (Remote)'" \
229
+ "$BASE" "$LOCAL" "$REMOTE" "$MERGED"]
230
+ } else {
231
+ set cmdline [list "$merge_tool_path" -wait -2 \
232
+ -title1:"'$MERGED (Local)'" -title2:"'$MERGED (Remote)'" \
233
+ "$LOCAL" "$REMOTE" "$MERGED"]
234
+ }
235
+ }
236
+ p4merge {
237
+ set cmdline [list "$merge_tool_path" "$BASE" "$REMOTE" "$LOCAL" "$MERGED"]
238
+ }
239
vimdiff {
240
error_popup [mc "Not a GUI merge tool: '%s'" $tool]
241
return
@@ -236,6 +262,7 @@ proc merge_tool_get_stages {target stages} {
262
foreach fname $stages {
263
if {$merge_stages($i) eq {}} {
264
file delete $fname
265
+ catch { close [open $fname w] }
266
} else {
267
# A hack to support autocrlf properly
268
git checkout-index -f --stage=$i -- $target