• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RefAlreadyExistsException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jgit.api.errors.RefAlreadyExistsException的典型用法代码示例。如果您正苦于以下问题:Java RefAlreadyExistsException类的具体用法?Java RefAlreadyExistsException怎么用?Java RefAlreadyExistsException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RefAlreadyExistsException类属于org.eclipse.jgit.api.errors包,在下文中一共展示了RefAlreadyExistsException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: submitBranch

import org.eclipse.jgit.api.errors.RefAlreadyExistsException; //导入依赖的package包/类
private void submitBranch(
        String newrev,
        String ref,
        JGitOperator jgitOp,
        RevCommit commitMetadata,
        String shortId) {
    String vgBranchName = VerigreenUtils.getVerigreenBranchName(shortId);
    
    try
    {
   		jgitOp.createBranch(newrev, vgBranchName); 
    }
    catch(RuntimeException e){
   		if (!(e.getCause() instanceof RefAlreadyExistsException))
   		{
   			throw e;
   		}
    }
    BranchDescriptor branchData = new BranchDescriptor();
    branchData.setCommitter(commitMetadata.getCommitterIdent().getEmailAddress());
    branchData.setProtectedBranch(ref);
    branchData.setNewBranch(vgBranchName);
    branchData.setCommitId(shortId);
    
    new RestClientImpl().post(GitHookApi.getCreateBranchRequest(branchData));
}
 
开发者ID:Verigreen,项目名称:verigreen,代码行数:27,代码来源:BranchOperator.java


示例2: switchToMainAndDeleteFrom

import org.eclipse.jgit.api.errors.RefAlreadyExistsException; //导入依赖的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


示例3: call

import org.eclipse.jgit.api.errors.RefAlreadyExistsException; //导入依赖的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


示例4: checkoutAllBranches

import org.eclipse.jgit.api.errors.RefAlreadyExistsException; //导入依赖的package包/类
private void checkoutAllBranches(Repository repository) throws GitAPIException {
    final Git git = Git.wrap(repository);
    for (final Ref ref : git.branchList().setListMode(ListBranchCommand.ListMode.REMOTE).call()) {
        final String refName = ref.getName();
        final String branchName = refName.substring(refName.lastIndexOf('/') + 1);
        try {
            git.checkout().setCreateBranch(true).setName(branchName).setStartPoint("origin/" + branchName).call();
        } catch (RefAlreadyExistsException e) {
            LOGGER.warning("Already exists, so ignoring " + e.getMessage());
        }
    }
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:13,代码来源:GitCloner.java


示例5: initializeGitFlow

import org.eclipse.jgit.api.errors.RefAlreadyExistsException; //导入依赖的package包/类
private static Git initializeGitFlow(Repository repo)
        throws RefAlreadyExistsException, RefNotFoundException,
        InvalidRefNameException, GitAPIException {
    Git git = new Git(repo);
    git.commit().setCommitter(COMMITTER).setMessage("initial commit").call();
    return git;
}
 
开发者ID:palantir,项目名称:gradle-gitsemver,代码行数:8,代码来源:TagBasedVersionFactoryTest.java


示例6: processOptions

import org.eclipse.jgit.api.errors.RefAlreadyExistsException; //导入依赖的package包/类
protected void processOptions() throws InvalidRefNameException,
	RefAlreadyExistsException, IOException
{
	String branchName = this.getBranchName();
	if (this.name == null || Repository.isValidRefName(branchName) == false) {
		throw new InvalidRefNameException(MessageFormat.format(
			JGitText.get().branchNameInvalid, this.name == null ? "<null>"
				: this.name));
	}
	Ref refToCheck = this.getRepository().getRef(branchName);
	if (refToCheck != null) {
		throw new RefAlreadyExistsException(MessageFormat.format(
			JGitText.get().refAlreadyExists, this.name));
	}
}
 
开发者ID:uw-loci,项目名称:github-backup-java,代码行数:16,代码来源:CreateOrphanBranchCommand.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XmlRpcRequest类代码示例发布时间:2022-05-21
下一篇:
Java SessionParameter类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap