public class TagCommand extends GitCommand<Ref>
Examples (git
is a Git
instance):
Create a new tag for the current commit:
git.tag().setName("v1.0").setMessage("First stable release").call();
Create a new unannotated tag for the current commit:
git.tag().setName("v1.0").setAnnotated(false).call();
Modifier and Type | Field and Description |
---|---|
private boolean |
annotated |
private boolean |
forceUpdate |
private RevObject |
id |
private java.lang.String |
message |
private java.lang.String |
name |
private boolean |
signed |
private PersonIdent |
tagger |
repo
Modifier | Constructor and Description |
---|---|
protected |
TagCommand(Repository repo)
Constructor for TagCommand.
|
Modifier and Type | Method and Description |
---|---|
Ref |
call() |
java.lang.String |
getMessage()
Get the tag
message . |
java.lang.String |
getName()
Get the tag
name . |
RevObject |
getObjectId()
Get the tag's object id
|
PersonIdent |
getTagger()
Get the
tagger who created the tag. |
boolean |
isAnnotated()
Whether this will create an annotated command
|
boolean |
isForceUpdate()
Whether this is a forced update
|
boolean |
isSigned()
Whether this tag is signed
|
private void |
processOptions(RepositoryState state)
Sets default values for not explicitly specified options.
|
TagCommand |
setAnnotated(boolean annotated)
Configure this tag to be created as an annotated tag
|
TagCommand |
setForceUpdate(boolean forceUpdate)
If set to true the Tag command may replace an existing tag object.
|
TagCommand |
setMessage(java.lang.String message)
Set the tag
message . |
TagCommand |
setName(java.lang.String name)
Set the tag
name . |
TagCommand |
setObjectId(RevObject id)
Sets the object id of the tag.
|
TagCommand |
setSigned(boolean signed)
If set to true the Tag command creates a signed tag object.
|
TagCommand |
setTagger(PersonIdent tagger)
Sets the tagger of the tag.
|
private Ref |
updateTagRef(ObjectId tagId,
RevWalk revWalk,
java.lang.String tagName,
java.lang.String newTagToString) |
checkCallable, getRepository, setCallable
private RevObject id
private java.lang.String name
private java.lang.String message
private PersonIdent tagger
private boolean signed
private boolean forceUpdate
private boolean annotated
protected TagCommand(Repository repo)
Constructor for TagCommand.
repo
- a Repository
object.public Ref call() throws GitAPIException, ConcurrentRefUpdateException, InvalidTagNameException, NoHeadException
Execute the command
Executes the tag
command with all the options and parameters
collected by the setter methods of this class. Each instance of this
class should only be used for one invocation of the command (means: one
call to call()
)
call
in interface java.util.concurrent.Callable<Ref>
call
in class GitCommand<Ref>
GitAPIException
ConcurrentRefUpdateException
InvalidTagNameException
NoHeadException
private Ref updateTagRef(ObjectId tagId, RevWalk revWalk, java.lang.String tagName, java.lang.String newTagToString) throws java.io.IOException, ConcurrentRefUpdateException, RefAlreadyExistsException
java.io.IOException
ConcurrentRefUpdateException
RefAlreadyExistsException
private void processOptions(RepositoryState state) throws InvalidTagNameException
state
- the state of the repository we are working onInvalidTagNameException
- if the tag name is null or invalidjava.lang.UnsupportedOperationException
- if the tag is signed (not supported yet)public TagCommand setName(java.lang.String name)
name
.name
- the tag name used for the tag
this
public java.lang.String getName()
name
.tag
public java.lang.String getMessage()
message
.tag
public TagCommand setMessage(java.lang.String message)
message
.message
- the tag message used for the tag
this
public boolean isSigned()
public TagCommand setSigned(boolean signed)
signed
- a boolean.this
public TagCommand setTagger(PersonIdent tagger)
tagger
- a PersonIdent
object.this
public PersonIdent getTagger()
tagger
who created the tag.public RevObject getObjectId()
public TagCommand setObjectId(RevObject id)
id
- a RevObject
object.this
public boolean isForceUpdate()
public TagCommand setForceUpdate(boolean forceUpdate)
forceUpdate
- whether this is a forced updatethis
public TagCommand setAnnotated(boolean annotated)
annotated
- whether this shall be an annotated tagthis
public boolean isAnnotated()