| garciadeblas | b90cbe6 | 2022-02-01 00:06:42 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | # |
| 15 | |
| garciadeblas | d326e87 | 2022-02-17 09:28:07 +0100 | [diff] [blame] | 16 | if [ $# -lt 2 ]; then |
| 17 | echo "Usage $0 <branch> <from_tag> [ <to_tag> ]" |
| 18 | echo " It will list all the changes in branch <branch> from <from_tag> to <to_tag>." |
| 19 | echo " If <to_tag> is not provided, HEAD is used. This is useful to get all changes from a specific tag to the tip of the branch." |
| 20 | echo " Examples:" |
| 21 | echo " $0 v11.0 v11.0.0" |
| 22 | echo " $0 v10.0 v10.0" |
| 23 | echo " $0 v10.0 v10.0.3" |
| 24 | echo " $0 v10.0 v10.0.2 v10.0.3" |
| garciadeblas | b90cbe6 | 2022-02-01 00:06:42 +0100 | [diff] [blame] | 25 | exit 1 |
| 26 | fi |
| 27 | |
| 28 | BRANCH="$1" |
| 29 | FROM_REF="$2" |
| garciadeblas | d326e87 | 2022-02-17 09:28:07 +0100 | [diff] [blame] | 30 | TO_REF="${3-HEAD}" |
| garciadeblas | b90cbe6 | 2022-02-01 00:06:42 +0100 | [diff] [blame] | 31 | |
| 32 | OSM_CHANGES_FOLDER="$(mktemp -d -q --tmpdir "osmchanges.XXXXXX")" |
| 33 | echo "Changes in branch ${BRANCH} from ${FROM_REF} to ${TO_REF} stored in ${OSM_CHANGES_FOLDER}" |
| 34 | |
| 35 | #trap 'rm -rf "${OSM_CHANGES_FOLDER}"' EXIT |
| 36 | |
| 37 | touch "${OSM_CHANGES_FOLDER}/osm_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" |
| 38 | |
| garciadeblas | 8cf045b | 2022-06-21 10:42:52 +0200 | [diff] [blame^] | 39 | modules="common devops IM LCM MON N2VC NBI NG-UI osmclient RO PLA POL SOL003 SOL005 tests" |
| 40 | for repo in $modules; do |
| garciadeblas | b90cbe6 | 2022-02-01 00:06:42 +0100 | [diff] [blame] | 41 | echo ${repo} |
| 42 | git -C ${OSM_CHANGES_FOLDER} clone "https://osm.etsi.org/gerrit/osm/${repo}" |
| 43 | git -C ${OSM_CHANGES_FOLDER}/$repo checkout ${BRANCH} |
| garciadeblas | d326e87 | 2022-02-17 09:28:07 +0100 | [diff] [blame] | 44 | |
| 45 | # Print changes in the module changelog |
| garciadeblas | b90cbe6 | 2022-02-01 00:06:42 +0100 | [diff] [blame] | 46 | 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" |
| garciadeblas | d326e87 | 2022-02-17 09:28:07 +0100 | [diff] [blame] | 47 | echo >> "${OSM_CHANGES_FOLDER}/${repo}_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" |
| 48 | |
| 49 | # Print changes in the global changelog |
| garciadeblas | b90cbe6 | 2022-02-01 00:06:42 +0100 | [diff] [blame] | 50 | echo ${repo} >> "${OSM_CHANGES_FOLDER}/osm_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" |
| 51 | 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" |
| 52 | echo >> "${OSM_CHANGES_FOLDER}/osm_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" |
| garciadeblas | d326e87 | 2022-02-17 09:28:07 +0100 | [diff] [blame] | 53 | echo "-----------------------------------------" >> "${OSM_CHANGES_FOLDER}/osm_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" |
| garciadeblas | b90cbe6 | 2022-02-01 00:06:42 +0100 | [diff] [blame] | 54 | done |
| 55 | |
| garciadeblas | d326e87 | 2022-02-17 09:28:07 +0100 | [diff] [blame] | 56 | echo |
| garciadeblas | b90cbe6 | 2022-02-01 00:06:42 +0100 | [diff] [blame] | 57 | echo "Changes in branch ${BRANCH} from ${FROM_REF} to ${TO_REF} stored in ${OSM_CHANGES_FOLDER}" |
| 58 | echo "All changes can be found in ${OSM_CHANGES_FOLDER}/osm_changes-${BRANCH}-from${FROM_REF}-to${TO_REF}.log" |
| 59 | |