René's URL Explorer Experiment


Title: Project.repository_merge_base([...]) with forks (remotes) · python-gitlab/python-gitlab · Discussion #2883 · GitHub

Open Graph Title: Project.repository_merge_base([...]) with forks (remotes) · python-gitlab/python-gitlab · Discussion #2883

X Title: Project.repository_merge_base([...]) with forks (remotes) · python-gitlab/python-gitlab · Discussion #2883

Description: Project.repository_merge_base([...]) with forks (remotes)

Open Graph Description: I am trying to streamline some cherry-picking for gitlab workflows. The principle is simple: Create a merge-request and label it with a specific label that marks it to be backported (cherry picked)...

X Description: I am trying to streamline some cherry-picking for gitlab workflows. The principle is simple: Create a merge-request and label it with a specific label that marks it to be backported (cherry picked)...

Opengraph URL: https://github.com/python-gitlab/python-gitlab/discussions/2883

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Project.repository_merge_base([...]) with forks (remotes)","text":"

I am trying to streamline some cherry-picking for gitlab workflows.

\n

The principle is simple:

\n
    \n
  1. Create a merge-request and label it with a specific label that marks it to be backported (cherry picked)
  2. \n
  3. Run a script that can create the necassary cherry-pick command
  4. \n
\n

Now, I can rather simple get to the point where I have the source branch and target branch as objects in the API workflow:

\n
# def get_project(project_id) -> Project\nmr = project.mergerequests.get(id)\nproject = get_project(project_id)\nsource = get_project(mr.source_project_id, mr.manager.gitlab).branches.get(mr.source_branch)\ntarget = project.branches.get(mr.target_branch)
\n

Generally these two originates from different sources, i.e. target.web_url != source.web_url.

\n

I tried:

