chiark / gitweb /
more convenient wrapper for bzr upgrade
[bin.git] / baztag
1 #! /bin/sh -e
2
3 usage () {
4         cat <<EOF
5 $0 [options] VERSION
6
7 Options:
8   -n, --no-act          Don't tag; just print the command that would be run.
9
10 EOF
11 }
12
13 NOACT=
14
15 if ! eval set -- "$(getopt -o n -l help,no-act -- "$@")"; then
16         usage >&2
17         exit 1
18 fi
19
20 while :; do
21         case $1 in
22                 --help) usage; exit 0 ;;
23                 -n|--no-act)
24                         NOACT=echo
25                         shift
26                         ;;
27                 --)     shift; break ;;
28                 *)      usage >&2; exit 1 ;;
29         esac
30 done
31
32 if [ $# -eq 0 ]; then
33         VERSION="$(dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2)"
34 else
35         VERSION="$1"
36 fi
37
38 $NOACT baz branch "$(bazpath)" "$(bazpath "releases--$VERSION")"