remoteName, localName, localUpdate.getOldObjectId() != null ? localUpdate.getOldObjectId() : ObjectId.zeroId(), newObjectId);
JGitText.get().cannotLock, ru.getName())); ObjectId origHead = ru.getOldObjectId(); if (origHead != null) repo.writeOrigHead(origHead);
/** * Write the given ref update to the ref's log. * * @param update * a {@link org.eclipse.jgit.lib.RefUpdate} * @param msg * reflog message * @param deref * whether to dereference symbolic refs * @return this writer * @throws java.io.IOException */ public ReflogWriter log(RefUpdate update, String msg, boolean deref) throws IOException { ObjectId oldId = update.getOldObjectId(); ObjectId newId = update.getNewObjectId(); Ref ref = update.getRef(); PersonIdent ident = update.getRefLogIdent(); if (ident == null) ident = new PersonIdent(refdb.getRepository()); else ident = new PersonIdent(ident); byte[] rec = encode(oldId, newId, ident, msg); if (deref && ref.isSymbolic()) { log(ref.getName(), rec); log(ref.getLeaf().getName(), rec); } else log(ref.getName(), rec); return this; }
private void runReceiveHook(@NotNull Repository repository, @NotNull RefUpdate refUpdate, @NotNull SVNErrorCode svnErrorCode, @Nullable String hook, @NotNull User userInfo) throws IOException, SVNException { runHook(repository, svnErrorCode, hook, userInfo, processBuilder -> { final Process process = processBuilder.start(); try (Writer stdin = new OutputStreamWriter(process.getOutputStream(), StandardCharsets.UTF_8)) { stdin.write(getObjectId(refUpdate.getOldObjectId())); stdin.write(' '); stdin.write(getObjectId(refUpdate.getNewObjectId())); stdin.write(' '); stdin.write(refUpdate.getName()); stdin.write('\n'); } return process; }); }
private void runUpdateHook(@NotNull Repository repository, @NotNull RefUpdate refUpdate, @Nullable String hook, @NotNull User userInfo) throws IOException, SVNException { runHook(repository, SVNErrorCode.REPOS_HOOK_FAILURE, hook, userInfo, processBuilder -> { processBuilder.command().addAll(Arrays.asList( refUpdate.getName(), getObjectId(refUpdate.getOldObjectId()), getObjectId(refUpdate.getNewObjectId()) )); return processBuilder.start(); }); }
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 deleteRef(RefUpdate refUpdate) { try { refUpdate.setForceUpdate(true); RefUpdate.Result result = refUpdate.delete(); 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); } }
@Override public boolean push(@NotNull Repository repository, @NotNull ObjectId ReceiveId, @NotNull String branch, @NotNull User userInfo) throws SVNException, IOException { final RefUpdate refUpdate = repository.updateRef(branch); refUpdate.getOldObjectId(); refUpdate.setNewObjectId(ReceiveId); runReceiveHook(repository, refUpdate, SVNErrorCode.REPOS_HOOK_FAILURE, preReceive, userInfo); runUpdateHook(repository, refUpdate, update, userInfo); final RefUpdate.Result result = refUpdate.update(); switch (result) { case REJECTED: return false; case NEW: case FAST_FORWARD: runReceiveHook(repository, refUpdate, SVNErrorCode.REPOS_POST_COMMIT_HOOK_FAILED, postReceive, userInfo); return true; default: log.error("Unexpected push error: {}", result); throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_WRITE_ERROR, result.name())); } }
return Result.IO_FAILURE; // not supported objId = source.getOldObjectId(); updateHEAD = needToUpdateHEAD(); tmp = refdb.newTemporaryUpdate();
remoteName, localName, localUpdate.getOldObjectId() != null ? localUpdate.getOldObjectId() : ObjectId.zeroId(), newObjectId);
remoteName, localName, localUpdate.getOldObjectId() != null ? localUpdate.getOldObjectId() : ObjectId.zeroId(), newObjectId);
RevCommit theirsCommit = revWalk.parseCommit(refUpdate.getOldObjectId()); NoteMap theirs = NoteMap.read(revWalk.getObjectReader(), theirsCommit); NoteMapMerger merger = new NoteMapMerger(repo);
/** * Write the given ref update to the ref's log * * @param update * @param msg * @param deref * @return this writer * @throws IOException */ public ReflogWriter log(final RefUpdate update, final String msg, final boolean deref) throws IOException { final ObjectId oldId = update.getOldObjectId(); final ObjectId newId = update.getNewObjectId(); final Ref ref = update.getRef(); PersonIdent ident = update.getRefLogIdent(); if (ident == null) ident = new PersonIdent(parent); else ident = new PersonIdent(ident); final byte[] rec = encode(oldId, newId, ident, msg); if (deref && ref.isSymbolic()) { log(ref.getName(), rec); log(ref.getLeaf().getName(), rec); } else log(ref.getName(), rec); return this; }
JGitText.get().cannotLock, ru.getName())); ObjectId origHead = ru.getOldObjectId(); if (origHead != null) repo.writeOrigHead(origHead);
JGitText.get().cannotLock, ru.getName())); ObjectId origHead = ru.getOldObjectId(); if (origHead != null) repo.writeOrigHead(origHead);
/** * Write the given ref update to the ref's log. * * @param update * a {@link org.eclipse.jgit.lib.RefUpdate} * @param msg * reflog message * @param deref * whether to dereference symbolic refs * @return this writer * @throws java.io.IOException */ public ReflogWriter log(RefUpdate update, String msg, boolean deref) throws IOException { ObjectId oldId = update.getOldObjectId(); ObjectId newId = update.getNewObjectId(); Ref ref = update.getRef(); PersonIdent ident = update.getRefLogIdent(); if (ident == null) ident = new PersonIdent(refdb.getRepository()); else ident = new PersonIdent(ident); byte[] rec = encode(oldId, newId, ident, msg); if (deref && ref.isSymbolic()) { log(ref.getName(), rec); log(ref.getLeaf().getName(), rec); } else log(ref.getName(), rec); return this; }
return Result.IO_FAILURE; // not supported objId = source.getOldObjectId(); updateHEAD = needToUpdateHEAD(); tmp = refdb.newTemporaryUpdate();
return Result.IO_FAILURE; // not supported objId = source.getOldObjectId(); updateHEAD = needToUpdateHEAD(); tmp = refdb.newTemporaryUpdate();