Skip to content

Make resource compatible with Bitbucket 7 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from

Conversation

holgerstolzenberg
Copy link

@holgerstolzenberg holgerstolzenberg commented Jul 1, 2020

The PR in general restores the compatibility with Bitbucket 7+ using the REST API instead of the Git refs. It is in an early but working stage and might need further cleanup/refactoring.

Code review and advice is pretty much appreciated.

The PR also adds a config option (debug) to the resource to turn on bash tracing.

Fixes #3

@holgerstolzenberg holgerstolzenberg marked this pull request as draft July 1, 2020 13:07
@holgerstolzenberg holgerstolzenberg marked this pull request as ready for review July 1, 2020 13:07
#git checkout -B $branch origin/$branch

git fetch $depthflag origin "${prq_from_branch}"
git checkout -B "${prq_from_branch}" "origin/${prq_from_branch}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the behavior of the resource.

The original code would checkout the special commit refs/pull-requests/$id/merge which is an automatic merge of the branches involved in the pull request.

To maintain the same behavior, we should checkout the to_branch and immediately merge the from_branch.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have to say I am not a git pro. In my understanding you want to do the following:

Pseudo:

git fetch […] from_branch
git fetch […] to_branch
git checktout -B to_branch
git merge from_branch

?? commit // What to do on merge conflict?

Can you please confirm my assumption or state the git calls to be integrated?

@thomasd-
Copy link

Hi, thanks for your PR, I think this change is globally a good idea. We didn't made the move to bitbucket 7 within emerald-squad, so I will have to check that these change still work with older versions before we can merge them.

@holgerstolzenberg
Copy link
Author

The fixes supplied by the PR are working, but we stumbled upon another issue in the out script.
The problematic line is out#99

prq_hash=$(echo "$ls_remote" | grep -E "/pull\-requests/${prq_number}/from" | awk '{print $1}')

that is also relying on the old ref. We have been able to workaround this by using the eager PR plugin for the moment, but this should also be fixed.

I am tough on schedule this week and holidays coming afterwards, so it looks like I won´t be able to supply that fix. Could you help out here?

@holgerstolzenberg
Copy link
Author

Fixed the merge conflict. Using the resource with the modifications without problems.

  • Any chance to get the PR merged?
  • Did you manage to have a look at my last comment regarding the out script.

@vijayantprakash
Copy link

@holgerstolzenberg @thomasd- is this issue fixed ?

@vijayantprakash
Copy link

@thomasd- any updates on this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resource not compatible with Bitbucket 7+
3 participants