1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-11-09 07:33:16 +01:00

Change 'git-obs' to use owner/repo[#pull] arguments consistently

This commit is contained in:
2025-01-15 17:01:47 +01:00
parent 99dcb4e10a
commit e23c566b0d
11 changed files with 172 additions and 63 deletions

View File

@@ -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,