public String toString() {
return "Fast-forward";
}
+
+ @Override
+ public boolean isSuccessful() {
+ return true;
+ }
},
/** */
ALREADY_UP_TO_DATE {
public String toString() {
return "Already-up-to-date";
}
+
+ @Override
+ public boolean isSuccessful() {
+ return true;
+ }
},
/** */
FAILED {
public String toString() {
return "Failed";
}
+
+ @Override
+ public boolean isSuccessful() {
+ return false;
+ }
},
/** */
MERGED {
public String toString() {
return "Merged";
}
+
+ @Override
+ public boolean isSuccessful() {
+ return true;
+ }
},
/** */
CONFLICTING {
public String toString() {
return "Conflicting";
}
+
+ @Override
+ public boolean isSuccessful() {
+ return false;
+ }
},
/** */
NOT_SUPPORTED {
public String toString() {
return "Not-yet-supported";
}
- }
+
+ @Override
+ public boolean isSuccessful() {
+ return false;
+ }
+ };
+
+ /**
+ * @return whether the status indicates a successful result
+ */
+ public abstract boolean isSuccessful();
}
private ObjectId[] mergedCommits;
return this.fetchedFrom;
}
+ /**
+ * @return whether the pull was successful
+ */
+ public boolean isSuccessful() {
+ if (mergeResult != null)
+ return mergeResult.getMergeStatus().isSuccessful();
+ else if (rebaseResult != null)
+ return rebaseResult.getStatus().isSuccessful();
+ return true;
+ }
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
/**
* Rebase was successful, HEAD points to the new commit
*/
- OK,
+ OK {
+ @Override
+ public boolean isSuccessful() {
+ return true;
+ }
+ },
/**
* Aborted; the original HEAD was restored
*/
- ABORTED,
+ ABORTED {
+ @Override
+ public boolean isSuccessful() {
+ return false;
+ }
+ },
/**
* Stopped due to a conflict; must either abort or resolve or skip
*/
- STOPPED,
+ STOPPED {
+ @Override
+ public boolean isSuccessful() {
+ return false;
+ }
+ },
/**
* Failed; the original HEAD was restored
*/
- FAILED,
+ FAILED {
+ @Override
+ public boolean isSuccessful() {
+ return false;
+ }
+ },
/**
* Already up-to-date
*/
- UP_TO_DATE,
+ UP_TO_DATE {
+ @Override
+ public boolean isSuccessful() {
+ return true;
+ }
+ },
/**
* Fast-forward, HEAD points to the new commit
*/
- FAST_FORWARD;
+ FAST_FORWARD {
+ @Override
+ public boolean isSuccessful() {
+ return true;
+ }
+ };
+
+ /**
+ * @return whether the status indicates a successful result
+ */
+ public abstract boolean isSuccessful();
}
static final RebaseResult OK_RESULT = new RebaseResult(Status.OK);