diff options
Diffstat (limited to 'org.eclipse.jgit.archive/src/org/eclipse/jgit')
5 files changed, 75 insertions, 3 deletions
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java index d56cb35d9d..900f024bfc 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java @@ -57,6 +57,7 @@ import org.apache.commons.compress.archivers.tar.TarConstants; import org.eclipse.jgit.api.ArchiveCommand; import org.eclipse.jgit.archive.internal.ArchiveText; import org.eclipse.jgit.lib.FileMode; +import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectLoader; /** @@ -84,9 +85,21 @@ public final class TarFormat extends BaseFormat implements return applyFormatOptions(out, o); } + @Deprecated + @Override public void putEntry(ArchiveOutputStream out, String path, FileMode mode, ObjectLoader loader) throws IOException { + putEntry(out, null, path, mode,loader); + } + + /** + * @since 4.7 + */ + @Override + public void putEntry(ArchiveOutputStream out, + ObjectId tree, String path, FileMode mode, ObjectLoader loader) + throws IOException { if (mode == FileMode.SYMLINK) { final TarArchiveEntry entry = new TarArchiveEntry( path, TarConstants.LF_SYMLINK); diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java index f3ab4da43a..bba0293637 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java @@ -53,6 +53,7 @@ import org.apache.commons.compress.archivers.ArchiveOutputStream; import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream; import org.eclipse.jgit.api.ArchiveCommand; import org.eclipse.jgit.lib.FileMode; +import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectLoader; /** @@ -80,10 +81,22 @@ public final class Tbz2Format extends BaseFormat implements return tarFormat.createArchiveOutputStream(out, o); } + @Deprecated + @Override public void putEntry(ArchiveOutputStream out, String path, FileMode mode, ObjectLoader loader) throws IOException { - tarFormat.putEntry(out, path, mode, loader); + putEntry(out, null, path, mode,loader); + } + + /** + * @since 4.7 + */ + @Override + public void putEntry(ArchiveOutputStream out, + ObjectId tree, String path, FileMode mode, ObjectLoader loader) + throws IOException { + tarFormat.putEntry(out, tree, path, mode, loader); } public Iterable<String> suffixes() { diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java index 06f09a4887..b6bf3ff665 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java @@ -53,6 +53,7 @@ import org.apache.commons.compress.archivers.ArchiveOutputStream; import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream; import org.eclipse.jgit.api.ArchiveCommand; import org.eclipse.jgit.lib.FileMode; +import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectLoader; /** @@ -80,10 +81,22 @@ public final class TgzFormat extends BaseFormat implements return tarFormat.createArchiveOutputStream(out, o); } + @Deprecated + @Override public void putEntry(ArchiveOutputStream out, String path, FileMode mode, ObjectLoader loader) throws IOException { - tarFormat.putEntry(out, path, mode, loader); + putEntry(out, null, path, mode,loader); + } + + /** + * @since 4.7 + */ + @Override + public void putEntry(ArchiveOutputStream out, + ObjectId tree, String path, FileMode mode, ObjectLoader loader) + throws IOException { + tarFormat.putEntry(out, tree, path, mode, loader); } public Iterable<String> suffixes() { diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java index 14839353d4..76d934f21c 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java @@ -53,6 +53,7 @@ import org.apache.commons.compress.archivers.ArchiveOutputStream; import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream; import org.eclipse.jgit.api.ArchiveCommand; import org.eclipse.jgit.lib.FileMode; +import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectLoader; /** @@ -80,10 +81,22 @@ public final class TxzFormat extends BaseFormat implements return tarFormat.createArchiveOutputStream(out, o); } + @Deprecated + @Override public void putEntry(ArchiveOutputStream out, String path, FileMode mode, ObjectLoader loader) throws IOException { - tarFormat.putEntry(out, path, mode, loader); + putEntry(out, null, path, mode,loader); + } + + /** + * @since 4.7 + */ + @Override + public void putEntry(ArchiveOutputStream out, + ObjectId tree, String path, FileMode mode, ObjectLoader loader) + throws IOException { + tarFormat.putEntry(out, tree, path, mode, loader); } public Iterable<String> suffixes() { diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java index 0e1b2536f2..dfbf2ee62d 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java @@ -56,7 +56,9 @@ import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import org.eclipse.jgit.api.ArchiveCommand; import org.eclipse.jgit.archive.internal.ArchiveText; import org.eclipse.jgit.lib.FileMode; +import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectLoader; +import org.eclipse.jgit.revwalk.RevCommit; /** * PKWARE's ZIP format. @@ -80,9 +82,21 @@ public final class ZipFormat extends BaseFormat implements return applyFormatOptions(new ZipArchiveOutputStream(s), o); } + @Deprecated + @Override public void putEntry(ArchiveOutputStream out, String path, FileMode mode, ObjectLoader loader) throws IOException { + putEntry(out, null, path, mode,loader); + } + + /** + * @since 4.7 + */ + @Override + public void putEntry(ArchiveOutputStream out, + ObjectId tree, String path, FileMode mode, ObjectLoader loader) + throws IOException { // ZipArchiveEntry detects directories by checking // for '/' at the end of the filename. if (path.endsWith("/") && mode != FileMode.TREE) //$NON-NLS-1$ @@ -92,6 +106,12 @@ public final class ZipFormat extends BaseFormat implements path = path + "/"; //$NON-NLS-1$ final ZipArchiveEntry entry = new ZipArchiveEntry(path); + + if(tree instanceof RevCommit){ + long commitTime = ((RevCommit) tree).getCommitTime(); + entry.setTime(commitTime); + } + if (mode == FileMode.TREE) { out.putArchiveEntry(entry); out.closeArchiveEntry(); |