Package org.eclipse.jgit.lib
Class RebaseTodoLine
java.lang.Object
org.eclipse.jgit.lib.RebaseTodoLine
Describes a single line in a file formatted like the git-rebase-todo file.
- Since:
- 3.2
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) RebaseTodoLine.Action(package private) String(package private) final AbbreviatedObjectId(package private) String -
Constructor Summary
ConstructorsConstructorDescriptionRebaseTodoLine(String newComment) Create a new comment lineRebaseTodoLine(RebaseTodoLine.Action action, AbbreviatedObjectId commit, String shortMessage) Create a new non-comment line -
Method Summary
Modifier and TypeMethodDescriptionprivate static IllegalArgumentExceptioncreateInvalidCommentException(String newComment) Get rebase action typeGet a commentGet abbreviated commit SHA-1 of commit that action will be performed onGet the first line of the commit message of the commit the action will be performed on.voidsetAction(RebaseTodoLine.Action newAction) Set the action.voidsetComment(String newComment) Set a comment for this line that is used if this line'sactionis aRebaseTodoLine.Action.COMMENTvoidsetShortMessage(String shortMessage) Set short messagetoString()
-
Field Details
-
action
RebaseTodoLine.Action action -
commit
-
shortMessage
String shortMessage -
comment
String comment
-
-
Constructor Details
-
RebaseTodoLine
Create a new comment line- Parameters:
newComment- the new comment
-
RebaseTodoLine
public RebaseTodoLine(RebaseTodoLine.Action action, AbbreviatedObjectId commit, String shortMessage) Create a new non-comment line- Parameters:
action- aRebaseTodoLine.Actionobject.commit- aAbbreviatedObjectIdobject.shortMessage- aStringobject.
-
-
Method Details
-
getAction
Get rebase action type- Returns:
- rebase action type
-
setAction
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- aRebaseTodoLine.Actionobject.- Throws:
IllegalTodoFileModification- on attempt to set a non-comment action on a line which was a comment line before.
-
setComment
Set a comment for this line that is used if this line's
It's allowed to unset the comment by callingactionis aRebaseTodoLine.Action.COMMENTsetComment(null)
A valid comment either starts with a hash (i.e.'#'), is an empty string, or consists of only spaces and tabs.
If the argumentnewCommentdoesn't match these requirements an Exception is thrown.- Parameters:
newComment- the comment
-
createInvalidCommentException
-
getCommit
Get abbreviated commit SHA-1 of commit that action will be performed on- Returns:
- abbreviated commit SHA-1 of commit that action will be performed on
-
getShortMessage
Get the first line of the commit message of the commit the action will be performed on.- Returns:
- the first line of the commit message of the commit the action will be performed on.
-
setShortMessage
Set short message- Parameters:
shortMessage- a short message.
-
getComment
Get a comment- 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 '#')
-
toString
-