Write the latest change_id on migration commit
The previous script wrote a lot of change_id on the migration commit message, and that was unreadable. Developers needed to change the message by hands for showing the latest change_id for each migrated module. That was boring. This patch makes the script write the latest change_id like * run_tempest.sh: I55311cff4dea1f6c5adaa2a6d51eeee2f6cc71ea * run_tests.sh: I55311cff4dea1f6c5adaa2a6d51eeee2f6cc71ea Change-Id: I7ce8e7b911c97ad7757a886f781341cce74c5307
This commit is contained in:
@@ -49,18 +49,11 @@ git clone $TEMPEST_GIT_URL $tmpdir
|
||||
cd $tmpdir
|
||||
|
||||
for file in $files; do
|
||||
# get only commits that touch our files
|
||||
commits="$commits $(git log --format=format:%h --no-merges --follow -- $file)"
|
||||
# then their merge commits - which works fina since we merge commits
|
||||
# individually.
|
||||
merge_commits="$merge_commits $(git log --format=format:%h --merges --first-parent -- $file)"
|
||||
# Get the latest change-id for each file
|
||||
change_id=`git log -n1 --grep "Change-Id: " -- $file | grep "Change-Id: " | awk '{print $2}'`
|
||||
CHANGE_LIST=`echo -e "$CHANGE_LIST\n * $file: $change_id"`
|
||||
done
|
||||
|
||||
pattern="\n$(echo $commits $merge_commits | sed -e 's/ /\\|/g')"
|
||||
|
||||
# order them by filtering each one in the order it appears on rev-list
|
||||
SHA1_LIST=$(git rev-list --oneline HEAD | grep $pattern)
|
||||
|
||||
# Move files and commit
|
||||
cd -
|
||||
file_list=''
|
||||
@@ -88,4 +81,4 @@ rm -rf $tmpdir
|
||||
commit_message="Migrated $file_list from tempest"
|
||||
pre_list=$"This migrates the above files from tempest. This includes tempest commits:"
|
||||
post_list=$"to see the commit history for these files refer to the above sha1s in the tempest repository"
|
||||
git commit -m "$commit_message" -m "$pre_list" -m "$SHA1_LIST" -m "$post_list"
|
||||
git commit -m "$commit_message" -m "$pre_list" -m "$CHANGE_LIST" -m "$post_list"
|
||||
|
Reference in New Issue
Block a user