/** * 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(); }); }
/** * 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; }
/** * 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; }