• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java MetaDataUpdate类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.google.gerrit.server.git.MetaDataUpdate的典型用法代码示例。如果您正苦于以下问题:Java MetaDataUpdate类的具体用法?Java MetaDataUpdate怎么用?Java MetaDataUpdate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

MetaDataUpdate类属于com.google.gerrit.server.git包,在下文中一共展示了MetaDataUpdate类的40个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: grant

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
protected void grant(
    Project.NameKey project,
    String ref,
    String permission,
    boolean force,
    AccountGroup.UUID groupUUID)
    throws RepositoryNotFoundException, IOException, ConfigInvalidException {
  try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
    md.setMessage(String.format("Grant %s on %s", permission, ref));
    ProjectConfig config = ProjectConfig.read(md);
    AccessSection s = config.getAccessSection(ref, true);
    Permission p = s.getPermission(permission, true);
    PermissionRule rule = Util.newRule(config, groupUUID);
    rule.setForce(force);
    p.add(rule);
    config.commit(md);
    projectCache.evict(config.getProject());
  }
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:20,
代码来源:AbstractDaemonTest.java

示例2: grantLabel

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
protected void grantLabel(
    String label,
    int min,
    int max,
    Project.NameKey project,
    String ref,
    boolean force,
    AccountGroup.UUID groupUUID,
    boolean exclusive)
    throws RepositoryNotFoundException, IOException, ConfigInvalidException {
  String permission = Permission.LABEL + label;
  try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
    md.setMessage(String.format("Grant %s on %s", permission, ref));
    ProjectConfig config = ProjectConfig.read(md);
    AccessSection s = config.getAccessSection(ref, true);
    Permission p = s.getPermission(permission, true);
    p.setExclusiveGroup(exclusive);
    PermissionRule rule = Util.newRule(config, groupUUID);
    rule.setForce(force);
    rule.setMin(min);
    rule.setMax(max);
    p.add(rule);
    config.commit(md);
    projectCache.evict(config.getProject());
  }
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:27,
代码来源:AbstractDaemonTest.java

