Package org.eclipse.jgit.lib

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


          }
          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


    }

    final RevCommit commit = parseCommit(branch);
    final RefUpdate u = db.updateRef(Constants.HEAD);
    u.setNewObjectId(commit);
    u.forceUpdate();

    DirCache dc = db.lockDirCache();
    DirCacheCheckout co = new DirCacheCheckout(db, dc, commit.getTree());
    co.checkout();
  }
View Full Code Here

    } else
      ref = Constants.R_HEADS + ref;

    RefUpdate u = db.updateRef(ref);
    u.setNewObjectId(obj);
    switch (u.forceUpdate()) {
    case FAST_FORWARD:
    case FORCED:
    case NEW:
    case NO_CHANGE:
      updateServerInfo();
View Full Code Here

        ru.setNewObjectId(commitId);

        String refName = Repository.shortenRefName(getRefOrHEAD());
        String message = refName + ": updating " + Constants.HEAD; //$NON-NLS-1$
        ru.setRefLogMessage(message, false);
        if (ru.forceUpdate() == RefUpdate.Result.LOCK_FAILURE)
          throw new JGitInternalException(MessageFormat.format(
              JGitText.get().cannotLock, ru.getName()));

        ObjectId origHead = ru.getOldObjectId();
        if (origHead != null)
View Full Code Here

      RefUpdate updateRef = repo.updateRef(Constants.R_HEADS + name);
      updateRef.setNewObjectId(startAt);
      updateRef.setRefLogMessage(refLogMessage, false);
      Result updateResult;
      if (exists && force)
        updateResult = updateRef.forceUpdate();
      else
        updateResult = updateRef.update();

      setCallable(false);
View Full Code Here

      else if (orphan) {
        updateResult = refUpdate.link(getBranchName());
        ref = repo.getRef(Constants.HEAD);
      } else {
        refUpdate.setNewObjectId(newCommit);
        updateResult = refUpdate.forceUpdate();
      }

      setCallable(false);

      boolean ok = false;
View Full Code Here

      JGitInternalException, GitAPIException {
    Git git = new Git(db);
    git.commit().setMessage("initial commit").call();
    RefUpdate r = db.updateRef("refs/heads/side");
    r.setNewObjectId(db.resolve(Constants.HEAD));
    assertEquals(r.forceUpdate(), RefUpdate.Result.NEW);
    RevCommit second = git.commit().setMessage("second commit").setCommitter(committer).call();
    db.updateRef(Constants.HEAD).link("refs/heads/side");
    RevCommit firstSide = git.commit().setMessage("first side commit").setAuthor(author).call();

    write(new File(db.getDirectory(), Constants.MERGE_HEAD), ObjectId
View Full Code Here

            co.setFailOnConflict(true);
            co.checkout();
            RefUpdate refUpdate = submoduleRepo.updateRef(
                Constants.HEAD, true);
            refUpdate.setNewObjectId(commit);
            refUpdate.forceUpdate();
          }
        } finally {
          submoduleRepo.close();
        }
        updated.add(generator.getPath());
View Full Code Here

    RefUpdate lockRef = db.updateRef("HEAD");
    ObjectId newId = ObjectId
        .fromString("07f822839a2fe9760f386cbbbcb3f92c5fe81def");
    lockRef.setNewObjectId(newId);
    assertEquals(RefUpdate.Result.FORCED, lockRef.forceUpdate());

    assertTrue(new File(db.getDirectory(), "refs/heads/foobar").exists());
    assertEquals(newId, db.resolve("refs/heads/foobar"));

    // Again. The ref already exists
View Full Code Here

    // Again. The ref already exists
    RefUpdate lockRef2 = db.updateRef("HEAD");
    ObjectId newId2 = ObjectId
        .fromString("7f822839a2fe9760f386cbbbcb3f92c5fe81def7");
    lockRef2.setNewObjectId(newId2);
    assertEquals(RefUpdate.Result.FORCED, lockRef2.forceUpdate());

    assertTrue(new File(db.getDirectory(), "refs/heads/foobar").exists());
    assertEquals(newId2, db.resolve("refs/heads/foobar"));
  }
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.