1. Bitbucket
  2. Public Issue Tracker
  3. master
  4. Issues

Issues

Issue #8323 open

Add link for raw patch to Pull Request UI (BB-9453)

nickspiers
created an issue

Using a git fork-clone-pull workflow, it's necessary sometimes to demo the pull request from the forked repository.

Currently you have to make sure you have all the appropriate permissions and pull down the forked repo which uses unnecessary time, space and bandwidth.

I propose a patch url where you could download a git patch that could be applied temporarily to your own pulled repo to demo the pull request.

Comments (19)

  1. fm-admin

    Another +1 for changes to the UI to make it -simple-possible to retrieve the URL for the patch file.

    Also thanks Andy Postnikov for the curl command as this solved my problem subsequently retrieving the patch file once I knew the URL for it (the destination repo is private).

    Using your solution, I was then able to use this one-liner to apply the patch within my local (clean) git directory:

    curl -u user:password https://bitbucket.org/api/2.0/repositories/{user}/{repo}/pullrequests/{pull_no}/diff -L | git apply -
    

    Update: unbelievable - now https://bitbucket.org/api/2.0/repositories/{user}/{repo}/pullrequests/{pull_no}/diff is just returning me a 403 (Forbidden) response.

    Latest update 10/7/15: slight change to the URL got this working again. Here's what works for me now:

    curl -u username:password https://api.bitbucket.org/2.0/repositories/{username}/{reponame}/pullrequests/{pull_no}/diff -L | git apply -
    
  2. Johan Walters

    Is 2.0 api also available for bitbucket server? I cannot find any relevant information on this. Version 1.0 of the rest api seems to work though, but that doesn't give what I need.

  3. Log in to comment