gerrit: add a generic "search" command
This lets people perform any kind of search they want and makes
the "mine" command a simple alias.
BUG=chromium:384547
TEST=`gerrit mine` still works
TEST=ran some custom queries and compared output to the web interface
Change-Id: I0108ee66c06f2dc4ba9cfb1497af930cbb575fa7
Reviewed-on: https://chromium-review.googlesource.com/203808
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/gerrit.py b/scripts/gerrit.py
index 0577ce3..1581d82 100644
--- a/scripts/gerrit.py
+++ b/scripts/gerrit.py
@@ -195,15 +195,20 @@
PrintCl(opts, cl, lims)
-def UserActMine(opts):
- """List your CLs with review statuses"""
- _, _, owners = _MyUserInfo()
- cls = FilteredQuery(opts, '( %s ) status:new' % (' OR '.join(owners),))
+def UserActSearch(opts, query):
+ """List CLs matching the Gerrit <search query>"""
+ cls = FilteredQuery(opts, query)
lims = limits(cls)
for cl in cls:
PrintCl(opts, cl, lims)
+def UserActMine(opts):
+ """List your CLs with review statuses"""
+ _, _, owners = _MyUserInfo()
+ UserActSearch(opts, '( %s ) status:new' % (' OR '.join(owners),))
+
+
def UserActInspect(opts, idx):
"""Inspect CL number <n>"""
cl = FilteredQuery(opts, idx)
@@ -287,6 +292,11 @@
There is no support for doing line-by-line code review via the command line.
This helps you manage various bits and CL status.
+For general Gerrit documentation, see:
+ https://gerrit-review.googlesource.com/Documentation/
+The Searching Changes page covers the search query syntax:
+ https://gerrit-review.googlesource.com/Documentation/user-search.html
+
Example:
$ gerrit todo # List all the CLs that await your review.
$ gerrit mine # List all of your open CLs.