Download:
child 155:79dbe7a162d5
parent 153:c50882dabe4f
154:e9b7e35f97bb
Anton Shestakov <av6@dwimlabs.net>, Sun, 17 Jul 2016 23:42:38 +0800
queue: git hooks naturally don't provide topological branch heads

1 файлов изменено, 8 вставок(+), 7 удалений(-) [+]
hooks-queue.py file | annotate | diff | comparison | revisions
--- a/hooks-queue.py Sun Jul 17 23:25:29 2016 +0800
+++ b/hooks-queue.py Sun Jul 17 23:42:38 2016 +0800
@@ -29,20 +29,21 @@
'source': 'bitbucket.org'
}
- items = []
+ hashes = set()
for change in payload['push']['changes']:
- for head in change['new']['heads']:
- item = base.copy()
- item.update(change=head['hash'])
- items.append(item)
+ for head in change['new'].get('heads', []):
+ hashes.add(head['hash'])
+ hashes.add(change['new']['target']['hash'])
- for item in items:
+ for hash_ in hashes:
+ item = base.copy()
+ item['change'] = hash_
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({'message': 'OK, added {}'.format(len(items))})
+ self.finish({'message': 'OK, added {}'.format(len(hashes))})
@property
def rconn(self):