From 6b223a1f039ecd6ed515e0f2714aa7a1f0a44c1b Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Tue, 29 Dec 2009 00:51:48 +0100 Subject: Added support for URLs to web frontends. --- gitnoti.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gitnoti.py b/gitnoti.py index 02949fe..5f2fd40 100755 --- a/gitnoti.py +++ b/gitnoti.py @@ -13,6 +13,7 @@ parser.add_option('-n', '--nick', default = 'git') parser.add_option('-d', '--dir') parser.add_option('-c', '--channel') parser.add_option('-i', '--interval', type = 'int', default = 10) +parser.add_option('-u', '--url') (options, args) = parser.parse_args() @@ -28,16 +29,23 @@ if root[-1] == '/': repos = None def repo_commit_msg(repo, commit): + reponame = os.path.splitext(os.path.basename(repo.path))[0] + stat = '%d files,' % commit.stats.total['files'] stat += ' \00305--%d\017' % commit.stats.total['deletions'] stat += ' \00303++%d\017' % commit.stats.total['insertions'] msg = '\002%s\002 pushed to \002%s\002 by \002%s\002 (%s) %s' % ( - os.path.splitext(os.path.basename(repo.path))[0], + reponame, commit.id_abbrev, commit.committer.name if commit.author.name == commit.committer.name else '%s/%s' % (commit.committer.name, commit.author.name), stat, commit.summary ) + + if options.url: + msg += ' | ' + msg += options.url % {'repo': reponame, 'commit': commit.id} + return msg class ReposNotifyEvent(pyinotify.ProcessEvent): -- cgit v1.2.3