summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/errors/CheckoutConflictException.java2
5 files changed, 15 insertions, 8 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java
index 7d75a6cda9..b1cac3a54d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java
@@ -56,6 +56,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import org.eclipse.jgit.api.CheckoutResult.Status;
+import org.eclipse.jgit.api.errors.CheckoutConflictException;
import org.eclipse.jgit.api.errors.InvalidRefNameException;
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
@@ -127,7 +128,8 @@ public class CheckoutCommandTest extends RepositoryTestCase {
@Test
public void testCheckoutToNonExistingBranch() throws JGitInternalException,
- RefAlreadyExistsException, InvalidRefNameException {
+ RefAlreadyExistsException, InvalidRefNameException,
+ CheckoutConflictException {
try {
git.checkout().setName("badbranch").call();
fail("Should have failed");
@@ -222,7 +224,7 @@ public class CheckoutCommandTest extends RepositoryTestCase {
@Test
public void testDetachedHeadOnCheckout() throws JGitInternalException,
RefAlreadyExistsException, RefNotFoundException,
- InvalidRefNameException, IOException {
+ InvalidRefNameException, IOException, CheckoutConflictException {
CheckoutCommand co = git.checkout();
co.setName("master").call();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
index efb686da59..6c6c911f23 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
@@ -62,7 +62,6 @@ import org.eclipse.jgit.api.MergeResult.MergeStatus;
import org.eclipse.jgit.api.ResetCommand.ResetType;
import org.eclipse.jgit.api.Status;
import org.eclipse.jgit.api.errors.GitAPIException;
-import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.api.errors.NoFilepatternException;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheCheckout;
@@ -1015,7 +1014,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
try {
checkout.call();
fail("Checkout exception not thrown");
- } catch (JGitInternalException e) {
+ } catch (org.eclipse.jgit.api.errors.CheckoutConflictException e) {
CheckoutResult result = checkout.getResult();
assertNotNull(result);
assertNotNull(result.getConflictList());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
index a41ff8454b..6a5c0bc0e0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
@@ -51,6 +51,7 @@ import java.util.List;
import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.api.CheckoutResult.Status;
+import org.eclipse.jgit.api.errors.CheckoutConflictException;
import org.eclipse.jgit.api.errors.InvalidRefNameException;
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
@@ -62,7 +63,6 @@ import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.dircache.DirCacheIterator;
import org.eclipse.jgit.errors.AmbiguousObjectException;
-import org.eclipse.jgit.errors.CheckoutConflictException;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
@@ -124,7 +124,8 @@ public class CheckoutCommand extends GitCommand<Ref> {
* @return the newly created branch
*/
public Ref call() throws JGitInternalException, RefAlreadyExistsException,
- RefNotFoundException, InvalidRefNameException {
+ RefNotFoundException, InvalidRefNameException,
+ CheckoutConflictException {
checkCallable();
processOptions();
try {
@@ -164,10 +165,10 @@ public class CheckoutCommand extends GitCommand<Ref> {
dco.setFailOnConflict(true);
try {
dco.checkout();
- } catch (CheckoutConflictException e) {
+ } catch (org.eclipse.jgit.errors.CheckoutConflictException e) {
status = new CheckoutResult(Status.CONFLICTS, dco
.getConflicts());
- throw e;
+ throw new CheckoutConflictException(dco.getConflicts(), e);
}
Ref ref = repo.getRef(name);
if (ref != null && !ref.getName().startsWith(Constants.R_HEADS))
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
index 35cccc6e50..ae73cacbe0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -62,6 +62,7 @@ import java.util.Map;
import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.api.RebaseResult.Status;
+import org.eclipse.jgit.api.errors.CheckoutConflictException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidRefNameException;
import org.eclipse.jgit.api.errors.JGitInternalException;
@@ -676,6 +677,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
throw new JGitInternalException(e.getMessage(), e);
} catch (InvalidRefNameException e) {
throw new JGitInternalException(e.getMessage(), e);
+ } catch (CheckoutConflictException e) {
+ throw new JGitInternalException(e.getMessage(), e);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/CheckoutConflictException.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/CheckoutConflictException.java
index 4d5bd1e03c..e317507139 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/CheckoutConflictException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/CheckoutConflictException.java
@@ -55,6 +55,8 @@ public class CheckoutConflictException extends GitAPIException {
* list of conflicting paths
*
* @param e
+ * a {@link org.eclipse.jgit.errors.CheckoutConflictException}
+ * exception
*/
public CheckoutConflictException(List<String> conflictingPaths,
org.eclipse.jgit.errors.CheckoutConflictException e) {