zulip/zerver/webhooks/bitbucket2
Eeshan Garg 026ff48020 webhooks/bitbucket2: Detect pushes that remove branches correctly.
This was a user-reported bug and a very subtle and painful one
to track down.

Previously, if payload['push']['changes'][i]['closed'] was True,
we assumed that a branch was removed. Looking at whether `closed`
was set to True or not was our way to tell whether a push removed
a branch or not.

However, this is wrong! `closed` being set to True can also mean
that the pull request associated with the branch was approved but
the branch itself was not deleted. According to the BitBucket docs,
the correct way to see if a branch is deleted is to check if `new`
is null.

This bug was leading to KeyErrors about not being able to find
the `commits` key, which shouldn't happen anymore!
2018-04-02 19:30:09 -02:30
..
fixtures webhooks/bitbucket2: Ignore push events with no changes. 2017-11-26 17:03:07 -08:00
__init__.py Make webhooks as separate modules with view and tests. 2017-01-25 23:14:19 -08:00
doc.md webhooks/bitbucket2: Update text to conform to doc style guide. 2018-03-08 08:19:32 -08:00
tests.py webhooks: Migrate 14 webhooks to use check_send_webhook_message. 2018-03-16 11:34:20 -07:00
view.py webhooks/bitbucket2: Detect pushes that remove branches correctly. 2018-04-02 19:30:09 -02:30