Merge branch 'dm/mergetool-vimdiff'

* dm/mergetool-vimdiff:
  mergetool-lib: make the three-way diff the default for vim/gvim
  mergetool-lib: add a three-way diff view for vim/gvim
  mergetool-lib: combine vimdiff and gvimdiff run blocks
This commit is contained in:
Junio C Hamano 2010-10-26 21:47:11 -07:00
commit 0141215c9b

View File

@ -10,10 +10,10 @@ merge_mode() {
translate_merge_tool_path () { translate_merge_tool_path () {
case "$1" in case "$1" in
vimdiff) vimdiff|vimdiff2)
echo vim echo vim
;; ;;
gvimdiff) gvimdiff|gvimdiff2)
echo gvim echo gvim
;; ;;
emerge) emerge)
@ -47,7 +47,8 @@ check_unchanged () {
valid_tool () { valid_tool () {
case "$1" in case "$1" in
kdiff3 | tkdiff | xxdiff | meld | opendiff | \ kdiff3 | tkdiff | xxdiff | meld | opendiff | \
emerge | vimdiff | gvimdiff | ecmerge | diffuse | araxis | p4merge) vimdiff | gvimdiff | vimdiff2 | gvimdiff2 | \
emerge | ecmerge | diffuse | araxis | p4merge)
;; # happy ;; # happy
tortoisemerge) tortoisemerge)
if ! merge_mode; then if ! merge_mode; then
@ -169,25 +170,30 @@ run_merge_tool () {
"$merge_tool_path" "$LOCAL" "$REMOTE" | cat "$merge_tool_path" "$LOCAL" "$REMOTE" | cat
fi fi
;; ;;
vimdiff) vimdiff|gvimdiff)
if merge_mode; then if merge_mode; then
touch "$BACKUP" touch "$BACKUP"
"$merge_tool_path" -d -c "wincmd l" \ if $base_present; then
"$LOCAL" "$MERGED" "$REMOTE" "$merge_tool_path" -f -d -c "wincmd J" \
"$MERGED" "$LOCAL" "$BASE" "$REMOTE"
else
"$merge_tool_path" -f -d -c "wincmd l" \
"$LOCAL" "$MERGED" "$REMOTE"
fi
check_unchanged check_unchanged
else else
"$merge_tool_path" -d -c "wincmd l" \ "$merge_tool_path" -f -d -c "wincmd l" \
"$LOCAL" "$REMOTE" "$LOCAL" "$REMOTE"
fi fi
;; ;;
gvimdiff) vimdiff2|gvimdiff2)
if merge_mode; then if merge_mode; then
touch "$BACKUP" touch "$BACKUP"
"$merge_tool_path" -d -c "wincmd l" -f \ "$merge_tool_path" -f -d -c "wincmd l" \
"$LOCAL" "$MERGED" "$REMOTE" "$LOCAL" "$MERGED" "$REMOTE"
check_unchanged check_unchanged
else else
"$merge_tool_path" -d -c "wincmd l" -f \ "$merge_tool_path" -f -d -c "wincmd l" \
"$LOCAL" "$REMOTE" "$LOCAL" "$REMOTE"
fi fi
;; ;;