diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2009-12-29 00:51:48 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2009-12-29 00:51:48 +0100 |
commit | 6b223a1f039ecd6ed515e0f2714aa7a1f0a44c1b (patch) | |
tree | 9c4835ba92d4117b4e8001a748c6b1c09adbc23e | |
parent | e5f4d0ad1d36a298e46d7c4e86851f5fc658ee59 (diff) |
Added support for URLs to web frontends.
-rwxr-xr-x | gitnoti.py | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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): |