Top Description Inners Fields Constructors Methods
org.eclipse.jgit.lib

public Class RebaseTodoLine

extends Object
Class Inheritance
Imports
java.text.MessageFormat, org.eclipse.jgit.errors.IllegalTodoFileModification, org.eclipse.jgit.internal.JGitText

Describes a single line in a file formatted like the git-rebase-todo file.
Since
3.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
RebaseTodoLine.Action

Describes rebase actions

Field Summary

Modifier and TypeField and Description
pack-priv RebaseTodoLine.Action
pack-priv String
pack-priv final AbbreviatedObjectId
pack-priv String

Constructor Summary

AccessConstructor and Description
public
RebaseTodoLine(String
the new comment
newComment
)

Create a new comment line

public

Method Summary

Modifier and TypeMethod and Description
private static IllegalArgumentException
public RebaseTodoLine.Action

Returns:

rebase action type
getAction
()

Get rebase action type

public String

Returns:

a comment. If the line is a comment line then the comment is returned. Lines starting with # or blank lines or lines containing only spaces and tabs are considered as comment lines. The complete line is returned (e.g. including the '#')
getComment
()

Get a comment

public AbbreviatedObjectId

Returns:

abbreviated commit SHA-1 of commit that action will be performed on
getCommit
()

Get abbreviated commit SHA-1 of commit that action will be performed on

public String

Returns:

the first line of the commit message of the commit the action will be performed on.
getShortMessage
()

Get the first line of the commit message of the commit the action will be performed on.

public void
public void
setComment(String
the comment
newComment
)

Set a comment for this line that is used if this line's org.eclipse.jgit.lib.RebaseTodoLine#action is a org.eclipse.jgit.lib.RebaseTodoLine.Action#COMMENT It's allowed to unset the comment by calling setComment(null) A valid comment either starts with a hash (i.e. '#'), is an empty string, or consists of only spaces and tabs.

public void
setShortMessage(String
a short message.
shortMessage
)

Set short message

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

actionback to summary
pack-priv RebaseTodoLine.Action action
commentback to summary
pack-priv String comment
commitback to summary
pack-priv final AbbreviatedObjectId commit
shortMessageback to summary
pack-priv String shortMessage

Constructor Detail

RebaseTodoLineback to summary
public RebaseTodoLine(String newComment)

Create a new comment line

Parameters
newComment:String

the new comment

RebaseTodoLineback to summary
public RebaseTodoLine(RebaseTodoLine.Action action, AbbreviatedObjectId commit, String shortMessage)

Create a new non-comment line

Parameters
action:RebaseTodoLine.Action

a org.eclipse.jgit.lib.RebaseTodoLine.Action object.

commit:AbbreviatedObjectId

a org.eclipse.jgit.lib.AbbreviatedObjectId object.

shortMessage:String

a java.lang.String object.

Method Detail

createInvalidCommentExceptionback to summary
private static IllegalArgumentException createInvalidCommentException(String newComment)
getActionback to summary
public RebaseTodoLine.Action getAction()

Get rebase action type

Returns:RebaseTodoLine.Action

rebase action type

getCommentback to summary
public String getComment()

Get a comment

Returns:String

a comment. If the line is a comment line then the comment is returned. Lines starting with # or blank lines or lines containing only spaces and tabs are considered as comment lines. The complete line is returned (e.g. including the '#')

getCommitback to summary
public AbbreviatedObjectId getCommit()

Get abbreviated commit SHA-1 of commit that action will be performed on

Returns:AbbreviatedObjectId

abbreviated commit SHA-1 of commit that action will be performed on

getShortMessageback to summary
public String getShortMessage()

Get the first line of the commit message of the commit the action will be performed on.

Returns:String

the first line of the commit message of the commit the action will be performed on.

setActionback to summary
public void setAction(RebaseTodoLine.Action newAction) throws IllegalTodoFileModification

