aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Duft2012-01-20 17:34:12 (EST)
committerMatthias Sohn2012-01-20 17:34:12 (EST)
commit222a1cb7ba65854e3ed89aa21ca20025e1741c68 (patch)
treee0fae782d8b237ec431944930eb53835334853ba
parent0c83c49451082f717af5699a9dd80625c275c499 (diff)
downloadegit-222a1cb7ba65854e3ed89aa21ca20025e1741c68.zip
egit-222a1cb7ba65854e3ed89aa21ca20025e1741c68.tar.gz
egit-222a1cb7ba65854e3ed89aa21ca20025e1741c68.tar.bz2
Nice checkout conflict display instead of internal errorrefs/changes/76/4976/2
When switching branches by double-clicking their label, a nice checkout conflict display appears if a conflict exists. When creating a new branch, an ugly error box is shown instead. By detecting the CheckoutConflictException explicitly and just returning, the BranchResultDialog will be used there too, and show a nice overview of all conflicts. Exception handling needs to be cleaned up (bug 369303) when JGit has fixed bug 356922. Change-Id: Ic772f519c5e36dcc1b0326dc1045497b211aaa66 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java
index 7d3806b..b5cb00d 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java
@@ -33,6 +33,7 @@ import org.eclipse.jgit.api.CheckoutResult.Status;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.JGitInternalException;
+import org.eclipse.jgit.errors.CheckoutConflictException;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
@@ -101,7 +102,15 @@ public class BranchOperation extends BaseOperation {
try {
co.call();
} catch (JGitInternalException e) {
- throw new CoreException(Activator.error(e.getMessage(), e));
+ // TODO replace this with API exception
+ // org.eclipse.jgit.api.errors.CheckoutConflictException
+ // as soon as http://egit.eclipse.org/r/#change,4178 has
+ // been accepted (bug 369303 tracks this)
+ if (e.getCause() instanceof CheckoutConflictException)
+ return;
+ else
+ throw new CoreException(Activator.error(e.getMessage(),
+ e));
} catch (GitAPIException e) {
throw new CoreException(Activator.error(e.getMessage(), e));
} finally {