Northward Midget Pole to Pole


Gitweb Diffs Between Versions

Posted by Quinn

Our company deploys code into production primarily from our version control system.  I suppose all companies do, in some way or another.  We endured a long hell with CVS and a far shorter stint in the purgatory of Subversion before we went into the heavenly light of Git.

The way we do it is to tag various branches destined for certain groups of machines, archive a snapshot, then copy those out to where they belong.  This is all partially automated by an awesome (if somewhat Byzantine) home-grown software suite that I inherited once the original author left for (at least literally) greener pastures in the Pacific northwest.

I'm not normally in charge of deployment, but since I "own" the software now and the usual dude is on a well-deserved vacation, this week I'm handling the once-weekly scheduled deploy and the multitude of little tweaks that absolutely positively must go out immediately.

Our regular deployment manager sends out hand-written emails when he starts a test deploy, initiates the production deploy, then a final one when everything is finished.  Myself,  being a hacker, just can't stomach the thought of not having something like that automated.  Thus, I dug into the command that prints the deployment status of all servers and hacked it up to be slightly more informative and email-friendly, so I could just copy-and-paste its output to an email.

Then I thought, as all hackers think, "Wouldn't it be cool if I could include a link to Gitweb that shows the exact changes that occurred since the previous deploy?"  I know the previous version commit-ish deployed to each  server, and of course I know the new one, so I could do it quite easily with a simple git command.

However, I didn't want to just slap that command in there so someone could (and likely never would) issue it within their cloned repo.  I wanted a simple clickable link to Gitweb.  Anyway, the query ends up being something like this, tacked onto your own Gitweb URL, of course:;a=commitdiff;hp=695de2d;h=fb7b608

Where hp is the previous commit-ish and h is the usual "current" commit-ish argument.


The next step was to group all the servers by common changes so there's only one diff link per group, and next I might try adding an --email-to option to send the email, skipping the copy-and-paste.

...and then I'll work on the bugs.

Tagged as: 4 Comments