public interface Repository extends Disposable
Repository is a representation of a Git repository stored under the specified directory.
It stores the information about the repository, which is frequently requested by other plugin components.
All get-methods (like getCurrentRevision()
) are just getters of the correspondent fields and thus are very fast.
The Repository is updated "externally" by the appropriate Updater class}, when correspondent .git/ or .hg/
service files
change.
To force asynchronous update, it is enough to call refresh
on the root directory.
To make a synchronous update of the repository call update()
.
Updating requires reading from disk, so it may take some time, however, updating the whole community repository took ~10 ms at the time
of measurement, so must be fast enough. Better not to be called in AWT though.
Getters and setters (update...()-methods) are not synchronized intentionally - to avoid live- and deadlocks.
GitRepository is updated asynchronously,
so even if the getters would have been synchronized, it wouldn't guarantee that they return actual values (as they are in .git).
If one needs a really 100 % up-to-date value, one should call update()
and then get...().
update() is a synchronous read from repository file (.git or .hg), so it is guaranteed to query the real value.
Modifier and Type | Interface and Description |
---|---|
static class |
Repository.State
Current state of the repository.
|
Disposable.Parent
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getCurrentBranchName() |
java.lang.String |
getCurrentRevision()
Returns the hash of the revision, which HEAD currently points to.
|
java.lang.String |
getPresentableUrl() |
Project |
getProject() |
VirtualFile |
getRoot() |
Repository.State |
getState() |
AbstractVcs |
getVcs() |
boolean |
isFresh() |
java.lang.String |
toLogString()
Returns a detailed String representation suitable for logging purposes.
|
void |
update()
Synchronously updates the Repository by reading information about it from disk (e.g.
|
dispose
VirtualFile getRoot()
java.lang.String getPresentableUrl()
Project getProject()
Repository.State getState()
java.lang.String getCurrentBranchName()
AbstractVcs getVcs()
java.lang.String getCurrentRevision()
boolean isFresh()
void update()
java.lang.String toLogString()