[psa] `gerrit` utility changing some subcommand names

16 views
Skip to first unread message

Mike Frysinger

unread,
Feb 7, 2020, 1:23:55 PM2/7/20
to chromium-os-dev
tl;dr: if you don't use the `gerrit` CLI tool, you can mute this thread

i'm landing a change that's going to rename a few of the gerrit subcommands.

specifically these are being renamed:
  autosubmit -> label-as
  review -> label-cr
  verify -> label-v
  ready -> label-cq

explanation is in the CL:
We're running into the problem where our colloquial names for labels
are colliding with Gerrit endpoints/concepts.  Gerrit now has the
concept of "ready" to complement "work-in-progress", but we've been
using "ready" to mean "set the Commit-Queue label". 
 
Lets rename our helpers that exist only to set labels to have a better
scoped name.  Hopefully this will avoid any future collisions, while
making it clearer what's going on, and be more portable across other
Gerrit instances.

to make up for the disruption, i'm adding a more powerful "review" subcommand to align with Gerrit's "review" REST API.  this will allow modifying multiple labels, reviewers, cc, messages, etc... all in one command/update so you don't have to run `gerrit` multiple times.
-mike

Jack Rosenthal

unread,
Feb 7, 2020, 1:28:09 PM2/7/20
to Mike Frysinger, chromium-os-dev
Potentially, should we just change the API to a single "label" command? Seems cleaner.

--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
https://groups.google.com/a/chromium.org/group/chromium-os-dev
---
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-os-d...@chromium.org.

Mike Frysinger

unread,
Feb 7, 2020, 1:31:57 PM2/7/20
to Jack Rosenthal, chromium-os-dev
the new review subcommand will have a simple enough API that i think will satisfy that request:
  gerrit review -l CR+1 12345
(where -l is short for --label)

the only thing a label subcommand might save is the -l option, but then it'd be difficult on the CLI to determine where the labels end and the CLs start.

wdyt ?
-mike

Jack Rosenthal

unread,
Feb 7, 2020, 2:25:00 PM2/7/20
to Mike Frysinger, chromium-os-dev
Can we specify -l or --label many times? Also maybe apply the syntax we use elsewhere for multiple arguments ("a b c")?

Sounds fine to me.

Also, would be nice if we can write the full label names in the same way we might use for push options to gerrit (e.g., "Auto-Submit+1") as well as the nice shorthand you have.

Mike Frysinger

unread,
Feb 7, 2020, 2:33:33 PM2/7/20
to Jack Rosenthal, chromium-os-dev
yep, I have support for multiple --label and for the full label names already. I can add support for space delimited labels. I was on the fence, but I guess it's not an ambiguous syntax, so shouldn't be a problem.
-mike

Vadim Bendebury (вб)

unread,
Feb 7, 2020, 2:36:56 PM2/7/20
to Mike Frysinger, chromium-os-dev
any chance to keep aliases for backwards compatibility? It is a pain to go through all scripts using this and change it.

-vb


--

Mike Frysinger

unread,
Feb 7, 2020, 2:38:46 PM2/7/20
to Vadim Bendebury (вб), chromium-os-dev
as i noted in the summary, no.  the names conflict with standard Gerrit names that we want to align with.
-mike

Vadim Bendebury (вб)

unread,
Feb 7, 2020, 2:51:08 PM2/7/20
to Mike Frysinger, chromium-os-dev
do you mean to say that these command line options will still be there but will perform different functions?

Mike Frysinger

unread,
Feb 7, 2020, 3:13:35 PM2/7/20
to Vadim Bendebury (вб), chromium-os-dev
there will be new "review" & "ready" subcommands with completely different options as they will be reflecting the Gerrit concepts rather than the unrelated CrOS-specific colloquial names.

there is no plan for new "verify" or "autosubmit" subcommands at this time.
-mike

Mike Frysinger

unread,
Mar 12, 2021, 1:45:08 AM3/12/21
to Vadim Bendebury (вб), chromium-os-dev
i dropped the ball on this a bit and didn't finish the review command until recently.  to make up for it, i've also implemented local alias support.

so to recap:
`gerrit review` can add/remove multiple labels, add a message, reviewers, and toggle wip status in a single transaction.  this is useful for people who have been using label-v or label-cq or label-as on the same set of CLs (e.g. V+1 CQ+2).

if you want to define an alias for common flows, you can do that now as documented in `gerrit help config`:
Gerrit may be customized via ~/.config/chromite/gerrit.cfg.
It is an ini file like ~/.gitconfig.  See `man git-config` for basic format. 
 
# Set up subcommand aliases.
[alias]
    common-search = search 'is:open project:something/i/care/about' 
-mike

Sonny Rao

unread,
Mar 12, 2021, 4:41:59 PM3/12/21
to Mike Frysinger, Vadim Bendebury (вб), chromium-os-dev
Super useful, thanks!
Reply all
Reply to author
Forward
0 new messages