aboutsummaryrefslogtreecommitdiffstats
path: root/local
diff options
context:
space:
mode:
authorkongr45gpen <electrovesta@gmail.com>2017-05-18 03:20:12 +0300
committerkongr45gpen <electrovesta@gmail.com>2017-05-18 03:20:12 +0300
commite350d277690773bf0cca5da00718a73262d69149 (patch)
tree6f0d04510cfdb7adf2a7ccc02f7ecdaf754ba59c /local
parentec80993f8f076874eb346cbf7c43dbd9301ac1e1 (diff)
downloadsupybot_github-e350d277690773bf0cca5da00718a73262d69149.tar.gz
supybot_github-e350d277690773bf0cca5da00718a73262d69149.tar.bz2
supybot_github-e350d277690773bf0cca5da00718a73262d69149.zip
Add support for specifying the maximum commit count
Diffstat (limited to 'local')
-rw-r--r--local/handler/PushHandler.py35
-rw-r--r--local/theme/DefaultTheme.py7
2 files changed, 34 insertions, 8 deletions
diff --git a/local/handler/PushHandler.py b/local/handler/PushHandler.py
index 903b1b6..fc33d4f 100644
--- a/local/handler/PushHandler.py
+++ b/local/handler/PushHandler.py
@@ -90,7 +90,7 @@ def handle(data, theme):
url = urls
)
- for commit in data['commits']:
+ def __commit(commit):
if 'username' in commit['author']:
author = commit['author']['username']
else:
@@ -99,15 +99,34 @@ def handle(data, theme):
commitBranch = branch
if not commit['distinct'] and not configValue('showMergedCommits'):
- continue
+ return False
if isMerge and not commit['distinct']:
- commitBranch = "%s -> %s" % ( baseBranch, branch )
+ commitBranch = "%s -> %s" % (baseBranch, branch)
theme.commit(
- branch = commitBranch,
- author = author,
- id = commit['id'],
- message = commit['message'],
- url = getShortURL(commit['url'])
+ branch=commitBranch,
+ author=author,
+ id=commit['id'],
+ message=commit['message'],
+ url=getShortURL(commit['url'])
)
+
+ return True
+
+ i = 0
+ for commit in data['commits']:
+ max = configValue('maxCommitCount')
+ print "len of data commits is " + str(len(data['commits'])) + " while max+1= " + str(max+1)
+ if max != 0 and len(data['commits']) != max + 1 and i >= max:
+ theme.more(
+ branch = branch,
+ number = len(data['commits']) - i,
+ type = "commits"
+ )
+ break
+
+ if __commit(commit):
+ i += 1
+
+
diff --git a/local/theme/DefaultTheme.py b/local/theme/DefaultTheme.py
index 4215f51..d9ee11a 100644
--- a/local/theme/DefaultTheme.py
+++ b/local/theme/DefaultTheme.py
@@ -197,6 +197,13 @@ class DefaultTheme(Theme):
ircutils.mircColor(message, "light blue")
))
+ def more(self, branch, number, type):
+ self.msgs.append("%s: ...and %d more %s" % (
+ self.repo(branch),
+ number,
+ type
+ ))
+
def unknown(self, eventType, action, actor, url):
if action is not None:
if eventType is None:

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