mktag
changeset 16 d5c7dea84c61
child 18 468be5a998dd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mktag	Sun Mar 01 18:36:07 2009 +0100
@@ -0,0 +1,34 @@
+#! /bin/bash
+
+tmp=$(getopt -n $0 -o f --long force -- "$@")
+eval set -- $tmp
+while true; do
+	o="$1"; shift
+	case "$o" in
+		--)		break;;
+		-f|--force)	o_force="-f";;
+	esac
+done
+
+
+tag="${1?}"
+
+id=$(hg id)
+id=${id%% *}
+
+id=${id%+}
+case "$id" in
+	*+)	echo "sorry, local version is modified." >&2
+		exit 1
+		;;
+esac
+
+case "$tag" in
+	v*.*)	;;
+	*)	echo "sorry, tag should be v*.*" >&2
+		exit 1
+		;;
+esac
+
+hg tag $o_force "$tag"
+hg up -r "$tag"