From: garciadeblas Date: Thu, 17 Feb 2022 08:28:07 +0000 (+0100) Subject: Added parameter to tools/check_changes.sh X-Git-Tag: v12.0.0rc1~36 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F87%2F11687%2F1;p=osm%2Fdevops.git Added parameter to tools/check_changes.sh Before this commit, only the changes in a branch from a tag to the HEAD were generated. This commit enables listing the changes in a branch from a tag to another tag or the HEAD of the branch. Change-Id: I389a7a06b68dc727910afd417e6a74e4d620deab Signed-off-by: garciadeblas --- diff --git a/tools/check_changes.sh b/tools/check_changes.sh index 96f3b906..4cd40722 100755 --- a/tools/check_changes.sh +++ b/tools/check_changes.sh @@ -13,17 +13,21 @@ # limitations under the License. # -if [ $# -ne 2 ]; then - echo "Usage $0 " - echo " It will list all the changes in branch from to the HEAD of the branch" - echo " Example: $0 v11.0 v11.0.0" - echo " Example: $0 v10.0 v10.0.3" +if [ $# -lt 2 ]; then + echo "Usage $0 [ ]" + echo " It will list all the changes in branch from to ." + echo " If is not provided, HEAD is used. This is useful to get all changes from a specific tag to the tip of the branch." + echo " Examples:" + echo " $0 v11.0 v11.0.0" + echo " $0 v10.0 v10.0" + echo " $0 v10.0 v10.0.3" + echo " $0 v10.0 v10.0.2 v10.0.3" exit 1 fi BRANCH="$1" FROM_REF="$2" -TO_REF="HEAD" +TO_REF="${3-HEAD}" OSM_CHANGES_FOLDER="$(mktemp -d -q --tmpdir "osmchanges.XXXXXX")" echo "Changes in branch ${BRANCH} from ${FROM_REF} to ${TO_REF} stored in ${OSM_CHANGES_FOLDER}" @@ -36,12 +40,19 @@ for repo in NBI osmclient IM NG-UI N2VC NG-UI MON POL PLA RO SOL005 common devop echo ${repo} git -C ${OSM_CHANGES_FOLDER} clone "https://osm.etsi.org/gerrit/osm/${repo}" git -C ${OSM_CHANGES_FOLDER}/$repo checkout ${BRANCH} + + # Print changes in the module changelog git -C ${OSM_CHANGES_FOLDER}/$repo log --pretty=format:"%C(yellow)%h %Cblue%ad %Cgreen%>(13,trunc)%an%Cred%d %Creset%s" --date=short ${FROM_REF}..${TO_REF} > "${OSM_CHANGES_FOLDER}/${repo}_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" + echo >> "${OSM_CHANGES_FOLDER}/${repo}_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" + + # Print changes in the global changelog echo ${repo} >> "${OSM_CHANGES_FOLDER}/osm_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" git -C ${OSM_CHANGES_FOLDER}/$repo log --pretty=format:"%C(yellow)%h %Cblue%ad %Cgreen%>(13,trunc)%an%Cred%d %Creset%s" --date=short ${FROM_REF}..${TO_REF} >> "${OSM_CHANGES_FOLDER}/osm_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" echo >> "${OSM_CHANGES_FOLDER}/osm_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" + echo "-----------------------------------------" >> "${OSM_CHANGES_FOLDER}/osm_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" done +echo echo "Changes in branch ${BRANCH} from ${FROM_REF} to ${TO_REF} stored in ${OSM_CHANGES_FOLDER}" echo "All changes can be found in ${OSM_CHANGES_FOLDER}/osm_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log"