project-config/tools/check_gerrit_projects_changed.sh
Graham Hayes 3539921573
gerrit tests should return to checked out branch
when running "tox -e gerrit" on a local checkout
after the tests have finshed the repo is checked out
to the HEAD commit, not the branch that was checked
out before the run.

This ensures the branch is checked out at the end
of the test.

Change-Id: I58dae937000d05c3a9b09dc4aed5362a5c56d133
2018-02-16 14:12:25 +00:00

21 lines
480 B
Bash
Executable File

#!/bin/bash -xe
GITHEAD=$(git rev-parse HEAD)
GITBRANCH=$(git rev-parse --abbrev-ref HEAD)
# Check out previous version
git checkout HEAD~1
cp gerrit/projects.yaml gerrit/projects-old.yaml
# Back to current version. Otherwise the
# check_gerrit_projects_changed.py invocation might be an old version.
git checkout $GITHEAD
python tools/check_gerrit_projects_changed.py gerrit/projects-old.yaml \
gerrit/projects.yaml
rm gerrit/projects-old.yaml
git checkout $GITBRANCH