What is ger2err
?
ger2err
stands for "Gerrit to Errors": it refers to converting Gerrit
review comments into a format which looks like the error output from a
a compiler. Text editors can read this so that you can navigate
through the error list and fix the reviewer comments, as if you were
fixing compiler errors.
Demo Example
First, set up the environment. Alternatively, these parameters can be passed as command line arguments. NOTE The Gerrit credentials here are not the same as those used to log in to the Gerrit web interface. These are entirely separate HTTPS credentials for the API, that you can create inside Gerrit.
Here $
represents your shell prompt:
$ export GER2ERR_SERVER=https://your.intranet.local/gerrit
$ export GER2ERR_USERID=yuzer
$ export GER2ERR_PASSWORD=ApTKT7YA16sg5cza31mx
Now we can get some comments:
$ ger2err I62b7e3e79fbeaece243eff2f369b3a90fae9628d
comments from patch set 1
lib/parser/scan.c:1357:20: unresolved comment by Co Worker (co.worker)
Where is this variable initialized?
lib/parser/parse.y:935:35: unresolved comment by Co Worker (co.worker)
This doesn't have to be a separate rule; it's a minor
variation in the foo_phrase grammar production.
This output can be captured and used by your editor. For instance,
a simple way to use it in Vim is to send it to a file called errors.err
and then run vim -q
. There is a way to do it within Vim.
Each comment consists of a main line which gives the source location info and identifies the commenter. Then the actual comment lines follow that, prefixed with a tab character, so they look like continuation lines.
Installation
ger2err
requires TXR 279 or later. It is a hash bang script which uses env
to look for txrlisp
in the PATH
. Just make it executable and use it.
You can compile it if you want.
$ txr --compile=ger2err:ger2err.out
Now ger2err.out
is a compiled version you can install as ger2err
instead of the original.
Documentation
ger2err
has a --help
option; that's it.
License
ger2err
is offered under a BSD license; see the comment header in the
ger2err
file.