public class RevTag extends RevObject
Modifier | Constructor and Description |
---|---|
protected |
RevTag(AnyObjectId id)
Create a new tag reference.
|
Modifier and Type | Method and Description |
---|---|
void |
disposeBody()
Discard the message buffer to reduce memory usage.
|
String |
getFullMessage()
Parse the complete tag message and decode it to a string.
|
RevObject |
getObject()
Get a reference to the object this tag was placed on.
|
String |
getShortMessage()
Parse the tag message and return the first "line" of it.
|
PersonIdent |
getTaggerIdent()
Parse the tagger identity from the raw buffer.
|
String |
getTagName()
Get the name of this tag, from the tag header.
|
int |
getType()
Get Git object type.
|
static RevTag |
parse(byte[] raw)
Parse an annotated tag from its canonical format.
|
static RevTag |
parse(RevWalk rw,
byte[] raw)
Parse an annotated tag from its canonical format.
|
add, add, appendCoreFlags, getId, has, hasAll, hasAny, remove, remove, toString
equals, fromRaw, fromRaw, fromRaw, fromRaw, fromString, fromString, isId, toObjectId, toString, zeroId
protected RevTag(AnyObjectId id)
id
- object name for the tag.public static RevTag parse(byte[] raw) throws CorruptObjectException
RevWalk.parseTag(AnyObjectId)
to obtain
a RevTag from an existing repository.raw
- the canonical formatted tag to be parsed.CorruptObjectException
- the tag contains a malformed header that cannot be handled.public static RevTag parse(RevWalk rw, byte[] raw) throws CorruptObjectException
This method inserts the tag directly into the caller supplied revision pool, making it appear as though the tag exists in the repository, even if it doesn't. The repository under the pool is not affected.
The body of the tag (message, tagger, signature) is always retained in
the returned RevTag
, even if the supplied RevWalk
has
been configured with setRetainBody(false)
.
rw
- the revision pool to allocate the tag within. The tag's object
pointer will be obtained from this pool.raw
- the canonical formatted tag to be parsed. This buffer will be
retained by the returned RevTag
and must not be
modified by the caller.CorruptObjectException
- the tag contains a malformed header that cannot be handled.public final int getType()
RevObject
Constants
.public final PersonIdent getTaggerIdent()
This method parses and returns the content of the tagger line, after taking the tag's character set into account and decoding the tagger name and email address. This method is fairly expensive and produces a new PersonIdent instance on each invocation. Callers should invoke this method only if they are certain they will be outputting the result, and should cache the return value for as long as necessary to use all information from it.
public final String getFullMessage()
This method parses and returns the message portion of the tag buffer, after taking the tag's character set into account and decoding the buffer using that character set. This method is a fairly expensive operation and produces a new string on each invocation.
public final String getShortMessage()
The first line is everything up to the first pair of LFs. This is the "oneline" format, suitable for output in a single line display.
This method parses and returns the message portion of the tag buffer, after taking the tag's character set into account and decoding the buffer using that character set. This method is a fairly expensive operation and produces a new string on each invocation.
public final RevObject getObject()
Note that the returned object has only been looked up (see
RevWalk.lookupAny(AnyObjectId, int)
. To access the contents it
needs to be parsed, see RevWalk.parseHeaders(RevObject)
and
RevWalk.parseBody(RevObject)
.
As an alternative, use RevWalk.peel(RevObject)
and pass this
RevTag
to peel it until the first non-tag object.
public final String getTagName()
public final void disposeBody()
After discarding the memory usage of the RevTag
is reduced to
only the getObject()
pointer and getTagName()
.
Accessing other properties such as getTaggerIdent()
or either
message function requires reloading the buffer by invoking
RevWalk.parseBody(RevObject)
.
Copyright © 2015 Eclipse JGit Project. All rights reserved.