use of com.oxygenxml.git.view.stash.StashApplyStatus in project oxygen-git-client-addon by oxygenxml.
the class GitAccess method applyStash.
/**
* Apply the given stash.
*
* @param stashRef the stash which will be applied.
*
* @return the status for stash apply operation.
*
* @throws GitAPIException
*/
public StashApplyStatus applyStash(String stashRef) throws GitAPIException {
fireOperationAboutToStart(new GitEventInfo(GitOperation.STASH_APPLY));
StashApplyStatus status = StashApplyStatus.NOT_APPLIED_UNKNOWN_CAUSE;
try {
checkIfStashIsApplicable(stashRef);
git.stashApply().setStashRef(stashRef).call();
status = StashApplyStatus.APPLIED_SUCCESSFULLY;
fireOperationSuccessfullyEnded(new GitEventInfo(GitOperation.STASH_APPLY));
} catch (StashApplyFailureWithStatusException e) {
status = e.getStatus();
displayStashApplyFailedCauseMessage(false, status, e);
} catch (StashApplyFailureException | IOException e) {
displayStashApplyFailedCauseMessage(false, status, e);
}
return status;
}
use of com.oxygenxml.git.view.stash.StashApplyStatus in project oxygen-git-client-addon by oxygenxml.
the class GitAccess method popStash.
/**
* Pop the given stash.
*
* @param stashRef the stash which will be applied.
*
* @return the status for stash apply operation.
*
* @throws GitAPIException
*/
public StashApplyStatus popStash(String stashRef) throws GitAPIException {
fireOperationAboutToStart(new GitEventInfo(GitOperation.STASH_APPLY));
StashApplyStatus status = StashApplyStatus.NOT_APPLIED_UNKNOWN_CAUSE;
try {
checkIfStashIsApplicable(stashRef);
git.stashApply().setStashRef(stashRef).call();
List<RevCommit> stashes = new ArrayList<>(listStashes());
status = StashApplyStatus.APPLIED_SUCCESSFULLY;
for (int i = 0; i < stashes.size(); i++) {
if (stashRef.equals(stashes.get(i).getName())) {
dropStash(i);
break;
}
}
fireOperationSuccessfullyEnded(new GitEventInfo(GitOperation.STASH_APPLY));
} catch (StashApplyFailureWithStatusException e) {
status = e.getStatus();
displayStashApplyFailedCauseMessage(true, status, e);
} catch (StashApplyFailureException | IOException e) {
displayStashApplyFailedCauseMessage(true, status, e);
}
return status;
}
Aggregations