Package org.eclipse.jgit.lib

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


          // 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


        // 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:
View Full Code Here

        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

        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

    RevCommit commit = git.commit().setMessage("create file").call();

    RefUpdate update = db.updateRef(Constants.R_STASH);
    update.setNewObjectId(commit);
    update.disableRefLog();
    assertEquals(Result.NEW, update.update());

    StashListCommand command = Git.wrap(db).stashList();
    Collection<RevCommit> stashed = command.call();
    assertNotNull(stashed);
    assertTrue(stashed.isEmpty());
View Full Code Here

    git.add().addFilepattern("file.txt").call();
    RevCommit commit = git.commit().setMessage("create file").call();

    RefUpdate update = db.updateRef(Constants.R_STASH);
    update.setNewObjectId(commit);
    assertEquals(Result.NEW, update.update());

    StashListCommand command = git.stashList();
    Collection<RevCommit> stashed = command.call();
    assertNotNull(stashed);
    assertEquals(1, stashed.size());
View Full Code Here

    git.add().addFilepattern("file.txt").call();
    RevCommit commit2 = git.commit().setMessage("edit file").call();

    RefUpdate create = db.updateRef(Constants.R_STASH);
    create.setNewObjectId(commit1);
    assertEquals(Result.NEW, create.update());

    RefUpdate update = db.updateRef(Constants.R_STASH);
    update.setNewObjectId(commit2);
    assertEquals(Result.FAST_FORWARD, update.update());
View Full Code Here

    create.setNewObjectId(commit1);
    assertEquals(Result.NEW, create.update());

    RefUpdate update = db.updateRef(Constants.R_STASH);
    update.setNewObjectId(commit2);
    assertEquals(Result.FAST_FORWARD, update.update());

    StashListCommand command = git.stashList();
    Collection<RevCommit> stashed = command.call();
    assertNotNull(stashed);
    assertEquals(2, stashed.size());
View Full Code Here

      case UPDATE_NONFASTFORWARD:
        ru.setForceUpdate(rp.isAllowNonFastForwards());
        ru.setExpectedOldObjectId(getOldId());
        ru.setNewObjectId(getNewId());
        ru.setRefLogMessage("push", true); //$NON-NLS-1$
        setResult(ru.update(rp.getRevWalk()));
        break;
      }
    } catch (IOException err) {
      reject(err);
    }
View Full Code Here

    secondCommit = git.commit().setMessage("Second commit").call();
    // create a master branch
    RefUpdate rup = db.updateRef("refs/heads/master");
    rup.setNewObjectId(initialCommit.getId());
    rup.setForceUpdate(true);
    rup.update();
  }

  private Git setUpRepoWithRemote() throws Exception {
    Repository remoteRepository = createWorkRepository();
    Git remoteGit = new Git(remoteRepository);
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.