Example usage for org.eclipse.jgit.api ApplyResult getUpdatedFiles

List of usage examples for org.eclipse.jgit.api ApplyResult getUpdatedFiles

Introduction

In this page you can find the example usage for org.eclipse.jgit.api ApplyResult getUpdatedFiles.

Prototype

public List<File> getUpdatedFiles() 

Source Link

Document

Get updated files

Usage

From source file:com.rimerosolutions.ant.git.tasks.ApplyTask.java

License:Apache License

@Override
protected void doExecute() {
    InputStream in = null;//from   w  w  w . j  a v  a2s. com

    try {
        in = new FileInputStream(patchFile);
        ApplyResult result = git.apply().setPatch(in).call();
        Collection<File> updatedFiles = result.getUpdatedFiles();

        log("Updated files:" + updatedFiles.size());

        if (updatedCountProperty != null) {
            getProject().setProperty(updatedCountProperty, String.valueOf(updatedFiles.size()));
        }
    } catch (PatchFormatException pfe) {
        throw new GitBuildException("Invalid patch format.", pfe);
    } catch (PatchApplyException pae) {
        throw new GitBuildException("Failed to apply patch.", pae);
    } catch (GitAPIException gae) {
        throw new GitBuildException("Unexpected runtime error.", gae);
    } catch (IOException ioe) {
        throw new GitBuildException("Unexpected IO/Error.", ioe);
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException ioe) {
                throw new GitBuildException("Cannot close patch file IO stream.", ioe);
            }
        }
    }
}