public abstract class Reftable extends Object implements AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
includeDeletes
true if deletions should be included in results. |
| Constructor and Description |
|---|
Reftable() |
| Modifier and Type | Method and Description |
|---|---|
abstract LogCursor |
allLogs()
Seek reader to read log records.
|
abstract RefCursor |
allRefs()
Seek to the first reference, to iterate in order.
|
abstract RefCursor |
byObjectId(AnyObjectId id)
Match references pointing to a specific object.
|
abstract void |
close() |
Ref |
exactRef(String refName)
Lookup a reference, or null if not found.
|
static Reftable |
from(Collection<Ref> refs)
References to convert into a reftable
|
boolean |
hasId(AnyObjectId id)
Test if any reference directly refers to the object.
|
boolean |
hasRef(String refName)
Test if a reference exists.
|
boolean |
hasRefsWithPrefix(String prefix)
Test if any reference starts with
prefix as a prefix. |
Ref |
resolve(Ref symref)
Resolve a symbolic reference to populate its value.
|
LogCursor |
seekLog(String refName)
Read a single reference's log.
|
abstract LogCursor |
seekLog(String refName,
long updateIndex)
Seek to an update index in a reference's log.
|
abstract RefCursor |
seekRef(String refName)
Seek to a reference.
|
abstract RefCursor |
seekRefsWithPrefix(String prefix)
Seek references with prefix.
|
void |
setIncludeDeletes(boolean deletes)
Whether deleted references will be returned.
|
protected boolean includeDeletes
true if deletions should be included in results.public static Reftable from(Collection<Ref> refs)
refs - references to convert into a reftable; may be empty.public void setIncludeDeletes(boolean deletes)
deletes - if true deleted references will be returned. If
false (default behavior), deleted references will be
skipped, and not returned.public abstract RefCursor allRefs() throws IOException
IOException - if references cannot be read.public abstract RefCursor seekRef(String refName) throws IOException
This method will seek to the reference refName. If present, the
returned cursor will iterate exactly one entry. If not found, an empty
cursor is returned.
refName - reference name.IOException - if references cannot be read.public abstract RefCursor seekRefsWithPrefix(String prefix) throws IOException
The method will seek all the references starting with prefix as a
prefix. If no references start with this prefix, an empty cursor is
returned.
prefix - prefix to find.IOException - if references cannot be read.public abstract RefCursor byObjectId(AnyObjectId id) throws IOException
id - object to find.IOException - if references cannot be read.public abstract LogCursor allLogs() throws IOException
IOException - if logs cannot be read.public LogCursor seekLog(String refName) throws IOException
refName - exact name of the reference whose log to read.IOException - if logs cannot be read.public abstract LogCursor seekLog(String refName, long updateIndex) throws IOException
refName - exact name of the reference whose log to read.updateIndex - most recent index to return first in the log cursor. Log
records at or before updateIndex will be returned.IOException - if logs cannot be read.@Nullable public Ref exactRef(String refName) throws IOException
refName - reference name to find.null if not found.IOException - if references cannot be read.public boolean hasRef(String refName) throws IOException
refName - reference name or subtree to find.true if the reference exists.IOException - if references cannot be read.public boolean hasRefsWithPrefix(String prefix) throws IOException
prefix as a prefix.prefix - prefix to find.true if at least one reference exists with prefix.IOException - if references cannot be read.public boolean hasId(AnyObjectId id) throws IOException
id - ObjectId to find.true if any reference exists directly referencing
id, or a annotated tag that peels to id.IOException - if references cannot be read.@Nullable public Ref resolve(Ref symref) throws IOException
symref - reference to resolve.symref, or null.IOException - if references cannot be read.public abstract void close()
throws IOException
close in interface AutoCloseableIOExceptionCopyright © 2020 Eclipse JGit Project. All rights reserved.