Example usage for org.eclipse.jgit.api ArchiveCommand registerFormat

List of usage examples for org.eclipse.jgit.api ArchiveCommand registerFormat

Introduction

In this page you can find the example usage for org.eclipse.jgit.api ArchiveCommand registerFormat.

Prototype

public static void registerFormat(String name, Format<?> fmt) 

Source Link

Document

Adds support for an additional archival format.

Usage

From source file:com.google.gerrit.server.change.ArchiveFormat.java

License:Open Source License

private ArchiveFormat(String mimeType, ArchiveCommand.Format<?> format) {
    this.format = format;
    this.mimeType = mimeType;
    ArchiveCommand.registerFormat(name(), format);
}

From source file:com.google.gitiles.ArchiveFormat.java

License:Open Source License

private ArchiveFormat(String mimeType, ArchiveCommand.Format<?> format) {
    this.format = format;
    this.mimeType = mimeType;
    ArchiveCommand.registerFormat(getRegisteredName(), format);
}

From source file:edu.nju.cs.inform.jgit.porcelain.CreateCustomFormatArchive.java

License:Apache License

public static void main(String[] args) throws IOException, GitAPIException {
    try (Repository repository = CookbookHelper.openJGitCookbookRepository()) {
        File file = File.createTempFile("test", ".mzip");
        // make the archive format known
        ArchiveCommand.registerFormat("myzip", new ZipArchiveFormat());
        try {//  w w w  . ja  va  2 s .  c o  m
            // this is the file that we write the archive to
            try (OutputStream out = new FileOutputStream(file)) {
                // finally call the ArchiveCommand to write out using the given format
                try (Git git = new Git(repository)) {
                    git.archive().setTree(repository.resolve("master")).setFormat("myzip").setOutputStream(out)
                            .call();
                }
            }
        } finally {
            ArchiveCommand.unregisterFormat("myzip");
        }

        System.out.println("Wrote " + file.length() + " bytes to " + file);
    }
}