aboutsummaryrefslogtreecommitdiffstats
path: root/plugin.py
diff options
context:
space:
mode:
authorkongr45gpen <kongr45gpen@helit.org>2013-08-01 13:05:37 +0300
committerkongr45gpen <kongr45gpen@helit.org>2013-08-01 13:05:37 +0300
commit1f54970da256d1a868e8bb960baf0c319f173214 (patch)
treed7603c9e06ad6cfea0b8a8402c3bc184e09688a5 /plugin.py
parentb05c1fb9aa25f4794dfd9d9f23ffc1a1881e5cf8 (diff)
downloadsupybot_github-1f54970da256d1a868e8bb960baf0c319f173214.tar.gz
supybot_github-1f54970da256d1a868e8bb960baf0c319f173214.tar.bz2
supybot_github-1f54970da256d1a868e8bb960baf0c319f173214.zip
Add support for branch creation and deletion messages
Diffstat (limited to 'plugin.py')
-rw-r--r--plugin.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/plugin.py b/plugin.py
index 08bc78c..e063431 100644
--- a/plugin.py
+++ b/plugin.py
@@ -59,6 +59,8 @@ def colorAction(action):
return ircutils.bold(ircutils.mircColor(action, "light blue"))
if action == "reopened":
return ircutils.bold(ircutils.mircColor(action, "blue"))
+ if action == "forced the creation of" or action == "forced the deletion of":
+ return ircutils.bold(ircutils.mircColor(action,"brown"))
return action
def registryValue(plugin, name, channel=None, value=True):
@@ -168,7 +170,24 @@ class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler):
commitno = len(data['commits'])
branch = data['ref'].split('/',2)[2]
- if configValue("hidePush",None) is False:
+ branched = data['created'] or data['deleted']
+ branchFrom = ''
+ if branched:
+ if 'base_ref' in data:
+ branchFrom = ' by %s' % (data['base_ref'].split('/',2)[2],)
+ if data['created'] and not data['forced']:
+ action = "created"
+ elif data['deleted'] and not data['forced']:
+ action = "deleted"
+ elif data['created']:
+ action = "created"
+ elif data['deleted']:
+ action = "deleted"
+ else:
+ action = "did something with"
+
+
+ if configValue("hidePush",None) == False and not branched:
msgs.append( ircmsgs.privmsg(channel, "%s @ %s: %s pushed %s %s (%s):" % (
ircutils.bold(ircutils.mircColor(branch, "blue")),
ircutils.bold(data['repository']['name']),
@@ -177,6 +196,15 @@ class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler):
plural(commitno, "commit", "commits"),
getShortURL(data['compare'])
)) )
+ elif branched:
+ msgs.append( ircmsgs.privmsg(channel, "%s: %s %s branch %s%s (%s):" % (
+ ircutils.bold(data['repository']['name']),
+ ircutils.mircColor(data['pusher']['name'], "green"),
+ colorAction(action),
+ ircutils.bold(ircutils.mircColor(branch, "blue")),
+ branchFrom,
+ getShortURL(data['compare'])
+ )) )
for commit in data['commits']:
if 'username' in commit['author']:

© 2014-2024 Faster IT GmbH | imprint | privacy policy