blob: 0c92574f0a8dafdd9eee13c9e453c156b5dd68e4 [file] [log] [blame]
#!/bin/bash
# -----------------------------------------------------------------------
# Copyright 2024 Open Networking Foundation Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------
# SPDX-FileCopyrightText: 2024 Open Networking Foundation Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
## -----------------------------------------------------------------------
## Usage: $0 --repo voltha-go --search --wip
## -----------------------------------------------------------------------
function do_gerrit_search()
{
local -n ref_urls=$1 ; shift
local -n ref_repos=$1 ; shift
local -n ref_status=$1 ; shift
ref_urls=()
# local stem='https://gerrit.opencord.org/q/project:voltha-go+status:open'
local stem='https://gerrit.opencord.org/q/'
local -a common=()
[[ -v me ]] && { common+=("${me[@]}"); }
common+=("${ref_status[@]}")
local repo
for repo in "${ref_repos[@]}";
do
local -a args=()
args+=("project:${repo}")
args+=("${common[@]}")
apply_filter_age args
local url="$stem"
url+="$(join_by '+' "${args[@]}")"
ref_urls+=("$url")
done
# https://gerrit.opencord.org/q/status:open+after:%222024-04-24%22
if [[ ${#ref_urls[@]} -eq 0 ]]; then
local -a args=()
args=("${common[@]}")
apply_filter_age args
local url="$stem"
url+="$(join_by '+' "${args[@]}")"
ref_urls+=("$url")
fi
# --debug) declare -g -i debug=1 ;;
# --search) declare -g -i search=1 ;;
# --wip) declare -g -i status_is_open=1 ;;
return
}
: # ($?==0) for source script
# [EOF]