org.eclipse.jgit.api.RevertCommand Java Examples
The following examples show how to use
org.eclipse.jgit.api.RevertCommand.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UIGit.java From hop with Apache License 2.0 | 5 votes |
@Override public boolean rollback( String name ) { if ( hasUncommittedChanges() ) { showMessageBox( BaseMessages.getString( PKG, "Dialog.Error" ), BaseMessages.getString( PKG, "Git.Dialog.UncommittedChanges.Message" ) ); return false; } String commit = resolve( Constants.HEAD ).getName(); RevertCommand cmd = git.revert(); for ( int i = 0; i < getRevisions().size(); i++ ) { String commitId = getRevisions().get( i ).getRevisionId(); /* * Revert commits from HEAD to the specified commit in reverse order. */ cmd.include( resolve( commitId ) ); if ( commitId.equals( name ) ) { break; } } try { cmd.call(); git.reset().setRef( commit ).call(); return true; } catch ( Exception e ) { showMessageBox( BaseMessages.getString( PKG, "Dialog.Error" ), e.getMessage() ); } return false; }