org.locationtech.geogig.repository.Repository.commitExists()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.locationtech.geogig.repository.Repository.commitExists方法的一些代码示例,展示了Repository.commitExists的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.commitExists方法的具体详情如下:
包路径:org.locationtech.geogig.repository.Repository
类名称:Repository
方法名:commitExists

Repository.commitExists介绍

[英]Determines if a commit with the given ObjectId exists in the object database.
[中]确定对象数据库中是否存在具有给定ObjectId的提交。

代码示例

代码示例来源:origin: org.locationtech.geogig/geogig-core

/**
 * Calculates the next commit in the history.
 * 
 * @return the next {@link RevCommit commit} in the history
 */
@Override
protected RevCommit computeNext() {
  if (nextCommitId.isPresent()) {
    RevCommit commit = repo.getCommit(nextCommitId.get());
    nextCommitId = commit.parentN(0);
    if (nextCommitId.isPresent() && !repo.commitExists(nextCommitId.get())) {
      nextCommitId = Optional.absent();
    }
    return commit;
  }
  return endOfData();
}

代码示例来源:origin: locationtech/geogig

/**
 * Calculates the next commit in the history.
 * 
 * @return the next {@link RevCommit commit} in the history
 */
@Override
protected RevCommit computeNext() {
  if (nextCommitId.isPresent()) {
    RevCommit commit = repo.getCommit(nextCommitId.get());
    nextCommitId = commit.parentN(0);
    if (nextCommitId.isPresent() && !repo.commitExists(nextCommitId.get())) {
      nextCommitId = Optional.absent();
    }
    return commit;
  }
  return endOfData();
}

代码示例来源:origin: locationtech/geogig

