gg - A prototype to rule Git, GitHub and Bugzilla

06 May 2016   0 comments   Python, Web development

Powered by Fusion×

tl;dr; I'm starting a new "side-project". (I say side-project in quotation marks because I'm doing this for the sake of work ultimately). It's call gg and it's a command line program for doing various tasks to do with git, GitHub and Bugzilla.

Many years ago I noticed certain patterns of things I do. Usually work starts with a Bugzilla bug. I then need to make a new branch with the bug number in the branch name and when I'm done I need to push that branch to my fork and create a GitHub Pull Request. When it's been merged (or if I merge it manually myself) I have to go back to the master branch, fetch the upstream, delete the now merged branch and delete the remove branch. All of these things are tedious so I wrapped up my patterns in a little Python project called bgg, so I can do:

$ G start 123456789  # that's a bugzilla ID
# edit files and save
$ G commit
# now I wait for the Pull Request to be merged
$ G getback
# all things get cleaned up and I'm back on the master branch

This new project, gg, is a complete re-write of bgg but with some big changes:

  1. It's based on Click
  2. All sub-commands are separate projects with their own GitHub repo and PyPI submissions
  3. Instead of wrapping git commands in a subprocess, it uses GitPython.
  4. Audacious goals of major feature upgrades such as automatic bug/issue assignment, ability to see rebased branches and automatic Pull Request creation, etc.
  5. Audacious goal of documenting everything and succeed in getting other people to write their own plugins and share what they make. Or at least, make it easy to write your own plugin.

So far, I've only written 1 plugin. It's called gg-start. All it does is it creates branches for you. For example, you can type:

$ gg start https://github.com/org/repo/issues/1234
# or...
$ gg start https://bugzilla.mozilla.org/show_bug.cgi?id=123456789
# or...
$ gg start

And it figures out a good branch name, remembers the issue title and checks out the new branch. All that stuff is saved in ~/.gg.json so that when you later (and this plugin hasn't been built yet) type gg commit it can use that title to automatically suggest a good git commit message and it should know where to push it and start the GitHub Pull Request etc.

My intention is to first get decent parity with bgg. So I'll need to create plugins called gg-commit, gg-branches, gg-rebase, gg-getback, gg-cleanup, gg-tag, gg-merge and gg-push. Once parity is achieved I'm going to add some more fancy features and work hard on making it clear how you can write your own plugin.

Wish me luck!

Comments

Thank you for posting a comment

Your email will never ever be published


Related posts

Previous:
How to track Google Analytics pageviews on non-web requests (with Python) 03 May 2016
Next:
Decorated Concurrency - Python multiprocessing made really really easy 13 May 2016
Related by Keyword:
A neat trick to zip a git repo with a version number 01 September 2017
.git/info/exclude, .gitignore and ~/.gitignore_global 20 April 2016
A quicksearch for Bugzilla using Autocompeter 27 January 2016
How I git 18 June 2015
GitHub PR triage across multiple projects 28 April 2014
Related by Text:
How I git 18 June 2015
Headsupper.io 05 December 2015
Github Pull Request Triage tool 06 March 2014
GitHub PR triage across multiple projects 28 April 2014
.git/info/exclude, .gitignore and ~/.gitignore_global 20 April 2016