Code

mergetool--lib: Sort tools alphabetically for easier lookup
authorSebastian Schuberth <sschuberth@gmail.com>
Sun, 27 Feb 2011 11:31:37 +0000 (12:31 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Feb 2011 20:42:23 +0000 (12:42 -0800)
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-difftool.txt
Documentation/git-mergetool.txt
Documentation/merge-config.txt
git-mergetool--lib.sh

index db87f1d42382e32d7e3ee94e5c3d0a032b7430e2..4c8825d19347cc895a9c9764cd60a111b1ad5f56 100644 (file)
@@ -31,8 +31,8 @@ OPTIONS
 --tool=<tool>::
        Use the diff tool specified by <tool>.
        Valid merge tools are:
-       kdiff3, kompare, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff,
-       ecmerge, diffuse, opendiff, p4merge and araxis.
+       araxis, diffuse, emerge, ecmerge, gvimdiff, kdiff3,
+       kompare, meld, opendiff, p4merge, tkdiff, vimdiff and xxdiff.
 +
 If a diff tool is not specified, 'git difftool'
 will use the configuration variable `diff.tool`.  If the
index 1f75a848ba36728eeaa67e5cbbc209075393193b..4987245aca2877f233ab26f2cf244430b2da8211 100644 (file)
@@ -26,8 +26,8 @@ OPTIONS
 --tool=<tool>::
        Use the merge resolution program specified by <tool>.
        Valid merge tools are:
-       kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge,
-       diffuse, tortoisemerge, opendiff, p4merge and araxis.
+       araxis, diffuse, ecmerge, emerge, gvimdiff, kdiff3,
+       meld, opendiff, p4merge, tkdiff, tortoisemerge, vimdiff and xxdiff.
 +
 If a merge resolution program is not specified, 'git mergetool'
 will use the configuration variable `merge.tool`.  If the
index 1e5c22c5e5c19dab5d5c35ec2401870237830a5d..90587db169870c682e747440b507273152e1e348 100644 (file)
@@ -33,10 +33,10 @@ merge.stat::
 
 merge.tool::
        Controls which merge resolution program is used by
-       linkgit:git-mergetool[1].  Valid built-in values are: "kdiff3",
-       "tkdiff", "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff",
-       "diffuse", "ecmerge", "tortoisemerge", "p4merge", "araxis" and
-       "opendiff".  Any other value is treated is custom merge tool
+       linkgit:git-mergetool[1].  Valid built-in values are: "araxis",
+       "diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld",
+       "opendiff", "p4merge", "tkdiff", "tortoisemerge", "vimdiff"
+       and "xxdiff".  Any other value is treated is custom merge tool
        and there must be a corresponding mergetool.<tool>.cmd option.
 
 merge.verbosity::
index 77d4aee20ee5b8b01f9a0e3d1f8dbc9f7fdf3eb9..efca09f51f58f289815402bfe84b04e12149904b 100644 (file)
@@ -10,17 +10,17 @@ merge_mode() {
 
 translate_merge_tool_path () {
        case "$1" in
-       vimdiff|vimdiff2)
-               echo vim
-               ;;
-       gvimdiff|gvimdiff2)
-               echo gvim
+       araxis)
+               echo compare
                ;;
        emerge)
                echo emacs
                ;;
-       araxis)
-               echo compare
+       gvimdiff|gvimdiff2)
+               echo gvim
+               ;;
+       vimdiff|vimdiff2)
+               echo vim
                ;;
        *)
                echo "$1"
@@ -46,17 +46,16 @@ check_unchanged () {
 
 valid_tool () {
        case "$1" in
-       kdiff3 | tkdiff | xxdiff | meld | opendiff | \
-       vimdiff | gvimdiff | vimdiff2 | gvimdiff2 | \
-       emerge | ecmerge | diffuse | araxis | p4merge)
+       araxis | diffuse | ecmerge | emerge | gvimdiff | gvimdiff2 | \
+       kdiff3 | meld | opendiff | p4merge | tkdiff | vimdiff | vimdiff2 | xxdiff)
                ;; # happy
-       tortoisemerge)
-               if ! merge_mode; then
+       kompare)
+               if ! diff_mode; then
                        return 1
                fi
                ;;
-       kompare)
-               if ! diff_mode; then
+       tortoisemerge)
+               if ! merge_mode; then
                        return 1
                fi
                ;;
@@ -89,88 +88,76 @@ run_merge_tool () {
        status=0
 
        case "$1" in
-       kdiff3)
+       araxis)
                if merge_mode; then
+                       touch "$BACKUP"
                        if $base_present; then
-                               ("$merge_tool_path" --auto \
-                                       --L1 "$MERGED (Base)" \
-                                       --L2 "$MERGED (Local)" \
-                                       --L3 "$MERGED (Remote)" \
-                                       -o "$MERGED" \
-                                       "$BASE" "$LOCAL" "$REMOTE" \
-                               > /dev/null 2>&1)
+                               "$merge_tool_path" -wait -merge -3 -a1 \
+                                       "$BASE" "$LOCAL" "$REMOTE" "$MERGED" \
+                                       >/dev/null 2>&1
                        else
-                               ("$merge_tool_path" --auto \
-                                       --L1 "$MERGED (Local)" \
-                                       --L2 "$MERGED (Remote)" \
-                                       -o "$MERGED" \
-                                       "$LOCAL" "$REMOTE" \
-                               > /dev/null 2>&1)
+                               "$merge_tool_path" -wait -2 \
+                                       "$LOCAL" "$REMOTE" "$MERGED" \
+                                       >/dev/null 2>&1
                        fi
-                       status=$?
+                       check_unchanged
                else
-                       ("$merge_tool_path" --auto \
-                               --L1 "$MERGED (A)" \
-                               --L2 "$MERGED (B)" "$LOCAL" "$REMOTE" \
-                       > /dev/null 2>&1)
+                       "$merge_tool_path" -wait -2 "$LOCAL" "$REMOTE" \
+                               >/dev/null 2>&1
                fi
                ;;
-       kompare)
-               "$merge_tool_path" "$LOCAL" "$REMOTE"
-               ;;
-       tkdiff)
+       diffuse)
                if merge_mode; then
+                       touch "$BACKUP"
                        if $base_present; then
-                               "$merge_tool_path" -a "$BASE" \
-                                       -o "$MERGED" "$LOCAL" "$REMOTE"
+                               "$merge_tool_path" \
+                                       "$LOCAL" "$MERGED" "$REMOTE" \
+                                       "$BASE" | cat
                        else
                                "$merge_tool_path" \
-                                       -o "$MERGED" "$LOCAL" "$REMOTE"
+                                       "$LOCAL" "$MERGED" "$REMOTE" | cat
                        fi
-                       status=$?
+                       check_unchanged
                else
-                       "$merge_tool_path" "$LOCAL" "$REMOTE"
+                       "$merge_tool_path" "$LOCAL" "$REMOTE" | cat
                fi
                ;;
-       p4merge)
+       ecmerge)
                if merge_mode; then
-                   touch "$BACKUP"
+                       touch "$BACKUP"
                        if $base_present; then
-                               "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
+                               "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" \
+                                       --default --mode=merge3 --to="$MERGED"
                        else
-                               "$merge_tool_path" "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED"
+                               "$merge_tool_path" "$LOCAL" "$REMOTE" \
+                                       --default --mode=merge2 --to="$MERGED"
                        fi
                        check_unchanged
                else
-                       "$merge_tool_path" "$LOCAL" "$REMOTE"
-               fi
-               ;;
-       meld)
-               if merge_mode; then
-                       touch "$BACKUP"
-                       "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
-                       check_unchanged
-               else
-                       "$merge_tool_path" "$LOCAL" "$REMOTE"
+                       "$merge_tool_path" --default --mode=diff2 \
+                               "$LOCAL" "$REMOTE"
                fi
                ;;