RevCommit commit;
for (ObjectId parent : mostRecent.getParentIds()) {
  if (repo.commitExists(parent)) {
    commit = repo.getCommit(parent);
    if (!seenCommits.contains(commit.getId())) {

代码示例来源:origin: locationtech/geogig

continue;
if (repo.commitExists(parentId)) {
  parent = Optional.of(parentId);
  break;
List<ObjectId> parents = lastCommit.getParentIds();
for (int i = index + 1; i < parents.size(); i++) {
  if (repo.commitExists(parents.get(i))) {
    final RevCommit commit = repo.getCommit(parents.get(i));
    tips.push(commit);

代码示例来源:origin: org.locationtech.geogig/geogig-core

RevCommit commit;
for (ObjectId parent : mostRecent.getParentIds()) {
  if (repo.commitExists(parent)) {
    commit = repo.getCommit(parent);
    if (!seenCommits.contains(commit.getId())) {

代码示例来源:origin: org.locationtech.geogig/geogig-core

continue;
if (repo.commitExists(parentId)) {
  parent = Optional.of(parentId);
  break;
List<ObjectId> parents = lastCommit.getParentIds();
for (int i = index + 1; i < parents.size(); i++) {
  if (repo.commitExists(parents.get(i))) {
    final RevCommit commit = repo.getCommit(parents.get(i));
    tips.push(commit);

代码示例来源:origin: org.locationtech.geogig/geogig-cli

/**
 * Executes the squash command using the provided options.
 */
@Override
public void runInternal(GeogigCLI cli) {
  checkParameter(commits.size() == 2, "2 commit references must be supplied");
  final GeoGIG geogig = cli.getGeogig();
  Optional<ObjectId> sinceId = geogig.command(RevParse.class).setRefSpec(commits.get(0))
      .call();
  checkParameter(sinceId.isPresent(), "'since' reference cannot be found");
  checkParameter(geogig.getRepository().commitExists(sinceId.get()),
      "'since' reference does not resolve to a commit");
  RevCommit sinceCommit = geogig.getRepository().getCommit(sinceId.get());
  Optional<ObjectId> untilId = geogig.command(RevParse.class).setRefSpec(commits.get(1))
      .call();
  checkParameter(untilId.isPresent(), "'until' reference cannot be found");
  checkParameter(geogig.getRepository().commitExists(untilId.get()),
      "'until' reference does not resolve to a commit");
  RevCommit untilCommit = geogig.getRepository().getCommit(untilId.get());
  geogig.command(SquashOp.class).setSince(sinceCommit).setUntil(untilCommit)
      .setMessage(message).call();
}

代码示例来源:origin: locationtech/geogig

/**
 * Executes the squash command using the provided options.
 */
@Override
public void runInternal(GeogigCLI cli) {
  checkParameter(commits.size() == 2, "2 commit references must be supplied");
  final GeoGIG geogig = cli.getGeogig();
  Optional<ObjectId> sinceId = geogig.command(RevParse.class).setRefSpec(commits.get(0))
      .call();
  checkParameter(sinceId.isPresent(), "'since' reference cannot be found");
  checkParameter(geogig.getRepository().commitExists(sinceId.get()),
      "'since' reference does not resolve to a commit");
  RevCommit sinceCommit = geogig.getRepository().getCommit(sinceId.get());
  Optional<ObjectId> untilId = geogig.command(RevParse.class).setRefSpec(commits.get(1))
      .call();
  checkParameter(untilId.isPresent(), "'until' reference cannot be found");
  checkParameter(geogig.getRepository().commitExists(untilId.get()),
      "'until' reference does not resolve to a commit");
  RevCommit untilCommit = geogig.getRepository().getCommit(untilId.get());
  geogig.command(SquashOp.class).setSince(sinceCommit).setUntil(untilCommit)
      .setMessage(message).call();
}

代码示例来源:origin: org.locationtech.geogig/geogig-cli-core

/**
 * Executes the squash command using the provided options.
 */
@Override
public void runInternal(GeogigCLI cli) {
  checkParameter(commits.size() == 2, "2 commit references must be supplied");
  final GeoGIG geogig = cli.getGeogig();
  Optional<ObjectId> sinceId = geogig.command(RevParse.class).setRefSpec(commits.get(0))
      .call();
  checkParameter(sinceId.isPresent(), "'since' reference cannot be found");
  checkParameter(geogig.getRepository().commitExists(sinceId.get()),
      "'since' reference does not resolve to a commit");
  RevCommit sinceCommit = geogig.getRepository().getCommit(sinceId.get());
  Optional<ObjectId> untilId = geogig.command(RevParse.class).setRefSpec(commits.get(1))
      .call();
  checkParameter(untilId.isPresent(), "'until' reference cannot be found");
  checkParameter(geogig.getRepository().commitExists(untilId.get()),
      "'until' reference does not resolve to a commit");
  RevCommit untilCommit = geogig.getRepository().getCommit(untilId.get());
  geogig.command(SquashOp.class).setSince(sinceCommit).setUntil(untilCommit)
      .setMessage(message).call();
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

newestCommitId = command(RevParse.class).setRefSpec(Ref.HEAD).call().get();
} else {
  if (!repository().commitExists(this.until)) {
    throw new IllegalArgumentException(
        "Provided 'until' commit id does not exist: " + until.toString());
  oldestCommitId = ObjectId.NULL;
} else {
  if (!repository().commitExists(this.since)) {
    throw new IllegalArgumentException(
        "Provided 'since' commit id does not exist: " + since.toString());

代码示例来源:origin: org.locationtech.geogig/geogig-cli-core

.call();
checkParameter(commitId.isPresent(), "Object not found '%s'", commit);
checkParameter(geogig.getRepository().commitExists(commitId.get()),
    "%s does not resolve to a commit", commit);
op.addCommit(commitId.get());

代码示例来源:origin: locationtech/geogig

.call();
checkParameter(commitId.isPresent(), "Object not found '%s'", commit);
checkParameter(geogig.getRepository().commitExists(commitId.get()),
    "%s does not resolve to a commit", commit);
op.addCommit(commitId.get());

代码示例来源:origin: org.locationtech.geogig/geogig-cli

.call();
checkParameter(commitId.isPresent(), "Object not found '%s'", commit);
checkParameter(geogig.getRepository().commitExists(commitId.get()),
    "%s does not resolve to a commit", commit);
op.addCommit(commitId.get());

代码示例来源:origin: locationtech/geogig

do {
  ObjectId parentId = commit.parentN(parentIndex++).or(ObjectId.NULL);
  if (parentId.isNull() || !repository.commitExists(parentId)) {

代码示例来源:origin: org.locationtech.geogig/geogig-core

do {
  ObjectId parentId = commit.parentN(parentIndex++).or(ObjectId.NULL);
  if (parentId.isNull() || !repository.commitExists(parentId)) {

代码示例来源:origin: locationtech/geogig

oldestCommitId = ObjectId.NULL;
} else {
  if (!repository().commitExists(this.since)) {
    throw new IllegalArgumentException(
        "Provided 'since' commit id does not exist: " + since.toString());

代码示例来源:origin: org.locationtech.geogig/geogig-core

Repository repository = repository();
for (ObjectId id : commits) {
  Preconditions.checkArgument(repository.commitExists(id),
      "Commit was not found in the repository: " + id.toString());
  RevCommit commit = repository.getCommit(id);

代码示例来源:origin: locationtech/geogig

private Ref updateLocalRef(Ref remoteRef, Remote remote, ImmutableSet<Ref> localRemoteRefs) {
  final String refName;
  if (remoteRef.getName().startsWith(Ref.TAGS_PREFIX)) {
    refName = remoteRef.getName();
  } else {
    refName = Ref.REMOTES_PREFIX + remote.getName() + "/" + remoteRef.localName();
  }
  Ref updatedRef = remoteRef;
  if (remoteRef instanceof SymRef) {
    String targetBranch = Ref.localName(((SymRef) remoteRef).getTarget());
    String newTarget = Ref.REMOTES_PREFIX + remote.getName() + "/" + targetBranch;
    updatedRef = command(UpdateSymRef.class).setName(refName).setNewValue(newTarget).call()
        .get();
  } else {
    ObjectId effectiveId = remoteRef.getObjectId();
    if (remote.getMapped() && !repository().commitExists(remoteRef.getObjectId())) {
      effectiveId = graphDatabase().getMapping(effectiveId);
    }
    updatedRef = command(UpdateRef.class).setName(refName).setNewValue(effectiveId).call()
        .get();
  }
  return updatedRef;
}

代码示例来源:origin: org.locationtech.geogig/geogig-remoting

private Ref updateLocalRef(Ref remoteRef, Remote remote, ImmutableSet<Ref> localRemoteRefs) {
  final String refName;
  if (remoteRef.getName().startsWith(Ref.TAGS_PREFIX)) {
    refName = remoteRef.getName();
  } else {
    refName = Ref.REMOTES_PREFIX + remote.getName() + "/" + remoteRef.localName();
  }
  Ref updatedRef = remoteRef;
  if (remoteRef instanceof SymRef) {
    String targetBranch = Ref.localName(((SymRef) remoteRef).getTarget());
    String newTarget = Ref.REMOTES_PREFIX + remote.getName() + "/" + targetBranch;
    updatedRef = command(UpdateSymRef.class).setName(refName).setNewValue(newTarget).call()
        .get();
  } else {
    ObjectId effectiveId = remoteRef.getObjectId();
    if (remote.getMapped() && !repository().commitExists(remoteRef.getObjectId())) {
      effectiveId = graphDatabase().getMapping(effectiveId);
    }
    updatedRef = command(UpdateRef.class).setName(refName).setNewValue(effectiveId).call()
        .get();
  }
  return updatedRef;
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

if (repository.commitExists(parentCommitId)) {
  parentTreeId = repository.getCommit(parentCommitId).getTreeId();

相关文章