Fix for ticket:2981: Bitbucket hook doesn't work when specifying project

I basically just copied the fix from the ``github.py`` web hook dialect.
If you could, that'd be great.

`firstOrNothing` should go to `buildbot.util` then.