chiark / gitweb /
Add a couple of tools to make working with Bazaar archives more convenient.
[bin.git] / baztag
diff --git a/baztag b/baztag
new file mode 100755 (executable)
index 0000000..249f61a
--- /dev/null
+++ b/baztag
@@ -0,0 +1,38 @@
+#! /bin/sh -e
+
+usage () {
+       cat <<EOF
+$0 [options] VERSION
+
+Options:
+  -n, --no-act          Don't tag; just print the command that would be run.
+
+EOF
+}
+
+NOACT=
+
+if ! eval set -- "$(getopt -o n -l help,no-act -- "$@")"; then
+       usage >&2
+       exit 1
+fi
+
+while :; do
+       case $1 in
+               --help) usage; exit 0 ;;
+               -n|--no-act)
+                       NOACT=echo
+                       shift
+                       ;;
+               --)     shift; break ;;
+               *)      usage >&2; exit 1 ;;
+       esac
+done
+
+if [ $# -eq 0 ]; then
+       usage >&2
+       exit 1
+fi
+VERSION="$1"
+
+$NOACT baz branch "$(bazpath)" "$(bazpath "releases--$VERSION")"