From 6890ad92d0037696add2958bc1e34a12ea3651c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C5=91d=20Ill=C3=A9s?= <elod.illes@est.tech>
Date: Wed, 9 Oct 2024 19:00:43 +0200
Subject: [PATCH] [tool] Update listing tool for open and unreleased changes

The list_unreleased_and_open_changes.sh was not prepared to use
different branch name than the series name. Since 2023.1 Antelope
release we have a 'series name' (antelope) and a 'release ID' (2023.1)
so this patch updates the script to work properly and use the series
name when that is required and use release ID for branch name.

Change-Id: Ibd932d9b9e1c0f5d6e3269c6f1822d7b1d56c7be
---
 tools/list_unreleased_and_open_changes.sh | 24 ++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/tools/list_unreleased_and_open_changes.sh b/tools/list_unreleased_and_open_changes.sh
index a8e517b8b3..a08127d4b4 100755
--- a/tools/list_unreleased_and_open_changes.sh
+++ b/tools/list_unreleased_and_open_changes.sh
@@ -16,21 +16,23 @@
 # open and unreleased changes.
 
 if [[ $# -lt 1 ]]; then
-    echo "Usage: $(basename $0) <branch>"
-    echo "branch should be e.g. ocata"
+    echo "Usage: $(basename $0) <series>"
+    echo "series should be e.g. antelope"
     exit 1
 fi
 
-BRANCH=${1}
-RESULT_DIR="$BRANCH-$(date '+%Y%m%d-%H%M')"
-mkdir -p $RESULT_DIR
-
-OPENSTACK_TEAMS=$(grep team deliverables/${BRANCH}/*.yaml | cut -f3 -d: | \
-                sort -u)
-
 TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 BASEDIR=$(dirname $TOOLSDIR)
 source $TOOLSDIR/functions
+enable_tox_venv
+
+SERIES=${1}
+BRANCH=$(get-series-id ${SERIES})
+RESULT_DIR="$SERIES-$(date '+%Y%m%d-%H%M')"
+mkdir -p $RESULT_DIR
+
+OPENSTACK_TEAMS=$(grep team deliverables/${SERIES}/*.yaml | cut -f3 -d: | \
+                sort -u)
 
 function get_open_patches {
     REPO=$1
@@ -49,8 +51,8 @@ function get_open_patches {
 for team in ${OPENSTACK_TEAMS}; do
     echo "Checking repositories of team: ${team}"
 
-    REPOS=$(tox -e venv -- list-deliverables --repos \
-            --series ${BRANCH} --team ${team} | grep "^openstack/")
+    REPOS=$(list-deliverables --repos \
+            --series ${SERIES} --team ${team} | grep "^openstack/")
 
     if [ -n "${REPOS}" ]; then
         echo "List of open and unreleased changes of team '${team}' " \