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

Java TagCommand类代码示例

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

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



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

示例1: run

import org.eclipse.jgit.api.TagCommand; //导入依赖的package包/类
@Override
protected void run () throws GitException {
    Repository repository = getRepository();
    try {
        RevObject obj = Utils.findObject(repository, taggedObject);
        TagCommand cmd = new Git(repository).tag();
        cmd.setName(tagName);
        cmd.setForceUpdate(forceUpdate);
        cmd.setObjectId(obj);
        cmd.setAnnotated(message != null && !message.isEmpty() || signed);
        if (cmd.isAnnotated()) {
            cmd.setMessage(message);
            cmd.setSigned(signed);
        }
        cmd.call();
        ListTagCommand tagCmd = new ListTagCommand(repository, getClassFactory(), false, new DelegatingGitProgressMonitor(monitor));
        tagCmd.run();
        Map<String, GitTag> tags = tagCmd.getTags();
        tag = tags.get(tagName);
    } catch (JGitInternalException | GitAPIException ex) {
        throw new GitException(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:CreateTagCommand.java


示例2: execute

import org.eclipse.jgit.api.TagCommand; //导入依赖的package包/类
public Result execute(String ref) throws Exception {
  RevCommit c = commitBuilder.create();
  if (changeId == null) {
    changeId = GitUtil.getChangeId(testRepo, c).get();
  }
  if (tag != null) {
    TagCommand tagCommand = testRepo.git().tag().setName(tag.name);
    if (tag instanceof AnnotatedTag) {
      AnnotatedTag annotatedTag = (AnnotatedTag) tag;
      tagCommand
          .setAnnotated(true)
          .setMessage(annotatedTag.message)
          .setTagger(annotatedTag.tagger);
    } else {
      tagCommand.setAnnotated(false);
    }
    tagCommand.call();
  }
  return new Result(ref, pushHead(testRepo, ref, tag != null, force, pushOptions), c, subject);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:PushOneCommit.java


示例3: createTag

import org.eclipse.jgit.api.TagCommand; //导入依赖的package包/类
/**
 * creates a tag in a repository
 * 
 * @param repository
 * @param objectId
 *            , the ref the tag points towards
 * @param tagger
 *            , the person tagging the object
 * @param tag
 *            , the string label
 * @param message
 *            , the string message
 * @return boolean, true if operation was successful, otherwise false
 */
public static boolean createTag(Repository repository, String objectId, PersonIdent tagger, String tag, String message) {
	try {
		Git gitClient = Git.open(repository.getDirectory());
		TagCommand tagCommand = gitClient.tag();
		tagCommand.setTagger(tagger);
		tagCommand.setMessage(message);
		if (objectId != null) {
			RevObject revObj = getCommit(repository, objectId);
			tagCommand.setObjectId(revObj);
		}
		tagCommand.setName(tag);
		Ref call = tagCommand.call();
		return call != null ? true : false;
	} catch (Exception e) {
		error(e, repository, "Failed to create tag {1} in repository {0}", objectId, tag);
	}
	return false;
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:33,代码来源:JGitUtils.java


示例4: call

import org.eclipse.jgit.api.TagCommand; //导入依赖的package包/类
public Git call(final GitOperationsStep gitOperationsStep, Git git,
    CredentialsProvider cp, String gitRepoUrl, File gitRepoFolder)
    throws IllegalArgumentException, IOException,
    ConcurrentRefUpdateException, InvalidTagNameException,
    NoHeadException, GitAPIException {
  TagCommand tc = git.tag().setAnnotated(annotated)
      .setForceUpdate(forceUpdate).setSigned(signed);
  if (!Const.isEmpty(this.message)) {
    tc = tc.setMessage(gitOperationsStep
        .environmentSubstitute(this.message));
  }
  if (!Const.isEmpty(this.name)) {
    tc = tc.setName(gitOperationsStep.environmentSubstitute(this.name));
  }
  tc.call();
  return git;
}
 
开发者ID:ivylabs,项目名称:ivy-pdi-git-steps,代码行数:18,代码来源:TagGitCommand.java


示例5: createTag

import org.eclipse.jgit.api.TagCommand; //导入依赖的package包/类
/**
 * creates a tag in a repository
 * 
 * @param repository
 * @param objectId, the ref the tag points towards
 * @param tagger, the person tagging the object
 * @param tag, the string label
 * @param message, the string message
 * @return boolean, true if operation was successful, otherwise false
 */
public static boolean createTag(Repository repository, String objectId, PersonIdent tagger, String tag, String message) {
	try {			
		Git gitClient = Git.open(repository.getDirectory());
		TagCommand tagCommand = gitClient.tag();
		tagCommand.setTagger(tagger);
		tagCommand.setMessage(message);
		if (objectId != null) {
			RevObject revObj = getCommit(repository, objectId);
			tagCommand.setObjectId(revObj);
		}
		tagCommand.setName(tag);
		Ref call = tagCommand.call();			
		return call != null ? true : false;
	} catch (Exception e) {
		error(e, repository, "Failed to create tag {1} in repository {0}", objectId, tag);
	}
	return false;
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:29,代码来源:JGitUtils.java


示例6: tagCreate

import org.eclipse.jgit.api.TagCommand; //导入依赖的package包/类
@Override
public Tag tagCreate(TagCreateParams params) throws GitException {
  String commit = params.getCommit();
  if (commit == null) {
    commit = HEAD;
  }

  try {
    RevWalk revWalk = new RevWalk(repository);
    RevObject revObject;
    try {
      revObject = revWalk.parseAny(repository.resolve(commit));
    } finally {
      revWalk.close();
    }

    TagCommand tagCommand =
        getGit()
            .tag()
            .setName(params.getName())
            .setObjectId(revObject)
            .setMessage(params.getMessage())
            .setForceUpdate(params.isForce());

    GitUser tagger = getUser();
    if (tagger != null) {
      tagCommand.setTagger(new PersonIdent(tagger.getName(), tagger.getEmail()));
    }

    Ref revTagRef = tagCommand.call();
    RevTag revTag = revWalk.parseTag(revTagRef.getLeaf().getObjectId());
    return newDto(Tag.class).withName(revTag.getTagName());
  } catch (IOException | GitAPIException exception) {
    throw new GitException(exception.getMessage(), exception);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:37,代码来源:JGitConnection.java


示例7: createTag

import org.eclipse.jgit.api.TagCommand; //导入依赖的package包/类
/**
 * Create a new tag in the local git repository
 * (git checkout tagname) and finally pushes new branch on the remote repository (git push)
 *
 * @param directory the directory in which the local git repository is located
 * @param username  the username to be used while pushing
 * @param password  the password matching with the provided username to be used
 *                  for authentication
 * @param message   the commit message to be used	 
 */
public static void createTag(@NonNull File directory, String tagName, String username,
							 String password, String message) {

	try {
		final Git git = Git.open(directory);

		final UsernamePasswordCredentialsProvider userCredential = new UsernamePasswordCredentialsProvider(
				username, password);

		TagCommand tagCommand = git.tag();
		tagCommand.setName(tagName);
		tagCommand.setMessage(message);
		tagCommand.call();
		log.info("Tag created");

		// and then commit
		final PersonIdent author = new PersonIdent(username, "");
		git.commit().setCommitter(author).setMessage(message)
				.setAuthor(author).call();
		log.info(message);

		git.push().setCredentialsProvider(userCredential).call();
		log.info("Pushed the changes in remote Git repository...");
	} catch (final GitAPIException | IOException e) {
		log.error(e.getMessage(), e);
	}
}
 
开发者ID:awltech,项目名称:easycukes,代码行数:38,代码来源:GitHelper.java


示例8: createAnnotatedTag

import org.eclipse.jgit.api.TagCommand; //导入依赖的package包/类
public static Ref createAnnotatedTag(TestRepository<?> testRepo, String name, PersonIdent tagger)
    throws GitAPIException {
  TagCommand cmd =
      testRepo.git().tag().setName(name).setAnnotated(true).setMessage(name).setTagger(tagger);
  return cmd.call();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:7,代码来源:GitUtil.java


示例9: updateAnnotatedTag

import org.eclipse.jgit.api.TagCommand; //导入依赖的package包/类
public static Ref updateAnnotatedTag(TestRepository<?> testRepo, String name, PersonIdent tagger)
    throws GitAPIException {
  TagCommand tc = testRepo.git().tag().setName(name);
  return tc.setAnnotated(true).setMessage(name).setTagger(tagger).setForceUpdate(true).call();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:GitUtil.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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