Gerrit is a web based code review system, and I decided I’d have a look at it. The install process is not easy, and not documented in such a way that I’d consider simple.
[Note: I later discovered the document that caused my confusion, which is http://en.wikibooks.org/wiki/Git/Gerrit_Code_Review – note that it, at this time, doesn’t contain anything about creating the project on the gerrit host!)
First off, installing the software (v2.2.1) to use MySQL just didn’t work; some unknown problem happened and the stack trace wasn’t helpful. I took the cowards way out and use the embedded H2 database instead, which gave me no such problems.
Next, the questions asked during install were not particularly obvious, if you didn’t know what it was really asking. For example, “Location of Git repositories” – what’s it asking here? It transpires that this is the location that Gerrit wants to store its own copies of the git repositories; or at least, that’s what I think it means. I ended up letting it use the default value which is simply “git”, because then it stores them within its own directory structure.
After this, I figured the documentation would tell me how to set up a new project. I’m not sure what I was originally looking at, but the first thing you need to do is to create a project repository by doing something like this:
ssh -p 29418 review.example.com gerrit create-project –name new/project
One of the guides I used did not have that in the instructions. This was a fail. As in most things, once you know how to do it, it’s easy, but on the basis that the instructions I was first using didn’t make any mention of needing to create a project outwith the web interface, I was stumped.
Now, at this point, I ended up causing myself no end of problems by thrashing around trying to get it to work. I ended up deleting something that I really shouldn’t have deleted, while attempting to get the git repository that I had initially stated in the setup (/usr/share/gerrit) to work. Bad move. Don’t go in and delete stuff in a terminal as otherwise you’ll confused the crap out of the web interface which then doesn’t cope well with things disappearing. So my bad there, but the lack of clear docs on how to get started didn’t help.
After the success of managing to get the new project created, it was relatively plain sailing. You need to create a branch within the web interface, I’ve yet to see any documentation about this but I didn’t look too hard as I figured it out from the error messages when attempting “git push” and from looking at the web app itself. I’ve yet to figure out how the workflow goes when making comments on a code change, but the UI at this point looks pretty neat, so I shall give it more of a chance from this point on (I’d given up an hour ago, judging gerrit to be pish, before my brain refused to be defeated and I came back and got it working).
So, ultimately, if you want to try it out, here’s my tips:
- when installing, just use the H2 db, especially if you’re just trying it out
- when asked for the location of git repositories, just let it put them in the default location
- don’t go changing things in the filesystem after you’ve installed it; a schoolboy error, admittedly, but the tool doesn’t appear defensive enough to say “Oi! you’ve broken something here, mate!”
- you need to ‘create-project’ from the command line before you can “git push” anything
- you need to create the branch in the web ui before you can “git push” changes on a branch
- be prepared for the ui to be green. I hate green with a vengeance.
Other than that, it looks good enough to continue investigations…