Package org.eclipse.jgit.lib
Class RebaseTodoLine
- java.lang.Object
-
- org.eclipse.jgit.lib.RebaseTodoLine
-
public class RebaseTodoLine extends java.lang.ObjectDescribes 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 classRebaseTodoLine.ActionDescribes rebase actions
-
Field Summary
Fields Modifier and Type Field Description (package private) RebaseTodoLine.Actionaction(package private) java.lang.Stringcomment(package private) AbbreviatedObjectIdcommit(package private) java.lang.StringshortMessage
-
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 Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.IllegalArgumentExceptioncreateInvalidCommentException(java.lang.String newComment)RebaseTodoLine.ActiongetAction()Get rebase action typejava.lang.StringgetComment()Get a commentAbbreviatedObjectIdgetCommit()Get abbreviated commit SHA-1 of commit that action will be performed onjava.lang.StringgetShortMessage()Get the first line of the commit message of the commit the action will be performed on.voidsetAction(RebaseTodoLine.Action newAction)Set the action.voidsetComment(java.lang.String newComment)Set a comment for this line that is used if this line'sactionis aRebaseTodoLine.Action.COMMENTvoidsetShortMessage(java.lang.String shortMessage)Set short messagejava.lang.StringtoString()
-
-
-
Field Detail
-
action
RebaseTodoLine.Action action
-
commit
final AbbreviatedObjectId commit
-
shortMessage
java.lang.String shortMessage
-
comment
java.lang.String comment
-
-
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- aRebaseTodoLine.Actionobject.commit- aAbbreviatedObjectIdobject.shortMessage- aStringobject.
-
-
Method Detail
-
getAction
public RebaseTodoLine.Action getAction()
Get rebase action type- 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- aRebaseTodoLine.Actionobject.- 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 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
private static java.lang.IllegalArgumentException createInvalidCommentException(java.lang.String newComment)
-
getCommit
public AbbreviatedObjectId 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
public java.lang.String 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
public void setShortMessage(java.lang.String shortMessage)
Set short message- Parameters:
shortMessage- a short message.
-
getComment
public java.lang.String 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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-