Keeping 2 disconnected sites in sync
Michael Smith
smithm at netapps.com.au
Tue Jun 20 17:32:09 CDT 2006
On Tue, 20 Jun 2006 22:23:51 +0100
"Paul Moore" <p.f.moore at gmail.com> wrote:
> A third option might be to use hg bundle and email bundles between the
> sites. But I can't see how to do this, as I get the impression that hg
> bundle needs to see the target repository in order to decide what
> changesets to include. I might be able to do it with a "master" and a
> "working" repository on each PC, but then I start getting lost in a
> maze of repositories, so I suspect that will become unmanageable.
This system actually works very well for me. At each site I have a
script like this: (watch the wrap)
#! /bin/ksh
MAILTO="michael.smith at thalesatm.com"
read COMMENT?"Enter delivery comment: "
hg commit -m "$COMMENT" .
APP=`basename $PWD`
case $APP in
nixedit)
slave=/data/smithm/remote/nixedit
;;
*)
echo $APP " is not recognised"
;;
esac
NUMBER=`date "+%G%m%d%H%M"`
echo "Sending changeset: $NUMBER"
echo "Comment: $COMMENT"
echo "Destination: $MAILTO"
CHANGESET="/tmp/$APP-changeset-$NUMBER.hg"
hg bundle $CHANGESET $slave
hg push $slave
sylpheed-claws --compose "mailto:$MAILTO?subject=[$APP] $COMMENT"
--attach $CHANGESET
...which creates a bundle and pushes to the reference repo. At the
other end I run:
#! /bin/ksh
INCOMING="$HOME/incoming"
for c in `ls $INCOMING/*.hg`
do
filename=`basename $c`
echo "Processing " $filename
APP=`echo $filename | cut -d "-" -f 1`
case $APP in
nixedit)
main=$HOME/src/nixedit
slave=/data/smithm/remote/nixedit
;;
*)
echo $APP " is not recognised"
exit 1
;;
esac
hg --repository $main unbundle $c
hg --repository $main push $slave
rm $c
done
...which looks for bundles, unpacks and deletes them. The case
statements allow me to easily define other parallel projects.
--
Michael Smith
Network Applications
www.netapps.com.au | +61 (0) 416 062 898
Web Hosting | Internet Services
More information about the Mercurial
mailing list