Merge "Remove unused ChangeUtil#updated method"

This commit is contained in:
Edwin Kempin
2016-02-18 08:04:47 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 19 deletions

View File

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

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.server;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.collect.Ordering; 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.Change;
import com.google.gerrit.reviewdb.client.PatchSet; import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.server.ReviewDb; 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, public static PatchSet.Id nextPatchSetId(Map<String, Ref> allRefs,
PatchSet.Id id) { PatchSet.Id id) {
PatchSet.Id next = nextPatchSetId(id); PatchSet.Id next = nextPatchSetId(id);