Merge "Update patch status before skipping duplicate emails" into stable-2.6

This commit is contained in:
Shawn Pearce
2013-11-18 16:22:44 +00:00
committed by Gerrit Code Review
2 changed files with 11 additions and 13 deletions

View File

@@ -126,7 +126,6 @@ public class Submit implements RestModifyView<RevisionResource, Input> {
// If the merge was attempted and it failed the system usually
// writes a comment as a ChangeMessage and sets status to NEW.
// Find the relevant message and report that as the conflict.
final Timestamp before = rsrc.getChange().getLastUpdatedOn();
ChangeMessage msg = Iterables.getFirst(Iterables.filter(
Lists.reverse(dbProvider.get().changeMessages()
.byChange(change.getId())
@@ -134,8 +133,7 @@ public class Submit implements RestModifyView<RevisionResource, Input> {
new Predicate<ChangeMessage>() {
@Override
public boolean apply(ChangeMessage input) {
return input.getAuthor() == null
&& input.getWrittenOn().getTime() >= before.getTime();
return input.getAuthor() == null;
}
}), null);
if (msg != null) {

View File

@@ -1045,16 +1045,6 @@ public class MergeOp {
private void sendMergeFail(final Change c, final ChangeMessage msg,
final boolean makeNew) {
if (isDuplicate(msg)) {
return;
}
try {
db.changeMessages().insert(Collections.singleton(msg));
} catch (OrmException err) {
log.warn("Cannot record merge failure message", err);
}
if (makeNew) {
try {
db.changes().atomicUpdate(c.getId(), new AtomicUpdate<Change>() {
@@ -1079,6 +1069,16 @@ public class MergeOp {
}
}
if (isDuplicate(msg)) {
return;
}
try {
db.changeMessages().insert(Collections.singleton(msg));
} catch (OrmException err) {
log.warn("Cannot record merge failure message", err);
}
PatchSetApproval submitter = null;
try {
submitter = getSubmitter(db, c.currentPatchSetId());