diff options
author | Alexander Nittka | 2020-02-22 14:23:51 +0000 |
---|---|---|
committer | Thomas Wolf | 2020-02-25 15:53:25 +0000 |
commit | 6f46e09be6e1ec6425b21c4650f6504a2a386eee (patch) | |
tree | a15a2fb8b3af4e199f433e1d35e9bf4e87710f1b /org.eclipse.egit.ui.test/src/org/eclipse | |
parent | 9680c04610188d9210e0df5056803cec452ac4f3 (diff) | |
download | egit-6f46e09be6e1ec6425b21c4650f6504a2a386eee.tar.gz egit-6f46e09be6e1ec6425b21c4650f6504a2a386eee.tar.xz egit-6f46e09be6e1ec6425b21c4650f6504a2a386eee.zip |
Dynamic label for Push to/Fetch from Upstream
Let push to and fetch from upstream contributions implement
IElementUpdater in order to inform the user about the push target/fetch
source. This is useful when working with several remotes for the same
repository.
Bug: 441940
Change-Id: I130437f59fd309566db85e30054baac4e9268760
Signed-off-by: Alexander Nittka <alex@nittka.de>
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse')
2 files changed, 14 insertions, 13 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushToUpstreamTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushToUpstreamTest.java index ad3511410d..5f604e1c38 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushToUpstreamTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushToUpstreamTest.java @@ -57,24 +57,26 @@ public class PushToUpstreamTest extends LocalRepositoryTestCase { public void pushWithExistingUpstreamConfiguration() throws Exception { checkoutNewLocalBranch("bar"); // Existing configuration + String remoteName = "fetch"; repository.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, - "bar", ConfigConstants.CONFIG_KEY_REMOTE, "fetch"); + "bar", ConfigConstants.CONFIG_KEY_REMOTE, remoteName); repository.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, "bar", ConfigConstants.CONFIG_KEY_MERGE, "refs/heads/bar"); - pushToUpstream(); + pushToUpstream(remoteName); assertBranchPushed("bar", remoteRepository); } @Test public void pushWithDefaultRemoteWithPushRefSpecs() throws Exception { checkoutNewLocalBranch("baz"); - repository.getConfig().setString("remote", "origin", "pushurl", + String remoteName = "origin"; + repository.getConfig().setString("remote", remoteName, "pushurl", repository.getConfig().getString("remote", "push", "pushurl")); - repository.getConfig().setString("remote", "origin", "push", + repository.getConfig().setString("remote", remoteName, "push", "refs/heads/*:refs/heads/*"); - pushToUpstream(); + pushToUpstream(remoteName); assertBranchPushed("baz", remoteRepository); } @@ -105,12 +107,13 @@ public class PushToUpstreamTest extends LocalRepositoryTestCase { return projectExplorerTree; } - private void pushToUpstream() { + private void pushToUpstream(String remoteName) { SWTBotTree project = selectProject(); JobJoiner joiner = JobJoiner.startListening(JobFamilies.PUSH, 20, TimeUnit.SECONDS); ContextMenuHelper - .clickContextMenu(project, getPushToUpstreamMenuPath()); + .clickContextMenu(project, + getPushToUpstreamMenuPath(remoteName)); TestUtil.openJobResultDialog(joiner.join()); SWTBotShell resultDialog = TestUtil .botForShellStartingWith("Push Results"); @@ -120,12 +123,11 @@ public class PushToUpstreamTest extends LocalRepositoryTestCase { private void assertPushToUpstreamDisabled() { SWTBotTree project = selectProject(); boolean enabled = ContextMenuHelper.isContextMenuItemEnabled(project, - getPushToUpstreamMenuPath()); + getPushToUpstreamMenuPath("Upstream")); assertFalse("Expected Push to Upstream to be disabled", enabled); } - private String[] getPushToUpstreamMenuPath() { - return new String[] { "Team", - util.getPluginLocalizedValue("PushToUpstreamCommand.label") }; + private String[] getPushToUpstreamMenuPath(String remoteName) { + return new String[] { "Team", "Push to " + remoteName }; } } diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java index b74ebb3656..e5ee3cf1cb 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java @@ -160,8 +160,7 @@ public class FetchAndMergeActionTest extends LocalRepositoryTestCase { private void fetch() throws Exception { SWTBotTree projectExplorerTree = TestUtil.getExplorerTree(); getProjectItem(projectExplorerTree, PROJ1).select(); - String menuString = util - .getPluginLocalizedValue("FetchFromUpstreamAction.label"); + String menuString = "Fetch from origin"; JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.FETCH, 20, TimeUnit.SECONDS); ContextMenuHelper.clickContextMenu(projectExplorerTree, "Team", menuString); |