Package org.eclipse.jgit.lib
Class RebaseTodoLine
- java.lang.Object
-
- org.eclipse.jgit.lib.RebaseTodoLine
-
public class RebaseTodoLine extends java.lang.Object
Describes a single line in a file formatted like the git-rebase-todo file.- Since:
- 3.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RebaseTodoLine.Action
Describes rebase actions
-
Constructor Summary
Constructors Constructor Description RebaseTodoLine(java.lang.String newComment)
Create a new comment lineRebaseTodoLine(RebaseTodoLine.Action action, AbbreviatedObjectId commit, java.lang.String shortMessage)
Create a new non-comment line
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RebaseTodoLine.Action
getAction()
java.lang.String
getComment()
AbbreviatedObjectId
getCommit()
java.lang.String
getShortMessage()
void
setAction(RebaseTodoLine.Action newAction)
Set the action.void
setComment(java.lang.String newComment)
Set a comment for this line that is used if this line'saction
is aRebaseTodoLine.Action.COMMENT
void
setShortMessage(java.lang.String shortMessage)
java.lang.String
toString()
-
-
-
Constructor Detail
-
RebaseTodoLine
public RebaseTodoLine(java.lang.String newComment)
Create a new comment line- Parameters:
newComment
- the new comment
-
RebaseTodoLine
public RebaseTodoLine(RebaseTodoLine.Action action, AbbreviatedObjectId commit, java.lang.String shortMessage)
Create a new non-comment line- Parameters:
action
-commit
-shortMessage
-
-
-
Method Detail
-
getAction
public RebaseTodoLine.Action getAction()
- Returns:
- rebase action type
-
setAction
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
-- Throws:
IllegalTodoFileModification
- on attempt to set a non-comment action on a line which was a comment line before.
-
setComment
public void setComment(java.lang.String newComment)
Set a comment for this line that is used if this line's
It's allowed to unset the comment by callingaction
is aRebaseTodoLine.Action.COMMENT
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 argumentnewComment
doesn't match these requirements an Exception is thrown.- Parameters:
newComment
- the comment
-
getCommit
public AbbreviatedObjectId getCommit()
- Returns:
- abbreviated commit SHA-1 of commit that action will be performed on
-
getShortMessage
public java.lang.String getShortMessage()
- Returns:
- the first line of the commit message of the commit the action will be performed on.
-
setShortMessage
public void setShortMessage(java.lang.String shortMessage)
- Parameters:
shortMessage
-
-
getComment
public java.lang.String getComment()
- 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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-