RebaseDialog: Use projectQuery to escape project name in operator

A project name containing spaces or other special characters in
the search language should be wrapped in "" to ensure the server
can parse it accurately. Use PageLinks.toProjectQuery() to run the
existing client side escaping rules.

AND is the default operator between two terms in a query string,
it is not necessary to specify it.

Use - instead of NOT for the inverse of age:90d.

Change-Id: I24fa20bd7320a916cdc1bab9fb5dd8a39e47e4a1
This commit is contained in:
Shawn Pearce
2015-07-17 11:49:58 -07:00
parent d8a4aed27c
commit 909b312da9

View File

@@ -20,8 +20,10 @@ import com.google.gerrit.client.changes.ChangeList;
import com.google.gerrit.client.changes.Util;
import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.client.rpc.Natives;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.extensions.client.ListChangesOption;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.CheckBox;
@@ -79,8 +81,9 @@ public abstract class RebaseDialog extends CommentedActionDialog {
boolean checked = ((CheckBox) event.getSource()).getValue();
if (checked) {
ChangeList.query(
"project:" + project + " AND branch:" + branch
+ " AND is:open NOT age:90d",
PageLinks.projectQuery(new Project.NameKey(project))
+ " " + PageLinks.op("branch", branch)
+ " is:open -age:90d",
Collections.<ListChangesOption> emptySet(),
new GerritCallback<ChangeList>() {
@Override