Basic Git integration with Google App Engine

So we at sendapatch.se use Git a lot for the our productions. It's great.

One vital detail you need to know in App Engine development is what’s up there, … y'know, up in the cloud.

The solution is as obvious as it is useful and tedious to write, for your consideration: a script that updates App Engine from the current HEAD and bookmarks it in a branch named uploaded-<version>.

#!/bin/bash

# updates appengine from current HEAD and puts tree in uploaded-<version>

BASE=.
PYTHON=python2.7
APPENGINE=$BASE/google_appengine
APP=$BASE/app
VERSION="$(grep '^version: ' "$APP/app.yaml" | cut -c 10-)"
BRANCH="uploaded-$VERSION"

echo "Creating snapshot for $VERSION" >&2

TREE="$(git write-tree)"
COMMIT="$(git commit-tree $TREE -p HEAD <<COMMIT
Upload $VERSION to Google App Engine
COMMIT
)"
echo "commit $COMMIT"
git branch -f "$BRANCH" "$COMMIT" || exit

exec "$PYTHON" "$APPENGINE/appcfg.py" update app "$@"

RSS 2.0