#! /bin/bash # ============LICENSE_START======================================================= # Copyright (C) 2018 The Nordix Foundation. All rights reserved. # ================================================================================ # 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-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= # # This script clones and sets up an ONAP repository from the Nordix gerrit. It # - clones the repository from the Nordix gerrit # - sets up a commit hook that signs reviews when they are committed # - sets up the ONAP gerrit as the "upstream" of the cloned repository by adding # it as an entry to the .git/config configuration file of the repository # if [ $# -ne 3 ] then echo "usage $0 nordix-gerrit-userid repository-path local-repository" echo " example: $0 seancitizen onap/policy/core core " exit 1 fi git clone ssh://$1@gerrit.nordix.org:29418/$2 $3 scp -p -P 29418 $1@gerrit.nordix.org:hooks/commit-msg $3/.git/hooks cd $3 # Adding gerrit remote base on the origin URL to make sure the git review have # a correct project path for repositories on Nordix gerrit_remote=$(git remote -v | awk ' /^origin.*\(push\)/ { print $2 }') git remote add gerrit ${gerrit_remote} git checkout master