Package org.eclipse.jgit.lib

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


  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

        inserter.flush();

        RefUpdate ru = repo.updateRef(Constants.HEAD);
        ru.setNewObjectId(commitId);
        ru.setExpectedOldObjectId(headId != null ? headId : ObjectId.zeroId());
        Result rc = ru.update(rw);

        switch (rc) {
          case NEW:
          case FORCED:
          case FAST_FORWARD:
View Full Code Here

              return super.isForceUpdate();
            }
          };
          update.setForceUpdate(true);
          update.setNewObjectId(b);
          return update.update();
        }
      });

      pool.submit(new Callable<Void>() {
        public Void call() throws Exception {
View Full Code Here

      updateRef.setRefLogMessage(refLogMessage, false);
      Result updateResult;
      if (exists && force)
        updateResult = updateRef.forceUpdate();
      else
        updateResult = updateRef.update();

      setCallable(false);

      boolean ok = false;
      switch (updateResult) {
View Full Code Here

    cb.parent(b1Tip).parent(b2Tip);
    cb.setTopLevelTree(merger.getResultTreeId());
    RevCommit mergeCommit = cb.create();
    RefUpdate u = repo.updateRef("refs/heads/b1");
    u.setNewObjectId(mergeCommit);
    u.update();

    RefUpdate update = repo.updateRef("refs/heads/b2");
    update.setForceUpdate(true);
    update.delete();
View Full Code Here

    super.setUp();

    RefUpdate createRemoteRefA = db
        .updateRef("refs/remotes/origin/remote-a");
    createRemoteRefA.setNewObjectId(db.resolve("refs/heads/a"));
    createRemoteRefA.update();

    RefUpdate createRemoteRefB = db
        .updateRef("refs/remotes/origin/remote-b");
    createRemoteRefB.setNewObjectId(db.resolve("refs/heads/b"));
    createRemoteRefB.update();
View Full Code Here

    createRemoteRefA.update();

    RefUpdate createRemoteRefB = db
        .updateRef("refs/remotes/origin/remote-b");
    createRemoteRefB.setNewObjectId(db.resolve("refs/heads/b"));
    createRemoteRefB.update();

    formatter = new MergeMessageFormatter();
  }

  @Test
View Full Code Here

  private void updateRef(Ref stashRef, ObjectId newId) {
    try {
      RefUpdate update = createRefUpdate(stashRef);
      update.setNewObjectId(newId);
      Result result = update.update();
      switch (result) {
      case FORCED:
      case NEW:
      case NO_CHANGE:
        return;
View Full Code Here

        RefUpdate rup = repo.updateRef(headName);
        rup.setExpectedOldObjectId(oldCommit);
        rup.setNewObjectId(newCommit);
        rup.setRefLogMessage("Fast-foward from " + oldCommit.name() //$NON-NLS-1$
            + " to " + newCommit.name(), false); //$NON-NLS-1$
        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.