No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Gruf (which may stand for "Gerrit Reviews Ur Files", or "Gerrit Review, U Fools", or maybe even "Giant Rodents Under Fireswamp) is a wrapper for the Gerrit command-line ssh interface.


For the latest and greatest:

pip install git+


Gruf expects a remote called "gerrit" to exist in your git config. It must be the ssh:// style in order for Gruf to parse it correctly. For example:

[remote "gerrit"]
    url = ssh://
    fetch = +refs/heads/*:refs/remotes/gerrit/*

Gruf will attempt to read $XDG_CONFIG_DIR/gruf/gruf.yml (which normally means $HOME/.config/gruf/gruf.yml), which is a YAML format file that can contain a querymap key that maps terms in your query to alias expansions. So if you have:

   oooq: project:redhat-openstack/tripleo-quickstart

You can ask for:

$ gruf query oooq open

And end up executing:

query project:redhat-openstack/tripleo-quickstart status:open

The following aliases are built-in:

  • mine: owner:self
  • here: project:<current project name>
  • open: status:open

Additionally, gruf will replace any argument prefixed with git: with the result of calling git rev-parse on the rest of the argument, so you can use git:HEAD or git:mytag any place that gerrit will accept a commit id.


The gruf query command produces results by passing the query results through a Jinja2 template. You can override this by passing a template name with the -t option. Gruf will first search for templates in a directory named after the class of the result, and then without the class prefix. For example, if you run:

gruf -t yaml query open here

Gruf will first attempt to load the template QueryResponse/yaml.j2, and if that fails it will look for yaml.j2.


  • Get a list of open changes for the current project:

      $ gruf query open here
  • Get a list of URLs for the same thing:

      $ gruf url-for open here
  • Approve the change associated with the current commit:

      $ gruf confirm git:HEAD

    This is actually shorthand for:

      $ gruf review --code-review 2 --verified 1 git:HEAD
  • Abandon a change with a comment:

      $ gruf abandon -m "this was a terrible idea" 263262,1

    This is actually shorthand for:

      $ gruf review --abandon 263262,1
  • See detailed information about changes:

      $ gruf show open here


Gruf supports the Gerrit stream-events command. The default template produces several lines of output for each event; for more compact output try:

gruf -t short stream-events

The output will look something like:

[PATCH     ] 240944,24 openstack/python-ironicclient sturivnyi
             Add sanity tests for testing actions with Port
[COMMENT   ] 282334,1 openstack/fuel-octane gelbuhos
             Workflow 1 Code-Review 2 
[COMMENT   ] 282334,1 openstack/fuel-octane gelbuhos
[COMMENT   ] 275844,23 openstack/kolla elemoine
             Workflow 1 Code-Review 2 
[COMMENT   ] 279478,3 openstack/fuel-octane gelbuhos
             Verified 2 
[MERGED    ] 279478,3 openstack/fuel-octane gelbuhos
[COMMENT   ] 248938,29 openstack/neutron slaweq
[COMMENT   ] 279478,3 openstack/fuel-octane gelbuhos
[COMMENT   ] 279478,3 openstack/fuel-octane gelbuhos
[COMMENT   ] 276419,1 openstack/glance siuzannatb
             Workflow 1 Code-Review 2 
[COMMENT   ] 276814,18 openstack/fuel-web vkramskikh
             Verified 1 
[COMMENT   ] 276419,1 openstack/glance siuzannatb
[COMMENT   ] 281472,2 openstack/ironic-webclient krotscheck
             Verified 1 
[COMMENT   ] 282331,1 openstack/fuel-qa apanchenko


You can filter the items returned from Gerrit by passing a jsonpointer expression and expected value to the --filter (-F) option. For example, to stream only events from the openstack/nova project:

gruf -F /change/project=openstack/nova stream-events

The expected values can use simple fnmatch style wildcards:

gruf -F /change/project=redhat-openstack/* stream-events


GRUF, a gerrit command-line wrapper Copyright (C) 2016 Lars Kellogg-Stedman

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see