diff options
author | kongr45gpen <electrovesta@gmail.com> | 2017-05-18 03:20:12 +0300 |
---|---|---|
committer | kongr45gpen <electrovesta@gmail.com> | 2017-05-18 03:20:12 +0300 |
commit | e350d277690773bf0cca5da00718a73262d69149 (patch) | |
tree | 6f0d04510cfdb7adf2a7ccc02f7ecdaf754ba59c /local/handler | |
parent | ec80993f8f076874eb346cbf7c43dbd9301ac1e1 (diff) | |
download | supybot_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/handler')
-rw-r--r-- | local/handler/PushHandler.py | 35 |
1 files changed, 27 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 + + |