#! /bin/sh
#
# test-ChangeLog.d-symlinks-merge.sh
#
# Copyright (C) 2004 Yann Droneaud
#
# 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
TLA=tla
# TLA=tla-1.2
# TLA=`which tla`
# TLA=$HOME/opt/tla/bin/tla
# TLA=/usr/local/opt/tla/bin/tla
if test $# -lt 1 ; then
echo "Usage $0 "
exit 1
fi
PROJECT=$1
if test -d $PROJECT ; then
cat < test.c <> test.c < ChangeLog
$TLA add ChangeLog
echo "**** commit ChangeLog ****"
$TLA commit -s "Added ChangeLog"
###
cd ..
echo "**** make new branch ****"
$TLA archive-setup $PROJECT--devel--1.0
$TLA tag $PROJECT--main--1.0 $PROJECT--devel--1.0
$TLA get $PROJECT--devel--1.0 devel
cd devel
$TLA cacherev $PROJECT--devel--1.0--base-0
mkdir ChangeLog.d
$TLA add ChangeLog.d
mkdir ChangeLog.d/$ARCHIVE
$TLA add ChangeLog.d/$ARCHIVE
$TLA changelog > ChangeLog.d/$ARCHIVE/$PROJECT--devel--1.0
$TLA add ChangeLog.d/$ARCHIVE/$PROJECT--devel--1.0
$TLA move ChangeLog ChangeLog.d/$ARCHIVE/$PROJECT--main--1.0
mv ChangeLog ChangeLog.d/$ARCHIVE/$PROJECT--main--1.0
ln -s ChangeLog.d/$ARCHIVE/$PROJECT--main--1.0 ChangeLog
$TLA add ChangeLog
echo "**** committing new ChangeLog tree ****"
$TLA commit -s "Build a ChangeLog hierachy"
###
# cd ..
# $TLA delta $PROJECT--main--1.0--patch-2 $PROJECT--devel--1.0--patch-1 delta
# cd main
# $TLA dopatch ../delta .
#
cd ../main
echo "**** Merging devel into main ****"
$TLA star-merge --three-way $PROJECT--devel--1.0
###
echo "**** Commit merge ****"
$TLA commit -s "Merge from devel"
###
ret=$?
cd ..
if test $ret -eq 0 ; then
rm -rf $PROJECT
$TLA register-archive -d address@hidden
else
echo "$TLA return error code $ret"
fi
$TLA my-default-archive $MYARCHIVE