Skip to content

Conversation

fmuellner
Copy link
Contributor

When trying to guess the merge request that corresponds to a
local branch, we search for MRs that match the (upstream) branch
name.

But as branch names only have to be unique within a project, it
is possible that there are multiple merge requests from different
forks that use the same source branch name.

Luckily we do know which is the correct source project: It's the
one that corresponds to the remote that the local branch was pushed
to.

fmuellner added 2 commits July 1, 2022 04:35
When trying to find the merge request that corresponds to the
local branch, we cannot assume that the branch was pushed to
the upstream repository instead of a personal fork.

This reverts commit 472b2e6.
When trying to guess the merge request that corresponds to a
local branch, we search for MRs that match the (upstream) branch
name.

But as branch names only have to be unique within a project, it
is possible that there are multiple merge requests from different
forks that use the same source branch name.

Luckily we do know which is the correct source project: It's the
one that corresponds to the remote that the local branch was pushed
to.
The changes from commit 9fa3698 changed the expected behavior on
Test_mrBrowseCurrent test code, which was waiting for an MR created from
the upstream repository instead of the fork that the 'mrtest' branch
tracks. This patch fix it by checking-out to the 'mrtest2' branch and
waiting for MR 3, which was created from fork's 'mrtest2' branch.

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
@bmeneg
Copy link
Collaborator

bmeneg commented Jul 2, 2022

This PR changes the expected behavior by the Test_mrBrowseCurrent test code: the mrtest branch tracks the lab-testing remote, while the test expects an MR (!1) which has as its source project the upstream own mrtest branch.

To fix it I pushed to your branch the necessary changes in cmd/mr_browse_test.go. Hopefully, it'll be enough.

@bmeneg bmeneg self-requested a review July 2, 2022 22:26
@codecov
Copy link

codecov bot commented Jul 2, 2022

Codecov Report

Merging #838 (7d8a8c7) into master (42a1af3) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #838      +/-   ##
==========================================
+ Coverage   55.94%   55.99%   +0.04%     
==========================================
  Files          77       77              
  Lines        5750     5751       +1     
==========================================
+ Hits         3217     3220       +3     
+ Misses       2243     2242       -1     
+ Partials      290      289       -1     
Impacted Files Coverage Δ
internal/gitlab/gitlab.go 8.35% <ø> (-0.44%) ⬇️
cmd/util.go 74.72% <100.00%> (+0.56%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 42a1af3...7d8a8c7. Read the comment docs.

@bmeneg
Copy link
Collaborator

bmeneg commented Jul 2, 2022

I'll also create a "hotfix" with your change and release it as 0.25.1.
Many thanks, @fmuellner!

@bmeneg bmeneg merged commit 0e2f2f2 into zaquestion:master Jul 2, 2022
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.

2 participants