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 or reference subtree exists.
|
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 either to a reference, or a reference subtree.
|
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
If refName
ends with "/"
the method will seek to the
subtree of all references starting with refName
as a prefix. If
no references start with this prefix, an empty cursor is returned.
Otherwise exactly refName
will be looked for. If present, the
returned cursor will iterate exactly one entry. If not found, an empty
cursor is returned.
refName
- reference name or subtree 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
If refName
ends with "/"
, the method tests if any
reference starts with refName
as a prefix.
Otherwise, the method checks if refName
exists.
refName
- reference name or subtree to find.true
if the reference exists, or at least one reference
exists in the subtree.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 AutoCloseable
IOException
Copyright © 2018 Eclipse JGit Project. All rights reserved.