From 183c425143626d2602c27150ac4fb20926b4fe10 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 24 Feb 2025 12:41:54 +0100 Subject: [PATCH] add script for getting the ref branch of a basop port branch --- ci/get_float_ref_branch_name.py | 59 +++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 ci/get_float_ref_branch_name.py diff --git a/ci/get_float_ref_branch_name.py b/ci/get_float_ref_branch_name.py new file mode 100644 index 0000000000..b8da8979e7 --- /dev/null +++ b/ci/get_float_ref_branch_name.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +""" +(C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository. All Rights Reserved. + +This software is protected by copyright law and by international treaties. +The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository retain full ownership rights in their respective contributions in +the software. This notice grants no license of any kind, including but not limited to patent +license, nor is any license granted by implication, estoppel or otherwise. + +Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +contributions. + +This software is provided "AS IS", without any express or implied warranties. The software is in the +development stage. It is intended exclusively for experts who have experience with such software and +solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +and fitness for a particular purpose are hereby disclaimed and excluded. + +Any dispute, controversy or claim arising under or in relation to providing this software shall be +submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +the United Nations Convention on Contracts on the International Sales of Goods. +""" + +import re +import sys +import argparse + +BASOP_PATTERN = r"\d+[_-]basop[_-].*" + +MSG_DOES_NOT_MATCH = """Your branch name {branchname} does not match the template '_basop_', e.g. '123_basop_fix_this_one_bug-2'. +Sticking to this branch is needed for the testing system to match this branch with its float-reference counterpart. +Please rename your branch. You can easily do this by creating a new branch from this branch: + - git checkout -b +You then also need to create a new merge request and update the links in your issue. +See here for details on the porting work process: https://forge.3gpp.org/rep/sa4/audio/ivas-basop/-/wikis/Porting-MRs-from-floating-point-codec#workflow-for-porting-a-merge-request-from-floating-point-codec-to-basop-codec +""" + +parser = argparse.ArgumentParser() +parser.add_argument("branchname") +args = parser.parse_args() +branchname = args.branchname + +re_match = re.match(BASOP_PATTERN, branchname) +if re_match is None: + print(MSG_DOES_NOT_MATCH.format(branchname=branchname)) + sys.exit(1) + +# the float ref branch is just the same name, but with basop -> ref replacement +# replace only the first occurrence, as "basop" mit be present in the later description +# if the format is correct, then before "_basop", only numbers can occur +print(branchname.replace("basop", "ref", 1)) -- GitLab