Class VersionedConfigFile

java.lang.Object
com.google.gerrit.server.git.meta.VersionedMetaData
com.google.gerrit.server.git.meta.VersionedConfigFile
Direct Known Subclasses:
VersionedDefaultPreferences

public class VersionedConfigFile extends VersionedMetaData
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.

  • Field Details

    • ref

      protected final String ref
    • fileName

      protected final String fileName
    • defaultOnSaveMessage

      protected final String defaultOnSaveMessage
    • cfg

      protected org.eclipse.jgit.lib.Config cfg
  • Constructor Details

    • VersionedConfigFile

      public VersionedConfigFile(String fileName)
    • VersionedConfigFile

      public VersionedConfigFile(String ref, String fileName)
    • VersionedConfigFile

      public VersionedConfigFile(String ref, String fileName, String defaultOnSaveMessage)
  • Method Details

    • getConfig

      public org.eclipse.jgit.lib.Config getConfig()
    • getFileName

      protected String getFileName()
    • getRefName

      protected String getRefName()
      Description copied from class: VersionedMetaData
      Returns name of the reference storing this configuration.
      Specified by:
      getRefName in class VersionedMetaData
    • onLoad

      protected void onLoad() throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
      Description copied from class: VersionedMetaData
      Set up the metadata, parsing any state from the loaded revision.
      Specified by:
      onLoad in class VersionedMetaData
      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 class VersionedMetaData
      Returns:
      true if the commit should proceed, false to abort.
      Throws:
      IOException
      org.eclipse.jgit.errors.ConfigInvalidException