Announcing git-deps: commit dependency analysis / visualization tool

By , January 19, 2015 12:15 am

I’m happy to announce a new tool called git-deps which performs automatic analysis and visualization of dependencies between commits in a git repository. Here’s a screencast demonstration!

Back in 2013 I blogged about some tools I wrote which harness the notes feature of git to help with the process of porting commits from one branch to another. These are mostly useful in the cases where porting is more complex than just cherry-picking a small number of commits.

However, even in the case where there are a small number of desired commits, sometimes those commits have hidden dependencies on other commits which you didn’t particularly want, but need to pull in anyway, e.g. in order to avoid conflicts during cherry-picking. Of course those secondary commits may in turn require other commits, and before you know it, you’re in dependency hell, which is only supposed to happen if you’re trying to install Linux packages and it’s still 1998 … but in fact that’s exactly what happened to me at SUSEcon 2013, when I attempted to help a colleague backport a bugfix in OpenStack Nova from the master branch to a stable release branch.

At first sight it looked like it would only require a trivial git cherry-pick, but that immediately revealed conflicts due to related code having changed in master since the release was made. I manually found the underlying commit which the bugfix required by using git blame, and tried another cherry-pick. The same thing happened again. Very soon I found myself in a quagmire of dependencies between commits, with no idea whether the end was in sight.

So wouldn’t it be nice if you could see the dependency tree ahead of time, rather than spending a whole bunch of time resolving unexpected conflicts due to missing dependencies, only to realise that the tree’s way deeper than you expected, and that actually a totally different approach is needed? Well, I thought it would, and so git-deps was born!

In coffee breaks during the ensuing openSUSE conference at the same venue, I feverishly hacked together a prototype and it seemed to work. Then normal life intervened, and no progress was made for another year.

However thanks to SUSE’s generous Hack Week policy, I have had the luxury of being able to spending some of early January 2015 working to bring this tool to the next level. I submitted a Hack Week project page, announced my intentions on the git mailing list, started hacking, missed quite a bit of sleep, and finally recorded the above screencast.

The tool is available here:

Please give it a go and let me know what you think! I’m particularly interested in hearing ideas for use cases I didn’t think of yet, and proposals for integration with other git web front-ends.


3 Responses to “Announcing git-deps: commit dependency analysis / visualization tool”

  1. Nice tool! I previously wrote `patchdeps`, a similar tool which handles both patches and git commits by manually analyzing the diff output. Your approach of just parsing git blame output looks great to me, the code is a lot simpler.

    At some point I got stuck at not being able to properly find dependencies without looking at the entire history when some more complex merges were involved. It seems your code just lets git sort this stuff out through blame 🙂

    I’ll keep this tool in mind the next time I have a bunch of patches to sort out 🙂

    • Adam says:

      Hi Matthijs! It’s funny – actually I just discovered `patchdeps` a few hours before you wrote this 🙂 Before I first wrote git-deps in late 2013 I googled around for any existing tools but didn’t find yours for some reason :-/ Otherwise I would have tried to build on yours instead of reinventing the wheel – sorry about that. But yes, it is a slightly different approach, although yours has the advantage of working with other SCMs I guess.

  2. […] Announcing git-deps: commit dependency analysis / visualization tool […]

Leave a Reply


Panorama Theme by Themocracy