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