A command line app with opinionated flows for a subset of Gerrit functionalities. Intended to ease people familiar with GitHub et al., to work with Gerrit. And hopefully help them remember to add reviewers to a change.
Inspired from:
- Lack of non-tedious way in git-review to add reviewers
- Lack of Python tooling for cross compilation
- The ease of Golang tooling for cross compilation
Download the binary and add to $PATH.
gerritr is supposed to be used in the same context as git - a command line application from the repository root directory. gerritr has two subcommands: push and patch.
--branchor-b: Target branch name. Required if the target branch is not main or master.--messageor-m: Commit message.--stateor-s: Change state. Ignored if the value is not one of:privateremove-privatewipready
--reviewersor-r: Space separated list of reviewer email IDs or aliases
Push the latest commit to the target branch, thereby creating a new change in Gerrit.
If --message flag is present, a new commit is created initally - with the staged changes and the provided message - and then pushed.
Adding reviewers without verbosely typing in everyone's email ID, is possible in two ways:
- Go to
$XDG_CONFIG_HOME, which is generally:~/.configfor Linux~/Library/Application Supportfor macOS%LOCALAPPDATA%for Windows
- Create a
gerritrdirectory there. - Add a
config.ymlingerritrdirectory with content similar to the sample below:alias: backend: - b1@org.com - b2@org.com frontend: - f1@org.com - f2@org.com someone: - someone.with.long.email.id@somewhere.com ...
The configured aliases can then be used as values to --reviewers. Unresolvable values for --reviewers are ignored.
Add a plaintext REVIEWERS file to the repository root directory, with a list of email IDs of people who should always be added as reviewers to every change pushed from this repository:
r1@org.com
r2@org.com
...
Both the ways to add reviewers are independent:
- With just the above global configuration in place,
gerritr push -r backend x1@org.comwill addx1@org.com,b1@org.comandb2@org.comas reviewers - With just the above local configuration in place,
gerritr pushwill addr1@org.comandr2@org.comas reviewers - With both of the above sample configurations in place,
gerritr push -r x1@org.com frontendwill addx1@org.com,f1@org.com,f2@org.com,r1@org.comandr2@org.comas reviewers
Amend the latest commit with the staged changes and push it to the target branch, thereby adding a patchset to an already existing change in Gerrit.
If --message flag is not specified, the commit message will be preserved. No change to the added reviewers.