Class VersionedConfigFile
java.lang.Object
com.google.gerrit.server.git.meta.VersionedMetaData
com.google.gerrit.server.git.meta.VersionedConfigFile
- Direct Known Subclasses:
VersionedDefaultPreferences
Versioned configuration file living in git
This class is a low-level API that allows callers to read the config directly from a repository and make updates to it.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.gerrit.server.git.meta.VersionedMetaData
VersionedMetaData.BatchMetaDataUpdate, VersionedMetaData.PathInfo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.eclipse.jgit.lib.Config
protected final String
protected final String
protected final String
Fields inherited from class com.google.gerrit.server.git.meta.VersionedMetaData
inserter, newTree, projectName, reader, revision, rw
-
Constructor Summary
ConstructorsConstructorDescriptionVersionedConfigFile
(String fileName) VersionedConfigFile
(String ref, String fileName) VersionedConfigFile
(String ref, String fileName, String defaultOnSaveMessage) -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.jgit.lib.Config
protected String
protected String
Returns name of the reference storing this configuration.protected void
onLoad()
Set up the metadata, parsing any state from the loaded revision.protected boolean
onSave
(org.eclipse.jgit.lib.CommitBuilder commit) Save any changes to the metadata in a commit.Methods inherited from class com.google.gerrit.server.git.meta.VersionedMetaData
commit, commit, commitToNewRef, getObjectId, getPathInfos, getRevision, load, load, load, load, load, openUpdate, openUpdate, readConfig, readConfig, readFile, readTree, readUTF8, saveConfig, saveFile, saveUTF8, set, set, set
-
Field Details
-
ref
-
fileName
-
defaultOnSaveMessage
-
cfg
protected org.eclipse.jgit.lib.Config cfg
-
-
Constructor Details
-
VersionedConfigFile
-
VersionedConfigFile
-
VersionedConfigFile
-
-
Method Details
-
getConfig
public org.eclipse.jgit.lib.Config getConfig() -
getFileName
-
getRefName
Description copied from class:VersionedMetaData
Returns name of the reference storing this configuration.- Specified by:
getRefName
in classVersionedMetaData
-
onLoad
Description copied from class:VersionedMetaData
Set up the metadata, parsing any state from the loaded revision.- Specified by:
onLoad
in classVersionedMetaData
- Throws:
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
onSave
protected boolean onSave(org.eclipse.jgit.lib.CommitBuilder commit) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException Description copied from class:VersionedMetaData
Save any changes to the metadata in a commit.- Specified by:
onSave
in classVersionedMetaData
- Returns:
- true if the commit should proceed, false to abort.
- Throws:
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-