]> source.dussan.org Git - jgit.git/commitdiff
Add commit id and parent count to exception message 20/4820/2
authorKevin Sawicki <kevin@github.com>
Wed, 14 Dec 2011 21:33:27 +0000 (13:33 -0800)
committerKevin Sawicki <kevin@github.com>
Tue, 27 Dec 2011 21:37:42 +0000 (13:37 -0800)
Bug: 357312
Change-Id: I2f85cf88650594eca7df6aa0e26bea329674f08e

org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

index fc77abf88cc9bc5753dd9a0e51f3d033f7fd3cd1..403d5fce7ce4c38a27f3dafe16b8e83072e00f12 100644 (file)
@@ -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!
index d3e81e7bc6b6dac50d0ccac8075fa4860ec04547..3fac637f3ebd5e352756b552e06153d6ae6114b3 100644 (file)
@@ -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);
 
index 1503857ca363bb0c57b8a0d81cedbf33b20adfb7..35cccc6e502d5f6420e71fc519ec4aeba90806d4 100644 (file)
@@ -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);
                }