#!/bin/bash
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) Bull S.A.S (2010, 2011)
# Contributor: Pierre Vignéras <pierre.vigneras@bull.net>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
###############################################################################

# This script does the following:
# - Fetch the list of git tag for the given git repository
# - Prompt the user to select one of the tag
# - Invoke autorelease to perform the release

if test $# -ne 1;then
	echo "Usage: $(basename $0) git_repo";
	exit 1;
fi

# Find the full path
GIT_WD=$(readlink -f 1)
cd $GIT_WD
PS3='Select a tag: ';
select TAG in $(git tag);do
	echo "Git tag $TAG selected, invoking autorelease.";
	break;
done

unpackaged/tools/autorelease . $TAG
