mirror of
https://github.com/openSUSE/osc.git
synced 2025-11-02 12:32:16 +01:00
Change 'git-obs' to use owner/repo[#pull] arguments consistently
This commit is contained in:
@@ -56,8 +56,8 @@ class Fork:
|
||||
return conn.request("POST", url, json_data=json_data)
|
||||
except GiteaException as e:
|
||||
# use ForkExists exception to parse fork_owner and fork_repo from the response
|
||||
fork_exists_exception = ForkExists(e.response, owner, repo)
|
||||
if e.status == 409:
|
||||
fork_exists_exception = ForkExists(e.response, owner, repo)
|
||||
if exist_ok:
|
||||
from . import Repo
|
||||
return Repo.get(conn, fork_exists_exception.fork_owner, fork_exists_exception.fork_repo)
|
||||
|
||||
@@ -22,7 +22,7 @@ class PullRequest:
|
||||
"""
|
||||
Split <owner>/<repo>#<number> into individual components and return them in a tuple.
|
||||
"""
|
||||
match = re.match(r"(.+)/(.+)#(.+)", pr_id)
|
||||
match = re.match(r"^([^/]+)/([^/]+)#([0-9]+)$", pr_id)
|
||||
if not match:
|
||||
raise ValueError(f"Invalid pull request id: {pr_id}")
|
||||
return match.groups()
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from typing import Optional
|
||||
from typing import Tuple
|
||||
|
||||
from .connection import Connection
|
||||
from .connection import GiteaHTTPResponse
|
||||
@@ -8,6 +10,16 @@ from .user import User
|
||||
|
||||
|
||||
class Repo:
|
||||
@classmethod
|
||||
def split_id(cls, repo_id: str) -> Tuple[str, str]:
|
||||
"""
|
||||
Split <owner>/<repo> into individual components and return them in a tuple.
|
||||
"""
|
||||
match = re.match(r"^([^/]+)/([^/]+)$", repo_id)
|
||||
if not match:
|
||||
raise ValueError(f"Invalid repo id: {repo_id}")
|
||||
return match.groups()
|
||||
|
||||
@classmethod
|
||||
def get(
|
||||
cls,
|
||||
|
||||
Reference in New Issue
Block a user