Example usage for org.eclipse.jgit.api RevertCommand include

List of usage examples for org.eclipse.jgit.api RevertCommand include

Introduction

In this page you can find the example usage for org.eclipse.jgit.api RevertCommand include.

Prototype

public RevertCommand include(AnyObjectId commit) 

Source Link

Document

Include a commit to be reverted

Usage

From source file:git_manager.tool.GitOperations.java

License:Open Source License

public void revertCommit() {
    RevertCommand revert = git.revert();
    Iterable<RevCommit> logs = getLogs();

    if (logs != null) {
        //      revert.include(logs.iterator().next());
        CommitCheckBox commitCheck = new CommitCheckBox(logs);
        if (commitCheck.logs.isEmpty()) {
            System.out.println("No commits selected to be undone");
        } else {//  ww w.  j av  a 2s. com
            try {
                System.out.println("The following commits will be undone:");
                for (RevCommit rc : commitCheck.logs) {
                    revert.include(rc);
                    System.out.println("  " + rc.getShortMessage());
                }
                revert.call();
                System.out.println("Done.");
            } catch (NoMessageException e) {
                e.printStackTrace();
            } catch (UnmergedPathsException e) {
                e.printStackTrace();
            } catch (ConcurrentRefUpdateException e) {
                e.printStackTrace();
            } catch (WrongRepositoryStateException e) {
                e.printStackTrace();
            } catch (GitAPIException e) {
                e.printStackTrace();
            }
        }
    }
}