1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#!/bin/sh
# Default read-only HTTP URL used for externals
SVNHTTPURL=https://svn.freepascal.org/svn
if [ $# -lt 1 ]; then
echo "Usage: $0 <branch/tag name>"
echo
echo "Example: $0 branches/fixes_2_1"
echo " $0 tags/release_2_0_4"
echo
exit 1
fi
NEWSVNTAG=$1
# For testing output the svn commands
if [ ."$2" = ."test" ]; then
SVN="echo svn"
else
SVN=svn
fi
# Decode SVN URL from current fpcbuild URL
FPCBUILDURL=`svn info . | grep URL | grep fpcbuild`
if [ $? -ne 0 ]; then
echo "This is not an fpcbuild checkout"
fi
SVNURL=`echo $FPCBUILDURL | sed -e 's+URL: ++' -e 's+/fpcbuild/.*$++'`
OLDSVNTAG=`echo $FPCBUILDURL | sed -e 's+URL:.*fpcbuild/++'`
COMMITMSG="Creating branch $NEWSVNTAG"
echo "SVN URL: $SVNURL"
echo "Old SVN (branch) dir: $OLDSVNTAG"
echo "New SVN (branch) dir: $NEWSVNTAG"
$SVN copy $SVNURL/fpc/$OLDSVNTAG $SVNURL/fpc/$NEWSVNTAG -m "$COMMITMSG"
$SVN copy $SVNURL/fpcbuild/$OLDSVNTAG $SVNURL/fpcbuild/$NEWSVNTAG -m "$COMMITMSG"
# Generate svn:externals property
cat << EXTERNALEOF > external.lst
../../../fpc/$NEWSVNTAG fpcsrc
../../../fpcdocs/trunk fpcdocs
EXTERNALEOF
echo
echo "External list:"
echo "===="
cat external.lst
echo "===="
echo
# Setting properties on a remote URL is not supported.
# To workaround we need to do a (non-recursive) checkout of the
# just created fpcbuild branch
$SVN co -N $SVNURL/fpcbuild/$NEWSVNTAG branchtmp
$SVN ps -F external.lst svn:externals branchtmp
# Commit and cleanup
$SVN ci branchtmp -m "$COMMITMSG" && rm -rf branchtmp && rm -f external.lst
|