summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>2015-09-15 07:40:19 +0900
committerKen'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>2015-09-16 01:13:09 +0900
commit2ce9a6f3981900e47eeea8bb3834c62c066ed237 (patch)
tree7c34407d4354795759dea8f31e77687aff526344
parent0c1374c143f1639c181423b0cd7886d4d75d8673 (diff)
downloadtempest-lib-2ce9a6f3981900e47eeea8bb3834c62c066ed237.tar.gz
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
-rwxr-xr-xtools/migrate_from_tempest.sh15
1 files changed, 4 insertions, 11 deletions
diff --git a/tools/migrate_from_tempest.sh b/tools/migrate_from_tempest.sh
index acafcd6..d0c5b96 100755
--- a/tools/migrate_from_tempest.sh
+++ b/tools/migrate_from_tempest.sh
@@ -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"