diff options
author | Andre Bossert <andre.bossert@siemens.com> | 2020-01-19 20:56:28 +0100 |
---|---|---|
committer | Andrey Loskutov <loskutov@gmx.de> | 2022-06-01 14:23:48 +0200 |
commit | 973e955ead1a9bf41efb3168baf5b68527e78023 (patch) | |
tree | 70e6b916308e20da790ac41759e1b9bd3c28b324 /org.eclipse.jgit.test/tst | |
parent | bb30be6b3335c67ee59d3705d5e04e2dbb688128 (diff) | |
download | jgit-973e955ead1a9bf41efb3168baf5b68527e78023.tar.gz jgit-973e955ead1a9bf41efb3168baf5b68527e78023.zip |
Add availability check of pre-defined tools
see: https://git-scm.com/docs/git-difftool
see: https://git-scm.com/docs/git-mergetool
* now all available tools are printed with "--tool-help"
* if no diff.tool or merge.tool is defined the first available
pre-defined tool is used
TODO:
- add mergetools to difftools --> extra change or merge to this
- return the exit-code of the tool to jgit / java runtime
Bug: 356832
Change-Id: I20fb04e71ced981f5625020f461bbac24e6cec70
Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
2 files changed, 6 insertions, 24 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/diffmergetool/ExternalDiffToolTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/diffmergetool/ExternalDiffToolTest.java index 4fd55c6cad..1b501c25b0 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/diffmergetool/ExternalDiffToolTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/diffmergetool/ExternalDiffToolTest.java @@ -97,7 +97,7 @@ public class ExternalDiffToolTest extends ExternalToolTestCase { @Test public void testAllTools() { DiffTools manager = new DiffTools(db); - Set<String> actualToolNames = manager.getAvailableTools().keySet(); + Set<String> actualToolNames = manager.getPredefinedTools(true).keySet(); Set<String> expectedToolNames = new LinkedHashSet<>(); CommandLineDiffTool[] defaultTools = CommandLineDiffTool.values(); for (CommandLineDiffTool defaultTool : defaultTools) { @@ -153,15 +153,6 @@ public class ExternalDiffToolTest extends ExternalToolTestCase { } @Test - public void testNotAvailableTools() { - DiffTools manager = new DiffTools(db); - Set<String> actualToolNames = manager.getNotAvailableTools().keySet(); - Set<String> expectedToolNames = Collections.emptySet(); - assertEquals("Incorrect set of not available external diff tools", - expectedToolNames, actualToolNames); - } - - @Test public void testCompare() throws ToolException { String toolName = "customTool"; @@ -239,7 +230,7 @@ public class ExternalDiffToolTest extends ExternalToolTestCase { DiffTools manager = new DiffTools(db); Map<String, ExternalDiffTool> availableTools = manager - .getAvailableTools(); + .getPredefinedTools(true); ExternalDiffTool externalDiffTool = availableTools .get(overridenToolName); String actualDiffToolPath = externalDiffTool.getPath(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/diffmergetool/ExternalMergeToolTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/diffmergetool/ExternalMergeToolTest.java index 50576682eb..305f2b470e 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/diffmergetool/ExternalMergeToolTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/diffmergetool/ExternalMergeToolTest.java @@ -9,14 +9,14 @@ */ package org.eclipse.jgit.internal.diffmergetool; -import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_MERGETOOL_SECTION; -import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_MERGE_SECTION; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_CMD; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_GUITOOL; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PATH; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PROMPT; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_TOOL; import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_TRUST_EXIT_CODE; +import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_MERGETOOL_SECTION; +import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_MERGE_SECTION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -95,7 +95,7 @@ public class ExternalMergeToolTest extends ExternalToolTestCase { @Test public void testAllTools() { MergeTools manager = new MergeTools(db); - Set<String> actualToolNames = manager.getAvailableTools().keySet(); + Set<String> actualToolNames = manager.getPredefinedTools(true).keySet(); Set<String> expectedToolNames = new LinkedHashSet<>(); CommandLineMergeTool[] defaultTools = CommandLineMergeTool.values(); for (CommandLineMergeTool defaultTool : defaultTools) { @@ -151,15 +151,6 @@ public class ExternalMergeToolTest extends ExternalToolTestCase { } @Test - public void testNotAvailableTools() { - MergeTools manager = new MergeTools(db); - Set<String> actualToolNames = manager.getNotAvailableTools().keySet(); - Set<String> expectedToolNames = Collections.emptySet(); - assertEquals("Incorrect set of not available external merge tools", - expectedToolNames, actualToolNames); - } - - @Test public void testCompare() throws ToolException { String toolName = "customTool"; @@ -236,7 +227,7 @@ public class ExternalMergeToolTest extends ExternalToolTestCase { MergeTools manager = new MergeTools(db); Map<String, ExternalMergeTool> availableTools = manager - .getAvailableTools(); + .getPredefinedTools(true); ExternalMergeTool externalMergeTool = availableTools .get(overridenToolName); String actualMergeToolPath = externalMergeTool.getPath(); |