Part of my responsibilities at my day job involves reviewing other people’s code. There can be a fairly large number of Pull Requests in many different repositories that I need to monitor. In the past, while I was working on OpenStack, I was quite fond of Gertty to give me a quick glance of the new PRs and help me spend my time better. I missed this tool after I changed teams and most of the code reviews happened on Github rather than Gerrit.

About a year ago, I decided to scratch my own itch and looked at how hard it would be to port Gertty to the Github API and workflow. It turned out to not be so difficult: Gertty is well designed and it’s a joy to work with its source code. Hubtty was born.

Hubtty v0.1

Meet Hubtty

How Hubtty came to be

OK, so where do I start? How do I port Gertty from Gerrit to Github? A quick look at the Github REST API tells me it should be possible to port most of the Gertty’s features relatively easily. I considered for a minute using a python library to talk to the Github API but rapidly put this idea aside as it would mean rewriting a lot of the sync module: Gertty uses the requests library to talk to the Gerrit REST API directly and I figured I could simply reuse the same call, but with the Gitub API instead as the two APIs are more or less compatible.

After experimenting a bit, I was quickly able to retrieve the list of PRs for each repositories the user had subscribed to. Excited with this early success I set myself a goal to send the first review from Hubtty before the end of the year (it was November) which I barely did.

At this time, Hubtty was still relying on an existing authorization token that you had to create manually from the Github UI or “borrow” from another application. Next step was to implement the device flow so that Hubtty could create Authorization tokens on the user’s behalf. This part was straightforward but I realized it now forces the organizations to explicitely approve Hubtty when they have enabled third-party application restrictions otherwise it wouldn’t be able to submit reviews. This is still an issue to this day.

After I started subscribing to more repositories I ran into issues with the Github API rate limiting. The issue was rather obvious and quickly fixed. A less obvious issue gave me a hard time and only manifested when I got back to using Hubtty after some time – think PTO – where it would only sync part of the PRs. It was an problem with how I handled the pagination for some queries, leading to this nasty synchronization issue.

Another big part was to port the search syntax to the Github search. As of today, I’ve implemented the most important search operators and left out things we do not yet synchronize with Hubtty.

Finally, I’ve also made Hubtty consistently use the Github terminology. For example, it now uses Repository over Project (which means something entirely different for Github), and Pull Request over Change to list the most obvious. This was quite painful.

I used Hubtty as my inbox for PRs for the major part of this year and it was getting more stable, to the point I’m no longer ashamed of recommending it to others.

What it looks like now

On Friday I released the first version of Hubtty, v0.1. It has reached a state where it has feature parity with Gertty, or close enough, and is also stable enough to be used by other developers.

It’s available through the cheese shop, install it with:

pip install hubtty

Take a look:

Repositories list

List of subscribed repositories

PRs list

List of PRs in a subscribed repository

PR view

Opening a PR

Diff view

Viewing code changes

Plans ahead

In the coming versions, I’d like to have it integrate better with the Github features and improve UX. There is a lot to do, among other things:

  • Markdown rendering
  • Highlight PR with merge conflicts
  • Highlight draft PRs
  • Sync draft reviews
  • Autocompletion for usernames
  • Cherry-pick PRs
  • Reactions
  • …

I would also like to have hubtty packaged for the major distros. This should be relatively straightforward considering gertty has already done the work for us.

I hope it’s going to be as useful to you as it is to me.

Test it, give feedback, and report issues and feature requests on the Github project page.

Happy hacking!