Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.Git.tag()


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


   * @return tag ref
   * @throws Exception
   */
  protected Ref tag(File repo, String name) throws Exception {
    Git git = Git.open(repo);
    git.tag().setName(name).setMessage(name).call();
    Ref tagRef = git.getRepository().getTags().get(name);
    assertNotNull(tagRef);
    return tagRef;
  }

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

    JGitTestUtil.writeTrashFile(defaultDb, "hello.txt", "branch world");
    git.add().addFilepattern("hello.txt").call();
    oldCommitId = git.commit().setMessage("Initial commit").call().getId();
    git.checkout().setName(BRANCH).setCreateBranch(true).call();
    git.checkout().setName("master").call();
    git.tag().setName(TAG).call();
    JGitTestUtil.writeTrashFile(defaultDb, "hello.txt", "master world");
    git.add().addFilepattern("hello.txt").call();
    git.commit().setMessage("Second commit").call();

    notDefaultDb = createWorkRepository();
View Full Code Here

    @TaskAction
    public void tag() throws Exception {
        final ReleaseConvention releaseConvention = releaseConvention(getProject());
        final Git git = git(getProject());

        git.tag().setName(MessageFormat.format(releaseConvention.getTagFormat(), getVersion(getProject()))).call();
    }
}
View Full Code Here

        out.write("hello 2");
        out.flush();
        git.add().addFilepattern("readme.txt").call();
        git.commit().setMessage("commit 2").call();

        git.tag().setName("tag").setAnnotated(true).call();

        out.write("hello 3");
        out.flush();
        git.add().addFilepattern("readme.txt").call();
        git.commit().setMessage("commit 3").call();
View Full Code Here

        FileUtils.touch(new File(wcPath + "/dir/world"));
        git.add().addFilepattern("hello").call();
        git.add().addFilepattern("dir").call();
        git.commit().setAuthor("yobi", "yobi@yobi.io").setMessage("test").call();
        git.branchCreate().setName(branchName).call();
        git.tag().setName(lightWeightTagName).setAnnotated(false).call();
        git.tag().setName(annotatedTagName).setAnnotated(true).setMessage("annotated tag").call();
        repository.close();

        running(support.Helpers.makeTestApplication(), new Runnable() {
            @Override
View Full Code Here

        git.add().addFilepattern("hello").call();
        git.add().addFilepattern("dir").call();
        git.commit().setAuthor("yobi", "yobi@yobi.io").setMessage("test").call();
        git.branchCreate().setName(branchName).call();
        git.tag().setName(lightWeightTagName).setAnnotated(false).call();
        git.tag().setName(annotatedTagName).setAnnotated(true).setMessage("annotated tag").call();
        repository.close();

        running(support.Helpers.makeTestApplication(), new Runnable() {
            @Override
            public void run() {
View Full Code Here

        // remove the tag before creating it
        git.tagDelete().setTags("tag_for_testing").call();

        // set it on the current HEAD
        Ref tag = git.tag().setName("tag_for_testing").call();
        System.out.println("Created/moved tag " + tag + " to repository at " + repository.getDirectory());

        // remove the tag again
        git.tagDelete().setTags("tag_for_testing").call();
View Full Code Here

        // read some other commit and set the tag on it
        ObjectId id = repository.resolve("HEAD^");
        RevWalk walk = new RevWalk(repository);
        RevCommit commit = walk.parseCommit(id);
        tag = git.tag().setObjectId(commit).setName("tag_for_testing").call();
        System.out.println("Created/moved tag " + tag + " to repository at " + repository.getDirectory());

        // remove the tag again
        git.tagDelete().setTags("tag_for_testing").call();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.