public ArchiveOutputStream createArchiveOutputStream(OutputStream s) throws IOException { return createArchiveOutputStream(s, Collections.<String, Object> emptyMap()); }
/** * Register all included archive formats so they can be used * as arguments to the ArchiveCommand.setFormat() method. * * Not thread-safe. */ public static void registerAll() { register("tar", new TarFormat()); //$NON-NLS-1$ register("tgz", new TgzFormat()); //$NON-NLS-1$ register("tbz2", new Tbz2Format()); //$NON-NLS-1$ register("txz", new TxzFormat()); //$NON-NLS-1$ register("zip", new ZipFormat()); //$NON-NLS-1$ }
/** * Register all included archive formats so they can be used * as arguments to the ArchiveCommand.setFormat() method. * * Not thread-safe. */ public static void registerAll() { register("tar", new TarFormat()); //$NON-NLS-1$ register("tgz", new TgzFormat()); //$NON-NLS-1$ register("tbz2", new Tbz2Format()); //$NON-NLS-1$ register("txz", new TxzFormat()); //$NON-NLS-1$ register("zip", new ZipFormat()); //$NON-NLS-1$ }
@Override public void writeData(Attributes attributes) throws IOException { if (format.equals("zip")) ArchiveCommand.registerFormat(format, new ZipFormat()); else ArchiveCommand.registerFormat(format, new TgzFormat()); try { ArchiveCommand archive = Git.wrap(project.getRepository()).archive(); archive.setFormat(format); archive.setTree(project.getRevCommit(revision).getId()); archive.setOutputStream(attributes.getResponse().getOutputStream()); archive.call(); } catch (GitAPIException e) { throw new RuntimeException(e); } finally { ArchiveCommand.unregisterFormat(format); } } });