Package org.eclipse.jgit.lib.RefUpdate

Examples of org.eclipse.jgit.lib.RefUpdate.Result


            branchName = "refs/heads/" + branchName;
          }
          RefUpdate ru = repository.updateRef(branchName);
          ru.setNewObjectId(commitId);
          ru.setRefLogMessage("commit: " + revCommit.getShortMessage(), false);
          Result rc = ru.forceUpdate();
          switch (rc) {
          case NEW:
          case FORCED:
          case FAST_FORWARD:
            success = true;
View Full Code Here


        // 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:
          success = true;
          break;
        default:
          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:
            success = true;
            break;
          default:
View Full Code Here

      RefRename cmd;
      try {
        cmd = repository.renameRef(oldRef.getName(), GB_REFLOG);
        cmd.setRefLogIdent(new PersonIdent("Gitblit", "gitblit@localhost"));
        cmd.setRefLogMessage("renamed " + oldRef.getName() + " => " + GB_REFLOG);
        Result res = cmd.rename();
        switch (res) {
        case RENAMED:
          LOGGER.info(repository.getDirectory() + " " + cmd.getRefLogMessage());
          return getRefLogBranch(repository);
        default:
          LOGGER.error("failed to rename " + oldRef.getName() + " => " + GB_REFLOG + " (" + res.name() + ")");
        }
      } catch (IOException e) {
        LOGGER.error("failed to rename reflog", e);
      }
    }
View Full Code Here

          RevCommit revCommit = revWalk.parseCommit(commitId);
          RefUpdate ru = repository.updateRef(GB_REFLOG);
          ru.setNewObjectId(commitId);
          ru.setExpectedOldObjectId(headId);
          ru.setRefLogMessage("commit: " + revCommit.getShortMessage(), false);
          Result rc = ru.forceUpdate();
          switch (rc) {
          case NEW:
          case FORCED:
          case FAST_FORWARD:
            success = true;
View Full Code Here

      RefRename cmd;
      try {
        cmd = db.renameRef(oldRef.getName(), BRANCH);
        cmd.setRefLogIdent(new PersonIdent("Gitblit", "gitblit@localhost"));
        cmd.setRefLogMessage("renamed " + oldRef.getName() + " => " + BRANCH);
        Result res = cmd.rename();
        switch (res) {
        case RENAMED:
          log.info(db.getDirectory() + " " + cmd.getRefLogMessage());
          return getTicketsBranch(db);
        default:
          log.error("failed to rename " + oldRef.getName() + " => " + BRANCH + " (" + res.name() + ")");
        }
      } catch (IOException e) {
        log.error("failed to rename tickets branch", e);
      }
    }
View Full Code Here

        RevCommit revCommit = revWalk.parseCommit(commitId);
        RefUpdate ru = db.updateRef(BRANCH);
        ru.setNewObjectId(commitId);
        ru.setExpectedOldObjectId(headId);
        ru.setRefLogMessage("commit: " + revCommit.getShortMessage(), false);
        Result rc = ru.forceUpdate();
        switch (rc) {
        case NEW:
        case FORCED:
        case FAST_FORWARD:
          success = true;
View Full Code Here

          }
          if (headId != null)
            ru.setExpectedOldObjectId(headId);
          else
            ru.setExpectedOldObjectId(ObjectId.zeroId());
          Result rc = ru.forceUpdate();
          switch (rc) {
          case NEW:
          case FORCED:
          case FAST_FORWARD: {
            setCallable(false);
View Full Code Here

      ConcurrentRefUpdateException {
    RefUpdate refUpdate = repo.updateRef(Constants.HEAD);
    refUpdate.setNewObjectId(newHeadId);
    refUpdate.setRefLogMessage(refLogMessage.toString(), false);
    refUpdate.setExpectedOldObjectId(oldHeadID);
    Result rc = refUpdate.update();
    switch (rc) {
    case NEW:
    case FAST_FORWARD:
      return;
    case REJECTED:
View Full Code Here

  public void testNoCacheObjectIdSubclass() throws IOException {
    final String newRef = "refs/heads/abc";
    final RefUpdate ru = updateRef(newRef);
    final SubclassedId newid = new SubclassedId(ru.getNewObjectId());
    ru.setNewObjectId(newid);
    Result update = ru.update();
    assertEquals(Result.NEW, update);
    final Ref r = db.getAllRefs().get(newRef);
    assertNotNull(r);
    assertEquals(newRef, r.getName());
    assertNotNull(r.getObjectId());
View Full Code Here

  @Test
  public void testNewNamespaceConflictWithLoosePrefixNameExists()
      throws IOException {
    final String newRef = "refs/heads/z";
    final RefUpdate ru = updateRef(newRef);
    Result update = ru.update();
    assertEquals(Result.NEW, update);
    // end setup
    final String newRef2 = "refs/heads/z/a";
    final RefUpdate ru2 = updateRef(newRef2);
    Result update2 = ru2.update();
    assertEquals(Result.LOCK_FAILURE, update2);
    assertEquals(1, db.getReflogReader("refs/heads/z").getReverseEntries().size());
    assertEquals(0, db.getReflogReader("HEAD").getReverseEntries().size());
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.RefUpdate.Result

Copyright © 2018 www.massapicom. 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.