use of com.oxygenxml.git.view.event.GitEventInfo in project oxygen-git-client-addon by oxygenxml.
the class GitAccess method tagCommit.
/**
* Creates a tag commit
*
* @param name the name of the tag
* @param message the message of the tag
* @param commitId the id of the commit where the tag will be
*
* @throws GitAPIException
* @throws NoRepositorySelected
* @throws IOException
*/
public void tagCommit(String name, String message, String commitId) throws GitAPIException, NoRepositorySelected, IOException {
fireOperationAboutToStart(new GitEventInfo(GitOperation.CREATE_TAG));
try {
RevWalk walk = new RevWalk(getRepository());
RevCommit id = walk.parseCommit(getRepository().resolve(commitId));
git.tag().setName(name).setMessage(message).setObjectId(id).setForceUpdate(true).call();
fireOperationSuccessfullyEnded(new GitEventInfo(GitOperation.CREATE_TAG));
} catch (GitAPIException | NoRepositorySelected | RevisionSyntaxException | IOException e) {
LOGGER.error(e.getMessage(), e);
fireOperationFailed(new GitEventInfo(GitOperation.CREATE_TAG), e);
throw e;
}
}
use of com.oxygenxml.git.view.event.GitEventInfo in project oxygen-git-client-addon by oxygenxml.
the class GitAccess method checkoutCommit.
/**
* Used to do a checkout commit.
*
* @param startPoint The start commit. <code>null</code> the index is used.
* @param branchName The new branch name. <code>null</code> to do a headless checkout.
*
* @throws GitAPIException Errors while invoking git commands.
*/
public void checkoutCommit(@Nullable String startPoint, @Nullable String branchName) throws GitAPIException {
fireOperationAboutToStart(new GitEventInfo(GitOperation.CHECKOUT_COMMIT));
CheckoutCommand checkoutCommand = this.git.checkout();
checkoutCommand.setStartPoint(startPoint);
doCheckoutCommit(checkoutCommand, branchName);
}
use of com.oxygenxml.git.view.event.GitEventInfo in project oxygen-git-client-addon by oxygenxml.
the class GitAccess method checkoutCommitForFile.
/**
* Checkout the current file to a specified commit version.
*
* @author Alex_Smarandache
*
* @param path The path of the file to reset.
* @param commitId The commit id to which to reset.
*/
public void checkoutCommitForFile(String path, String commitId) {
fireOperationAboutToStart(new GitEventInfo(GitOperation.CHECKOUT_FILE));
try {
CheckoutCommand checkOut = GitAccess.getInstance().getGit().checkout();
checkOut.setStartPoint(commitId);
checkOut.addPath(path);
checkOut.call();
fireOperationSuccessfullyEnded(new GitEventInfo(GitOperation.CHECKOUT_FILE));
} catch (GitAPIException e) {
fireOperationFailed(new GitEventInfo(GitOperation.CHECKOUT_FILE), e);
LOGGER.error(e.getMessage(), e);
}
}
use of com.oxygenxml.git.view.event.GitEventInfo in project oxygen-git-client-addon by oxygenxml.
the class GitAccess method checkoutCommit.
/**
* Used to do a checkout commit.
*
* @param startPoint The start commit.
* @param branchName The new branch name(if shouldCreateANewBranch is <code>true</code>).
*
* @throws GitAPIException Errors while invoking git commands.
*/
public void checkoutCommit(RevCommit startPoint, String branchName) throws GitAPIException {
fireOperationAboutToStart(new GitEventInfo(GitOperation.CHECKOUT_COMMIT));
CheckoutCommand checkoutCommand = this.git.checkout();
checkoutCommand.setStartPoint(startPoint);
doCheckoutCommit(checkoutCommand, branchName);
}
use of com.oxygenxml.git.view.event.GitEventInfo in project oxygen-git-client-addon by oxygenxml.
the class GitAccess method dropAllStashes.
/**
* Drops all stashes.
*
* @throws GitAPIException
*/
public void dropAllStashes() throws GitAPIException {
fireOperationAboutToStart(new GitEventInfo(GitOperation.STASH_DROP));
try {
git.stashDrop().setAll(true).call();
fireOperationSuccessfullyEnded(new GitEventInfo(GitOperation.STASH_DROP));
} catch (GitAPIException e) {
LOGGER.error(e.getMessage(), e);
fireOperationFailed(new GitEventInfo(GitOperation.STASH_DROP), e);
throw e;
}
}
Aggregations