Fix the extraction of commit hashes from Bitbucket webhook payloads.

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

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.

reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/hostingsvcs/bitbucket.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/hostingsvcs/bitbucket.py
      Ignored Files:
    
    
  2. 
      
chipx86
  1. Ship It!

  2. 
      
OR
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (f6a0cba)