Fix migrate_from_tempest script to work with multiple files

The '--follow' option from git log was used to follow the file even if
it was renamed for instance, although the option can't deal with
multiple files which was blocking us to migrate multiple files at once.

This patches fixes the issue by looking one file at time and
concatenating their ids in the end.

Change-Id: I39a2e94e1c27a83de2b976f263928c5199d44b22
Closes-bug: #1411499
This commit is contained in:
Mauro S. M. Rodrigues
2015-01-16 20:12:04 +00:00
parent 84dee6b781
commit c473cda72f

View File

@@ -46,11 +46,14 @@ function count_commits {
git clone $TEMPEST_GIT_URL $tmpdir
cd $tmpdir
# get only commits that touch our files
commits="$(git log --format=format:%h --no-merges --follow -- $files)"
# then their merge commits - which works fina since we merge commits
# individually.
merge_commits="$(git log --format=format:%h --merges --first-parent -- $files)"
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)"
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