Run the difference between the current feature branch and target branch (configured to dev) to which the feature branches are merged in the current dev process.
The $file_list array is built with the files:
- from merge commit if feature branch is already merged
- from fork-point if the branch is not merged
In my scenario all the files are run in SQL*PLUS, but $file_list variable can be used for any purpose
# Run changes made in current branch comparing to $traget_branch_name = dev branch in the database given in the first parameter
# If changes is already merged thus it merge-base --fork-point produce wrong results - the git log -m -1 --first-parent is used for merge commit to find difference
# If no merge commit present merge-base --fork-point is used to build the difference
$traget_branch_name = 'dev'
$repo = 'C:\code\myrepo'
cd $repo
$dbname=$args[0]
$script = "connect $dbname"
$merge_commit = git log HEAD..$traget_branch_name --ancestry-path --merges --reverse --pretty=format:%h | Select-Object -First 1
if ( $merge_commit -eq $null )
{
'...No subsequent merges...'
$file_list = (git diff --name-only $(git merge-base --fork-point $traget_branch_name))
} else {
"Merge commit found $merge_commit"
$file_list = git log -m -1 --first-parent --name-only --pretty="format:" $merge_commit
}
$file_list
#process file list in sql*plus
$file_list |
ForEach {
$fullname = "@$repo$_"
$script += "PROMPT Running $fullname`n"
$script += "@$fullname`n"
}
$script += 'EXIT'
echo $script
echo $script | sqlplus /nolog
Комментариев нет:
Отправить комментарий