# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1469154571 -28800
# Node ID 30e27c4a23c6cb8eb4ac39794612a9854748f5f2
# Parent  5be4b5a422120a748617bc6d56cd2558e70c0738
queue: we track changes, not hashes (also, they could be refs)

diff -r 5be4b5a42212 -r 30e27c4a23c6 hooks-queue.py
--- 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):