当前位置: 首页>>代码示例>>Java>>正文


Java CheckoutConflictException类代码示例

本文整理汇总了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();
			}
		}
	}
}
 
开发者ID:mast-group,项目名称:commitmining-tools,代码行数:33,代码来源:RepositoryFileWalker.java

示例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);
	}
}
 
开发者ID:uw-loci,项目名称:github-backup-java,代码行数:23,代码来源:CreateOrphanBranchCommand.java

示例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();
	}
}
 
开发者ID:uw-loci,项目名称:github-backup-java,代码行数:17,代码来源:CreateOrphanBranchCommand.java

示例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(); //
}
 
开发者ID:retest,项目名称:rebazer,代码行数:13,代码来源:RebaseService.java

示例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));
}
 
开发者ID:oxygenxml,项目名称:oxygen-git-plugin,代码行数:13,代码来源:PushPullController.java

示例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);
        }
}
 
开发者ID:rimerosolutions,项目名称:ant-git-tasks,代码行数:32,代码来源:MergeTask.java

示例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);
	}
}
 
开发者ID:uw-loci,项目名称:github-backup-java,代码行数:9,代码来源:CreateOrphanBranchCommand.java

示例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;
    }

}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:51,代码来源:GitManagerImpl.java

示例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);
}
 
开发者ID:link-intersystems,项目名称:GitDirStat,代码行数:6,代码来源:GitRepository.java


注:本文中的org.eclipse.jgit.api.errors.CheckoutConflictException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。