Examples of updateRef()


Examples of org.eclipse.jgit.lib.Repository.updateRef()

        };
        for (NewProjectCreatedListener l : createdListener) {
          l.onNewProjectCreated(event);
        }

        final RefUpdate u = repo.updateRef(Constants.HEAD);
        u.disableRefLog();
        u.link(head);

        createProjectConfig();
View Full Code Here

Examples of org.eclipse.jgit.lib.Repository.updateRef()

      if (!refControl.canCreate(rw, object)) {
        throw new IllegalStateException("Cannot create " + refname);
      }

      try {
        final RefUpdate u = repo.updateRef(refname);
        u.setExpectedOldObjectId(ObjectId.zeroId());
        u.setNewObjectId(object.copy());
        u.setRefLogIdent(identifiedUser.newRefLogIdent());
        u.setRefLogMessage("created via web from " + startingRevision, false);
        final RefUpdate.Result result = u.update(rw);
View Full Code Here

Examples of org.eclipse.jgit.lib.Repository.updateRef()

      for (final Branch.NameKey branchKey : toRemove) {
        final String refname = branchKey.get();
        final RefUpdate.Result result;
        final RefUpdate u;
        try {
          u = r.updateRef(refname);
          u.setForceUpdate(true);
          result = u.delete();
        } catch (IOException e) {
          log.error("Cannot delete " + branchKey, e);
          continue;
View Full Code Here

Examples of org.eclipse.jgit.lib.Repository.updateRef()

                    ChangeUtil.updated(change);
                    return change;
                  }
                });

        final RefUpdate ru = git.updateRef(rebasedPatchSet.getRefName());
        ru.setNewObjectId(rebasedCommitId);
        ru.disableRefLog();
        if (ru.update(revWalk) != RefUpdate.Result.NEW) {
          throw new IOException("Failed to create ref "
              + rebasedPatchSet.getRefName() + " in " + git.getDirectory()
View Full Code Here

Examples of org.eclipse.jgit.lib.Repository.updateRef()

          patchSetInfoFactory.get(revWalk.parseCommit(id), ps.getId());
      change.setCurrentPatchSet(info);
      ChangeUtil.updated(change);
      db.changes().insert(Collections.singleton(change));

      final RefUpdate ru = git.updateRef(ps.getRefName());
      ru.setNewObjectId(id);
      ru.disableRefLog();
      if (ru.update(revWalk) != RefUpdate.Result.NEW) {
        throw new IOException("Failed to create ref " + ps.getRefName()
            + " in " + git.getDirectory() + ": " + ru.getResult());
View Full Code Here

Examples of org.eclipse.jgit.lib.Repository.updateRef()

      throw new NoSuchChangeException(patchSetId.getParentKey());
    }

    Repository repo = gitManager.openRepository(change.getProject());
    try {
      RefUpdate update = repo.updateRef(patch.getRefName());
      update.setForceUpdate(true);
      update.disableRefLog();
      switch (update.delete()) {
        case NEW:
        case FAST_FORWARD:
View Full Code Here

Examples of org.eclipse.jgit.lib.Repository.updateRef()

      // set the branch refs
      RevWalk revWalk = new RevWalk(db);
      try {
        // set the master branch
        RevCommit revCommit = revWalk.parseCommit(commitId);
        RefUpdate masterRef = db.updateRef(Constants.R_MASTER);
        masterRef.setNewObjectId(commitId);
        masterRef.setRefLogMessage("commit: " + revCommit.getShortMessage(), false);
        Result masterRC = masterRef.update();
        switch (masterRC) {
        case NEW:
View Full Code Here

Examples of org.eclipse.jgit.lib.Repository.updateRef()

          success = false;
        }

        if (addGitFlow) {
          // set the develop branch for git-flow
          RefUpdate developRef = db.updateRef(Constants.R_DEVELOP);
          developRef.setNewObjectId(commitId);
          developRef.setRefLogMessage("commit: " + revCommit.getShortMessage(), false);
          Result developRC = developRef.update();
          switch (developRC) {
          case NEW:
View Full Code Here

Examples of org.eclipse.jgit.lib.Repository.updateRef()

  public void oneOriginChange() throws Exception {
    RevCommit commit1 = add("test.txt", "content");
    File repo2 = initRepo();
    RevCommit commit2 = add(repo2, "test2.txt", "content2.txt");
    Repository repo = new FileRepository(testRepo);
    RefUpdate originMaster = repo.updateRef(Constants.R_REMOTES
        + Constants.DEFAULT_REMOTE_NAME + "/" + Constants.MASTER);
    originMaster.setNewObjectId(commit1);
    originMaster.forceUpdate();
    RemoteConfig config = new RemoteConfig(repo.getConfig(),
        Constants.DEFAULT_REMOTE_NAME);
View Full Code Here

Examples of org.eclipse.jgit.lib.Repository.updateRef()

  }

  @Test(expected = NoHeadException.class)
  public void testPullEmptyRepository() throws Exception {
    Repository empty = createWorkRepository();
    RefUpdate delete = empty.updateRef(Constants.HEAD, true);
    delete.setForceUpdate(true);
    delete.delete();
    Git.wrap(empty).pull().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.