Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Current Atlassian position regarding refs/pull-requests/*/from (merge) refs

Hello!

I would like to follow-up on this thread response:
https://community.atlassian.com/t5/Bitbucket-questions/Difference-of-refs-pull-requests-lt-ID-gt-merge-and-refs-pull/qaq-p/772142

Long story short, I wanted to confirm if:
a) are "from" refs considered to be internal as well as "merge"? I`m asking because this guide: https://www.atlassian.com/git/articles/pull-request-proficiency-fetching-abilities-unlocked explicitly mentions usage of refspec on */from ref. Is it safe to use it?
b) has anything changed regarding the */merge refs, by chance (in terms of being officially supported/internal)?
c) as of now, we do have an implementation which is dependant on */from refs. Do you have any plans for implementing the same refs for the Bitbucket Cloud?

Looking forward to hear from you on this topic - please let me know if you`d like any details on the questions above.

2 answers

0 votes
Bryan Turner Atlassian Team May 13, 2020

@Freddy

a) Pull request refs have always been, and still are, considered an internal implementation detail. We document how to use them, but the primary purpose for that is for developers to be able to fetch changes and play around with them locally in an editor or other environment. Pull request refs are not updated in a deterministic fashion, which makes relying on them for builds, for example, dangerous. (This is exacerbated in 7.x; see BSERV-12284 for more details.)

b) 7.x no longer creates "merge" refs, as part of switching from 3-way diffs in pull requests to 2-way diffs, so anything built against them will not be possible on 7.0 or newer. We currently have no plans to ever bring "merge" refs back.

c) The Bitbucket Server team has no direct connection with Bitbucket Cloud. The two systems don't share a single line of code (they're not even written in the same language). BCLOUD-5814 is an open issue about adding pull request refs to Cloud, in case it's useful to you for advocating for the feature or tracking its delivery.

Hope this helps!
Bryan Turner
Atlassian Bitbucket

@Bryan Turner  hi , Is it correct to say that the from branch is created only when user switch to the diff tab in a pull request and not when the pull request is created ? 

I seem to be experiencing the same thing, just wondering if you found another way to trigger builds on creation of the PR without having to go down the webhooks path. @Bryan Turner are you able to confirm if there's another way?

@John Clarete  Not sure it is related the build triggering to this pr. 

Maybe you wanted to reply to the main thread of this question but you replied to my comment.
I was referring on the branch created in background by BB when a pr is opening. Was not talking about the build at all. 

Bryan Turner Atlassian Team Feb 08, 2021

@John Clarete- I'm not really sure what you're asking here. Bitbucket Server doesn't raise webhooks for pull request ref changes. How you trigger your builds is largely up to you and the CI system you use. I'd assume most people use polling, or use a webhook coupled to the underlying pull request itself (i.e. the "pr:from_ref_updated" webhook; though, please note, that webhook is about when the ref is updated in the database, not in the underlying Git repository).

@Jgafner- Just a quick update for you while I'm here, but BSERV-12284 is now in progress, and a future version will make updating the "from" ref in the repository more deterministic. (It will not bring back "merge" refs, though; we have no plans to do so.)

Best regards,
Bryan Turner
Atlassian Bitbucket

@Bryan Turner  Sorry for the lack of context. Basically I'm relying on the "from" branch to be created when the PR is created (it just happens that I'm using this for the build process) but as discussed here it does not do that and this is by design. I was hoping there was another way to get the from branch created automatically or if @Jgafner found a way to create the branch in the background until BSERV-12284 is completed.

Bryan Turner Atlassian Team Feb 08, 2021

There's a third-party plugin that's been created that automatically makes a call to get the pull request effective diff which, with the existing code, will create or update the "from" ref. I can't speak to the quality of it (I've never looked at it), and you'd need to investigate the performance implications of using it in your environment, but it may be a way forward until BSERV-12284 ships.

Best regards,
Bryan Turner
Atlassian Bitbucket

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Bitbucket

How do you use the Bitbucket-Jira integration? How does it help your team?

Hey everyone, over the past year, we've added several new features on how you can use Bitbucket and Jira together. We'd love to know how you'll are using the integration and how it's helping your t...

103 views 0 2
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you