Set the action. It's not allowed to set a non-comment action on a line which was a comment line before. But you are allowed to set the comment action on a non-comment line and afterwards change the action back to non-comment.

Parameters
newAction:RebaseTodoLine.Action

a org.eclipse.jgit.lib.RebaseTodoLine.Action object.

Exceptions
IllegalTodoFileModification:
on attempt to set a non-comment action on a line which was a comment line before.
setCommentback to summary
public void setComment(String newComment)

Set a comment for this line that is used if this line's org.eclipse.jgit.lib.RebaseTodoLine#action is a org.eclipse.jgit.lib.RebaseTodoLine.Action#COMMENT

It's allowed to unset the comment by calling setComment(null)
A valid comment either starts with a hash (i.e. '#'), is an empty string, or consists of only spaces and tabs.
If the argument newComment doesn't match these requirements an Exception is thrown.
Parameters
newComment:String

the comment

setShortMessageback to summary
public void setShortMessage(String shortMessage)

Set short message

Parameters
shortMessage:String

a short message.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@SuppressWarnings:nls
@Override
org.eclipse.jgit.lib back to summary

public final Enum RebaseTodoLine.Action

extends Enum<RebaseTodoLine.Action>
Class Inheritance
Annotations
@SuppressWarnings:nls

Describes rebase actions

Field Summary

Modifier and TypeField and Description
public static final RebaseTodoLine.Action
COMMENT

A comment in the file.

public static final RebaseTodoLine.Action
EDIT

Use commit, but stop for amending

public static final RebaseTodoLine.Action
FIXUP

like "squash", but discard this commit's log message

public static final RebaseTodoLine.Action
PICK

Use commit

public static final RebaseTodoLine.Action
REWORD

Use commit, but edit the commit message

private final String
public static final RebaseTodoLine.Action
SQUASH

Use commit, but meld into previous commit

private final String

Constructor Summary

AccessConstructor and Description
private
Action(String token, String shortToken)

Method Summary

Modifier and TypeMethod and Description
public static RebaseTodoLine.Action

Returns:

the Action
parse
(String
token to parse
token
)

Parse a token

public String
toString()

Overrides java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration.

public String

Returns:

full action token name
toToken
()

Get full action token name

public static RebaseTodoLine.Action
public static RebaseTodoLine.Action[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinalvalueOf

Field Detail

COMMENTback to summary
public static final RebaseTodoLine.Action COMMENT

A comment in the file. Also blank lines (or lines containing only whitespaces) are reported as comments

EDITback to summary
public static final RebaseTodoLine.Action EDIT

Use commit, but stop for amending

FIXUPback to summary
public static final RebaseTodoLine.Action FIXUP

like "squash", but discard this commit's log message

PICKback to summary
public static final RebaseTodoLine.Action PICK

Use commit

REWORDback to summary
public static final RebaseTodoLine.Action REWORD

Use commit, but edit the commit message

shortTokenback to summary
private final String shortToken
SQUASHback to summary
public static final RebaseTodoLine.Action SQUASH

Use commit, but meld into previous commit

tokenback to summary
private final String token

Constructor Detail

Actionback to summary
private Action(String token, String shortToken)

Method Detail

parseback to summary
public static RebaseTodoLine.Action parse(String token)

Parse a token

Parameters
token:String

token to parse

Returns:RebaseTodoLine.Action

the Action

toStringback to summary
public String toString()

Overrides java.lang.Enum.toString.

Doc from java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration. This method may be overridden, though it typically isn't necessary or desirable. An enum class should override this method when a more "programmer-friendly" string form exists.

Returns:String

the name of this enum constant

Annotations
@Override
toTokenback to summary
public String toToken()

Get full action token name

Returns:String

full action token name

valueOfback to summary
public static RebaseTodoLine.Action valueOf(String name)
valuesback to summary
public static RebaseTodoLine.Action[] values()