Commit 18470e86 authored by Mark Canterbury's avatar Mark Canterbury Committed by Mark Canterbury
Browse files

Moving

parent 3177731d
Loading
Loading
Loading
Loading
+0 −0

File moved.

+8 −6
Original line number Diff line number Diff line
@@ -6,24 +6,26 @@ from forgelib.scrapers.etsi import getSpecHistory
root_url = "https://forge.etsi.org/rep/"
project_number = 586

spec = "102 232-1"

gl = gitlab.Gitlab(url = root_url)
project = gl.projects.get(project_number)

out_str = ""

tags = project.tags.list(search = 'spec/103120', get_all = True)
tags = project.tags.list(search = f"spec/{spec.replace(" ","")}", get_all = True)
tags.sort(key = lambda x: x.commit['created_at'])
tags.reverse()

print ("Getting spec history from portal (could take a few moments)...")
spec_history = getSpecHistory("TS 103 120")
spec_history = getSpecHistory(f"TS {spec}")

for tag in tags:
    print(tag.name)
    version = tag.name.split('/')[2]
    spec_version = next((x for x in spec_history if x.version == version), None)
    out_str += f"# TS 103 120 v{tag.name.split('/')[2]}\n"
    out_str += f"{tag.message}, tagged as [{tag.name}]({root_url}li/schemas-definitions/-/tree/{tag.name}/103120?ref_type=tags)"
    out_str += f"# TS {spec} v{tag.name.split('/')[2]}\n"
    out_str += f"{tag.message}, tagged as [{tag.name}]({root_url}li/schemas-definitions/-/tree/{tag.name}/{spec.replace(" ","")}?ref_type=tags)"
    if spec_version is not None and spec_version.pdfLink is not None and spec_version.pdfLink != "":
        out_str += f" and available [from the ETSI portal as a PDF]({spec_version.pdfLink})\n"
    out_str += "  \n  \n"
@@ -49,11 +51,11 @@ for tag in tags:

    out_str += f"Includes the following CRs with Forge changes:\n"
    crs = project.mergerequests.list(target_branch = mr['source_branch'], state="merged", get_all = True)
    crs = [cr for cr in crs if cr.source_branch.startswith("cr/103120")]
    crs = [cr for cr in crs if cr.source_branch.startswith(f"cr/{spec.replace(" ","")}")]
    for cr in crs:
        out_str += f"* {cr.title} ([MR {cr.iid}]({cr.web_url}))\n"

out_file = Path("103120/change_notes.md")
out_file = Path(f"{spec.replace(" ","")}/changelog.md")
out_file.write_text(out_str, "utf8")