From fbfb3932180f2888cc8f3c7929b20824c8aa749c Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Tue, 24 Sep 2013 16:45:42 +0100 Subject: [PATCH 3/3] Git: Fixed presentation of branches containing front-slashes. Many projects use hierarchical branch names, for example: "devs/tasn/feature-branch" Before this commit, the branch above would be printed as "feature-branch" instead of "devs/tasn/feature-branch". Signed-off-by: Bertrand Jacquin --- irkerhook.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/irkerhook.py b/irkerhook.py index f11cc47..2ff2dc3 100755 --- a/irkerhook.py +++ b/irkerhook.py @@ -39,7 +39,7 @@ default_channels = "irc://chat.freenode.net/#commits" version = "2.4" -import os, sys, commands, socket, urllib, subprocess, locale, datetime +import os, sys, commands, socket, urllib, subprocess, locale, datetime, re from pipes import quote as shellquote try: import simplejson as json # Faster, also makes us Python-2.5-compatible @@ -258,7 +258,8 @@ class GitExtractor(GenericExtractor): def commit_factory(self, commit_id): "Make a Commit object holding data for a specified commit ID." commit = Commit(self, commit_id) - commit.branch = os.path.basename(self.refname) + # Get rid of refs/*/ for cleaner output. + commit.branch = re.sub(r"^refs/[^/]*/", "", self.refname) # Compute a description for the revision if self.revformat == 'raw': commit.rev = commit.commit -- 1.8.5.1