示例3: updateProjectConfig

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Override
protected ProjectAccess updateProjectConfig(
    ProjectConfig config, MetaDataUpdate md, boolean parentProjectUpdate)
    throws IOException, NoSuchProjectException, ConfigInvalidException,
        PermissionBackendException {
  RevCommit commit = config.commit(md);

  gitRefUpdated.fire(
      config.getProject().getNameKey(),
      RefNames.REFS_CONFIG,
      base,
      commit.getId(),
      user.asIdentifiedUser().getAccount());

  projectCache.evict(config.getProject());
  createGroupPermissionSyncer.syncIfNeeded();
  return projectAccessFactory.create(projectName).call();
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:19,
代码来源:ChangeProjectAccess.java

示例4: ProjectAccessFactory

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
ProjectAccessFactory(
    GroupBackend groupBackend,
    ProjectCache projectCache,
    PermissionBackend permissionBackend,
    Provider<CurrentUser> user,
    GroupControl.Factory groupControlFactory,
    MetaDataUpdate.Server metaDataUpdateFactory,
    AllProjectsName allProjectsName,
    WebLinks webLinks,
    @Assisted final Project.NameKey name) {
  this.groupBackend = groupBackend;
  this.projectCache = projectCache;
  this.permissionBackend = permissionBackend;
  this.user = user;
  this.groupControlFactory = groupControlFactory;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.allProjectsName = allProjectsName;
  this.webLinks = webLinks;

  this.projectName = name;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:23,
代码来源:ProjectAccessFactory.java

示例5: GetAccess

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
public GetAccess(
    Provider<CurrentUser> self,
    PermissionBackend permissionBackend,
    GroupControl.Factory groupControlFactory,
    AllProjectsName allProjectsName,
    ProjectCache projectCache,
    MetaDataUpdate.Server metaDataUpdateFactory,
    ProjectJson projectJson,
    GroupBackend groupBackend,
    GroupJson groupJson) {
  this.user = self;
  this.permissionBackend = permissionBackend;
  this.groupControlFactory = groupControlFactory;
  this.allProjectsName = allProjectsName;
  this.projectJson = projectJson;
  this.projectCache = projectCache;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.groupBackend = groupBackend;
  this.groupJson = groupJson;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:22,
代码来源:GetAccess.java

示例6: CreateAccessChange

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
CreateAccessChange(
    PermissionBackend permissionBackend,
    ChangeInserter.Factory changeInserterFactory,
    BatchUpdate.Factory updateFactory,
    Sequences seq,
    Provider<MetaDataUpdate.User> metaDataUpdateFactory,
    Provider<ReviewDb> db,
    SetAccessUtil accessUtil,
    ChangeJson.Factory jsonFactory) {
  this.permissionBackend = permissionBackend;
  this.seq = seq;
  this.changeInserterFactory = changeInserterFactory;
  this.updateFactory = updateFactory;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.db = db;
  this.setAccess = accessUtil;
  this.jsonFactory = jsonFactory;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:20,
代码来源:CreateAccessChange.java

示例7: SetAccess

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
private SetAccess(
    GroupBackend groupBackend,
    PermissionBackend permissionBackend,
    Provider<MetaDataUpdate.User> metaDataUpdateFactory,
    ProjectCache projectCache,
    GetAccess getAccess,
    Provider<IdentifiedUser> identifiedUser,
    SetAccessUtil accessUtil,
    CreateGroupPermissionSyncer createGroupPermissionSyncer) {
  this.groupBackend = groupBackend;
  this.permissionBackend = permissionBackend;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.getAccess = getAccess;
  this.projectCache = projectCache;
  this.identifiedUser = identifiedUser;
  this.accessUtil = accessUtil;
  this.createGroupPermissionSyncer = createGroupPermissionSyncer;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:20,
代码来源:SetAccess.java

示例8: getMetaDataUpdateFactory

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
private static MetaDataUpdateFactory getMetaDataUpdateFactory(
    MetaDataUpdate.User metaDataUpdateUserFactory,
    MetaDataUpdate.Server metaDataUpdateServerFactory,
    @Nullable IdentifiedUser currentUser,
    PersonIdent serverIdent,
    String serverId,
    String anonymousCowardName) {
  return currentUser != null
      ? projectName -> {
        MetaDataUpdate metaDataUpdate =
            metaDataUpdateUserFactory.create(projectName, currentUser);
        PersonIdent authorIdent =
            getAuditLogAuthorIdent(
                currentUser.getAccount(), serverIdent, serverId, anonymousCowardName);
        metaDataUpdate.getCommitBuilder().setAuthor(authorIdent);
        return metaDataUpdate;
      }
      : metaDataUpdateServerFactory::create;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:20,
代码来源:GroupsUpdate.java

示例9: User

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
public User(
    GitRepositoryManager repoManager,
    GitReferenceUpdated gitRefUpdated,
    AllUsersName allUsersName,
    OutgoingEmailValidator emailValidator,
    @GerritPersonIdent Provider<PersonIdent> serverIdent,
    Provider<IdentifiedUser> identifiedUser,
    Provider<MetaDataUpdate.User> metaDataUpdateUserFactory) {
  this.repoManager = repoManager;
  this.gitRefUpdated = gitRefUpdated;
  this.allUsersName = allUsersName;
  this.serverIdent = serverIdent;
  this.emailValidator = emailValidator;
  this.identifiedUser = identifiedUser;
  this.metaDataUpdateUserFactory = metaDataUpdateUserFactory;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:18,
代码来源:AccountsUpdate.java

示例10: SetPreferences

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
SetPreferences(
    Provider<CurrentUser> self,
    AccountCache cache,
    PermissionBackend permissionBackend,
    GeneralPreferencesLoader loader,
    Provider<MetaDataUpdate.User> metaDataUpdateFactory,
    AllUsersName allUsersName,
    DynamicMap<DownloadScheme> downloadSchemes) {
  this.self = self;
  this.loader = loader;
  this.cache = cache;
  this.permissionBackend = permissionBackend;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.allUsersName = allUsersName;
  this.downloadSchemes = downloadSchemes;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:18,
代码来源:SetPreferences.java

示例11: writeToGit

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
private void writeToGit(Account.Id id, GeneralPreferencesInfo i)
    throws RepositoryNotFoundException, IOException, ConfigInvalidException {
  VersionedAccountPreferences prefs;
  try (MetaDataUpdate md = metaDataUpdateFactory.get().create(allUsersName)) {
    prefs = VersionedAccountPreferences.forUser(id);
    prefs.load(md);

    storeSection(
        prefs.getConfig(),
        UserConfigSections.GENERAL,
        null,
        i,
        loader.readDefaultsFromGit(md.getRepository(), null));

    storeMyChangeTableColumns(prefs, i.changeTable);
    storeMyMenus(prefs, i.my);
    storeUrlAliases(prefs, i.urlAliases);
    prefs.commit(md);
    cache.evict(id);
  }
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:22,
代码来源:SetPreferences.java

示例12: writeToGit

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
private GeneralPreferencesInfo writeToGit(GeneralPreferencesInfo i)
    throws RepositoryNotFoundException, IOException, ConfigInvalidException {
  try (MetaDataUpdate md = metaDataUpdateFactory.get().create(allUsersName)) {
    VersionedAccountPreferences p = VersionedAccountPreferences.forDefault();
    p.load(md);
    storeSection(
        p.getConfig(), UserConfigSections.GENERAL, null, i, GeneralPreferencesInfo.defaults());
    com.google.gerrit.server.account.SetPreferences.storeMyMenus(p, i.my);
    com.google.gerrit.server.account.SetPreferences.storeUrlAliases(p, i.urlAliases);
    p.commit(md);

    accountCache.evictAllNoReindex();

    GeneralPreferencesInfo r =
        loadSection(
            p.getConfig(),
            UserConfigSections.GENERAL,
            null,
            new GeneralPreferencesInfo(),
            GeneralPreferencesInfo.defaults(),
            null);
    return loader.loadMyMenusAndUrlAliases(r, p, null);
  }
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:25,
代码来源:SetPreferences.java

示例13: writeToGit

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
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;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:20,
代码来源:SetDiffPreferences.java

示例14: getLabelTypes

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
private Collection<LabelType> getLabelTypes(ProjectConfig config)
    throws IOException, ConfigInvalidException {
  Map<String, LabelType> labelTypes = new HashMap<>(config.getLabelSections());
  Project.NameKey parent = config.getProject().getParent(allProjectsName);
  while (parent != null) {
    try (Repository git = repoManager.openRepository(parent);
        MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED, parent, git)) {
      ProjectConfig parentConfig = ProjectConfig.read(md);
      for (LabelType lt : parentConfig.getLabelSections().values()) {
        if (!labelTypes.containsKey(lt.getName())) {
          labelTypes.put(lt.getName(), lt);
        }
      }
      parent = parentConfig.getProject().getParent(allProjectsName);
    }
  }
  return labelTypes.values();
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:19,
代码来源:Schema_125.java

示例15: migrateData

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
  try (Repository git = repoManager.openRepository(allProjectsName);
      MetaDataUpdate md =
          new MetaDataUpdate(GitReferenceUpdated.DISABLED, allProjectsName, git)) {
    ProjectConfig config = ProjectConfig.read(md);

    GroupReference registered = systemGroupBackend.getGroup(REGISTERED_USERS);
    AccessSection refsFor = config.getAccessSection("refs/for/*", true);
    grant(config, refsFor, Permission.ADD_PATCH_SET, false, false, registered);

    md.getCommitBuilder().setAuthor(serverUser);
    md.getCommitBuilder().setCommitter(serverUser);
    md.setMessage(COMMIT_MSG);
    config.commit(md);
  } catch (ConfigInvalidException | IOException ex) {
    throw new OrmException(ex);
  }
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:20,
代码来源:Schema_128.java

示例16: migrateData

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
  SortedSet<Project.NameKey> repoList = repoManager.list();
  SortedSet<Project.NameKey> repoUpgraded = new TreeSet<>();
  ui.message("\tMigrating " + repoList.size() + " repositories ...");
  for (Project.NameKey projectName : repoList) {
    try (Repository git = repoManager.openRepository(projectName);
        MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED, projectName, git)) {
      ProjectConfig config = ProjectConfig.read(md);
      if (config.hasLegacyPermissions()) {
        md.getCommitBuilder().setAuthor(serverUser);
        md.getCommitBuilder().setCommitter(serverUser);
        md.setMessage(COMMIT_MSG);
        config.commit(md);
        repoUpgraded.add(projectName);
      }
    } catch (ConfigInvalidException | IOException ex) {
      throw new OrmException("Cannot migrate project " + projectName, ex);
    }
  }
  ui.message("\tMigration completed:  " + repoUpgraded.size() + " repositories updated:");
  ui.message("\t" + repoUpgraded.stream().map(n -> n.get()).collect(joining(" ")));
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:24,
代码来源:Schema_131.java

示例17: migrateData

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
  try (Repository git = repoManager.openRepository(allUsersName);
      MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED, allUsersName, git)) {
    ProjectConfig cfg = ProjectConfig.read(md);
    if (allProjectsName.equals(cfg.getProject().getParent(allProjectsName))) {
      return;
    }
    cfg.getProject().setParentName(allProjectsName);
    md.getCommitBuilder().setAuthor(serverUser);
    md.getCommitBuilder().setCommitter(serverUser);
    md.setMessage(
        String.format("Make %s inherit from %s", allUsersName.get(), allProjectsName.get()));
    cfg.commit(md);
  } catch (ConfigInvalidException | IOException ex) {
    throw new OrmException(ex);
  }
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:19,
代码来源:Schema_162.java

示例18: createGroupInNoteDb

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
private InternalGroup createGroupInNoteDb(
    Repository repository, InternalGroupCreation groupCreation, InternalGroupUpdate groupUpdate)
    throws ConfigInvalidException, IOException, OrmDuplicateKeyException {
  GroupConfig groupConfig =
      GroupConfig.createForNewGroup(
          allUsersName, repository, groupCreation, p -> createMetaDataUpdate(p));
  // We don't add any initial members or subgroups and hence the provided functions should never
  // be called. To be on the safe side, we specify some valid functions.
  groupConfig.setGroupUpdate(groupUpdate, Account.Id::toString, AccountGroup.UUID::get);
  try (MetaDataUpdate metaDataUpdate = createMetaDataUpdate(repository)) {
    groupConfig.commit(metaDataUpdate);
  }
  return groupConfig
      .getLoadedGroup()
      .orElseThrow(() -> new IllegalStateException("Created group wasn't automatically loaded"));
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:17,
代码来源:SchemaCreator.java

示例19: migrateData

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
  try (Repository git = repoManager.openRepository(allUsersName);
      MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED, allUsersName, git)) {
    ProjectConfig config = ProjectConfig.read(md);

    String refsUsersShardedId = RefNames.REFS_USERS + "${" + RefPattern.USERID_SHARDED + "}";
    config.remove(config.getAccessSection(refsUsersShardedId));

    GroupReference registered = systemGroupBackend.getGroup(REGISTERED_USERS);
    AccessSection users = config.getAccessSection(refsUsersShardedId, true);
    grant(config, users, Permission.READ, false, true, registered);
    grant(config, users, Permission.PUSH, false, true, registered);
    grant(config, users, Permission.SUBMIT, false, true, registered);

    md.getCommitBuilder().setAuthor(serverUser);
    md.getCommitBuilder().setCommitter(serverUser);
    md.setMessage(COMMIT_MSG);
    config.commit(md);
  } catch (ConfigInvalidException | IOException ex) {
    throw new OrmException(ex);
  }
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:24,
代码来源:Schema_126.java

示例20: migrateData

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
  SortedSet<Project.NameKey> repoList = repoManager.list();
  SortedSet<Project.NameKey> repoUpgraded = new TreeSet<>();
  ui.message("\tMigrating " + repoList.size() + " repositories ...");
  for (Project.NameKey projectName : repoList) {
    try (Repository git = repoManager.openRepository(projectName);
        MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED, projectName, git)) {
      ProjectConfigSchemaUpdate cfg = ProjectConfigSchemaUpdate.read(md);
      cfg.removeForceFromPermission("pushTag");
      if (cfg.isUpdated()) {
        repoUpgraded.add(projectName);
      }
      cfg.save(serverUser, COMMIT_MSG);
    } catch (ConfigInvalidException | IOException ex) {
      throw new OrmException("Cannot migrate project " + projectName, ex);
    }
  }
  ui.message("\tMigration completed:  " + repoUpgraded.size() + " repositories updated:");
  ui.message("\t" + repoUpgraded.stream().map(n -> n.get()).collect(joining(" ")));
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:22,
代码来源:Schema_130.java

示例21: reindex

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Test
public void reindex() throws Exception {
  AccountInfo user1 = newAccountWithFullName("tester", "Test Usre");

  // update account without reindex so that account index is stale
  Account.Id accountId = new Account.Id(user1._accountId);
  String newName = "Test User";
  try (Repository repo = repoManager.openRepository(allUsers)) {
    MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED, allUsers, repo);
    PersonIdent ident = serverIdent.get();
    md.getCommitBuilder().setAuthor(ident);
    md.getCommitBuilder().setCommitter(ident);
    AccountConfig accountConfig = new AccountConfig(null, accountId);
    accountConfig.load(repo);
    accountConfig.getAccount().setFullName(newName);
    accountConfig.commit(md);
  }

  assertQuery("name:" + quote(user1.name), user1);
  assertQuery("name:" + quote(newName));

  gApi.accounts().id(user1.username).index();
  assertQuery("name:" + quote(user1.name));
  assertQuery("name:" + quote(newName), user1);
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:26,
代码来源:AbstractQueryAccountsTest.java

示例22: fixIncorrectInheritance

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Test
public void fixIncorrectInheritance() throws Exception {
  String testProject = gApi.projects().create("test").get().name;
  assertThatAllUsersInheritsFrom(allProjectsName.get());

  try (Repository git = repoManager.openRepository(allUsersName);
      MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED, allUsersName, git)) {
    ProjectConfig cfg = ProjectConfig.read(md);
    cfg.getProject().setParentName(testProject);
    md.getCommitBuilder().setCommitter(serverUser);
    md.getCommitBuilder().setAuthor(serverUser);
    md.setMessage("Test");
    cfg.commit(md);
  } catch (ConfigInvalidException | IOException ex) {
    throw new OrmException(ex);
  }
  assertThatAllUsersInheritsFrom(testProject);

  schema162.migrateData(db, new TestUpdateUI());

  assertThatAllUsersInheritsFrom(allProjectsName.get());
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:23,
代码来源:Schema_161_to_162_Test.java

示例23: CreateProjectStep

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
public CreateProjectStep(
    @GitHubURL String gitHubUrl,
    MetaDataUpdate.User metaDataUpdateFactory,
    GroupBackend groupBackend,
    ProjectCache projectCache,
    GitHubRepository.Factory ghRepoFactory,
    GitHubConfig gitHubConfig,
    @Assisted("organisation") String organisation,
    @Assisted("name") String repository,
    @Assisted("description") String description,
    @Assisted("username") String username) {
  super(gitHubUrl, organisation, repository, ghRepoFactory);
  LOG.debug("Gerrit CreateProject " + organisation + "/" + repository);

  this.organisation = organisation;
  this.repository = repository;
  this.description = description;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.groupBackend = groupBackend;
  this.projectCache = projectCache;
  this.username = username;
  this.config = gitHubConfig;
}
 

开发者ID:GerritCodeReview,
项目名称:plugins_github,
代码行数:25,
代码来源:CreateProjectStep.java

示例24: doImport

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Override
public void doImport(ProgressMonitor progress) throws Exception {
  MetaDataUpdate md = null;
  try {
    md = metaDataUpdateFactory.create(getProjectNameKey());
    projectConfig = ProjectConfig.read(md);
    progress.beginTask("Configure Gerrit project", 2);
    setProjectSettings();
    progress.update(1);
    setProjectPermissions();
    progress.update(1);
    md.setMessage("Imported from " + getSourceUri());
    projectConfig.commit(md);
    projectCache.onCreateProject(getProjectNameKey());
  } finally {
    if (md != null) {
      md.close();
    }
    progress.endTask();
  }
}
 

开发者ID:GerritCodeReview,
项目名称:plugins_github,
代码行数:22,
代码来源:CreateProjectStep.java

示例25: PutReviewers

点赞 3

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
PutReviewers(@PluginName String pluginName,
    ReviewersConfig.Factory configFactory,
    Provider<MetaDataUpdate.User> metaDataUpdateFactory,
    ProjectCache projectCache,
    AccountResolver accountResolver,
    Provider<GroupsCollection> groupsCollection,
    Provider<ReviewDb> reviewDbProvider) {
  this.pluginName = pluginName;
  this.configFactory = configFactory;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.projectCache = projectCache;
  this.accountResolver = accountResolver;
  this.groupsCollection = groupsCollection;
  this.reviewDbProvider = reviewDbProvider;
}
 

开发者ID:davido,
项目名称:gerrit-reviewers-plugin,
代码行数:17,
代码来源:PutReviewers.java

示例26: commit

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
private void commit(Repository repository, GroupConfig groupConfig, Timestamp groupCreatedOn)
    throws IOException {
  PersonIdent personIdent =
      new PersonIdent(new GerritPersonIdentProvider(flags.cfg).get(), groupCreatedOn);
  try (MetaDataUpdate metaDataUpdate = createMetaDataUpdate(repository, personIdent)) {
    groupConfig.commit(metaDataUpdate);
  }
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:9,
代码来源:GroupsOnInit.java

示例27: createMetaDataUpdate

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
private MetaDataUpdate createMetaDataUpdate(Repository repository, PersonIdent personIdent) {
  MetaDataUpdate metaDataUpdate =
      new MetaDataUpdate(GitReferenceUpdated.DISABLED, new Project.NameKey(allUsers), repository);
  metaDataUpdate.getCommitBuilder().setAuthor(personIdent);
  metaDataUpdate.getCommitBuilder().setCommitter(personIdent);
  return metaDataUpdate;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:8,
代码来源:GroupsOnInit.java

示例28: setUseContributorAgreements

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
protected void setUseContributorAgreements(InheritableBoolean value) throws Exception {
  try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
    ProjectConfig config = ProjectConfig.read(md);
    config.getProject().setUseContributorAgreements(value);
    config.commit(md);
    projectCache.evict(config.getProject());
  }
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:9,
代码来源:AbstractDaemonTest.java

示例29: setUseSignedOffBy

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
protected void setUseSignedOffBy(InheritableBoolean value) throws Exception {
  try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
    ProjectConfig config = ProjectConfig.read(md);
    config.getProject().setUseSignedOffBy(value);
    config.commit(md);
    projectCache.evict(config.getProject());
  }
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:9,
代码来源:AbstractDaemonTest.java

示例30: saveProjectConfig

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
protected void saveProjectConfig(Project.NameKey p, ProjectConfig cfg) throws Exception {
  try (MetaDataUpdate md = metaDataUpdateFactory.create(p)) {
    md.setAuthor(identifiedUserFactory.create(admin.getId()));
    cfg.commit(md);
  }
  projectCache.evict(cfg.getProject());
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:8,
代码来源:AbstractDaemonTest.java

示例31: removePermission

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
protected void removePermission(Project.NameKey project, String ref, String permission)
    throws IOException, ConfigInvalidException {
  try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
    md.setMessage(String.format("Remove %s on %s", permission, ref));
    ProjectConfig config = ProjectConfig.read(md);
    AccessSection s = config.getAccessSection(ref, true);
    Permission p = s.getPermission(permission, true);
    p.getRules().clear();
    config.commit(md);
    projectCache.evict(config.getProject());
  }
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:13,
代码来源:AbstractDaemonTest.java

示例32: ChangeProjectAccess

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
ChangeProjectAccess(
    ProjectAccessFactory.Factory projectAccessFactory,
    ProjectCache projectCache,
    GroupBackend groupBackend,
    MetaDataUpdate.User metaDataUpdateFactory,
    AllProjectsName allProjects,
    AllUsersName allUsers,
    Provider<SetParent> setParent,
    GitReferenceUpdated gitRefUpdated,
    ContributorAgreementsChecker contributorAgreements,
    Provider<CurrentUser> user,
    PermissionBackend permissionBackend,
    CreateGroupPermissionSyncer createGroupPermissionSyncer,
    @Assisted("projectName") Project.NameKey projectName,
    @Nullable @Assisted ObjectId base,
    @Assisted List<AccessSection> sectionList,
    @Nullable @Assisted("parentProjectName") Project.NameKey parentProjectName,
    @Nullable @Assisted String message) {
  super(
      groupBackend,
      metaDataUpdateFactory,
      allProjects,
      allUsers,
      setParent,
      user.get(),
      projectName,
      base,
      sectionList,
      parentProjectName,
      message,
      contributorAgreements,
      permissionBackend,
      true);
  this.projectAccessFactory = projectAccessFactory;
  this.projectCache = projectCache;
  this.gitRefUpdated = gitRefUpdated;
  this.createGroupPermissionSyncer = createGroupPermissionSyncer;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:40,
代码来源:ChangeProjectAccess.java

示例33: ProjectAccessHandler

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
protected ProjectAccessHandler(
    GroupBackend groupBackend,
    MetaDataUpdate.User metaDataUpdateFactory,
    AllProjectsName allProjects,
    AllUsersName allUsers,
    Provider<SetParent> setParent,
    CurrentUser user,
    Project.NameKey projectName,
    ObjectId base,
    List<AccessSection> sectionList,
    Project.NameKey parentProjectName,
    String message,
    ContributorAgreementsChecker contributorAgreements,
    PermissionBackend permissionBackend,
    boolean checkIfOwner) {
  this.groupBackend = groupBackend;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.allProjects = allProjects;
  this.allUsers = allUsers;
  this.setParent = setParent;
  this.user = user;

  this.projectName = projectName;
  this.base = base;
  this.sectionList = sectionList;
  this.parentProjectName = parentProjectName;
  this.message = message;
  this.contributorAgreements = contributorAgreements;
  this.permissionBackend = permissionBackend;
  this.checkIfOwner = checkIfOwner;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:32,
代码来源:ProjectAccessHandler.java

示例34: CreateProject

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
CreateProject(
    Provider<ProjectsCollection> projectsCollection,
    Provider<GroupsCollection> groupsCollection,
    ProjectJson json,
    DynamicSet<ProjectCreationValidationListener> projectCreationValidationListeners,
    GitRepositoryManager repoManager,
    DynamicSet<NewProjectCreatedListener> createdListeners,
    ProjectCache projectCache,
    GroupBackend groupBackend,
    ProjectOwnerGroupsProvider.Factory projectOwnerGroups,
    MetaDataUpdate.User metaDataUpdateFactory,
    GitReferenceUpdated referenceUpdated,
    RepositoryConfig repositoryCfg,
    @GerritPersonIdent PersonIdent serverIdent,
    Provider<IdentifiedUser> identifiedUser,
    Provider<PutConfig> putConfig,
    AllProjectsName allProjects,
    DynamicItem<ProjectNameLockManager> lockManager,
    @Assisted String name) {
  this.projectsCollection = projectsCollection;
  this.groupsCollection = groupsCollection;
  this.projectCreationValidationListeners = projectCreationValidationListeners;
  this.json = json;
  this.repoManager = repoManager;
  this.createdListeners = createdListeners;
  this.projectCache = projectCache;
  this.groupBackend = groupBackend;
  this.projectOwnerGroups = projectOwnerGroups;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.referenceUpdated = referenceUpdated;
  this.repositoryCfg = repositoryCfg;
  this.serverIdent = serverIdent;
  this.identifiedUser = identifiedUser;
  this.putConfig = putConfig;
  this.allProjects = allProjects;
  this.lockManager = lockManager;
  this.name = name;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:40,
代码来源:CreateProject.java

示例35: createProjectConfig

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
private void createProjectConfig(CreateProjectArgs args)
    throws IOException, ConfigInvalidException {
  try (MetaDataUpdate md = metaDataUpdateFactory.create(args.getProject())) {
    ProjectConfig config = ProjectConfig.read(md);

    Project newProject = config.getProject();
    newProject.setDescription(args.projectDescription);
    newProject.setSubmitType(
        MoreObjects.firstNonNull(
            args.submitType, repositoryCfg.getDefaultSubmitType(args.getProject())));
    newProject.setUseContributorAgreements(args.contributorAgreements);
    newProject.setUseSignedOffBy(args.signedOffBy);
    newProject.setUseContentMerge(args.contentMerge);
    newProject.setCreateNewChangeForAllNotInTarget(args.newChangeForAllNotInTarget);
    newProject.setRequireChangeID(args.changeIdRequired);
    newProject.setMaxObjectSizeLimit(args.maxObjectSizeLimit);
    if (args.newParent != null) {
      newProject.setParentName(args.newParent);
    }

    if (!args.ownerIds.isEmpty()) {
      AccessSection all = config.getAccessSection(AccessSection.ALL, true);
      for (AccountGroup.UUID ownerId : args.ownerIds) {
        GroupDescription.Basic g = groupBackend.get(ownerId);
        if (g != null) {
          GroupReference group = config.resolve(GroupReference.forGroup(g));
          all.getPermission(Permission.OWNER, true).add(new PermissionRule(group));
        }
      }
    }

    md.setMessage("Created project\n");
    config.commit(md);
    md.getRepository().setGitwebDescription(args.projectDescription);
  }
  projectCache.onCreateProject(args.getProject());
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:38,
代码来源:CreateProject.java

示例36: PutConfig

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
PutConfig(
    @EnableSignedPush boolean serverEnableSignedPush,
    Provider<MetaDataUpdate.User> metaDataUpdateFactory,
    ProjectCache projectCache,
    ProjectState.Factory projectStateFactory,
    TransferConfig config,
    DynamicMap<ProjectConfigEntry> pluginConfigEntries,
    PluginConfigFactory cfgFactory,
    AllProjectsName allProjects,
    UiActions uiActions,
    DynamicMap<RestView<ProjectResource>> views,
    Provider<CurrentUser> user,
    PermissionBackend permissionBackend) {
  this.serverEnableSignedPush = serverEnableSignedPush;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.projectCache = projectCache;
  this.projectStateFactory = projectStateFactory;
  this.config = config;
  this.pluginConfigEntries = pluginConfigEntries;
  this.cfgFactory = cfgFactory;
  this.allProjects = allProjects;
  this.uiActions = uiActions;
  this.views = views;
  this.user = user;
  this.permissionBackend = permissionBackend;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:28,
代码来源:PutConfig.java

示例37: PutDescription

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
PutDescription(
    ProjectCache cache,
    MetaDataUpdate.Server updateFactory,
    PermissionBackend permissionBackend) {
  this.cache = cache;
  this.updateFactory = updateFactory;
  this.permissionBackend = permissionBackend;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:10,
代码来源:PutDescription.java

示例38: SetDefaultDashboard

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
SetDefaultDashboard(
    ProjectCache cache,
    MetaDataUpdate.Server updateFactory,
    DashboardsCollection dashboards,
    Provider<GetDashboard> get,
    PermissionBackend permissionBackend) {
  this.cache = cache;
  this.updateFactory = updateFactory;
  this.dashboards = dashboards;
  this.get = get;
  this.permissionBackend = permissionBackend;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:14,
代码来源:SetDefaultDashboard.java

示例39: SetParent

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
SetParent(
    ProjectCache cache,
    PermissionBackend permissionBackend,
    MetaDataUpdate.Server updateFactory,
    AllProjectsName allProjects,
    AllUsersName allUsers) {
  this.cache = cache;
  this.permissionBackend = permissionBackend;
  this.updateFactory = updateFactory;
  this.allProjects = allProjects;
  this.allUsers = allUsers;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:14,
代码来源:SetParent.java

示例40: CreateGroupPermissionSyncer

点赞 2

import com.google.gerrit.server.git.MetaDataUpdate; //导入依赖的package包/类
@Inject
CreateGroupPermissionSyncer(
    AllProjectsName allProjects,
    AllUsersName allUsers,
    ProjectCache projectCache,
    Provider<MetaDataUpdate.Server> metaDataUpdateFactory) {
  this.allProjects = allProjects;
  this.allUsers = allUsers;
  this.projectCache = projectCache;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
}
 

开发者ID:gerrit-review,
项目名称:gerrit,
代码行数:12,
代码来源:CreateGroupPermissionSyncer.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)