mirror of
https://github.com/openSUSE/osc.git
synced 2025-10-27 17:42:16 +01:00
Change gitea_api.Git to work with the current remote instead of 'origin'
This commit is contained in:
@@ -107,7 +107,7 @@ class Git:
|
|||||||
self,
|
self,
|
||||||
pull_number: int,
|
pull_number: int,
|
||||||
*,
|
*,
|
||||||
remote: str = "origin",
|
remote: Optional[str] = None,
|
||||||
commit: Optional[str] = None,
|
commit: Optional[str] = None,
|
||||||
force: bool = False,
|
force: bool = False,
|
||||||
):
|
):
|
||||||
@@ -120,6 +120,9 @@ class Git:
|
|||||||
if commit and self.branch_exists(target_branch) and self.get_branch_head(target_branch) == commit:
|
if commit and self.branch_exists(target_branch) and self.get_branch_head(target_branch) == commit:
|
||||||
return target_branch
|
return target_branch
|
||||||
|
|
||||||
|
if not remote:
|
||||||
|
remote = self.get_current_remote()
|
||||||
|
|
||||||
cmd = ["fetch", remote, f"pull/{pull_number}/head:{target_branch}"]
|
cmd = ["fetch", remote, f"pull/{pull_number}/head:{target_branch}"]
|
||||||
if force:
|
if force:
|
||||||
cmd += [
|
cmd += [
|
||||||
@@ -171,7 +174,7 @@ class Git:
|
|||||||
cmd = ["fetch", "--all"]
|
cmd = ["fetch", "--all"]
|
||||||
self._run_git(cmd)
|
self._run_git(cmd)
|
||||||
|
|
||||||
def get_owner_repo(self, remote: str = "origin") -> Tuple[str, str]:
|
def get_owner_repo(self, remote: Optional[str] = None) -> Tuple[str, str]:
|
||||||
remote_url = self.get_remote_url(name=remote)
|
remote_url = self.get_remote_url(name=remote)
|
||||||
if "@" in remote_url:
|
if "@" in remote_url:
|
||||||
# ssh://gitea@example.com:owner/repo.git
|
# ssh://gitea@example.com:owner/repo.git
|
||||||
|
|||||||
Reference in New Issue
Block a user