CommandLineDiffTool.java

  1. /*
  2.  * Copyright (C) 2018-2021, Andre Bossert <andre.bossert@siemens.com>
  3.  *
  4.  * This program and the accompanying materials are made available under the
  5.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  6.  * https://www.eclipse.org/org/documents/edl-v10.php.
  7.  *
  8.  * SPDX-License-Identifier: BSD-3-Clause
  9.  */

  10. package org.eclipse.jgit.internal.diffmergetool;

  11. /**
  12.  * Pre-defined command line diff tools.
  13.  *
  14.  * Adds same diff tools as also pre-defined in C-Git
  15.  * <p>
  16.  * see "git-core\mergetools\"
  17.  * </p>
  18.  * <p>
  19.  * see links to command line parameter description for the tools
  20.  * </p>
  21.  *
  22.  * <pre>
  23.  * araxis
  24.  * bc
  25.  * bc3
  26.  * codecompare
  27.  * deltawalker
  28.  * diffmerge
  29.  * diffuse
  30.  * ecmerge
  31.  * emerge
  32.  * examdiff
  33.  * guiffy
  34.  * gvimdiff
  35.  * gvimdiff2
  36.  * gvimdiff3
  37.  * kdiff3
  38.  * kompare
  39.  * meld
  40.  * opendiff
  41.  * p4merge
  42.  * tkdiff
  43.  * vimdiff
  44.  * vimdiff2
  45.  * vimdiff3
  46.  * winmerge
  47.  * xxdiff
  48.  * </pre>
  49.  *
  50.  */
  51. @SuppressWarnings("nls")
  52. public enum CommandLineDiffTool {
  53.     /**
  54.      * See: <a href=
  55.      * "https://www.araxis.com/merge/documentation-windows/command-line.en">https://www.araxis.com/merge/documentation-windows/command-line.en</a>
  56.      */
  57.     araxis("compare", "-wait -2 \"$LOCAL\" \"$REMOTE\""),
  58.     /**
  59.      * See: <a href=
  60.      * "https://www.scootersoftware.com/v4help/index.html?command_line_reference.html">https://www.scootersoftware.com/v4help/index.html?command_line_reference.html</a>
  61.      */
  62.     bc("bcomp", "\"$LOCAL\" \"$REMOTE\""),
  63.     /**
  64.      * See: <a href=
  65.      * "https://www.scootersoftware.com/v4help/index.html?command_line_reference.html">https://www.scootersoftware.com/v4help/index.html?command_line_reference.html</a>
  66.      */
  67.     bc3("bcompare", bc),
  68.     /**
  69.      * See: <a href=
  70.      * "https://www.devart.com/codecompare/docs/index.html?comparing_via_command_line.htm">https://www.devart.com/codecompare/docs/index.html?comparing_via_command_line.htm</a>
  71.      */
  72.     codecompare("CodeCompare", "\"$LOCAL\" \"$REMOTE\""),
  73.     /**
  74.      * See: <a href=
  75.      * "https://www.deltawalker.com/integrate/command-line">https://www.deltawalker.com/integrate/command-line</a>
  76.      */
  77.     deltawalker("DeltaWalker", "\"$LOCAL\" \"$REMOTE\""),
  78.     /**
  79.      * See: <a href=
  80.      * "https://sourcegear.com/diffmerge/webhelp/sec__clargs__diff.html">https://sourcegear.com/diffmerge/webhelp/sec__clargs__diff.html</a>
  81.      */
  82.     diffmerge("diffmerge", "\"$LOCAL\" \"$REMOTE\""),
  83.     /**
  84.      * See: <a href=
  85.      * "http://diffuse.sourceforge.net/manual.html#introduction-usage">http://diffuse.sourceforge.net/manual.html#introduction-usage</a>
  86.      */
  87.     diffuse("diffuse", "\"$LOCAL\" \"$REMOTE\""),
  88.     /**
  89.      * See: <a href=
  90.      * "http://www.elliecomputing.com/en/OnlineDoc/ecmerge_en/44205167.asp">http://www.elliecomputing.com/en/OnlineDoc/ecmerge_en/44205167.asp</a>
  91.      */
  92.     ecmerge("ecmerge", "--default --mode=diff2 \"$LOCAL\" \"$REMOTE\""),
  93.     /**
  94.      * See: <a href=
  95.      * "https://www.gnu.org/software/emacs/manual/html_node/emacs/Overview-of-Emerge.html">https://www.gnu.org/software/emacs/manual/html_node/emacs/Overview-of-Emerge.html</a>
  96.      */
  97.     emerge("emacs", "-f emerge-files-command \"$LOCAL\" \"$REMOTE\""),
  98.     /**
  99.      * See: <a href=
  100.      * "https://www.prestosoft.com/ps.asp?page=htmlhelp/edp/command_line_options">https://www.prestosoft.com/ps.asp?page=htmlhelp/edp/command_line_options</a>
  101.      */
  102.     examdiff("ExamDiff", "\"$LOCAL\" \"$REMOTE\" -nh"),
  103.     /**
  104.      * See: <a href=
  105.      * "https://www.guiffy.com/help/GuiffyHelp/GuiffyCmd.html">https://www.guiffy.com/help/GuiffyHelp/GuiffyCmd.html</a>
  106.      */
  107.     guiffy("guiffy", "\"$LOCAL\" \"$REMOTE\""),
  108.     /**
  109.      * See: <a href=
  110.      * "http://vimdoc.sourceforge.net/htmldoc/diff.html">http://vimdoc.sourceforge.net/htmldoc/diff.html</a>
  111.      */
  112.     gvimdiff("gvimdiff", "\"$LOCAL\" \"$REMOTE\""),
  113.     /**
  114.      * See: <a href=
  115.      * "http://vimdoc.sourceforge.net/htmldoc/diff.html">http://vimdoc.sourceforge.net/htmldoc/diff.html</a>
  116.      */
  117.     gvimdiff2(gvimdiff),
  118.     /**
  119.      * See: <a href=
  120.      * "http://vimdoc.sourceforge.net/htmldoc/diff.html">http://vimdoc.sourceforge.net/htmldoc/diff.html</a>
  121.      */
  122.     gvimdiff3(gvimdiff),
  123.     /**
  124.      * See: <a href=
  125.      * "http://kdiff3.sourceforge.net/doc/documentation.html">http://kdiff3.sourceforge.net/doc/documentation.html</a>
  126.      */
  127.     kdiff3("kdiff3",
  128.             "--L1 \"$MERGED (A)\" --L2 \"$MERGED (B)\" \"$LOCAL\" \"$REMOTE\""),
  129.     /**
  130.      * See: <a href=
  131.      * "https://docs.kde.org/trunk5/en/kdesdk/kompare/commandline-options.html">https://docs.kde.org/trunk5/en/kdesdk/kompare/commandline-options.html</a>
  132.      */
  133.     kompare("kompare", "\"$LOCAL\" \"$REMOTE\""),
  134.     /**
  135.      * See: <a href=
  136.      * "ttp://meldmerge.org/help/file-mode.html">http://meldmerge.org/help/file-mode.html</a>
  137.      */
  138.     meld("meld", "\"$LOCAL\" \"$REMOTE\""),
  139.     /**
  140.      * See: <a href=
  141.      * "http://www.manpagez.com/man/1/opendiff/">http://www.manpagez.com/man/1/opendiff/</a>
  142.      * <p>
  143.      * Hint: check the ' | cat' for the call
  144.      * </p>
  145.      */
  146.     opendiff("opendiff", "\"$LOCAL\" \"$REMOTE\""),
  147.     /**
  148.      * See: <a href=
  149.      * "https://www.perforce.com/manuals/v15.1/cmdref/p4_merge.html">https://www.perforce.com/manuals/v15.1/cmdref/p4_merge.html</a>
  150.      */
  151.     p4merge("p4merge", "\"$LOCAL\" \"$REMOTE\""),
  152.     /**
  153.      * See: <a href=
  154.      * "http://linux.math.tifr.res.in/manuals/man/tkdiff.html">http://linux.math.tifr.res.in/manuals/man/tkdiff.html</a>
  155.      */
  156.     tkdiff("tkdiff", "\"$LOCAL\" \"$REMOTE\""),
  157.     /**
  158.      * See: <a href=
  159.      * "http://vimdoc.sourceforge.net/htmldoc/diff.html">http://vimdoc.sourceforge.net/htmldoc/diff.html</a>
  160.      */
  161.     vimdiff("vimdiff", gvimdiff),
  162.     /**
  163.      * See: <a href=
  164.      * "http://vimdoc.sourceforge.net/htmldoc/diff.html">http://vimdoc.sourceforge.net/htmldoc/diff.html</a>
  165.      */
  166.     vimdiff2(vimdiff),
  167.     /**
  168.      * See: <a href=
  169.      * "http://vimdoc.sourceforge.net/htmldoc/diff.html">http://vimdoc.sourceforge.net/htmldoc/diff.html</a>
  170.      */
  171.     vimdiff3(vimdiff),
  172.     /**
  173.      * See: <a href=
  174.      * "http://manual.winmerge.org/Command_line.html">http://manual.winmerge.org/Command_line.html</a>
  175.      * <p>
  176.      * Hint: check how 'mergetool_find_win32_cmd "WinMergeU.exe" "WinMerge"'
  177.      * works
  178.      * </p>
  179.      */
  180.     winmerge("WinMergeU", "-u -e \"$LOCAL\" \"$REMOTE\""),
  181.     /**
  182.      * See: <a href=
  183.      * "http://furius.ca/xxdiff/doc/xxdiff-doc.html">http://furius.ca/xxdiff/doc/xxdiff-doc.html</a>
  184.      */
  185.     xxdiff("xxdiff",
  186.             "-R 'Accel.Search: \"Ctrl+F\"' -R 'Accel.SearchForward: \"Ctrl+G\"' \"$LOCAL\" \"$REMOTE\"");

  187.     CommandLineDiffTool(String path, String parameters) {
  188.         this.path = path;
  189.         this.parameters = parameters;
  190.     }

  191.     CommandLineDiffTool(CommandLineDiffTool from) {
  192.         this(from.getPath(), from.getParameters());
  193.     }

  194.     CommandLineDiffTool(String path, CommandLineDiffTool from) {
  195.         this(path, from.getParameters());
  196.     }

  197.     private final String path;

  198.     private final String parameters;

  199.     /**
  200.      * @return path
  201.      */
  202.     public String getPath() {
  203.         return path;
  204.     }

  205.     /**
  206.      * @return parameters as one string
  207.      */
  208.     public String getParameters() {
  209.         return parameters;
  210.     }

  211. }