Allow watching specific branches or any other search query

Any valid search string is now a valid filter expression or a
watched project.  The only operator not supported here is the
is:watched operator, because that creates a recursive call that
would never succeed.

The change turned out far bigger than it should be due to the request
scope requirement for the query builder.  We had to rearrange a lot
of code to ensure we always have the request scope available in order
to construct a query builder and execute the filter expressions.

Bug: issue 492
Change-Id: I199d9b215e000c049279cd8e86e7a36386fee0fb
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-07-19 16:15:08 -07:00
parent 14760b7c0e
commit 0f42fc05a4
46 changed files with 908 additions and 434 deletions

View File

@@ -25,6 +25,7 @@ import com.google.gerrit.reviewdb.RevId;
import com.google.gerrit.reviewdb.ReviewDb;
import com.google.gerrit.server.ChangeUtil;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.git.MergeOp;
import com.google.gerrit.server.git.MergeQueue;
import com.google.gerrit.server.patch.PublishComments;
import com.google.gerrit.server.project.CanSubmitResult;
@@ -95,6 +96,9 @@ public class ReviewCommand extends BaseCommand {
@Inject
private MergeQueue merger;
@Inject
private MergeOp.Factory opFactory;
@Inject
private ApprovalTypes approvalTypes;
@@ -166,7 +170,7 @@ public class ReviewCommand extends BaseCommand {
changeControl.canSubmit(patchSetId, db, approvalTypes,
functionStateFactory);
if (result == CanSubmitResult.OK) {
ChangeUtil.submit(patchSetId, currentUser, db, merger);
ChangeUtil.submit(opFactory, patchSetId, currentUser, db, merger);
} else {
throw error(result.getMessage());
}