diff options
author | kongr45gpen <electrovesta@gmail.com> | 2017-01-04 00:27:19 +0200 |
---|---|---|
committer | kongr45gpen <electrovesta@gmail.com> | 2017-01-04 00:27:19 +0200 |
commit | 7f46f55d67c50f50dc51a00d2487250c4c1e5e94 (patch) | |
tree | 3247bdc33b5125b79433a1089dee2577b51c51ee /local | |
parent | fb353478e24e5e4341b86fec3a390906e5e8ce74 (diff) | |
download | supybot_github-7f46f55d67c50f50dc51a00d2487250c4c1e5e94.tar.gz supybot_github-7f46f55d67c50f50dc51a00d2487250c4c1e5e94.tar.bz2 supybot_github-7f46f55d67c50f50dc51a00d2487250c4c1e5e94.zip |
Note when a push is forced
Diffstat (limited to 'local')
-rw-r--r-- | local/handler/PushHandler.py | 16 | ||||
-rw-r--r-- | local/theme/DefaultTheme.py | 5 | ||||
-rw-r--r-- | local/utility.py | 7 |
3 files changed, 11 insertions, 17 deletions
diff --git a/local/handler/PushHandler.py b/local/handler/PushHandler.py index e40aa64..13052a3 100644 --- a/local/handler/PushHandler.py +++ b/local/handler/PushHandler.py @@ -29,17 +29,6 @@ def handle(data, theme): action = "re-tagged" else: action = "re-created" - elif data['created'] and not data['forced']: - if isTag: - action = "tagged" - else: - action = "created" - elif data['deleted'] and not data['forced']: - if isTag: - action = "deleted tag" - else: - action = "deleted" - urls = '' elif data['created']: if isTag: action = "tagged" @@ -62,9 +51,12 @@ def handle(data, theme): branch = branch, actor = data['pusher']['name'], url = getShortURL(data['compare']), - count = commitno + count = commitno, + forced = data['forced'] ) elif branched: + action = "force %s" % (action,) + if isTag: theme.tag( actor = data['pusher']['name'], diff --git a/local/theme/DefaultTheme.py b/local/theme/DefaultTheme.py index 3442383..96259d0 100644 --- a/local/theme/DefaultTheme.py +++ b/local/theme/DefaultTheme.py @@ -3,10 +3,11 @@ from Theme import Theme from ..utility import * class DefaultTheme(Theme): - def push(self, branch, actor, count, url): - self.msgs.append( "%s: %s pushed %s %s %s%s" % ( + def push(self, branch, actor, count, forced, url): + self.msgs.append( "%s: %s %s %s %s %s%s" % ( self.repo(branch), ircutils.mircColor(actor, "green"), + colorAction("force pushed") if forced else "pushed", ircutils.bold(str(count)), plural(count, "commit", "commits"), self.enclose(url), diff --git a/local/utility.py b/local/utility.py index 59dfd91..321637e 100644 --- a/local/utility.py +++ b/local/utility.py @@ -76,7 +76,7 @@ def maxLen(msg, maxn=400, splitLines=True): if splitLines is True: lines = msg.splitlines() - line = lines[0] + line = lines[0] if lines else "" else: line = msg @@ -90,6 +90,7 @@ def maxLen(msg, maxn=400, splitLines=True): def colorAction(action): """Give an action string (e.g. created, edited) and get a nice IRC colouring""" + if action in [ "created", "opened", "tagged", "success", "passed", "fixed", "published", "completed" ]: return ircutils.bold(ircutils.mircColor(action, "green")) @@ -101,8 +102,8 @@ def colorAction(action): return ircutils.bold(ircutils.mircColor(action, "light blue")) if action in [ "reopened", "pending" ]: return ircutils.bold(ircutils.mircColor(action, "blue")) - if action in [ "forced the creation of", "forced the deletion of" ]: - return ircutils.bold(ircutils.mircColor(action,"brown")) + if action[0:5] in [ "force" ]: + return ircutils.bold(ircutils.mircColor(action, "brown")) return action def getShortURL(longurl): |