Thursday 22 September 2011

svn ci -m"svn helper script to maintain 'Pristine' workspace area and do faster checkouts" svncoP.sh svnmaintainP.sh

#!/bin/bash
# svncoP: svn co using Pristine workspace (faster!)
#
#Svn command-line co or updates are slow on big svn repositories becasuse they do each file sequentially.
#TortoiseSvn and other clients are a little bit more clever I think and have an element of multi-threaded/parallel checkouts.
#In the past I used a cron to maintain a .pristine. copy of large svn.
#And a helper script when I needed a checkout.
#
#The way it works:
#Cron does regular cleanup and svn up and makes archive of the pristine workspace.
#Helper checkout script unpacks archive of pristine workspace, unpacks it in new place, then does svn up in there.
#
# 22/9/2011 James Coleman

PRISTINEDIR=~intregress/pristine
if [[ ! -d $PRISTINEDIR ]] ; then
  echo "FAIL: pristine dir:$PRISTINEDIR is not set up"
  exit -1
fi
project=$1
if [[ "$project" == "" ]] ; then
  echo "FAIL: USAGE: $0 "
  echo "e.g. $0 lab"
  exit -1
fi
if [[ ! -e $PRISTINEDIR/${project}_trunk.tbz ]] ; then
  echo "FAIL: pristine workspace:$PRISTINEDIR/${project}_trunk.tbz is not set up"
  exit -1
fi

DTS_START="$(date)"
S_START="$(date +%s)"
echo "DTS_START:$DTS_START"
tar -jxvf $PRISTINEDIR/${project}_trunk.tbz
DTS_UPSTART="$(date)"
echo "DTS_UPSTART:$DTS_UPSTART"
cd $project
svn up
cd ..

DTS_END="$(date)"
S_END="$(date +%s)"
echo "DTS_START:$DTS_START"
echo "DTS_UPSTART:$DTS_UPSTART"
echo "DTS_END:$DTS_END"
echo "svncoP project:$project Total time taken: $(($S_END - $S_START)) secs" |tee -a $PRISTINEDIR/svncoP_${project}.log



#!/bin/bash
# svnmaintainP: cron script to maintain 'Pristine' svn workspace
#
#Svn command-line co or updates are slow on big svn repositories becasuse they do each file sequentially.
#TortoiseSvn and other clients are a little bit more clever I think and have an element of multi-threaded/parallel checkouts.
#In the past I used a cron to maintain a .pristine. copy of large svn.
#And a helper script when I needed a checkout.
#
#The way it works:
#Cron does regular cleanup and svn up and makes archive of the pristine workspace.
#Helper checkout script unpacks archive of pristine workspace, unpacks it in new place, then does svn up in there.
#
# 22/9/2011 James Coleman

PRISTINEDIR=~intregress/pristine
if [[ ! -d $PRISTINEDIR ]] ; then
  echo "FAIL: pristine dir:$PRISTINEDIR is not set up"
  exit -1
fi
project=$1
if [[ "$project" == "" ]] ; then
  echo "FAIL: USAGE: $0 "
  echo "e.g. $0 lab"
  exit -1
fi
if [[ ! -e $PRISTINEDIR/${project} ]] ; then
  echo "FAIL: pristine workspace:$PRISTINEDIR/${project} is not set up"
  exit -1
fi

DTS_START="$(date)"
S_START="$(date +%s)"
echo "DTS_START:$DTS_START"

cd $PRISTINEDIR/${project}
svn up

DTS_TARSTART="$(date)"
echo "DTS_TARSTART:$DTS_TARSTART"
cd ..
tar -jcvf $PRISTINEDIR/${project}_trunk_new.tbz ${project}
mv $PRISTINEDIR/${project}_trunk_new.tbz $PRISTINEDIR/${project}_trunk.tbz

DTS_END="$(date)"
S_END="$(date +%s)"
echo "DTS_START:$DTS_START"
echo "DTS_TARSTART:$DTS_TARSTART"
echo "DTS_END:$DTS_END"
echo "svnmaintainP project:$project Total time taken: $(($S_END - $S_START)) secs" |tee -a $PRISTINEDIR/svnmaintainP_${project}.log



No comments: