From ef4fd9c52f16e6d242f999dd87170e6cac07230d Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Wed, 10 Jun 2015 17:51:29 +0200 Subject: add ./logerrit testfeature - ./logerrit testfeature will trigger a testbuild of the current feature branch as it is on gerrit - ./logerrit testfeature $BRANCH will do the same for $BRANCH - cloning to a tempdir and rm -rf'ing around isnt ideal, so consider this as a template for your own scripting Change-Id: I50a3c80748af82d855522f245ddbff227c8adab2 --- logerrit | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'logerrit') diff --git a/logerrit b/logerrit index 9e7f2b87fd1e..a88c56f383d7 100755 --- a/logerrit +++ b/logerrit @@ -52,6 +52,7 @@ case "$1" in echo " (yes, this modifies your last commit)" echo " (yes, this modifies your last commit)" echo " nextchange [BRANCH] reset branch to the remote to start with the next change" + echo " testfeature [BRANCH] trigger a test of a feature branch on gerrit" echo "Note: drafts are only visibly to yourself and those that you explicitly add as reviewers." echo echo " --- for reviewers:" @@ -203,6 +204,41 @@ case "$1" in shift ssh ${GERRITHOST?} gerrit query project:core $@ ;; + testfeature) + BRANCH=$2 + if test -z "$BRANCH" + then + BRANCH=`git symbolic-ref HEAD 2> /dev/null` + BRANCH="${BRANCH##refs/heads/}" + if test -z "$BRANCH" + then + echo "no branch specified, and could not guess the current branch" + exit 1 + fi + echo "no branch specified, guessing current branch $BRANCH" + fi + BRANCH="${BRANCH##feature/}" + WORKDIR=`mktemp -d` + if test -z "$WORKDIR" + then + echo "could no create work directory." + exit 1 + fi + echo workdir at $WORKDIR + git clone -s `dirname $0` $WORKDIR/core + pushd $WORKDIR/core + echo "noop commit: trigger test build for branch feature/$BRANCH" > ../commitmsg + echo >> ../commitmsg + echo "branch is at:" >> ../commitmsg + git log -1|sed -e "s/Change-Id:/XXXXXX:/" >> ../commitmsg + git fetch git://gerrit.libreoffice.org/core.git feature/$BRANCH && \ + git checkout -b featuretst FETCH_HEAD && \ + cp -a .git-hooks/* .git/hooks + git commit --allow-empty -F ../commitmsg && \ + git push $GERRITURL HEAD:refs/for/feature/$BRANCH + popd + rm -rf $WORKDIR/core + ;; *) ssh ${GERRITHOST?} gerrit $@ ;; -- cgit