Commit 95301526 authored by Méven Car's avatar Méven Car Committed by Jonah Brüchert
Browse files

Track pushed remote branches

parent d71f8e25
......@@ -14,7 +14,7 @@ import sys
from typing import List, Any
from git import Remote, IndexFile
from git import Remote, IndexFile, PushInfo
from gitlab.v4.objects import Project, ProjectMergeRequest
from gitlab.exceptions import GitlabCreateError, GitlabGetError
......@@ -161,12 +161,15 @@ class MergeRequestCreator(RepositoryConnection):
pushes the local repository to the fork remote
"""
remote: Remote
info: PushInfo
if self.__fork:
remote = self._local_repo.remotes.fork
remote.push(force=True)
info = remote.push(force=True)[0]
else:
remote = self._local_repo.remotes.origin
remote.push(refspec=self._local_repo.head, force=True)
info = remote.push(refspec=self._local_repo.head, force=True)[0]
self._local_repo.active_branch.set_tracking_branch(info.remote_ref)
def __upload_assets(self, text: str) -> str:
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment