Project.repository_merge_base([...]) with forks (remotes) #2883
-
I am trying to streamline some cherry-picking for gitlab workflows. The principle is simple:
Now, I can rather simple get to the point where I have the source branch and target branch as objects in the API workflow: # def get_project(project_id) -> Project
mr = project.mergerequests.get(id)
project = get_project(project_id)
source = get_project(mr.source_project_id, mr.manager.gitlab).branches.get(mr.source_branch)
target = project.branches.get(mr.target_branch) Generally these two originates from different sources, i.e. I tried: mb = project.repository_merge_base([
target.commit["web_url"],
source.commit["web_url"]
]) to no avail (not that i fully expected this to work)... So basically, how can I use The merge-request can either be merged, or not merged, both cases are interesting! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
First thing I would do is look at the upstream documentation: https://docs.gitlab.com/ee/api/repositories.html#merge-base From my quick glance I don't think it will work how you hope. I believe it only takes One thing that might be helpful for debugging is: |
Beta Was this translation helpful? Give feedback.
First thing I would do is look at the upstream documentation:
https://docs.gitlab.com/ee/api/repositories.html#merge-base
From my quick glance I don't think it will work how you hope. I believe it only takes
refs
aka SHA values.One thing that might be helpful for debugging is:
target.pprint()
that should print out all the values in the object. Which can be helpful. All the Python GitLab objects supportpprint()
,pformat()
,to_json()
, andasdict()
. Depending on the situation they can be useful in debugging code.