Search in sources :

Example 6 with VersionedAccountPreferences

use of com.google.gerrit.server.account.VersionedAccountPreferences in project gerrit by GerritCodeReview.

the class SetDiffPreferences method writeToGit.

private DiffPreferencesInfo writeToGit(DiffPreferencesInfo in) throws RepositoryNotFoundException, IOException, ConfigInvalidException {
    DiffPreferencesInfo out = new DiffPreferencesInfo();
    try (MetaDataUpdate md = metaDataUpdateFactory.get().create(allUsersName)) {
        VersionedAccountPreferences prefs = VersionedAccountPreferences.forDefault();
        prefs.load(md);
        DiffPreferencesInfo defaults = DiffPreferencesInfo.defaults();
        storeSection(prefs.getConfig(), UserConfigSections.DIFF, null, in, defaults);
        prefs.commit(md);
        loadSection(prefs.getConfig(), UserConfigSections.DIFF, null, out, DiffPreferencesInfo.defaults(), null);
    }
    return out;
}
Also used : VersionedAccountPreferences(com.google.gerrit.server.account.VersionedAccountPreferences) DiffPreferencesInfo(com.google.gerrit.extensions.client.DiffPreferencesInfo) MetaDataUpdate(com.google.gerrit.server.git.MetaDataUpdate)

Aggregations

VersionedAccountPreferences (com.google.gerrit.server.account.VersionedAccountPreferences)6 MetaDataUpdate (com.google.gerrit.server.git.MetaDataUpdate)4 Repository (org.eclipse.jgit.lib.Repository)4 DiffPreferencesInfo (com.google.gerrit.extensions.client.DiffPreferencesInfo)3 GeneralPreferencesInfo (com.google.gerrit.extensions.client.GeneralPreferencesInfo)3 Account (com.google.gerrit.reviewdb.client.Account)2 OrmException (com.google.gwtorm.server.OrmException)2 IOException (java.io.IOException)2 ResultSet (java.sql.ResultSet)2 Statement (java.sql.Statement)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ConfigInvalidException (org.eclipse.jgit.errors.ConfigInvalidException)2 BatchRefUpdate (org.eclipse.jgit.lib.BatchRefUpdate)2 RevWalk (org.eclipse.jgit.revwalk.RevWalk)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 JdbcSchema (com.google.gwtorm.jdbc.JdbcSchema)1 Connection (java.sql.Connection)1