Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.RefUpdate.update()


        RefUpdate rup = repo.updateRef(headName);
        rup.setExpectedOldObjectId(oldCommit);
        rup.setNewObjectId(newCommit);
        rup.setRefLogMessage("Fast-foward from " + oldCommit.name()
            + " to " + newCommit.name(), false);
        Result res = rup.update(walk);
        switch (res) {
        case FAST_FORWARD:
        case NO_CHANGE:
        case FORCED:
          break;
View Full Code Here


            ru.setNewObjectId(commitId);
            ru.setRefLogMessage("commit : "
                + revCommit.getShortMessage(), false);

            ru.setExpectedOldObjectId(headId);
            Result rc = ru.update();
            switch (rc) {
            case NEW:
            case FAST_FORWARD: {
              setCallable(false);
              if (state == RepositoryState.MERGING_RESOLVED) {
View Full Code Here

          String refName = Constants.R_TAGS + newTag.getTag();
          RefUpdate tagRef = repo.updateRef(refName);
          tagRef.setNewObjectId(tagId);
          tagRef.setForceUpdate(forceUpdate);
          tagRef.setRefLogMessage("tagged " + name, false);
          Result updateResult = tagRef.update(revWalk);
          switch (updateResult) {
          case NEW:
          case FORCED:
            return revTag;
          case LOCK_FAILURE:
View Full Code Here

  protected void createBranch(ObjectId objectId, String branchName)
      throws IOException {
    RefUpdate updateRef = db.updateRef(branchName);
    updateRef.setNewObjectId(objectId);
    updateRef.update();
  }

  protected void checkoutBranch(String branchName)
      throws IllegalStateException, IOException {
    RevWalk walk = new RevWalk(db);
View Full Code Here

      }

      // Create the destination, logging the rename during the creation.
      dst.setExpectedOldObjectId(ObjectId.zeroId());
      dst.setNewObjectId(objId);
      if (dst.update(rw) != Result.NEW) {
        // If we didn't create the destination we have to undo
        // our work. Put the log back and restore source.
        if (renameLog(destination, tmp))
          renameLog(tmp, source);
        source.setExpectedOldObjectId(ObjectId.zeroId());
View Full Code Here

      case UPDATE_NONFASTFORWARD:
        ru.setForceUpdate(isAllowNonFastForwards());
        ru.setExpectedOldObjectId(cmd.getOldId());
        ru.setNewObjectId(cmd.getNewId());
        ru.setRefLogMessage("push", true);
        status(cmd, ru.update(walk));
        break;
      }
    } catch (IOException err) {
      cmd.setResult(Result.REJECTED_OTHER_REASON, MessageFormat.format(
          JGitText.get().lockError, err.getMessage()));
View Full Code Here

          // set the merge ref to the merge commit
          RevCommit mergeCommit = revWalk.parseCommit(mergeCommitId);
          RefUpdate mergeRefUpdate = repository.updateRef(toBranch);
          mergeRefUpdate.setNewObjectId(mergeCommitId);
          mergeRefUpdate.setRefLogMessage("commit: " + mergeCommit.getShortMessage(), false);
          RefUpdate.Result rc = mergeRefUpdate.update();
          switch (rc) {
          case FAST_FORWARD:
            // successful, clean merge
            break;
          default:
View Full Code Here

        break;
      }

      ru.setExpectedOldObjectId(ticketRefId);
      ru.setNewObjectId(newId);
      RefUpdate.Result result = ru.update(getRevWalk());
      if (result == RefUpdate.Result.LOCK_FAILURE) {
        sendError("Failed to obtain lock when updating {0}:{1}", repository.name, ref);
        sendError("Perhaps an administrator should remove {0}/{1}.lock?", getRepository().getDirectory(), ref);
        return null;
      }
View Full Code Here

      case UPDATE_NONFASTFORWARD:
        ru.setForceUpdate(isAllowNonFastForwards());
        ru.setExpectedOldObjectId(cmd.getOldId());
        ru.setNewObjectId(cmd.getNewId());
        ru.setRefLogMessage("push", true);
        status(cmd, ru.update(walk));
        break;
      }
    } catch (IOException err) {
      cmd.setResult(Result.REJECTED_OTHER_REASON, MessageFormat.format(
          JGitText.get().lockError, err.getMessage()));
View Full Code Here

        RefUpdate rup = repo.updateRef(headName);
        rup.setExpectedOldObjectId(oldCommit);
        rup.setNewObjectId(newCommit);
        rup.setRefLogMessage("Fast-foward from " + oldCommit.name()
            + " to " + newCommit.name(), false);
        Result res = rup.update(walk);
        switch (res) {
        case FAST_FORWARD:
        case NO_CHANGE:
        case FORCED:
          break;
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.