本文整理汇总了Java中org.eclipse.jgit.api.errors.CheckoutConflictException类的典型用法代码示例。如果您正苦于以下问题:Java CheckoutConflictException类的具体用法?Java CheckoutConflictException怎么用?Java CheckoutConflictException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CheckoutConflictException类属于org.eclipse.jgit.api.errors包,在下文中一共展示了CheckoutConflictException类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: switchToMainAndDeleteFrom
import org.eclipse.jgit.api.errors.CheckoutConflictException; //导入依赖的package包/类
/**
* Switch to the main branch and delete the temporary branch.
*
* @throws GitAPIException
* @throws RefAlreadyExistsException
* @throws RefNotFoundException
* @throws InvalidRefNameException
* @throws CheckoutConflictException
* @throws NotMergedException
* @throws CannotDeleteCurrentBranchException
*/
private void switchToMainAndDeleteFrom(final String tempBranch)
throws GitAPIException, RefAlreadyExistsException,
RefNotFoundException, InvalidRefNameException,
CheckoutConflictException, NotMergedException,
CannotDeleteCurrentBranchException {
try {
repository.reset().setMode(ResetType.HARD).call();
} finally {
try {
repository.checkout().setCreateBranch(false)
.setName(mainBranchName).setForce(true).call();
} finally {
try {
repository.reset().setMode(ResetType.HARD).call();
} finally {
repository.branchDelete().setForce(true)
.setBranchNames(tempBranch).call();
}
}
}
}
示例2: call
import org.eclipse.jgit.api.errors.CheckoutConflictException; //导入依赖的package包/类
@Override
public Ref call() throws GitAPIException, RefNotFoundException,
CheckoutConflictException, InvalidRefNameException,
RefAlreadyExistsException
{
this.checkCallable();
try {
this.processOptions();
this.checkoutStartPoint();
RefUpdate update = this.getRepository().updateRef(Constants.HEAD);
Result r = update.link(this.getBranchName());
if (EnumSet.of(Result.NEW, Result.FORCED).contains(r) == false) {
throw new JGitInternalException(MessageFormat.format(
JGitText.get().checkoutUnexpectedResult, r.name()));
}
this.setCallable(false);
return this.getRepository().getRef(Constants.HEAD);
}
catch (IOException e) {
throw new JGitInternalException(e.getMessage(), e);
}
}
示例3: checkout
import org.eclipse.jgit.api.errors.CheckoutConflictException; //导入依赖的package包/类
protected void checkout(ObjectId fromId) throws GitAPIException,
CheckoutConflictException, IOException
{
RevWalk rw = new RevWalk(this.getRepository());
try {
Ref headRef = this.repo.getRef(Constants.HEAD);
AnyObjectId headId = headRef.getObjectId();
RevCommit headCommit = headId == null ? null : rw.parseCommit(headId);
RevTree headTree = headCommit == null ? null : headCommit.getTree();
RevCommit from = rw.parseCommit(fromId);
this.checkout(headTree, from.getTree());
}
finally {
rw.release();
}
}
示例4: resetAndRemoveUntrackedFiles
import org.eclipse.jgit.api.errors.CheckoutConflictException; //导入依赖的package包/类
private void resetAndRemoveUntrackedFiles( final Git repository )
throws GitAPIException, CheckoutConflictException {
repository.clean() //
.setCleanDirectories( true ) //
.setForce( true ) //
.setIgnore( false ) //
.call(); //
repository.reset() //
.setMode( ResetType.HARD ) //
.call(); //
}
示例5: showPullFailedBecauseofConflict
import org.eclipse.jgit.api.errors.CheckoutConflictException; //导入依赖的package包/类
/**
* Pull failed because there are uncommitted files that would be in conflict
* after the pull.
*
* @param e Exception.
*/
protected void showPullFailedBecauseofConflict(CheckoutConflictException e) {
new PullWithConflictsDialog(
translator.getTranslation(Tags.PULL_STATUS),
e.getConflictingPaths(),
translator.getTranslation(Tags.PULL_CHECKOUT_CONFLICT_MESSAGE));
}
示例6: doExecute
import org.eclipse.jgit.api.errors.CheckoutConflictException; //导入依赖的package包/类
@Override
public void doExecute() {
try {
MergeCommand mergeCommand = git.merge().setSquash(squash);
mergeCommand.include(mergeCommand.getRepository().getRef(branchname));
setupCredentials(mergeCommand);
MergeResult mergeResult = null;
try {
mergeResult = mergeCommand.call();
} catch (CheckoutConflictException conflicts) {
throw new BuildException(String.format("%s - Checkout conflicts: %s", MESSAGE_MERGE_FAILED, conflicts.getConflictingPaths()));
}
if (!mergeResult.getMergeStatus().isSuccessful()) {
if (mergeResult.getCheckoutConflicts() != null && mergeResult.getCheckoutConflicts().size() > 0) {
throw new BuildException(String.format("%s - Checkout conflicts: %s", MESSAGE_MERGE_FAILED, mergeResult.getCheckoutConflicts()));
}
if (mergeResult.getFailingPaths() != null && mergeResult.getFailingPaths().size() > 0) {
throw new BuildException(String.format("%s - Failing paths: %s", MESSAGE_MERGE_FAILED, mergeResult.getFailingPaths()));
}
throw new BuildException(String.format(MESSAGE_MERGE_FAILED_WITH_STATUS, mergeResult.getMergeStatus().name()));
}
} catch (Exception e) {
throw new GitBuildException(String.format(MESSAGE_MERGE_FAILED_WITH_URI, getUri()), e);
}
}
示例7: checkoutStartPoint
import org.eclipse.jgit.api.errors.CheckoutConflictException; //导入依赖的package包/类
protected void checkoutStartPoint() throws GitAPIException,
RefNotFoundException, CheckoutConflictException, IOException
{
ObjectId sp = this.getStartPoint();
if (sp != null) {
this.checkout(sp);
}
}
示例8: checkout
import org.eclipse.jgit.api.errors.CheckoutConflictException; //导入依赖的package包/类
@Override
public CheckoutResponse checkout(Workspace ws, String name, String startPoint) throws GitAPIException, IOException, GitOperationException {
Repository repository = getRepository(ws.getSpaceKey());
try (Git git = Git.wrap(repository)) {
CheckoutCommand command = git.checkout().setName(name);
if (isRemoteBranch(ws, name)) {
throw new GitOperationException("Remote branch must be checkout as new local branch");
}
if (StringUtils.isNotEmpty(startPoint)) {
command.setStartPoint(startPoint);
command.setCreateBranch(true);
}
try {
command.call();
} catch (CheckoutConflictException e) {
// Ignore
}
CheckoutResult result = command.getResult();
CheckoutResult.Status s = result.getStatus();
CheckoutResponse.Status status = CheckoutResponse.Status.OK;
if (s == CheckoutResult.Status.CONFLICTS) {
status = CheckoutResponse.Status.CONFLICTS;
} else if (s == CheckoutResult.Status.ERROR) {
status = CheckoutResponse.Status.ERROR;
} else if (s == CheckoutResult.Status.NONDELETED) {
status = CheckoutResponse.Status.NONDELETED;
} else if (s == CheckoutResult.Status.NOT_TRIED) {
status = CheckoutResponse.Status.NOT_TRIED;
}
CheckoutResponse response = new CheckoutResponse();
response.setStatus(status);
response.setConflictList(result.getConflictList());
response.setModifiedList(result.getModifiedList());
response.setRemovedList(result.getRemovedList());
response.setUndeletedList(result.getUndeletedList());
publisher.publishEvent(new GitCheckoutEvent(ws, repository.getBranch()));
return response;
}
}
示例9: applyFilter
import org.eclipse.jgit.api.errors.CheckoutConflictException; //导入依赖的package包/类
public void applyFilter(Collection<CommitRange> commitRanges,
IndexFilter indexFilter) throws IOException,
CheckoutConflictException, GitAPIException {
applyFilter(commitRanges, indexFilter, NullProgressListener.INSTANCE);
}