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 (27)

  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. Silas Baronda

    +1, seriously. I love the GH feature that any SHA URL can be changed to generate a diff or patch by adding either .diff or .patch to the end of the url. Would love this feature with BB Server.

  4. Kalpit_Jain

    +1, This is a much needed feature to simplify and ease the patch generation from a pull-request. It will be great if the patch url can be exposed to the users.

  5. podsiadly

    Had the same need, but worked around it. I created a branch, edited pull request destination to be that new branch, merged pull request there and pulled the branch to my local git repo.

    Link to download patch would be much more convenient

  6. Jeffrey Harris

    It's really painful not to have this for bitbucket server.

    I can't figure out how to construct a XPC-RPC request for this by hand, even. It's really painful to have to use Bitbucket's broken merge feature to accept patches.

  7. Log in to comment