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


Java RefUpdate.disableRefLog方法代码示例

本文整理汇总了Java中org.eclipse.jgit.lib.RefUpdate.disableRefLog方法的典型用法代码示例。如果您正苦于以下问题:Java RefUpdate.disableRefLog方法的具体用法?Java RefUpdate.disableRefLog怎么用?Java RefUpdate.disableRefLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.lib.RefUpdate的用法示例。


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

示例1: store

import org.eclipse.jgit.lib.RefUpdate; //导入方法依赖的package包/类
private RefUpdate.Result store(Repository repo, RevWalk rw, @Nullable ObjectId oldId, int val)
    throws IOException {
  ObjectId newId;
  try (ObjectInserter ins = repo.newObjectInserter()) {
    newId = ins.insert(OBJ_BLOB, Integer.toString(val).getBytes(UTF_8));
    ins.flush();
  }
  RefUpdate ru = repo.updateRef(refName);
  if (oldId != null) {
    ru.setExpectedOldObjectId(oldId);
  }
  ru.disableRefLog();
  ru.setNewObjectId(newId);
  ru.setForceUpdate(true); // Required for non-commitish updates.
  RefUpdate.Result result = ru.update(rw);
  if (refUpdated(result)) {
    gitRefUpdated.fire(projectName, ru, null);
  }
  return result;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:RepoSequence.java

示例2: createLocally

import org.eclipse.jgit.lib.RefUpdate; //导入方法依赖的package包/类
private static void createLocally(URIish uri, String head) {
  try (Repository repo = new FileRepository(uri.getPath())) {
    repo.create(true /* bare */);

    if (head != null) {
      RefUpdate u = repo.updateRef(Constants.HEAD);
      u.disableRefLog();
      u.link(head);
    }
  } catch (IOException e) {
    repLog.error(String.format("Error creating local repository %s:\n", uri.getPath()), e);
  }
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:14,代码来源:ReplicationQueue.java

示例3: update

import org.eclipse.jgit.lib.RefUpdate; //导入方法依赖的package包/类
private void update(RevCommit rev) throws Exception {
  RefUpdate u = db.updateRef(RefNames.REFS_CONFIG);
  u.disableRefLog();
  u.setNewObjectId(rev);
  Result result = u.forceUpdate();
  assertWithMessage("Cannot update ref for test: " + result)
      .that(result)
      .isAnyOf(Result.FAST_FORWARD, Result.FORCED, Result.NEW, Result.NO_CHANGE);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:ProjectConfigTest.java

示例4: GitRepository

import org.eclipse.jgit.lib.RefUpdate; //导入方法依赖的package包/类
/**
 * Creates a new Git-backed repository.
 *
 * @param repoDir the location of this repository
 * @param format the repository format
 * @param repositoryWorker the {@link Executor} which will perform the blocking repository operations
 * @param creationTimeMillis the creation time
 * @param author the user who initiated the creation of this repository
 *
 * @throws StorageException if failed to create a new repository
 */
GitRepository(Project parent, File repoDir, GitRepositoryFormat format, Executor repositoryWorker,
              long creationTimeMillis, Author author) {

    this.parent = requireNonNull(parent, "parent");
    name = requireNonNull(repoDir, "repoDir").getName();
    this.repositoryWorker = requireNonNull(repositoryWorker, "repositoryWorker");
    this.format = requireNonNull(format, "format");

    requireNonNull(author, "author");

    final RepositoryBuilder repositoryBuilder = new RepositoryBuilder().setGitDir(repoDir).setBare();
    boolean success = false;
    try {
        // Create an empty repository with format version 0 first.
        try (org.eclipse.jgit.lib.Repository initRepo = repositoryBuilder.build()) {
            if (exist(repoDir)) {
                throw new StorageException(
                        "failed to create a repository at: " + repoDir + " (exists already)");
            }

            initRepo.create(true);

            final StoredConfig config = initRepo.getConfig();
            if (format == GitRepositoryFormat.V1) {
                // Update the repository settings to upgrade to format version 1 and reftree.
                config.setInt(CONFIG_CORE_SECTION, null, CONFIG_KEY_REPO_FORMAT_VERSION, 1);
            }

            // Disable hidden files, symlinks and file modes we do not use.
            config.setEnum(CONFIG_CORE_SECTION, null, CONFIG_KEY_HIDEDOTFILES, HideDotFiles.FALSE);
            config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_SYMLINKS, false);
            config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_FILEMODE, false);

            // Set the diff algorithm.
            config.setString(CONFIG_DIFF_SECTION, null, CONFIG_KEY_ALGORITHM, "histogram");

            // Disable rename detection which we do not use.
            config.setBoolean(CONFIG_DIFF_SECTION, null, CONFIG_KEY_RENAMES, false);

            config.save();
        }

        // Re-open the repository with the updated settings and format version.
        jGitRepository = new RepositoryBuilder().setGitDir(repoDir).build();

        // Initialize the master branch.
        final RefUpdate head = jGitRepository.updateRef(Constants.HEAD);
        head.disableRefLog();
        head.link(Constants.R_HEADS + Constants.MASTER);

        // Initialize the commit ID database.
        commitIdDatabase = new CommitIdDatabase(jGitRepository);

        // Insert the initial commit into the master branch.
        commit0(null, Revision.INIT, creationTimeMillis, author,
                "Create a new repository", "", Markup.PLAINTEXT,
                Collections.emptyList(), true);

        headRevision = Revision.INIT;
        success = true;
    } catch (IOException e) {
        throw new StorageException("failed to create a repository at: " + repoDir, e);
    } finally {
        if (!success) {
            close();
            // Failed to create a repository. Remove any cruft so that it is not loaded on the next run.
            deleteCruft(repoDir);
        }
    }
}
 
开发者ID:line,项目名称:centraldogma,代码行数:82,代码来源:GitRepository.java

示例5: commit

import org.eclipse.jgit.lib.RefUpdate; //导入方法依赖的package包/类
private RevCommit commit(
    Repository repo,
    RevWalk rw,
    @Nullable InMemoryInserter tmpIns,
    ObjectInserter ins,
    String refName,
    ObjectId tree,
    RevCommit merge)
    throws IOException {
  rw.parseHeaders(merge);
  // For maximum stability, choose a single ident using the committer time of
  // the input commit, using the server name and timezone.
  PersonIdent ident =
      new PersonIdent(
          gerritIdent, merge.getCommitterIdent().getWhen(), gerritIdent.getTimeZone());
  CommitBuilder cb = new CommitBuilder();
  cb.setAuthor(ident);
  cb.setCommitter(ident);
  cb.setTreeId(tree);
  cb.setMessage("Auto-merge of " + merge.name() + '\n');
  for (RevCommit p : merge.getParents()) {
    cb.addParentId(p);
  }

  if (!save) {
    checkArgument(tmpIns != null);
    try (ObjectReader tmpReader = tmpIns.newReader();
        RevWalk tmpRw = new RevWalk(tmpReader)) {
      return tmpRw.parseCommit(tmpIns.insert(cb));
    }
  }

  checkArgument(tmpIns == null);
  checkArgument(!(ins instanceof InMemoryInserter));
  ObjectId commitId = ins.insert(cb);
  ins.flush();

  RefUpdate ru = repo.updateRef(refName);
  ru.setNewObjectId(commitId);
  ru.disableRefLog();
  ru.forceUpdate();
  return rw.parseCommit(commitId);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:44,代码来源:AutoMerger.java


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