Remove unused ChangeUtil#updated method

Plugins that use this method must be adapted to use BatchUpdate for
updating changes, otherwise they can't work with notedb.

Change-Id: I5cdaa7fa532519d3650c2886a9ab5ae2b3d1a780
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-02-17 18:34:17 +01:00
parent bf55fa403a
commit e2d06b05c1
2 changed files with 10 additions and 19 deletions

View File

@@ -1200,20 +1200,16 @@ public Object apply(RevisionResource rcrs, Input in) {
[...]
// update change
ReviewDb db = dbProvider.get();
db.changes().beginTransaction(change.getId());
try {
change = db.changes().atomicUpdate(
change.getId(),
new AtomicUpdate<Change>() {
try (BatchUpdate bu = batchUpdateFactory.create(
db, project.getNameKey(), user, TimeUtil.nowTs())) {
bu.addOp(change.getId(), new BatchUpdate.Op() {
@Override
public Change update(Change change) {
ChangeUtil.updated(change);
return change;
public boolean updateChange(BatchUpdate.ChangeContext ctx) {
ctx.saveChange();
return true;
}
});
db.commit();
} finally {
db.rollback();
bu.execute();
}
[...]
}

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.server;
import com.google.common.base.Function;
import com.google.common.collect.Ordering;
import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.server.ReviewDb;
@@ -87,10 +86,6 @@ public class ChangeUtil {
}
}
public static void updated(Change c) {
c.setLastUpdatedOn(TimeUtil.nowTs());
}
public static PatchSet.Id nextPatchSetId(Map<String, Ref> allRefs,
PatchSet.Id id) {
PatchSet.Id next = nextPatchSetId(id);