Good or Best way to copy a new local repository to a remote hg apache server?
List Box
listbox at hymerfania.com
Wed Oct 1 18:15:46 CDT 2008
Hi folks,
I'm rewriting a script I've been using that recreates a local repository
onto a remote apache server.
The local machine is often windows, and the remote one is a Linux apache
server.
My script is a bit complicated, because instead of just copying the whole
repository, it
)logs onto the remote machine,
)creates a new empty repository,
)pulls and merges with it,
)pushes all the local contents.
I chose this method to avoid platform differences, and try to mitigate
versioning problems with hg itself.
I was wondering if anybody else had a different or better way to do the same
thing.
Here is my old bash script. Yes it needs a complete re-write, that's why I'm
posting here :)
*********************************************************
*********************************************************
*********************************************************
#!/bin/bash
browsercommand=firefox
localrepo=$1
if ! [[ -d $localrepo ]] ; then
echo "Local repository $localrepo does not exist or could not be read."
exit 16
fi
set -e
if ! [[ -d $localrepo/.hg ]] ; then
echo "Local directory $localrepo exists, but is not a Mercural
repository..."
hg init $localrepo
fi
nurepository=`basename "$1"`
description=$2
checkoutdir="$nurepository""_checked"
repopath="\$HOME/repositories/$nurepository"
litralizer_ex='s,[]/\\$*[],\\\\&,g'
B=`basename $1`
P=`dirname $1`
cd $P
if [ `pwd` != "/" ]
then
FULLNAME=`pwd`/$B
else
FULLNAME=/$B
fi
if [[ -n CYGWIN ]]; then
message=`cygpath -w $FULLNAME | sed -e $litralizer_ex`
else
message=`echo $FULLNAME | sed -e $litralizer_ex`
fi
cooked_des=`echo -e $description| sed -e $litralizer_ex`". "
export DISPLAY=none:0.0
export SSH_ASKPASS=dummy_script.sh
export HGHOST=hg.localnet.org
export HGUSER=me
export HG_USER_PASSWORD=passwordA
export HG_REPO_PASSWORD=passwordB
export REMOTE_REPO_URI="http://$HGHOST/$nurepository"
remo_repo_uri="http://$HGUSER:$HG_USER_PASSWORD@$HGHOST/$nurepository"
echo $REMOTE_REPO_URI
ssh-add < "/dev/null"
hg --repository $localrepo add
hg --repository $localrepo commit -m "Checkin for subsequent push to
$REMOTE_REPO_URI"
echo "Creating new repository for project $nurepository at "
$REMOTE_REPO_URI
ssh -q hguser@$HGHOST "mkdir -p $repopath"
ssh -q hguser@$HGHOST "hg init $repopath"
ssh -q hguser@$HGHOST "cat \$HOME/hgrc | sed -e \"s,PLACEHOLDER,$cooked_des
More information about the Mercurial
mailing list