diff --git a/scripts/dbmigrate-test b/scripts/dbmigrate-test new file mode 100755 --- /dev/null +++ b/scripts/dbmigrate-test @@ -0,0 +1,122 @@ +#!/bin/sh -e + +if [ $# -lt 2 ] || [ $# -gt 3 ]; then + cat >&2 <&1) + st=$? + if [ $st -ne 0 ]; then + echo "$output" >&2 + echo "Command $@ returned exit status $st." >&2 + exit 1 + fi +) + +HG() { + "${HG:-hg}" --repository "$source_repo" "$@" +} + +# If upgrading to "current revision", warn if working directory is dirty. +if [ ! "$to_rev" ] && [ "$(HG status -mard)" ]; then + announce "Warning: Uncommitted changes in working directory will be ignored!" +fi + +from_rev_hash=$(HG id --id --rev "${from_rev:-.}") +to_rev_hash=$(HG id --id --rev "${to_rev:-.}") +temp=$(readlink -f "$(mktemp --tmpdir -d 'dbmigrate-test.XXXXXX')") + +cat <