Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-12-14 21:33:27 +0000
committerKevin Sawicki2011-12-27 21:37:42 +0000
commit3c7dceec1a7dc367a3e716331bacc37b74e3f6e0 (patch)
tree8393cec24c0c72d1c27ce5d0e46629ec2790c3a0 /org.eclipse.jgit
parent80c521040940fe4f81d38f2dd4b53d3370fb5413 (diff)
downloadjgit-3c7dceec1a7dc367a3e716331bacc37b74e3f6e0.tar.gz
jgit-3c7dceec1a7dc367a3e716331bacc37b74e3f6e0.tar.xz
jgit-3c7dceec1a7dc367a3e716331bacc37b74e3f6e0.zip
Add commit id and parent count to exception message
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java5
3 files changed, 11 insertions, 5 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
index fc77abf88c..403d5fce7c 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
@@ -76,7 +76,7 @@ cannotResolveLocalTrackingRefForUpdating=Cannot resolve local tracking ref {0} f
cannotStoreObjects=cannot store objects
cannotUnloadAModifiedTree=Cannot unload a modified tree.
cannotWorkWithOtherStagesThanZeroRightNow=Cannot work with other stages than zero right now. Won't write corrupt index.
-canOnlyCherryPickCommitsWithOneParent=Can only cherry-pick commits which have exactly one parent
+canOnlyCherryPickCommitsWithOneParent=Cannot cherry-pick commit ''{0}'' because it has {1} parents, only commits with exactly one parent are supported.
canOnlyRevertCommitsWithOneParent=Can only revert commits which have exactly one parent
cantFindObjectInReversePackIndexForTheSpecifiedOffset=Can't find object in (reverse) pack index for the specified offset {0}
cantPassMeATree=Can't pass me a tree!
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
index d3e81e7bc6..3fac637f3e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
@@ -122,10 +122,13 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
RevCommit srcCommit = revWalk.parseCommit(srcObjectId);
// get the parent of the commit to cherry-pick
- if (srcCommit.getParentCount() != 1) {
+ if (srcCommit.getParentCount() != 1)
throw new MultipleParentsNotAllowedException(
- JGitText.get().canOnlyCherryPickCommitsWithOneParent);
- }
+ MessageFormat.format(
+ JGitText.get().canOnlyCherryPickCommitsWithOneParent,
+ srcCommit.name(),
+ Integer.valueOf(srcCommit.getParentCount())));
+
RevCommit srcParent = srcCommit.getParent(0);
revWalk.parseHeaders(srcParent);
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 1503857ca3..35cccc6e50 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -554,7 +554,10 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
for (RevCommit commit : commitsToUse) {
if (commit.getParentCount() != 1)
throw new JGitInternalException(
- JGitText.get().canOnlyCherryPickCommitsWithOneParent);
+ MessageFormat.format(
+ JGitText.get().canOnlyCherryPickCommitsWithOneParent,
+ commit.name(),
+ Integer.valueOf(commit.getParentCount())));
cherryPickList.add(commit);
}

Back to the top