-       diffuse)
+       emerge)
                if merge_mode; then
-                       touch "$BACKUP"
                        if $base_present; then
                                "$merge_tool_path" \
-                                       "$LOCAL" "$MERGED" "$REMOTE" \
-                                       "$BASE" | cat
+                                       -f emerge-files-with-ancestor-command \
+                                       "$LOCAL" "$REMOTE" "$BASE" \
+                                       "$(basename "$MERGED")"
                        else
                                "$merge_tool_path" \
-                                       "$LOCAL" "$MERGED" "$REMOTE" | cat
+                                       -f emerge-files-command \
+                                       "$LOCAL" "$REMOTE" \
+                                       "$(basename "$MERGED")"
                        fi
-                       check_unchanged
+                       status=$?
                else
-                       "$merge_tool_path" "$LOCAL" "$REMOTE" | cat
+                       "$merge_tool_path" -f emerge-files-command \
+                               "$LOCAL" "$REMOTE"
                fi
                ;;
-       vimdiff|gvimdiff)
+       gvimdiff|vimdiff)
                if merge_mode; then
                        touch "$BACKUP"
                        if $base_present; then
@@ -186,7 +173,7 @@ run_merge_tool () {
                                "$LOCAL" "$REMOTE"
                fi
                ;;
-       vimdiff2|gvimdiff2)
+       gvimdiff2|vimdiff2)
                if merge_mode; then
                        touch "$BACKUP"
                        "$merge_tool_path" -f -d -c "wincmd l" \
@@ -197,30 +184,42 @@ run_merge_tool () {
                                "$LOCAL" "$REMOTE"
                fi
                ;;
-       xxdiff)
+       kdiff3)
                if merge_mode; then
-                       touch "$BACKUP"
                        if $base_present; then
-                               "$merge_tool_path" -X --show-merged-pane \
-                                       -R 'Accel.SaveAsMerged: "Ctrl-S"' \
-                                       -R 'Accel.Search: "Ctrl+F"' \
-                                       -R 'Accel.SearchForward: "Ctrl-G"' \
-                                       --merged-file "$MERGED" \
-                                       "$LOCAL" "$BASE" "$REMOTE"
+                               ("$merge_tool_path" --auto \
+                                       --L1 "$MERGED (Base)" \
+                                       --L2 "$MERGED (Local)" \
+                                       --L3 "$MERGED (Remote)" \
+                                       -o "$MERGED" \
+                                       "$BASE" "$LOCAL" "$REMOTE" \
+                               > /dev/null 2>&1)
                        else
-                               "$merge_tool_path" -X $extra \
-                                       -R 'Accel.SaveAsMerged: "Ctrl-S"' \
-                                       -R 'Accel.Search: "Ctrl+F"' \
-                                       -R 'Accel.SearchForward: "Ctrl-G"' \
-                                       --merged-file "$MERGED" \
-                                       "$LOCAL" "$REMOTE"
+                               ("$merge_tool_path" --auto \
+                                       --L1 "$MERGED (Local)" \
+                                       --L2 "$MERGED (Remote)" \
+                                       -o "$MERGED" \
+                                       "$LOCAL" "$REMOTE" \
+                               > /dev/null 2>&1)
                        fi
+                       status=$?
+               else
+                       ("$merge_tool_path" --auto \
+                               --L1 "$MERGED (A)" \
+                               --L2 "$MERGED (B)" "$LOCAL" "$REMOTE" \
+                       > /dev/null 2>&1)
+               fi
+               ;;
+       kompare)
+               "$merge_tool_path" "$LOCAL" "$REMOTE"
+               ;;
+       meld)
+               if merge_mode; then
+                       touch "$BACKUP"
+                       "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
                        check_unchanged
                else
