本文整理汇总了Java中org.eclipse.jgit.api.ArchiveCommand.unregisterFormat方法的典型用法代码示例。如果您正苦于以下问题:Java ArchiveCommand.unregisterFormat方法的具体用法?Java ArchiveCommand.unregisterFormat怎么用?Java ArchiveCommand.unregisterFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.api.ArchiveCommand
的用法示例。
在下文中一共展示了ArchiveCommand.unregisterFormat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRepositoryZip
import org.eclipse.jgit.api.ArchiveCommand; //导入方法依赖的package包/类
/** 커밋을 입력받으면 당시 파일들을 압축하여 사용자에게 보내줌.
* @param commitName
* @param format
* @param response
*/
public void getRepositoryZip(String commitName,String format, HttpServletResponse response) {
try {
ArchiveCommand.registerFormat("zip", new ZipFormat());
ArchiveCommand.registerFormat("tar", new TarFormat());
ObjectId revId = this.localRepo.resolve(commitName);
git.archive().setOutputStream(response.getOutputStream())
.setFormat(format)
.setTree(revId)
.call();
ArchiveCommand.unregisterFormat("zip");
ArchiveCommand.unregisterFormat("tar");
response.flushBuffer();
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
示例2: getProjectZip
import org.eclipse.jgit.api.ArchiveCommand; //导入方法依赖的package包/类
/** 커밋을 입력받으면 당시 파일들을 압축하여 사용자에게 보내줌.
* @param commitName
* @param format
* @param response
*/
public void getProjectZip(String commitName,String format, HttpServletResponse response) {
try {
ArchiveCommand.registerFormat("zip", new ZipFormat());
ArchiveCommand.registerFormat("tar", new TarFormat());
ObjectId revId = this.localRepo.resolve(commitName);
git.archive().setOutputStream(response.getOutputStream())
.setFormat(format)
.setTree(revId)
.call();
ArchiveCommand.unregisterFormat("zip");
ArchiveCommand.unregisterFormat("tar");
response.flushBuffer();
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
示例3: getConfiguration
import org.eclipse.jgit.api.ArchiveCommand; //导入方法依赖的package包/类
/**
* Export the git tag identified by the entry id
*
* @param config
* @param e
* @param exportDirectory
* @throws Exception
*/
public void getConfiguration(Configuration config, Entry e, File exportDirectory) throws Exception {
Preconditions.checkNotNull(config, "Configuration must be supplied.");
Preconditions.checkNotNull(e, "Entry must be supplied.");
Preconditions.checkNotNull(exportDirectory, "Directory must be supplied.");
File zip = new File(exportDirectory, e.getUUID().toString()+".zip");
ArchiveCommand.registerFormat("zip", new ZipFormat());
try (FileOutputStream out = new FileOutputStream(zip);){
LOG.debug("Exporting tag {} to {}", e.getUUID(), zip);
git.archive().setTree(git.getRepository().resolve(e.getUUID().toString()))
.setFormat("zip")
.setOutputStream(out)
.call();
unzip(zip);
} catch (IOException | RevisionSyntaxException | GitAPIException ioe) {
zip.delete();
LOG.error("Error creating archive from tag: " + e.getUUID().toString(), ioe);
throw ioe;
} finally {
ArchiveCommand.unregisterFormat("zip");
}
}
示例4: main
import org.eclipse.jgit.api.ArchiveCommand; //导入方法依赖的package包/类
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 {
// 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);
}
}