Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Hohenegger2015-06-18 08:51:28 +0000
committerMatthias Sohn2015-07-22 22:40:55 +0000
commitbcfcb1deca78c932f24c3cbc0c7358512b180ce3 (patch)
treeb0cf50337247a48589b62075b4513a45b78043ac /org.eclipse.egit.ui.test
parent6ede5fbc53cded73276bb094efaef4e22c48bfbd (diff)
downloadegit-bcfcb1deca78c932f24c3cbc0c7358512b180ce3.tar.gz
egit-bcfcb1deca78c932f24c3cbc0c7358512b180ce3.tar.xz
egit-bcfcb1deca78c932f24c3cbc0c7358512b180ce3.zip
[gitflow] Fix feature rebase which sometimes fails silently
- always show warning message if rebase operation was unsuccessful - fix conflict warning for non-feature finish operations - refactoring to avoid redundancy - fix UI test and add test for dirty working dir Bug: 470434 Change-Id: I963b61768add59d65070f0b193ef91eade95f28a Signed-off-by: Max Hohenegger <eclipse@hohenegger.eu> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui.test')
-rw-r--r--org.eclipse.egit.ui.test/pom.xml5
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureRebaseHandlerTest.java48
2 files changed, 49 insertions, 4 deletions
diff --git a/org.eclipse.egit.ui.test/pom.xml b/org.eclipse.egit.ui.test/pom.xml
index ab25e5fa9d..c4ead98159 100644
--- a/org.eclipse.egit.ui.test/pom.xml
+++ b/org.eclipse.egit.ui.test/pom.xml
@@ -87,6 +87,11 @@
</requirement>
<requirement>
<type>eclipse-feature</type>
+ <id>org.eclipse.egit.gitflow.feature</id>
+ <versionRange>0.0.0</versionRange>
+ </requirement>
+ <requirement>
+ <type>eclipse-feature</type>
<id>org.eclipse.e4.rcp</id>
<versionRange>0.0.0</versionRange>
</requirement>
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureRebaseHandlerTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureRebaseHandlerTest.java
index b03ba8c880..feeed0d2b4 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureRebaseHandlerTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/FeatureRebaseHandlerTest.java
@@ -18,10 +18,14 @@ import org.eclipse.egit.gitflow.op.FeatureStartOperation;
import org.eclipse.egit.gitflow.op.InitOperation;
import org.eclipse.egit.gitflow.ui.Activator;
import org.eclipse.egit.gitflow.ui.internal.JobFamilies;
+import org.eclipse.egit.gitflow.ui.internal.UIText;
import org.eclipse.egit.ui.test.ContextMenuHelper;
import org.eclipse.egit.ui.test.TestUtil;
+import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.api.RebaseResult;
import org.eclipse.jgit.api.Status;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
@@ -36,7 +40,11 @@ import org.junit.runner.RunWith;
public class FeatureRebaseHandlerTest extends AbstractGitflowHandlerTest {
@Test
- public void testRebase() throws Exception {
+ public void testRebaseFailOnConflict() throws Exception {
+ // if AUTOMATED_MODE is true, we wouldn't get the error
+ // dialog which is part of what we want to test here
+ ErrorDialog.AUTOMATED_MODE = false;
+
Git git = Git.wrap(repository);
init();
@@ -50,15 +58,48 @@ public class FeatureRebaseHandlerTest extends AbstractGitflowHandlerTest {
checkoutFeature(FEATURE_NAME);
rebaseFeature();
+ acceptError(RebaseResult.Status.STOPPED);
- Status call = git.status().call();
- Object[] conflicting = call.getConflicting().toArray();
+ Status status = git.status().call();
+ Object[] conflicting = status.getConflicting().toArray();
assertEquals(1, conflicting.length);
assertEquals(FILE1_PATH, conflicting[0]);
assertEquals("org.eclipse.egit.ui.InteractiveRebaseView", bot.activeView().getReference().getId());
}
+ private void acceptError(org.eclipse.jgit.api.RebaseResult.Status status) {
+ bot.button("Details >>").click();
+ bot.list().select(NLS.bind(
+ UIText.FeatureRebaseHandler_statusWas, status.toString()));
+ bot.button("OK").click();
+ }
+
+ @Test
+ public void testRebaseFailOnDirtyWorkingDirectory() throws Exception {
+ // if AUTOMATED_MODE is true, we wouldn't get the error
+ // dialog which is part of what we want to test here
+ ErrorDialog.AUTOMATED_MODE = false;
+
+ Git git = Git.wrap(repository);
+
+ init();
+ setContentAddAndCommit("bar");
+
+ createFeature(FEATURE_NAME);
+ setContentAddAndCommit("foo");
+
+ setTestFileContent("foobar");
+
+ rebaseFeature();
+ acceptError(RebaseResult.Status.UNCOMMITTED_CHANGES);
+
+ Status status = git.status().call();
+ Object[] uncommitted = status.getUncommittedChanges().toArray();
+ assertEquals(1, uncommitted.length);
+ assertEquals(FILE1_PATH, uncommitted[0]);
+ }
+
private void init() throws CoreException {
new InitOperation(repository).execute(null);
}
@@ -90,7 +131,6 @@ public class FeatureRebaseHandlerTest extends AbstractGitflowHandlerTest {
ContextMenuHelper.clickContextMenuSync(projectExplorerTree, menuPath);
}
});
- bot.button().click();
bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs"));
}
}

Back to the top