private RefUpdate createRefUpdate(Ref stashRef) throws IOException { RefUpdate update = repo.updateRef(R_STASH); update.disableRefLog(); update.setExpectedOldObjectId(stashRef.getObjectId()); update.setForceUpdate(true); return update; }
String fullName = currentRef.getName(); RefUpdate update = repo.updateRef(fullName); update.setForceUpdate(true); Result deleteResult = update.delete();
private Ref updateTagRef(ObjectId tagId, RevWalk revWalk, String tagName, String newTagToString) throws IOException, ConcurrentRefUpdateException, RefAlreadyExistsException { String refName = Constants.R_TAGS + tagName; RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(forceUpdate); tagRef.setRefLogMessage("tagged " + name, false); //$NON-NLS-1$ Result updateResult = tagRef.update(revWalk); switch (updateResult) { case NEW: case FORCED: return repo.exactRef(refName); case LOCK_FAILURE: throw new ConcurrentRefUpdateException( JGitText.get().couldNotLockHEAD, tagRef.getRef(), updateResult); case REJECTED: throw new RefAlreadyExistsException(MessageFormat.format( JGitText.get().tagAlreadyExists, newTagToString)); default: throw new JGitInternalException(MessageFormat.format( JGitText.get().updatingRefFailed, refName, newTagToString, updateResult)); } }
RefUpdate update = repo.updateRef(fullName); update.setRefLogMessage("branch deleted", false); //$NON-NLS-1$ update.setForceUpdate(true); Result deleteResult = update.delete();
if (localName != null && localDb != null) { localUpdate = localDb.updateRef(localName); localUpdate.setForceUpdate(true); localUpdate.setRefLogMessage("push", true); //$NON-NLS-1$ localUpdate.setNewObjectId(newObjectId);
if (!ObjectId.zeroId().equals(cmd.getOldId())) ru.setExpectedOldObjectId(cmd.getOldId()); ru.setForceUpdate(true); return ru; case UPDATE_NONFASTFORWARD: default: ru.setForceUpdate(isAllowNonFastForwards()); ru.setExpectedOldObjectId(cmd.getOldId()); ru.setNewObjectId(cmd.getNewId());
String toName = Repository.shortenRefName(name); RefUpdate refUpdate = repo.updateRef(Constants.HEAD, ref == null); refUpdate.setForceUpdate(force); refUpdate.setRefLogMessage(refLogMessage + " to " + toName, false); //$NON-NLS-1$ Result updateResult;
ru.setForceUpdate(true); setResult(ru.delete(rp.getRevWalk())); break; case UPDATE: case UPDATE_NONFASTFORWARD: ru.setForceUpdate(rp.isAllowNonFastForwards()); ru.setExpectedOldObjectId(getOldId()); ru.setRefLogMessage("push", true); //$NON-NLS-1$
@Nonnull private static RefUpdate prepareUpdateHead(@Nonnull Repository repo, @Nonnull String name, boolean detach) throws IOException { RefUpdate ret = repo.updateRef(Constants.HEAD, detach); ret.setForceUpdate(true); ret.setRefLogMessage("checkout: moving from HEAD to " + Repository.shortenRefName(name), false); return ret; }
Result updateHead( Repository repo, String newHead, boolean force, boolean detach ) throws IOException { RefUpdate refUpdate = repo.getRefDatabase().newUpdate(Constants.HEAD, detach); refUpdate.setForceUpdate(force); return refUpdate.link(newHead); }
private static void deleteRef(Repository repo, String branchName, String revision) throws IOException { RefUpdate u = repo.updateRef(branchName, true); u.setForceUpdate(true); String resultMessage = "deleting branch "+branchName+" at revision " + revision; u.setRefLogMessage(resultMessage , true); Result result = u.delete(); log.info(resultMessage + " result = " + result); }
@Nonnull private static RefUpdate prepareUpdateHead(Repository repo, String name, boolean detach) throws IOException { RefUpdate ret = repo.updateRef(Constants.HEAD, detach); ret.setForceUpdate(true); ret.setRefLogMessage("checkout: moving from HEAD to " + Repository.shortenRefName(name), false); return ret; }
@Nonnull private static RefUpdate prepareUpdateHead(Repository repo, String name, boolean detach) throws IOException { RefUpdate ret = repo.updateRef(Constants.HEAD, detach); ret.setForceUpdate(true); ret.setRefLogMessage("checkout: moving from HEAD to " + Repository.shortenRefName(name), false); return ret; }
public static void deleteBranch(@Nonnull String name, @Nonnull Repository repo) throws IOException { String refName = RefUtils.ensureBranchRefName(name); if(prepareDeleteBranch(refName, repo)) { RefUpdate update = repo.updateRef(refName); update.setRefLogMessage("branch deleted", false); update.setForceUpdate(true); RefUpdateValidator.validate(update.delete()); } }
private static void setBranchHead(@Nonnull String name, @Nonnull AnyObjectId commitId, @Nonnull Repository repo, @Nullable String refLogMessage, boolean forceUpdate) throws IOException { String refName = RefUtils.ensureBranchRefName(name); AnyObjectId currentHead = repo.resolve(refName); if(currentHead == null) currentHead = ObjectId.zeroId(); RefUpdate update = repo.updateRef(refName); update.setRefLogMessage(refLogMessage, false); update.setForceUpdate(forceUpdate); update.setNewObjectId(commitId); update.setExpectedOldObjectId(currentHead); RefUpdateValidator.validate(update.update()); }
private RefUpdate createRefUpdate(final Ref stashRef) throws IOException { RefUpdate update = repo.updateRef(R_STASH); update.disableRefLog(); update.setExpectedOldObjectId(stashRef.getObjectId()); update.setForceUpdate(true); return update; }
private void deleteAllRefs() throws Exception { final RevWalk rw = new RevWalk(db); Map<String, Ref> refs = db.getRefDatabase().getRefs(ALL); for (final Ref r : refs.values()) { if (Constants.HEAD.equals(r.getName())) continue; final RefUpdate u = db.updateRef(r.getName()); u.setForceUpdate(true); u.delete(rw); } }
public static void deleteBranch(String name, Repository repo) throws IOException { String refName = fullBranchName(name); if(prepareDeleteBranch(refName, repo)) { RefUpdate update = repo.updateRef(refName); update.setRefLogMessage("branch deleted", false); update.setForceUpdate(true); RefUpdateValidator.validate(update.delete()); } }
private static void setBranchHead(String name, AnyObjectId commitId, Repository repo, @Nullable String refLogMessage, boolean forceUpdate) throws IOException { String refName = fullBranchName(name); AnyObjectId currentHead = repo.resolve(refName); if(currentHead == null) currentHead = zeroId(); RefUpdate update = repo.updateRef(refName); update.setRefLogMessage(refLogMessage, false); update.setForceUpdate(forceUpdate); update.setNewObjectId(commitId); update.setExpectedOldObjectId(currentHead); RefUpdateValidator.validate(update.update()); }
source.setForceUpdate(true); source.disableRefLog(); if (source.delete(rw) != Result.FORCED) {