diff options
-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): |