private void updateStashRef(ObjectId commitId, PersonIdent refLogIdent, String refLogMessage) throws IOException { Ref currentRef = repo.exactRef(Constants.R_STASH); RefUpdate refUpdate = repo.updateRef(Constants.R_STASH); refUpdate.setNewObjectId(commitId); refUpdate.setRefLogIdent(refLogIdent); refUpdate.setRefLogMessage(refLogMessage, false); refUpdate.setForceRefLog(true); if (currentRef != null) refUpdate.setExpectedOldObjectId(currentRef.getObjectId()); else refUpdate.setExpectedOldObjectId(ObjectId.zeroId()); refUpdate.forceUpdate(); }
private void updateStashRef(ObjectId commitId, PersonIdent refLogIdent, String refLogMessage) throws IOException { if (ref == null) return; Ref currentRef = repo.findRef(ref); RefUpdate refUpdate = repo.updateRef(ref); refUpdate.setNewObjectId(commitId); refUpdate.setRefLogIdent(refLogIdent); refUpdate.setRefLogMessage(refLogMessage, false); refUpdate.setForceRefLog(true); if (currentRef != null) refUpdate.setExpectedOldObjectId(currentRef.getObjectId()); else refUpdate.setExpectedOldObjectId(ObjectId.zeroId()); refUpdate.forceUpdate(); }
rup.setRefLogMessage("rebase finished: " + headName + " onto " //$NON-NLS-1$ //$NON-NLS-2$ + onto.getName(), false); Result res = rup.forceUpdate(); switch (res) { case FAST_FORWARD:
RefUpdate u = clonedRepo.updateRef(Constants.HEAD, detached); u.setNewObjectId(commit.getId()); u.forceUpdate();
Result updateResult; if (exists && force) updateResult = updateRef.forceUpdate(); else updateResult = updateRef.update();
} else { refUpdate.setNewObjectId(newCommit); updateResult = refUpdate.forceUpdate();
Constants.HEAD, true); refUpdate.setNewObjectId(commit); refUpdate.forceUpdate(); if (callback != null) { callback.checkingOut(commit,
ru.setRefLogMessage(message, false); if (ru.forceUpdate() == RefUpdate.Result.LOCK_FAILURE) throw new JGitInternalException(MessageFormat.format( JGitText.get().cannotLock, ru.getName()));
+ Repository.shortenRefName(headName) + " to " + commit.getName(), false); //$NON-NLS-1$ Result res = refUpdate.forceUpdate(); switch (res) { case FAST_FORWARD:
else ru.setExpectedOldObjectId(ObjectId.zeroId()); Result rc = ru.forceUpdate(); switch (rc) { case NEW:
} else { refUpdate.setNewObjectId(repo.readOrigHead()); res = refUpdate.forceUpdate();
public static void detachRepositoryHead(@Nonnull Repository repo, @Nonnull AnyObjectId id) throws IOException { id = CommitUtils.getCommit(id, repo); RefUpdate update = prepareUpdateHead(repo, id.getName(), true); update.setNewObjectId(id); RefUpdateValidator.validate(update.forceUpdate()); }
public static void detachRepositoryHead(Repository repo, AnyObjectId id) throws IOException { id = CommitUtils.getCommit(id, repo); RefUpdate update = prepareUpdateHead(repo, id.getName(), true); update.setNewObjectId(id); RefUpdateValidator.validate(update.forceUpdate()); }
public static void detachRepositoryHead(Repository repo, AnyObjectId id) throws IOException { id = CommitUtils.getCommit(id, repo); RefUpdate update = prepareUpdateHead(repo, id.getName(), true); update.setNewObjectId(id); RefUpdateValidator.validate(update.forceUpdate()); }
public static void updateRef(RefUpdate refUpdate) { try { RefUpdate.Result result = refUpdate.forceUpdate(); if (result == RefUpdate.Result.LOCK_FAILURE && refUpdate.getExpectedOldObjectId() != null && !refUpdate.getExpectedOldObjectId().equals(refUpdate.getOldObjectId())) { throw new ObsoleteCommitException(refUpdate.getOldObjectId()); } else if (result != RefUpdate.Result.FAST_FORWARD && result != RefUpdate.Result.FORCED && result != RefUpdate.Result.NEW && result != RefUpdate.Result.NO_CHANGE) { throw new RefUpdateException(result); } } catch (IOException e) { throw new RuntimeException(e); } }
public static void addToStash(RevCommit commit, Repository repo) throws IOException { RefUpdate update = repo.updateRef(R_STASH); update.setNewObjectId(commit); update.setRefLogIdent(commit.getCommitterIdent()); AnyObjectId prevStash = repo.resolve(R_STASH); update.setExpectedOldObjectId(prevStash != null ? prevStash : zeroId()); update.forceUpdate(); }
public static void addToStash(RevCommit commit, Repository repo) throws IOException { RefUpdate update = repo.updateRef(R_STASH); update.setNewObjectId(commit); update.setRefLogIdent(commit.getCommitterIdent()); AnyObjectId prevStash = repo.resolve(R_STASH); update.setExpectedOldObjectId(prevStash != null ? prevStash : zeroId()); update.forceUpdate(); }
private void updateStashRef(ObjectId commitId, PersonIdent refLogIdent, String refLogMessage) throws IOException { Ref currentRef = repo.exactRef(Constants.R_STASH); RefUpdate refUpdate = repo.updateRef(Constants.R_STASH); refUpdate.setNewObjectId(commitId); refUpdate.setRefLogIdent(refLogIdent); refUpdate.setRefLogMessage(refLogMessage, false); if (currentRef != null) refUpdate.setExpectedOldObjectId(currentRef.getObjectId()); else refUpdate.setExpectedOldObjectId(ObjectId.zeroId()); refUpdate.forceUpdate(); }
private void doCheckout(final Ref branch) throws IOException { if (branch == null) throw die(CLIText.get().cannotChekoutNoHeadsAdvertisedByRemote); if (!Constants.HEAD.equals(branch.getName())) { RefUpdate u = db.updateRef(Constants.HEAD); u.disableRefLog(); u.link(branch.getName()); } 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(); }
private void updateStashRef(ObjectId commitId, PersonIdent refLogIdent, String refLogMessage) throws IOException { Ref currentRef = repo.exactRef(Constants.R_STASH); RefUpdate refUpdate = repo.updateRef(Constants.R_STASH); refUpdate.setNewObjectId(commitId); refUpdate.setRefLogIdent(refLogIdent); refUpdate.setRefLogMessage(refLogMessage, false); refUpdate.setForceRefLog(true); if (currentRef != null) refUpdate.setExpectedOldObjectId(currentRef.getObjectId()); else refUpdate.setExpectedOldObjectId(ObjectId.zeroId()); refUpdate.forceUpdate(); }