当前位置: 首页>>代码示例>>Java>>正文


Java RevTag类代码示例

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


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

示例1: testForCreateAnotationTag

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
@Test
public void testForCreateAnotationTag() throws GitAPIException, IOException {
    Git git = Git.wrap(repository);

    gitMgr.createTag(ws, "test", null, "test message", false);

    List<Ref> refs = git.tagList().call();
    assertEquals(1, refs.size());
    assertEquals("refs/tags/test", refs.get(0).getName());

    assertNotEquals(repository.resolve("HEAD"), refs.get(0).getObjectId());

    RevWalk walk = new RevWalk(repository);
    RevTag tag = walk.parseTag(refs.get(0).getObjectId());

    assertEquals("test message", tag.getFullMessage());
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:18,代码来源:GitManagerTest.java

示例2: fromRef

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
@Override
public ProposedTag fromRef(final Ref gitTag) throws SCMException {
	notNull(gitTag, "gitTag");

	final RevWalk walk = new RevWalk(getGit().getRepository());
	final ObjectId tagId = gitTag.getObjectId();
	JSONObject message;
	try {
		final RevTag tag = walk.parseTag(tagId);
		message = (JSONObject) JSONValue.parse(tag.getFullMessage());
	} catch (final IOException e) {
		throw new SCMException(e, "Error while looking up tag because RevTag could not be parsed! Object-id was %s",
				tagId);
	} finally {
		walk.dispose();
	}
	if (message == null) {
		message = new JSONObject();
		message.put(VERSION, "0");
		message.put(BUILD_NUMBER, "0");
	}
	return new GitProposedTag(getGit(), log, gitTag, stripRefPrefix(gitTag.getName()), message,
			config.getRemoteUrlOrNull());
}
 
开发者ID:SourcePond,项目名称:release-maven-plugin-parent,代码行数:25,代码来源:GitRepository.java

示例3: fromRef

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
public static AnnotatedTag fromRef(Repository repository, Ref gitTag) throws IOException, IncorrectObjectTypeException {
    Guard.notNull("gitTag", gitTag);

    RevWalk walk = new RevWalk(repository);
    JSONObject message;
    try {
        ObjectId tagId = gitTag.getObjectId();
        RevTag tag = walk.parseTag(tagId);
        message = (JSONObject) JSONValue.parse(tag.getFullMessage());
    } finally {
        walk.dispose();
    }
    if (message == null) {
        message = new JSONObject();
        message.put(VERSION, "0");
        message.put(BUILD_NUMBER, "0");
    }
    return new AnnotatedTag(gitTag, stripRefPrefix(gitTag.getName()), message);
}
 
开发者ID:danielflower,项目名称:multi-module-maven-release-plugin,代码行数:20,代码来源:AnnotatedTag.java

示例4: assertTag

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
private void assertTag(Project.NameKey project, String branch, PushOneCommit.Tag tag)
    throws Exception {
  try (Repository repo = repoManager.openRepository(project)) {
    Ref tagRef = repo.findRef(tag.name);
    assertThat(tagRef).isNotNull();
    ObjectId taggedCommit = null;
    if (tag instanceof PushOneCommit.AnnotatedTag) {
      PushOneCommit.AnnotatedTag annotatedTag = (PushOneCommit.AnnotatedTag) tag;
      try (RevWalk rw = new RevWalk(repo)) {
        RevObject object = rw.parseAny(tagRef.getObjectId());
        assertThat(object).isInstanceOf(RevTag.class);
        RevTag tagObject = (RevTag) object;
        assertThat(tagObject.getFullMessage()).isEqualTo(annotatedTag.message);
        assertThat(tagObject.getTaggerIdent()).isEqualTo(annotatedTag.tagger);
        taggedCommit = tagObject.getObject();
      }
    } else {
      taggedCommit = tagRef.getObjectId();
    }
    ObjectId headCommit = repo.exactRef(branch).getObjectId();
    assertThat(taggedCommit).isNotNull();
    assertThat(taggedCommit).isEqualTo(headCommit);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:25,代码来源:SubmitOnPushIT.java

示例5: addToTags

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
private void addToTags(
    final Map<String, Set<GitCommit>> commitsPerTag,
    final String tagName,
    final Date tagTime,
    final List<GitTag> addTo,
    final Map<String, RevTag> annotatedTagPerTagName) {
  if (commitsPerTag.containsKey(tagName)) {
    final Set<GitCommit> gitCommits = commitsPerTag.get(tagName);
    final boolean isAnnotated = annotatedTagPerTagName.containsKey(tagName);
    String annotation = null;
    if (isAnnotated) {
      annotation = annotatedTagPerTagName.get(tagName).getFullMessage();
    }

    final GitTag gitTag = new GitTag(tagName, annotation, newArrayList(gitCommits), tagTime);
    addTo.add(gitTag);
  }
}
 
开发者ID:tomasbjerre,项目名称:git-changelog-lib,代码行数:19,代码来源:GitRepo.java

示例6: getAnnotatedTagPerTagName

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
private Map<String, RevTag> getAnnotatedTagPerTagName(
    final Optional<String> ignoreTagsIfNameMatches, final List<Ref> tagList) {
  final Map<String, RevTag> tagPerCommit = newHashMap();
  for (final Ref tag : tagList) {
    if (ignoreTagsIfNameMatches.isPresent()) {
      if (compile(ignoreTagsIfNameMatches.get()).matcher(tag.getName()).matches()) {
        continue;
      }
    }
    final Ref peeledTag = this.repository.peel(tag);
    if (peeledTag.getPeeledObjectId() != null) {
      try {
        final RevTag revTag = RevTag.parse(this.repository.open(tag.getObjectId()).getBytes());
        tagPerCommit.put(tag.getName(), revTag);
      } catch (final IOException e) {
        LOG.error(e.getMessage(), e);
      }
    }
  }
  return tagPerCommit;
}
 
开发者ID:tomasbjerre,项目名称:git-changelog-lib,代码行数:22,代码来源:GitRepo.java

示例7: internalGetDate

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
private Date internalGetDate(RevObject referencedObject) {
	Date date = new Date(0);
	if (referencedObject != null) {
		if (referencedObject instanceof RevTag) {
			RevTag tag = (RevTag) referencedObject;
			PersonIdent tagger = tag.getTaggerIdent();
			if (tagger != null) {
				date = tagger.getWhen();
			}
		} else if (referencedObject instanceof RevCommit) {
			RevCommit commit = (RevCommit) referencedObject;
			date = JGitUtils.getAuthorDate(commit);
		}
	}
	return date;
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:17,代码来源:RefModel.java

示例8: getTime

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
Long getTime(final RevWalk walk, final ObjectId id) throws IOException {
  try {
    return cache.get(id, new Callable<Long>() {
      @Override
      public Long call() throws IOException {
        RevObject o = walk.parseAny(id);
        while (o instanceof RevTag) {
          RevTag tag = (RevTag) o;
          PersonIdent ident = tag.getTaggerIdent();
          if (ident != null) {
            return ident.getWhen().getTime() / 1000;
          }
          o = tag.getObject();
          walk.parseHeaders(o);
        }
        if (o.getType() == Constants.OBJ_COMMIT) {
          return Long.valueOf(((RevCommit) o).getCommitTime());
        }
        return Long.MIN_VALUE;
      }
    });
  } catch (ExecutionException e) {
    Throwables.propagateIfInstanceOf(e.getCause(), IOException.class);
    throw new IOException(e);
  }
}
 
开发者ID:afrojer,项目名称:gitiles,代码行数:27,代码来源:TimeCache.java

示例9: listObjects

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
static List<RevObject> listObjects(RevWalk walk, Revision rev)
    throws MissingObjectException, IOException {
  List<RevObject> objects = Lists.newArrayListWithExpectedSize(1);
  ObjectId id = rev.getId();
  RevObject cur;
  while (true) {
    cur = walk.parseAny(id);
    objects.add(cur);
    if (cur.getType() != Constants.OBJ_TAG) {
      break;
    }
    id = ((RevTag) cur).getObject();
  }
  if (cur.getType() == Constants.OBJ_COMMIT) {
    objects.add(walk.parseTree(((RevCommit) cur).getTree()));
  }
  return objects;
}
 
开发者ID:afrojer,项目名称:gitiles,代码行数:19,代码来源:RevisionServlet.java

示例10: testParseTag

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
public void testParseTag() throws Exception {
  RevCommit master = repo.branch("master").commit().create();
  RevTag masterTag = repo.update("refs/tags/master-tag", repo.tag("master-tag", master));
  RevTag masterTagTag = repo.update("refs/tags/master-tag-tag",
      repo.tag("master-tag-tag", master));

  assertEquals(new Result(
          new Revision("master-tag", masterTag, OBJ_TAG, master, OBJ_COMMIT)),
      parser.parse("master-tag"));
  assertEquals(new Result(
          new Revision("master-tag-tag", masterTagTag, OBJ_TAG, master, OBJ_COMMIT)),
      parser.parse("master-tag-tag"));

  RevBlob blob = repo.update("refs/tags/blob", repo.blob("blob"));
  RevTag blobTag = repo.update("refs/tags/blob-tag", repo.tag("blob-tag", blob));
  assertEquals(new Result(Revision.peeled("blob", blob)), parser.parse("blob"));
  assertEquals(new Result(new Revision("blob-tag", blobTag, OBJ_TAG, blob, OBJ_BLOB)),
      parser.parse("blob-tag"));
}
 
开发者ID:afrojer,项目名称:gitiles,代码行数:20,代码来源:RevisionParserTest.java

示例11: testFirstTagMissingTime

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
public void testFirstTagMissingTime() throws Exception {
  RevCommit commit = repo.commit().create();
  repo.tick(1);
  RevTag tag = repo.tag("tag", commit);
  repo.tick(1);

  TagBuilder builder = new TagBuilder();
  builder.setObjectId(tag);
  builder.setTag("tagtag");
  builder.setMessage("");
  ObjectInserter ins = repo.getRepository().newObjectInserter();
  ObjectId tagTagId;
  try {
    tagTagId = ins.insert(builder);
    ins.flush();
  } finally {
    ins.release();
  }
  assertEquals(start + 1, getTime(commit));
  assertEquals(start + 2, getTime(tag));
  assertEquals(start + 2, getTime(tagTagId));
}
 
开发者ID:afrojer,项目名称:gitiles,代码行数:23,代码来源:TimeCacheTest.java

示例12: apply

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
Collection<TestResult> apply(ChangeApplicator applicator, String ... changeDescriptions) {
    try {
        final Collection<RevTag> matchingTags = findMatchingTags(changeDescriptions);
        if (changeDescriptions.length != matchingTags.size()) {
            throw new IllegalStateException("Unable to find all required changes " + Arrays.toString(changeDescriptions)
                + ", found only " + matchingTags.stream().map(tag -> tag.getTagName() + ": " + tag.getFullMessage()).collect(Collectors.toList()));
        }
        return applicator.apply(matchingTags);
    } catch (GitAPIException e) {
        throw new RuntimeException("Failed applying changes '" + Arrays.toString(changeDescriptions) + "'", e);
    }
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:13,代码来源:ChangeApplier.java

示例13: cherryPickTags

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
private Collection<TestResult> cherryPickTags(Collection<RevTag> tags) throws GitAPIException {
    final Set<TestResult> combinedTestResults = new HashSet<>();
    for (final RevTag tag : tags) {
        final ObjectId tagId = tag.getObject().getId();
        git.cherryPick().include(tagId).call();
        combinedTestResults.addAll(testResultsExtractor.expectedTestResults(tagId));
    }
    return combinedTestResults;
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:10,代码来源:ChangeApplier.java

示例14: applyLocallyFromTags

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
private Collection<TestResult> applyLocallyFromTags(Collection<RevTag> tags) throws GitAPIException {
    final Set<TestResult> combinedTestResults = new HashSet<>();
    final List<RevCommit> stashesToApply = new ArrayList<>();
    stashesToApply.add(git.stashCreate().setIncludeUntracked(true).call());
    for (final RevTag tag : tags) {
        final ObjectId tagId = tag.getObject().getId();
        git.cherryPick().setNoCommit(true).include(tagId).call();
        stashesToApply.add(git.stashCreate().setIncludeUntracked(true).call());
        combinedTestResults.addAll(testResultsExtractor.expectedTestResults(tagId));
    }
    applyStashChangesLocally(stashesToApply);
    return combinedTestResults;
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:14,代码来源:ChangeApplier.java

示例15: findMatchingTags

import org.eclipse.jgit.revwalk.RevTag; //导入依赖的package包/类
private Collection<RevTag> findMatchingTags(String[] changeDescriptions) throws GitAPIException {
    final Set<String> changes = new HashSet<>(asList(changeDescriptions));
    final RevWalk revWalk = new RevWalk(repository);
    final List<RevTag> matchingTags = git.tagList().call().stream().map(ref -> {
        try {
            return revWalk.parseTag(ref.getObjectId());
        } catch (IOException e) {
            throw new RuntimeException("Unable to find tag for " + ref.getObjectId(), e);
        }
    }).filter(revTag -> changes.contains(revTag.getFullMessage().trim()))
        .collect(Collectors.toList());
    revWalk.dispose();
    return matchingTags;
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:15,代码来源:ChangeApplier.java


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