org.eclipse.jgit.lib.ObjectId mapping.
A reference database stores a mapping of reference names to
org.. Every
org. has a single reference database,
mapping names to the tips of the object graph contained by the
org..
| Modifier and Type | Field and Description |
|---|---|
| protected static final String[] | additionalRefsNames
The names of additional refs |
| public static final String | ALL
Magic value for |
| public static final int | MAX_SYMBOLIC_REF_DEPTH
Maximum number of times a |
| protected static final String[] | SEARCH_PATH
Order of prefixes to search when using non-absolute references. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract void | |
| public abstract void | |
| public abstract Ref | |
| public Map | |
| public final Ref | Returns: the reference (if it exists); elsenull.the name of the reference. May be a short name which must be
searched for using the standard name)SEARCH_PATH.Read a single reference. |
| public static Ref | Returns: The first ref matching the name, ornull if not found.map of refs to search within. Names should be fully qualified,
e.g. "refs/heads/master". map, String short name of ref to find, e.g. "master" to find
"refs/heads/master" in map. name)Try to find the specified name in the ref map using |
| public Ref | Returns: the first named reference that exists (if any); elsenull.the unabbreviated names of references to look up. refs)Find the first named reference. |
| public abstract List | Returns: a list of additional refsGet the additional reference-like entities from the repository. |
| public Collection | Returns: a collection of full names of existing refs which would conflict with the passed ref name; empty collection when there are no conflictsproposed name to check for conflicts against name)Determine if a proposed reference cannot coexist with existing ones. |
| public ReflogReader | Returns: aorg. for the supplied
refname, or null if the named ref does not exist.a refName)java. object.Get the reflog reader |
| public abstract ReflogReader | Returns: aorg. for the supplied ref.a Ref ref)Get the reflog reader. |
| public List | |
| public abstract Map | Returns: modifiable map that is a complete snapshot of the current reference namespace, withprefix removed from the start
of each key. The map can be an unsorted map.prefix to search the namespace with; must end with prefix)/.
If the empty string (ALL), obtain a complete snapshot
of all references.
Deprecated
use
getRefsByPrefix instead
Get a section of the reference namespace. |
| public List | Returns: immutable list of refs whose names start withprefix.string that names of refs should start with; may be empty (to
return all refs). prefix)Returns refs whose names start with a given prefix. |
| public List | Returns: immutable list of refs whose names start with one ofprefixes. Refs can be unsorted and may contain duplicates
if the prefixes overlap.strings that names of refs should start with. prefixes)Returns refs whose names start with one of the given prefixes. |
| public List | Returns: immutable list of refs whose names start withprefix and
none of the strings in excludes.string that names of refs should start with; may be empty. include, Set<String> strings that names of refs can't start with; may be empty. excludes)Returns refs whose names start with a given prefix excluding all refs that start with one of the given prefixes. |
| public Set | |
| public boolean | Returns: whether this RefDatabase supports fast inverse ref queries.If the ref database does not support fast inverse queries, it may be advantageous to build a complete SHA1 to ref map in advance for multiple uses. |
| public boolean | |
| public boolean | Returns: true if the implementation assigns update indices to references.With versioning, each reference has a version number that increases on update. |
| public abstract boolean | Returns: true if the name overlaps with an existing reference; false if using this name right now would be safe.proposed name. name)Determine if a proposed reference name overlaps with an existing one. |
| public BatchRefUpdate | Returns: a new batch update object.Create a new batch update to attempt on this database. |
| public abstract RefRename | |
| public abstract RefUpdate | Returns: a new update for the requested name; never null.the name of the reference. name, boolean if detach)true and name is currently a
org., the update will
replace it with an org..
Otherwise, the update will recursively traverse
org.s and operate on the
leaf org..Create a new update command to create, modify or delete a reference. |
| public void | packRefs(ProgressMonitor
a progress monitor pm, PackRefsCommand PackRefsCommand to control ref packing behaviorOptimize pack ref storage. |
| public abstract Ref | |
| public boolean | Returns: whether transactions are atomic by default.Whether the database is capable of performing batch updates as atomic transactions. |
| public void |
| additionalRefsNames | back to summary |
|---|---|
| protected static final String[] additionalRefsNames The names of additional refs
| |
| ALL | back to summary |
|---|---|
| public static final String ALL Magic value for | |
| MAX_SYMBOLIC_REF_DEPTH | back to summary |
|---|---|
| public static final int MAX_SYMBOLIC_REF_DEPTH Maximum number of times a If the reference is nested deeper than this depth, the implementation should either fail, or at least claim the reference does not exist.
| |
| SEARCH_PATH | back to summary |
|---|---|
| protected static final String[] SEARCH_PATH Order of prefixes to search when using non-absolute references.
| |
| RefDatabase | back to summary |
|---|---|
| public RefDatabase() | |
| close | back to summary |
|---|---|
| public abstract void close() Close any resources held by this database. | |
| create | back to summary |
|---|---|
| public abstract void create() throws IOException Initialize a new reference database at this location.
| |
| exactRef | back to summary |
|---|---|
| public abstract Ref exactRef(String name) throws IOException Read a single reference.
Unlike
| |
| exactRef | back to summary |
|---|---|
| public Map Read the specified references. This method expects a list of unshortened reference names and returns a map from reference names to refs. Any named references that do not exist will not be included in the returned map.
| |
| findRef | back to summary |
|---|---|
| public final Ref findRef(String name) throws IOException Read a single reference.
Aside from taking advantage of
To read a specific reference without using @{link #SEARCH_PATH}, see
| |
| findRef | back to summary |
|---|---|
| public static Ref findRef(Map<String, Ref> map, String name) Try to find the specified name in the ref map using
| |
| firstExactRef | back to summary |
|---|---|
| public Ref firstExactRef(String... refs) throws IOException Find the first named reference. This method expects a list of unshortened reference names and returns the first that exists.
| |
| getAdditionalRefs | back to summary |
|---|---|
| public abstract List Get the additional reference-like entities from the repository.
The result list includes non-ref items such as MERGE_HEAD and
FETCH_RESULT cast to be refs. The names of these refs are not returned by
| |
| getConflictingNames | back to summary |
|---|---|
| public Collection Determine if a proposed reference cannot coexist with existing ones. If the passed name already exists, it's not considered a conflict.
| |
| getReflogReader | back to summary |
|---|---|
| public ReflogReader getReflogReader(String refName) throws IOException Get the reflog reader
| |
| getReflogReader | back to summary |
|---|---|
| public abstract ReflogReader getReflogReader(Ref ref) throws IOException Get the reflog reader.
| |
| getRefs | back to summary |
|---|---|
| public List Returns all refs.
This includes
Symbolic references to a non-existent ref (for example,
Callers interested in only a portion of the ref hierarchy can call
| |
| getRefs | back to summary |
|---|---|
| public abstract Map Deprecated use Get a section of the reference namespace.
| |
| getRefsByPrefix | back to summary |
|---|---|
| public List Returns refs whose names start with a given prefix.
The default implementation uses
| |
| getRefsByPrefix | back to summary |
|---|---|
| public List Returns refs whose names start with one of the given prefixes.
The default implementation uses
| |
| getRefsByPrefixWithExclusions | back to summary |
|---|---|
| public List Returns refs whose names start with a given prefix excluding all refs that start with one of the given prefixes.
The default implementation is not efficient. Implementors of
| |
| getTipsWithSha1 | back to summary |
|---|---|
| public Set Returns all refs that resolve directly to the given
The default implementation uses a linear scan. Implementors of
| |
| hasFastTipsWithSha1 | back to summary |
|---|---|
| public boolean hasFastTipsWithSha1() throws IOException If the ref database does not support fast inverse queries, it may be advantageous to build a complete SHA1 to ref map in advance for multiple uses. To let applications decide on this decision, this function indicates whether the inverse map is available.
| |
| hasRefs | back to summary |
|---|---|
| public boolean hasRefs() throws IOException Check if any refs exist in the ref database.
This uses the same definition of refs as
| |
| hasVersioning | back to summary |
|---|---|
| public boolean hasVersioning() With versioning, each reference has a version number that increases on
update. See Implementation Specification This method returns false by default. Implementations supporting versioning must override it to return true.
| |
| isNameConflicting | back to summary |
|---|---|
| public abstract boolean isNameConflicting(String name) throws IOException Determine if a proposed reference name overlaps with an existing one. Reference names use '/' as a component separator, and may be stored in a hierarchical storage such as a directory on the local filesystem. If the reference "refs/heads/foo" exists then "refs/heads/foo/bar" must not exist, as a reference cannot have a value and also be a container for other references at the same time. If the reference "refs/heads/foo/bar" exists than the reference "refs/heads/foo" cannot exist, for the same reason.
| |
| newBatchUpdate | back to summary |
|---|---|
| public BatchRefUpdate newBatchUpdate() Create a new batch update to attempt on this database. The default implementation performs a sequential update of each command.
| |
| newRename | back to summary |
|---|---|
| public abstract RefRename newRename(String fromName, String toName) throws IOException Create a new update command to rename a reference.
| |
| newUpdate | back to summary |
|---|---|
| public abstract RefUpdate newUpdate(String name, boolean detach) throws IOException Create a new update command to create, modify or delete a reference.
| |
| packRefs | back to summary |
|---|---|
| public void packRefs(ProgressMonitor pm, PackRefsCommand packRefs) throws IOException Optimize pack ref storage.
| |
| peel | back to summary |
|---|---|
| public abstract Ref peel(Ref ref) throws IOException Peel a possibly unpeeled reference by traversing the annotated tags.
If the reference cannot be peeled (as it does not refer to an annotated
tag) the peeled id stays null, but
Implementors should check
| |
| performsAtomicTransactions | back to summary |
|---|---|
| public boolean performsAtomicTransactions() Whether the database is capable of performing batch updates as atomic transactions.
If true, by default
If false,
This definition of atomicity is stronger than what is provided by
| |
| refresh | back to summary |
|---|---|
| public void refresh() Triggers a refresh of all internal data structures. In case the RefDatabase implementation has internal caches this method will trigger that all these caches are cleared. Implementors should overwrite this method if they use any kind of caches. | |