Disable submit button if merge will fail

This feature aims to test the mergeability of each change tagging it
according to the result (true or false).
When the change page is load, the test is triggered and the sha1 of
the dest branch (tested against) is stored within the change table.
The submit button will be enabled or disabled according to the result.
The test is triggered only if it’s outdated.
As the branch evolves the sha1 stored at the moment of the test
becomes different from the last one merged into the branch, meaning
the test is outdated.

Bug: issue 381
Change-Id: I8bdb26db6fc35067b8c14b987984cfd80745f3d3
This commit is contained in:
carloseduardo.baldacin
2011-07-14 17:52:22 -03:00
committed by Ulrik Sjölin
parent 3f41a0ad0a
commit 14246de3c0
18 changed files with 301 additions and 92 deletions

View File

@@ -25,27 +25,25 @@ import com.google.gerrit.reviewdb.PatchSetInfo;
import com.google.gerrit.reviewdb.RevId;
import com.google.gerrit.reviewdb.ReviewDb;
import com.google.gerrit.reviewdb.TrackingId;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.config.TrackingFooter;
import com.google.gerrit.server.config.TrackingFooters;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.MergeOp;
import com.google.gerrit.server.git.MergeQueue;
import com.google.gerrit.server.git.ReplicationQueue;
import com.google.gerrit.server.patch.PatchSetInfoFactory;
import com.google.gerrit.server.patch.PatchSetInfoNotAvailableException;
import com.google.gerrit.server.project.InvalidChangeOperationException;
import com.google.gerrit.server.project.NoSuchChangeException;
import com.google.gerrit.server.mail.AbandonedSender;
import com.google.gerrit.server.mail.EmailException;
import com.google.gerrit.server.mail.ReplyToChangeSender;
import com.google.gerrit.server.mail.RestoredSender;
import com.google.gerrit.server.mail.RevertedSender;
import com.google.gerrit.server.patch.PatchSetInfoFactory;
import com.google.gerrit.server.patch.PatchSetInfoNotAvailableException;
import com.google.gerrit.server.project.InvalidChangeOperationException;
import com.google.gerrit.server.project.NoSuchChangeException;
import com.google.gwtorm.client.AtomicUpdate;
import com.google.gwtorm.client.OrmConcurrencyException;
import com.google.gwtorm.client.OrmException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
@@ -165,6 +163,10 @@ public class ChangeUtil {
db.trackingIds().delete(toDelete);
}
public static void testMerge(MergeOp.Factory opFactory, Change change) {
opFactory.create(change.getDest()).verifyMergeability(change);
}
public static void submit(final PatchSet.Id patchSetId,
final IdentifiedUser user, final ReviewDb db,
final MergeOp.Factory opFactory, final MergeQueue merger)