\n
mb = project.repository_merge_base([\n    target.commit[\"web_url\"],\n    source.commit[\"web_url\"]\n])
\n

to no avail (not that i fully expected this to work)...

\n

So basically, how can I use gitlab to extract the merge-base between the two branches? Or, can I retrieve the commits that will be added (or has been added) to target so I can create the necessary cherry-picks?

\n

The merge-request can either be merged, or not merged, both cases are interesting!

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

First thing I would do is look at the upstream documentation:

\n

https://docs.gitlab.com/ee/api/repositories.html#merge-base

\n

From my quick glance I don't think it will work how you hope. I believe it only takes refs aka SHA values.

\n

One thing that might be helpful for debugging is:
\ntarget.pprint() that should print out all the values in the object. Which can be helpful. All the Python GitLab objects support pprint(), pformat(), to_json(), and asdict(). Depending on the situation they can be useful in debugging code.

","upvoteCount":1,"url":"https://github.com/python-gitlab/python-gitlab/discussions/2883#discussioncomment-9549328"}}}

route-pattern/_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format)
route-controllervoltron_discussions_fragments
route-actiondiscussion_layout
fetch-noncev2:afbcd40a-3d2f-00ae-b7e2-0233d5d0d60a
current-catalog-service-hash9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be
request-idE946:1EF577:127406:198E42:697272E7
html-safe-noncef14445346bd159e8e1cfdc2163444d899256c8ce5491424e4fc65876d4df39f5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTQ2OjFFRjU3NzoxMjc0MDY6MTk4RTQyOjY5NzI3MkU3IiwidmlzaXRvcl9pZCI6IjY4NzE5NjQ0NjQzOTYyNjgyNjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc5ceeb1e4bb4d33b11f122e008aba79afd76e584b1afe7029813b37bed2172ba
hovercard-subject-tagdiscussion:6723481
github-keyboard-shortcutsrepository,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/discussions_fragments/discussion_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/python-gitlab/python-gitlab/2883/discussion_layout
twitter:imagehttps://opengraph.githubassets.com/4c4b765df5c28e32f3bf13b4266e84f0d67e7872246b47b5f1129fe4603ecf1d/python-gitlab/python-gitlab/discussions/2883
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4c4b765df5c28e32f3bf13b4266e84f0d67e7872246b47b5f1129fe4603ecf1d/python-gitlab/python-gitlab/discussions/2883
og:image:altI am trying to streamline some cherry-picking for gitlab workflows. The principle is simple: Create a merge-request and label it with a specific label that marks it to be backported (cherry picked)...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None3be355d8ea7ca74c4edec03a70ecaa8211862649e90886d88a4db13e6778e4c3
turbo-cache-controlno-preview
go-importgithub.com/python-gitlab/python-gitlab git https://github.com/python-gitlab/python-gitlab.git
octolytics-dimension-user_id28886265
octolytics-dimension-user_loginpython-gitlab
octolytics-dimension-repository_id8077625
octolytics-dimension-repository_nwopython-gitlab/python-gitlab
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id8077625
octolytics-dimension-repository_network_root_nwopython-gitlab/python-gitlab
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4ae5b6c1e16519c3e3ad37a388f7cca2192a79a8
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python-gitlab/python-gitlab/discussions/2883#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-gitlab%2Fpython-gitlab%2Fdiscussions%2F2883
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-gitlab%2Fpython-gitlab%2Fdiscussions%2F2883
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fdiscussions_fragments%2Fdiscussion_layout&source=header-repo&source_repo=python-gitlab%2Fpython-gitlab
Reloadhttps://github.com/python-gitlab/python-gitlab/discussions/2883
Reloadhttps://github.com/python-gitlab/python-gitlab/discussions/2883
Reloadhttps://github.com/python-gitlab/python-gitlab/discussions/2883
python-gitlab https://github.com/python-gitlab
python-gitlabhttps://github.com/python-gitlab/python-gitlab
Notifications https://github.com/login?return_to=%2Fpython-gitlab%2Fpython-gitlab
Fork 675 https://github.com/login?return_to=%2Fpython-gitlab%2Fpython-gitlab
Star 2.4k https://github.com/login?return_to=%2Fpython-gitlab%2Fpython-gitlab
Code https://github.com/python-gitlab/python-gitlab
Issues 26 https://github.com/python-gitlab/python-gitlab/issues
Pull requests 10 https://github.com/python-gitlab/python-gitlab/pulls
Discussions https://github.com/python-gitlab/python-gitlab/discussions
Actions https://github.com/python-gitlab/python-gitlab/actions
Projects 0 https://github.com/python-gitlab/python-gitlab/projects
Security 0 https://github.com/python-gitlab/python-gitlab/security
Insights https://github.com/python-gitlab/python-gitlab/pulse
Code https://github.com/python-gitlab/python-gitlab
Issues https://github.com/python-gitlab/python-gitlab/issues
Pull requests https://github.com/python-gitlab/python-gitlab/pulls
Discussions https://github.com/python-gitlab/python-gitlab/discussions
Actions https://github.com/python-gitlab/python-gitlab/actions
Projects https://github.com/python-gitlab/python-gitlab/projects
Security https://github.com/python-gitlab/python-gitlab/security
Insights https://github.com/python-gitlab/python-gitlab/pulse
Answered https://github.com/python-gitlab/python-gitlab/discussions/2883#discussioncomment-9549328
JohnVillalovoshttps://github.com/JohnVillalovos
zerothi https://github.com/zerothi
Q&Ahttps://github.com/python-gitlab/python-gitlab/discussions/categories/q-a
Project.repository_merge_base([...]) with forks (remotes) https://github.com/python-gitlab/python-gitlab/discussions/2883#top
zerothi https://github.com/zerothi
Answered https://github.com/python-gitlab/python-gitlab/discussions/2883#discussioncomment-9549328
JohnVillalovoshttps://github.com/JohnVillalovos
Return to tophttps://github.com/python-gitlab/python-gitlab/discussions/2883#top
Please reload this pagehttps://github.com/python-gitlab/python-gitlab/discussions/2883
https://github.com/python-gitlab/python-gitlab/discussions/2883
zerothi https://github.com/zerothi
May 24, 2024 https://github.com/python-gitlab/python-gitlab/discussions/2883#discussion-6723481
Give feedback.https://github.com/python-gitlab/python-gitlab/discussions/2883
JohnVillalovos https://github.com/JohnVillalovos
May 24, 2024 https://github.com/python-gitlab/python-gitlab/discussions/2883#discussioncomment-9549328
https://docs.gitlab.com/ee/api/repositories.html#merge-basehttps://docs.gitlab.com/ee/api/repositories.html#merge-base
View full answer https://github.com/python-gitlab/python-gitlab/discussions/2883#discussioncomment-9549328
Oldest https://github.com/python-gitlab/python-gitlab/discussions/2883?sort=old
Newest https://github.com/python-gitlab/python-gitlab/discussions/2883?sort=new
Top https://github.com/python-gitlab/python-gitlab/discussions/2883?sort=top
Please reload this pagehttps://github.com/python-gitlab/python-gitlab/discussions/2883
https://github.com/python-gitlab/python-gitlab/discussions/2883
Please reload this pagehttps://github.com/python-gitlab/python-gitlab/discussions/2883
https://github.com/python-gitlab/python-gitlab/discussions/2883
JohnVillalovos https://github.com/JohnVillalovos
May 24, 2024 https://github.com/python-gitlab/python-gitlab/discussions/2883#discussioncomment-9549328
https://docs.gitlab.com/ee/api/repositories.html#merge-basehttps://docs.gitlab.com/ee/api/repositories.html#merge-base
Give feedback.https://github.com/python-gitlab/python-gitlab/discussions/2883
https://github.com/zerothi
Please reload this pagehttps://github.com/python-gitlab/python-gitlab/discussions/2883
https://github.com/python-gitlab/python-gitlab/discussions/2883
zerothihttps://github.com/zerothi
May 27, 2024 https://github.com/python-gitlab/python-gitlab/discussions/2883#discussioncomment-9570538
Give feedback.https://github.com/python-gitlab/python-gitlab/discussions/2883
zerothihttps://github.com/zerothi
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-gitlab%2Fpython-gitlab%2Fdiscussions%2F2883
🙏 Q&A https://github.com/python-gitlab/python-gitlab/discussions/categories/q-a
https://github.com/zerothi
https://github.com/JohnVillalovos
https://github.com/python-gitlab/python-gitlab/discussions/2883
https://github.com/settings/replies?return_to=1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.