protected Change.Id updateProjectConfig(ProjectConfig config, MetaDataUpdate md)
throws IOException, NoSuchProjectException, ConfigInvalidException, OrmException {
int nextChangeId = db.nextChangeId();
PatchSet.Id patchSetId = new PatchSet.Id(new Change.Id(nextChangeId), 1);
final PatchSet ps = new PatchSet(patchSetId);
RevCommit commit = config.commitToNewRef(md, ps.getRefName());
if (commit.getId().equals(base)) {
return null;
}
Change.Key changeKey = new Change.Key("I" + commit.name());
final Change change =
new Change(changeKey, new Change.Id(nextChangeId), user.getAccountId(),
new Branch.NameKey(config.getProject().getNameKey(),
GitRepositoryManager.REF_CONFIG));
change.nextPatchSetId();
ps.setCreatedOn(change.getCreatedOn());
ps.setUploader(user.getAccountId());
ps.setRevision(new RevId(commit.name()));
db.patchSets().insert(Collections.singleton(ps));
final PatchSetInfo info = patchSetInfoFactory.get(commit, ps.getId());
change.setCurrentPatchSet(info);