zaquestion / lab

Lab wraps Git or Hub, making it simple to clone, fork, and interact with repositories on GitLab
https://zaquestion.github.io/lab
Creative Commons Zero v1.0 Universal
1.11k stars 102 forks source link

Consider branch remote when guessing MR #838

Closed fmuellner closed 2 years ago

fmuellner commented 2 years ago

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.

bmeneg commented 2 years ago

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.

codecov[bot] commented 2 years ago

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%) :arrow_down:
cmd/util.go 74.72% <100.00%> (+0.56%) :arrow_up:

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 commented 2 years ago

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