summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2009-12-29 00:51:48 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2009-12-29 00:51:48 +0100
commit6b223a1f039ecd6ed515e0f2714aa7a1f0a44c1b (patch)
tree9c4835ba92d4117b4e8001a748c6b1c09adbc23e
parente5f4d0ad1d36a298e46d7c4e86851f5fc658ee59 (diff)
Added support for URLs to web frontends.
-rwxr-xr-xgitnoti.py10
1 files changed, 9 insertions, 1 deletions
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):