mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
Add Package.get_revision_list() for listing commit log
This commit is contained in:
parent
eb2678e0c7
commit
89f74665d1
@ -3,6 +3,7 @@ from ..util.models import * # pylint: disable=wildcard-import,unused-wildcard-i
|
|||||||
from .flag import Flag
|
from .flag import Flag
|
||||||
from .group_role import GroupRole
|
from .group_role import GroupRole
|
||||||
from .package_devel import PackageDevel
|
from .package_devel import PackageDevel
|
||||||
|
from .package_revision import PackageRevision
|
||||||
from .person_role import PersonRole
|
from .person_role import PersonRole
|
||||||
from .simple_flag import SimpleFlag
|
from .simple_flag import SimpleFlag
|
||||||
from .status import Status
|
from .status import Status
|
||||||
@ -126,3 +127,20 @@ class Package(XmlModel):
|
|||||||
}
|
}
|
||||||
response = cls.xml_request("POST", apiurl, url_path, url_query)
|
response = cls.xml_request("POST", apiurl, url_path, url_query)
|
||||||
return Status.from_file(response, apiurl=apiurl)
|
return Status.from_file(response, apiurl=apiurl)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_revision_list(cls, apiurl: str, project: str, package: str, deleted: Optional[bool] = None, meta: Optional[bool] = None):
|
||||||
|
from xml.etree import ElementTree as ET
|
||||||
|
|
||||||
|
url_path = ["source", project, package, "_history"]
|
||||||
|
url_query = {
|
||||||
|
"meta": meta,
|
||||||
|
"deleted": deleted,
|
||||||
|
}
|
||||||
|
response = cls.xml_request("GET", apiurl, url_path, url_query)
|
||||||
|
root = ET.parse(response).getroot()
|
||||||
|
assert root.tag == "revisionlist"
|
||||||
|
result = []
|
||||||
|
for node in root:
|
||||||
|
result.append(PackageRevision.from_xml(node, apiurl=apiurl))
|
||||||
|
return result
|
||||||
|
35
osc/obs_api/package_revision.py
Normal file
35
osc/obs_api/package_revision.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
from ..util.models import * # pylint: disable=wildcard-import,unused-wildcard-import
|
||||||
|
|
||||||
|
|
||||||
|
class PackageRevision(XmlModel):
|
||||||
|
XML_TAG = "revision"
|
||||||
|
|
||||||
|
rev: int = Field(
|
||||||
|
xml_attribute=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
vrev: Optional[int] = Field(
|
||||||
|
xml_attribute=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
srcmd5: str = Field(
|
||||||
|
)
|
||||||
|
|
||||||
|
version: str = Field(
|
||||||
|
)
|
||||||
|
|
||||||
|
time: int = Field(
|
||||||
|
)
|
||||||
|
|
||||||
|
user: str = Field(
|
||||||
|
)
|
||||||
|
|
||||||
|
comment: Optional[str] = Field(
|
||||||
|
)
|
||||||
|
|
||||||
|
requestid: Optional[int] = Field(
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_time_str(self):
|
||||||
|
import time
|
||||||
|
return time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(self.time))
|
Loading…
Reference in New Issue
Block a user