com.aragost.javahg.commands
Class CommitCommand

java.lang.Object
  extended by com.aragost.javahg.internals.AbstractCommand
      extended by com.aragost.javahg.commands.flags.CommitCommandFlags
          extended by com.aragost.javahg.commands.CommitCommand

public class CommitCommand
extends CommitCommandFlags

Command class for executing hg commit. Set flags from CommitCommandFlags and call the execute(java.lang.String...) method.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.aragost.javahg.internals.AbstractCommand
AbstractCommand.State
 
Constructor Summary
CommitCommand(Repository repository)
           
 
Method Summary
 Changeset execute()
          Commit all changes
 Changeset execute(File... files)
           
 Changeset execute(String... files)
          Commit changes in the passed in files only
 void extra(String key, String value)
          Add a field to the extra dictionary for the changeset.
 boolean isSuccessful()
          Check if the commit was successful.
 CommitCommand message(String text)
          Set the commit message.
 
Methods inherited from class com.aragost.javahg.commands.flags.CommitCommandFlags
amend, closeBranch, date, exclude, getCommandName, include, on, user
 
Methods inherited from class com.aragost.javahg.internals.AbstractCommand
cancel, clear, cmdAppend, cmdAppend, cmdAppend, cmdAppend, cmdAppend, doneHook, getErrorString, getRepository, getReturnCode, launchIterator, launchStream, launchString, needsInputLine, reopenOutputChannelStream, sendLine, toString, withDebugAndChangesetStyle, withDebugFlag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommitCommand

public CommitCommand(Repository repository)
Parameters:
repository - the repository associated with this command.
Method Detail

isSuccessful

public boolean isSuccessful()
Check if the commit was successful. In contrast with Mercurial, this returns true if hg commit exited with a return code of 1. This happens if there were no changes and is signaled to the caller by returning null instead of a changeset.

Overrides:
isSuccessful in class AbstractCommand
Returns:
true if the command ended successfully.

execute

public Changeset execute(String... files)
Commit changes in the passed in files only

Parameters:
files - the files to commit.
Returns:
the changeset created by the commit, or null if nothing was committed.

execute

public Changeset execute(File... files)
Parameters:
files - the files to commit.
Returns:
the changeset created by the commit, or null if nothing was committed.

execute

public Changeset execute()
Commit all changes

Returns:
the changeset created by the commit, or null if nothing was committed.

message

public CommitCommand message(String text)
Set the commit message. A message is mandatory for commit.

Overrides:
message in class CommitCommandFlags
Returns:
this instance
See Also:
Mercurial documentation

extra

public void extra(String key,
                  String value)
Add a field to the extra dictionary for the changeset.

Note this is implemented via the javahg extension for Mercurial.

Parameters:
key -
value -


Copyright © 2011-2013 aragost Trifork ag. All Rights Reserved.