Slack Collaboration with Visual SVN Integration via Commit Hooks & a Perl script

Finding a Suitable Collaborative Chat Tool

After trying Campfire, Bitrix24 and HipChat, I finally settled on Slack as my preference for a collaboration tool for our team.

Campfire was very bare bones, and the various window client options just didn't do it for me.

Hipchat had huge potential, though when i get into it, most of the features I wanted where not in the software, but on their suggestions page. Some with hundreds of votes but no reply.

Bitrix was close, but is a whole intranet in the cloud so was a bit of overkill. I only needed the chat. and it does that ok, though didn't have the IRC like room set up I was after.

Slack

Slack was everything I was after. I was a bit critical when the instructions for the windows client consisted of how to turn the webpage into a chrome application shortcut. I originally wanted something that would give the taskbar a notify glow (not a blink as some clients did) so the dev's new that there was a conversation going on, but not annoying enough ot break them out of the zone if there were not participating.

A quick search confirmed that neither a script, or extension that would glow the task bar, though the use of notifications would likely do the job, if not a bit more distracting than I would like.

The chat, room and search features were everything I wanted, but the real power cam via the integration tools.

In a few clicks a Jira channel was showing new & closed tickets from my on premises install. Though I was sure to vote for confluence integration in their integration feedback survey, as that was not out of the box,. though likely not difficult to craft my own.

SVN Integration

Next was SVN, this was a bit trickier as the instructions for integration was a perl script on github.

The next challenge was that I was not suing SVN on a linux box,. but SVN server in windows. This meant that Visual SVN called a batch file, passed in the repository name and revision as arguments, which needed that to fire the Perlscript.

First of all, I needed Perl. and grabbed a download of Active State Perl

Next, triggering the script via Visual SVN.

Right clicking on the repository in Visual SVN, then Properties then the Hooks tab brought up a window, where i could Edit the Post-commit hook.

Here I entered the DOS command to fire my batch file.

c:
cd\Program Files (x86)\VisualSVN Server\bin\
hook %1 %2

Next I created hook.bat and placed it in the folder above. This woulds take the 2 args and pass it to the PERL script.

"C:\Perl\bin\perl.exe" "C:\Program Files (x86)\VisualSVN Server\bin\svn.pl" %1 %2

With the plumbing ot the Perl script out of the way, I modified the PERL script to run on windows, which involved changing the linux friendly...

my $log = `/usr/bin/svnlook log -r $ARGV[1] $ARGV[0]`;
my $who = `/usr/bin/svnlook author -r $ARGV[1] $ARGV[0]`;

To the more windows command line friendly...

my $log = `svnlook log -r $ARGV[1] $ARGV[0]`;
my $who = `svnlook author -r $ARGV[1] $ARGV[0]`;

 

After testing by firing my bat file manually, and a few SVN commits, I had all my SVN updates posted to their own channel in Slack.

Confluence is next, so that updates and new pages can go into their own channel too. 

 

Leave a Reply