org.eclipse.jgit.api
Class StashCreateCommand

java.lang.Object
  extended by org.eclipse.jgit.api.GitCommand<RevCommit>
      extended by org.eclipse.jgit.api.StashCreateCommand
All Implemented Interfaces:
Callable<RevCommit>

public class StashCreateCommand
extends GitCommand<RevCommit>

Command class to stash changes in the working directory and index in a commit.

Since:
2.0
See Also:
Git documentation about Stash

Field Summary
 
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
 
Constructor Summary
StashCreateCommand(Repository repo)
          Create a command to stash changes in the working directory and index
 
Method Summary
 RevCommit call()
          Stash the contents on the working directory and index in separate commits and reset to the current HEAD commit.
 StashCreateCommand setIndexMessage(String message)
          Set the message used when committing index changes
 StashCreateCommand setPerson(PersonIdent person)
          Set the person to use as the author and committer in the commits made
 StashCreateCommand setRef(String ref)
          Set the reference to update with the stashed commit id
 StashCreateCommand setWorkingDirectoryMessage(String message)
          Set the message used when committing working directory changes
 
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StashCreateCommand

public StashCreateCommand(Repository repo)
Create a command to stash changes in the working directory and index

Parameters:
repo -
Method Detail

setIndexMessage

public StashCreateCommand setIndexMessage(String message)
Set the message used when committing index changes

The message will be formatted with the current branch, abbreviated commit id, and short commit message when used.

Parameters:
message -
Returns:
this

setWorkingDirectoryMessage

public StashCreateCommand setWorkingDirectoryMessage(String message)
Set the message used when committing working directory changes

The message will be formatted with the current branch, abbreviated commit id, and short commit message when used.

Parameters:
message -
Returns:
this

setPerson

public StashCreateCommand setPerson(PersonIdent person)
Set the person to use as the author and committer in the commits made

Parameters:
person -
Returns:
this

setRef

public StashCreateCommand setRef(String ref)
Set the reference to update with the stashed commit id

This value defaults to Constants.R_STASH

Parameters:
ref -
Returns:
this

call

public RevCommit call()
               throws GitAPIException
Stash the contents on the working directory and index in separate commits and reset to the current HEAD commit.

Specified by:
call in interface Callable<RevCommit>
Specified by:
call in class GitCommand<RevCommit>
Returns:
stashed commit or null if no changes to stash
Throws:
GitAPIException


Copyright © 2012. All Rights Reserved.