Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.TagCommand


   * @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;
View Full Code Here


   * @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;
View Full Code Here

  @Override
  protected void run() throws Exception {
    Git git = new Git(db);
    if (tagName != null) {
      TagCommand command = git.tag().setForceUpdate(force)
          .setMessage(message).setName(tagName);

      if (object != null) {
        RevWalk walk = new RevWalk(db);
        command.setObjectId(walk.parseAny(object));
      }
      try {
        command.call();
      } catch (RefAlreadyExistsException e) {
        throw die(MessageFormat.format(CLIText.get().tagAlreadyExists,
            tagName));
      }
    } else {
      ListTagCommand command = git.tagList();
      List<Ref> list = command.call();
      for (Ref ref : list) {
        outw.println(Repository.shortenRefName(ref.getName()));
      }
    }
  }
View Full Code Here

      walk.dispose();
    }
  }

  static Ref tag(Git git, RevCommit revCommit, String tagName) throws GitAPIException {
    TagCommand tag = git.tag();
    return tag.setObjectId(revCommit).setName(tagName).call();
  }
View Full Code Here

   }

   public static List<Ref> getTags(final Git repo) throws JGitInternalException, ConcurrentRefUpdateException,
            InvalidTagNameException, NoHeadException
   {
      TagCommand tagCommand = repo.tag();
      RevTag revTag = tagCommand.call();
      String tagName = revTag.getTagName();

      return null;
   }
View Full Code Here

    commit.setMessage(message);
    RevCommit revCommit = commit.call();

    if (!StringUtils.isEmpty(tagName) && !StringUtils.isEmpty(tagMessage)) {
      // tag the commit
      TagCommand tagCommand = git.tag();
      tagCommand.setName(tagName);
      tagCommand.setMessage(tagMessage);
      tagCommand.setForceUpdate(true);
      tagCommand.setObjectId(revCommit);
      tagCommand.call();
    }
    git.getRepository().close();
    return revCommit.getId().getName();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.api.TagCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.