-                       "$merge_tool_path" \
-                               -R 'Accel.Search: "Ctrl+F"' \
-                               -R 'Accel.SearchForward: "Ctrl-G"' \
-                               "$LOCAL" "$REMOTE"
+                       "$merge_tool_path" "$LOCAL" "$REMOTE"
                fi
                ;;
        opendiff)
@@ -239,39 +238,31 @@ run_merge_tool () {
                        "$merge_tool_path" "$LOCAL" "$REMOTE" | cat
                fi
                ;;
-       ecmerge)
+       p4merge)
                if merge_mode; then
-                       touch "$BACKUP"
+                   touch "$BACKUP"
                        if $base_present; then
-                               "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" \
-                                       --default --mode=merge3 --to="$MERGED"
+                               "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
                        else
-                               "$merge_tool_path" "$LOCAL" "$REMOTE" \
-                                       --default --mode=merge2 --to="$MERGED"
+                               "$merge_tool_path" "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED"
                        fi
                        check_unchanged
                else
-                       "$merge_tool_path" --default --mode=diff2 \
-                               "$LOCAL" "$REMOTE"
+                       "$merge_tool_path" "$LOCAL" "$REMOTE"
                fi
                ;;
-       emerge)
+       tkdiff)
                if merge_mode; then
                        if $base_present; then
-                               "$merge_tool_path" \
-                                       -f emerge-files-with-ancestor-command \
-                                       "$LOCAL" "$REMOTE" "$BASE" \
-                                       "$(basename "$MERGED")"
+                               "$merge_tool_path" -a "$BASE" \
+                                       -o "$MERGED" "$LOCAL" "$REMOTE"
                        else
                                "$merge_tool_path" \
-                                       -f emerge-files-command \
-                                       "$LOCAL" "$REMOTE" \
-                                       "$(basename "$MERGED")"
+                                       -o "$MERGED" "$LOCAL" "$REMOTE"
                        fi
                        status=$?
                else
-                       "$merge_tool_path" -f emerge-files-command \
-                               "$LOCAL" "$REMOTE"
+                       "$merge_tool_path" "$LOCAL" "$REMOTE"
                fi
                ;;
        tortoisemerge)
@@ -286,22 +277,30 @@ run_merge_tool () {
                        status=1
                fi
                ;;
-       araxis)
+       xxdiff)
                if merge_mode; then
                        touch "$BACKUP"
                        if $base_present; then
-                               "$merge_tool_path" -wait -merge -3 -a1 \
-                                       "$BASE" "$LOCAL" "$REMOTE" "$MERGED" \
-                                       >/dev/null 2>&1
+                               "$merge_tool_path" -X --show-merged-pane \
+                                       -R 'Accel.SaveAsMerged: "Ctrl-S"' \
+                                       -R 'Accel.Search: "Ctrl+F"' \
+                                       -R 'Accel.SearchForward: "Ctrl-G"' \
+                                       --merged-file "$MERGED" \
+                                       "$LOCAL" "$BASE" "$REMOTE"
                        else
-                               "$merge_tool_path" -wait -2 \
-                                       "$LOCAL" "$REMOTE" "$MERGED" \
-                                       >/dev/null 2>&1
+                               "$merge_tool_path" -X $extra \
+                                       -R 'Accel.SaveAsMerged: "Ctrl-S"' \
+                                       -R 'Accel.Search: "Ctrl+F"' \
+                                       -R 'Accel.SearchForward: "Ctrl-G"' \
+                                       --merged-file "$MERGED" \
+                                       "$LOCAL" "$REMOTE"
                        fi
                        check_unchanged
                else
-                       "$merge_tool_path" -wait -2 "$LOCAL" "$REMOTE" \
-                               >/dev/null 2>&1
+                       "$merge_tool_path" \
+                               -R 'Accel.Search: "Ctrl+F"' \
+                               -R 'Accel.SearchForward: "Ctrl-G"' \
+                               "$LOCAL" "$REMOTE"
                fi
                ;;
        *)