summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorStefan Lay <stefan.lay@sap.com>2013-10-22 16:01:18 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2013-11-05 18:05:03 +0100
commitcce2561e9fe2ce1cf60182f9d95c8537ce13de92 (patch)
treee8da3faa367b665ec03e1811160bceb3c3f1affc /org.eclipse.jgit
parent765896febb4b63cfe2c37dc0a73c90c79dd1591b (diff)
downloadjgit-cce2561e9fe2ce1cf60182f9d95c8537ce13de92.tar.gz
jgit-cce2561e9fe2ce1cf60182f9d95c8537ce13de92.zip
Add additional RebaseResult for editing commits
With the new RebaseResult.EDIT a client can now distinguish if rebase stopped due to a conflict or because the commit was marked for edit in an interactive rebase. Change-Id: I40f2311cf43ed5f290dcda65a7bd85ba770a85f5 Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseResult.java14
2 files changed, 19 insertions, 8 deletions
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 1feb3f2090..ef739bb050 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -302,7 +302,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
RevCommit commitToPick = walk
.parseCommit(ids.iterator().next());
if (monitor.isCancelled())
- return new RebaseResult(commitToPick);
+ return new RebaseResult(commitToPick, Status.STOPPED);
try {
monitor.beginTask(MessageFormat.format(
JGitText.get().applyingCommit,
@@ -328,9 +328,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
return abort(new RebaseResult(
cherryPickResult.getFailingPaths()));
else
- return stop(commitToPick);
+ return stop(commitToPick, Status.STOPPED);
case CONFLICTING:
- return stop(commitToPick);
+ return stop(commitToPick, Status.STOPPED);
case OK:
newHead = cherryPickResult.getNewHead();
}
@@ -348,7 +348,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
continue;
case EDIT:
rebaseState.createFile(AMEND, commitToPick.name());
- return stop(commitToPick);
+ return stop(commitToPick, Status.EDIT);
case COMMENT:
break;
case SQUASH:
@@ -673,7 +673,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
return parseAuthor(raw);
}
- private RebaseResult stop(RevCommit commitToPick) throws IOException {
+ private RebaseResult stop(RevCommit commitToPick, RebaseResult.Status status)
+ throws IOException {
PersonIdent author = commitToPick.getAuthorIdent();
String authorScript = toAuthorScript(author);
rebaseState.createFile(AUTHOR_SCRIPT, authorScript);
@@ -691,7 +692,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
// Remove cherry pick state file created by CherryPickCommand, it's not
// needed for rebase
repo.writeCherryPickHead(null);
- return new RebaseResult(commitToPick);
+ return new RebaseResult(commitToPick, status);
}
String toAuthorScript(PersonIdent author) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseResult.java
index ff18adce4f..6df5ffdd1d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseResult.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseResult.java
@@ -85,6 +85,15 @@ public class RebaseResult {
}
},
/**
+ * Stopped for editing in the context of an interactive rebase
+ */
+ EDIT {
+ @Override
+ public boolean isSuccessful() {
+ return false;
+ }
+ },
+ /**
* Failed; the original HEAD was restored
*/
FAILED {
@@ -183,9 +192,10 @@ public class RebaseResult {
*
* @param commit
* current commit
+ * @param status
*/
- RebaseResult(RevCommit commit) {
- status = Status.STOPPED;
+ RebaseResult(RevCommit commit, RebaseResult.Status status) {
+ this.status = status;
currentCommit = commit;
}