forked from importers/git-importer
Push to the remote when the repo changed
This commit is contained in:
11
lib/git.py
11
lib/git.py
@@ -214,3 +214,14 @@ class Git:
|
||||
print(response.data)
|
||||
url = f"gitea@gitea.opensuse.org:{org_name}/{repo_name}.git"
|
||||
self.repo.remotes.create("origin", url)
|
||||
|
||||
def push(self):
|
||||
remo = self.repo.remotes["origin"]
|
||||
|
||||
keypair = pygit2.KeypairFromAgent("gitea")
|
||||
callbacks = pygit2.RemoteCallbacks(credentials=keypair)
|
||||
|
||||
refspecs = ["refs/heads/factory"]
|
||||
if "refs/heads/devel" in self.repo.references:
|
||||
refspecs.append("refs/heads/devel")
|
||||
remo.push(refspecs, callbacks=callbacks)
|
||||
|
Reference in New Issue
Block a user