Project

General

Profile

Feature #51222 » 0010-scripts-ceph-backport.sh-implement-pr_commits_count.patch

Loïc Dachary, 08/10/2021 12:13 PM

View differences:

ceph-backport.sh
echo "$tslc_is_ok"
}
function pr_commits_count {
local remote_api_output="$1"
local number_of_commits=$(echo "${remote_api_output}" | jq '.commits')
if [ "$number_of_commits" != "null" ] ; then
echo -n "$number_of_commits"
else
local merge_base=$(echo "${remote_api_output}" | jq --raw-output '.merge_base')
local original_pr=$(echo "${remote_api_output}" | jq '.number')
git log --oneline "${merge_base}..pr-${original_pr}" | wc -l
fi
}
function cherry_pick_phase {
local base_branch
local default_val
......
git fetch "$upstream_remote" "pull/$original_pr/head:pr-$original_pr"
number_of_commits=$(echo "${remote_api_output}" | jq '.commits')
number_of_commits=$(pr_commits_count ${remote_api_output})
if [ "$number_of_commits" -eq "$number_of_commits" ] 2>/dev/null ; then
# \$number_of_commits is set, and is an integer
if [ "$number_of_commits" -eq "1" ] ; then
(10-10/10)