Java 类org.eclipse.jgit.api.errors.InvalidTagNameException 实例源码

项目:Elegit    文件:TagModel.java   
/**
 * Tags a commit
 *
 * @param tagName the name for the tag.
 * @param commitName the id of the commit to apply this tag to
 * @throws GitAPIException if the 'git tag' call fails.
 */
public void tag(String tagName, String commitName) throws GitAPIException, MissingRepoException,
        IOException, TagNameExistsException, InvalidTagNameException {
    logger.info("Attempting tag");
    if (!repoHelper.exists()) throw new MissingRepoException();
    Git git = new Git(this.repoHelper.getRepo());
    // This creates a lightweight tag
    // TODO: add support for annotated tags?
    CommitHelper c = repoHelper.getCommit(commitName);
    if (c.getTagNames().contains(tagName))
        throw new TagNameExistsException();
    Ref r = git.tag().setName(tagName).setObjectId(c.getCommit()).setAnnotated(false).call();
    git.close();
    TagHelper t = makeTagHelper(r, tagName);
    this.unpushedTags.add(t);
}
项目:ivy-pdi-git-steps    文件:TagGitCommand.java   
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;
}
项目:incubator-netbeans    文件:TagTest.java   
public void testTagInvalidName () throws Exception {
    File f = new File(workDir, "f");
    File[] files = new File[] { f };
    GitClient client = getClient(workDir);
    write(f, "init");
    GitRevisionInfo commit = client.commit(files, "init commit", null, null, NULL_PROGRESS_MONITOR);
    String name = "tag with spaces";
    try {
        client.createTag(name, commit.getRevision(), null, false, false, NULL_PROGRESS_MONITOR);
        fail("Should fail");
    } catch (GitException ex) {
        assertTrue(ex.getCause() != null);
        assertTrue(ex.getCause().toString(), ex.getCause() instanceof InvalidTagNameException);
    }
}
项目:gradle-gitsemver    文件:TagBasedVersionFactoryTest.java   
@Test
public void testHeadPointsAtStable() throws ConcurrentRefUpdateException,
        InvalidTagNameException, NoHeadException, GitAPIException,
        NoWorkTreeException, MissingObjectException,
        IncorrectObjectTypeException, IOException {
    tag("v1.0.0");
    validateStableTag("1.0.0");
}
项目:gradle-gitsemver    文件:TagBasedVersionFactoryTest.java   
@Test
public void testHeadPointsAtStableWhenUsingPrefix() throws ConcurrentRefUpdateException,
        InvalidTagNameException, NoHeadException, GitAPIException,
        NoWorkTreeException, MissingObjectException,
        IncorrectObjectTypeException, IOException {
    versionFactory = new TagBasedVersionFactory("myPrefix");
    tag("myPrefix-v1.0.0");
    validateStableTag("1.0.0");
}
项目:gradle-gitsemver    文件:TagBasedVersionFactoryTest.java   
@Test
public void testHeadPointsOneAboveStable()
        throws ConcurrentRefUpdateException, InvalidTagNameException,
        NoHeadException, GitAPIException, NoWorkTreeException,
        MissingObjectException, IncorrectObjectTypeException, IOException {
    tag("v1.0.0");
    RevCommit head = makeCommit();
    validateUnstable("1.0.0", 1, head, Dirty.NO, DOT);
}
项目:gradle-gitsemver    文件:TagBasedVersionFactoryTest.java   
@Test
public void testVUnnecessary() throws ConcurrentRefUpdateException,
        InvalidTagNameException, NoHeadException, GitAPIException,
        NoWorkTreeException, IOException {
    makeCommit();
    tag("0.1.0");
    validateStableTag("0.1.0");
}
项目:gradle-gitsemver    文件:TagBasedVersionFactoryTest.java   
@Test
public void testUnstableIsDirty() throws ConcurrentRefUpdateException,
        InvalidTagNameException, NoHeadException, GitAPIException,
        NoWorkTreeException, MissingObjectException,
        IncorrectObjectTypeException, IOException {
    RevCommit commit = makeCommit();
    tag("0.1.0-dev");
    dirtyRepo();
    validateUnstable("0.1.0-dev", 0, commit, Dirty.YES, DOT);
}
项目:gradle-gitsemver    文件:TagBasedVersionFactoryTest.java   
@Test
public void testOrdering() throws ConcurrentRefUpdateException,
        InvalidTagNameException, NoHeadException, GitAPIException,
        NoWorkTreeException, MissingObjectException,
        IncorrectObjectTypeException, IOException {
    tag("3.0.0");
    makeCommit();
    RevCommit head = makeCommit();
    tag("1.0.0");
    validateUnstable("3.0.0", 2, head, Dirty.NO, DASH);
}
项目:gradle-gitsemver    文件:TagBasedVersionFactoryTest.java   
private Ref tag(String tagName) throws ConcurrentRefUpdateException,
        InvalidTagNameException, NoHeadException, GitAPIException {
    return git.tag().setMessage("blah").setName(tagName).call();
}