diff --git a/Documentation/rest-api-groups.txt b/Documentation/rest-api-groups.txt index bf83112fd7..bef21538f1 100644 --- a/Documentation/rest-api-groups.txt +++ b/Documentation/rest-api-groups.txt @@ -120,8 +120,13 @@ client so they are generally disabled by default. Optional fields are: ==== Check if a group is owned by the calling user By setting the option `owned` and specifying a group to inspect with -the option `q`, it is possible to find out, if this group is owned by -the calling user. +the option `group`/`g`, it is possible to find out if this group is +owned by the calling user. + +[NOTE] Earlier the `group`/`g` option was named `query`/`q`. Using +`query`/`q` still works, but this option is deprecated and may be +removed in future. Hence all users should be adapted to use +`group`/`g` instead. .Request ---- @@ -181,8 +186,8 @@ If this option is set and `n` is not set, then `n` defaults to 10. When using this option, the `project` or `p` option can be used to name the current project, to allow context-dependent suggestions. -Not compatible with `visible-to-all`, `owned`, `user`, `match`, `q`, -or `S`. +Not compatible with `visible-to-all`, `owned`, `user`, `match`, +`group`, or `S`. (Attempts to use one of those options combined with `suggest` will error out.) @@ -224,6 +229,11 @@ can be used to skip/limit results. As result a list of link:#group-info[GroupInfo] entities is returned. +[NOTE] `query2` is a temporary name and in future this option may be +renamed to `query`. `query2` was chosen to maintain backwards +compatibility with the deprecated `query` parameter on the +link:#list-groups[List Groups] endpoint. + .Request ---- GET /groups/?query2=inname:test HTTP/1.0 diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupMap.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupMap.java index 5e230493a2..e0a7d0cfb9 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupMap.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupMap.java @@ -59,7 +59,7 @@ public class GroupMap extends NativeMap { } public static void myOwned(String groupName, AsyncCallback cb) { - myOwnedGroups().addParameter("q", groupName).get( + myOwnedGroups().addParameter("g", groupName).get( NativeMap.copyKeysIntoChildren(cb)); } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/group/ListGroups.java b/gerrit-server/src/main/java/com/google/gerrit/server/group/ListGroups.java index 0f495ce498..80a639b9ae 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/group/ListGroups.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/group/ListGroups.java @@ -106,9 +106,23 @@ public class ListGroups implements RestReadView { this.owned = owned; } - @Option(name = "--query", aliases = {"-q"}, usage = "group to inspect") - public void addGroup(AccountGroup.UUID id) { - groupsToInspect.add(id); + + /** + * Add a group to inspect. + * + * @param uuid UUID of the group + * @deprecated use {@link #addGroup(AccountGroup.UUID)}. + */ + @Deprecated + @Option(name = "--query", aliases = {"-q"}, + usage = "group to inspect (deprecated: use --group/-g instead)") + void addGroup_Deprecated(AccountGroup.UUID uuid) { + addGroup(uuid); + } + + @Option(name = "--group", aliases = {"-g"}, usage = "group to inspect") + public void addGroup(AccountGroup.UUID uuid) { + groupsToInspect.add(uuid); } @Option(name = "--limit", aliases = {"-n"}, metaVar = "CNT", diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/group/QueryGroups.java b/gerrit-server/src/main/java/com/google/gerrit/server/group/QueryGroups.java index 4252d3591e..bbbfd7caf6 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/group/QueryGroups.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/group/QueryGroups.java @@ -51,6 +51,8 @@ public class QueryGroups implements RestReadView { private EnumSet options = EnumSet.noneOf(ListGroupsOption.class); + // TODO(ekempin): --query in ListGroups is marked as deprecated, once it is + // removed we want to rename --query2 to --query here. /** --query (-q) is already used by {@link ListGroups} */ @Option(name = "--query2", aliases = {"-q2"}, usage = "group query") public void setQuery(String query) {