Reputation: 1040
I'm trying to create pull request from python, it doesn't seem to work with the gitpython
. The checkout, creating branch, commit and push is working fine, however the pull request doesn't seem to work. After some quick search I found the hub is the cli to create pull requests. Is there a python API for creating pull request. Here is my code so far.
from git import Repo
import git
Repo.clone_from(url='[email protected]:Amjad/test_repo.git', to_path='./test_repo')
git_branch = "test7"
git_repo = Repo("./test_repo")
git_repo.git.checkout("-b", git_branch)
git_repo.git.status()
shutil.copy("./ps.txt", "./test_repo/ps.txt")
git_repo.git.add("ps.txt")
git_repo.git.commit(m="first test push")
git_repo.git.push('--set-upstream', 'origin', git_branch)
git_repo.git.request_pull(git_branch, '[email protected]:Amjad/test_repo.git', "master")
Upvotes: 0
Views: 4784
Reputation: 295
Pull requests are on a per-service basis. Meaning that you won't have a command to make one from a generic git library, but you can make them using whichever remote API (REST http, etc.) to create a pull request.
For example, with GitHub, you can make pull requests with the REST API.
Upvotes: 2