Fix the extraction of commit hashes from Bitbucket webhook payloads.

Review Request #5851 — Created May 21, 2014 and submitted — Latest diff uploaded

Information

Review Board
master
fa473c2...

Reviewers

I needed to make this change before /bitbucket/hooks/close-submitted/ would work for commits which don't have the review request ID in the commit message.
This is what a Bitbucket webhook looks like:
https://gist.github.com/orrc/0dcbede4f5536cf3f1d7

I don't have access to a Mercurial repository, but according to the sparse documentation of the format, the important parts of the Mercurial webhook JSON are identical to the git version:
https://confluence.atlassian.com/display/BITBUCKET/POST+hook+management

--

Previously, the commit hash was read from the 'node' field of the JSON payload,
which only holds the first 12 characters of the git hash.

If we're trying to determine which review request ID corresponds to a given
webhook, but the request ID is not mentioned in the commit comment, then we must
search for an existing review request which matches the commit hash in the
webhook payload.

Since the 'get_review_request_id' function searches for an exact match of the
commit hash, we now use the 'raw_node' property, which contains the full hash.

Tested by pushing to a private Bitbucket git.
The commit did not mention the review request ID, but the request was automatically closed after the webhook was received.

    Loading...