Download:
child 174:9ef694997649
parent 172:5be4b5a42212
173:30e27c4a23c6
Anton Shestakov <av6@dwimlabs.net>, Fri, 22 Jul 2016 10:29:31 +0800
queue: we track changes, not hashes (also, they could be refs)

1 файлов изменено, 8 вставок(+), 8 удалений(-) [+]
hooks-queue.py file | annotate | diff | comparison | revisions
--- a/hooks-queue.py Thu Jul 21 23:38:15 2016 +0800
+++ b/hooks-queue.py Fri Jul 22 10:29:31 2016 +0800
@@ -23,16 +23,16 @@
def rconn(self):
return self.application.rconn
- def push(self, base, hashes):
- for hash_ in hashes:
+ def push(self, base, changes):
+ for change in changes:
item = base.copy()
- item['change'] = hash_
+ item['change'] = change
data = json.dumps(item)
logging.debug('Pushing %s', data)
self.rconn.rpush('candolint:queue:changes', data)
logging.info('Pushed a change for %s', item['repo'])
- self.finish({'result': 'OK', 'queued': len(hashes)})
+ self.finish({'result': 'OK', 'queued': len(changes)})
class BitbucketHookHandler(BaseHookHandler):
@@ -46,13 +46,13 @@
'source': 'bitbucket.org'
}
- hashes = set()
+ changes = set()
for change in payload['push']['changes']:
for head in change['new'].get('heads', []):
- hashes.add(head['hash'])
- hashes.add(change['new']['target']['hash'])
+ changes.add(head['hash'])
+ changes.add(change['new']['target']['hash'])
- self.push(base, hashes)
+ self.push(base, changes)
class CandolintHooks(Application):