support gerrit style refs/changes/... for branch names

To use a gerrit "branch" with devstack I would find the repo/remote and
set it for the specific project.

Example: https://review.openstack.org/2059

Would mean I update my localrc with the following settings:

KEYSTONE_REPO=https://review.openstack.org/p/openstack/keystone
KEYSTONE_BRANCH=refs/changes/59/2059/2

Change-Id: I0793415fb03cc08d1eb1a3faf1b8ec3e723beb31
main
Jesse Andrews 13 years ago
parent ef4e5367d2
commit 1a52a02f10

@ -448,10 +448,18 @@ function git_clone {
GIT_DEST=$2
GIT_BRANCH=$3
if echo $GIT_BRANCH | egrep -q "^refs"; then
# If our branch name is a gerrit style refs/changes/...
if [ ! -d $GIT_DEST ]; then
git clone $GIT_REMOTE $GIT_DEST
fi
cd $GIT_DEST
git fetch $GIT_REMOTE $GIT_BRANCH && git checkout FETCH_HEAD
else
# do a full clone only if the directory doesn't exist
if [ ! -d $GIT_DEST ]; then
git clone $GIT_REMOTE $GIT_DEST
cd $2
cd $GIT_DEST
# This checkout syntax works for both branches and tags
git checkout $GIT_BRANCH
elif [[ "$RECLONE" == "yes" ]]; then
@ -469,6 +477,7 @@ function git_clone {
git branch -D $GIT_BRANCH || true
git checkout -b $GIT_BRANCH
fi
fi
}
# compute service

Loading…
Cancel
Save