Skip to content

Instantly share code, notes, and snippets.

@reyjrar
Created September 10, 2012 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reyjrar/3690818 to your computer and use it in GitHub Desktop.
Save reyjrar/3690818 to your computer and use it in GitHub Desktop.
How I work with mercurial!
#!/bin/sh
BASEDIR=$HOME/code/project
UPSTREAM="$BASEDIR/upstream"
WORKING="$BASEDIR/working"
RSYNC_OPTS=""
(( $DEBUG )) && RSYNC_OPTS="--dry-run -v"
cd $UPSTREAM;
hg pull > /dev/null
if [[ $? -ne 0 ]]; then
echo "hg pull in $UPSTREAM failed.";
exit $?;
fi
cd $WORKING;
git checkout upstream > /dev/null
if [[ $? -ne 0 ]]; then
echo "checking out upstream in $WORKING failed.";
exit $?;
fi
rsync -a --exclude=.git* --exclude=.hg* --delete $RSYNC_OPTS $UPSTREAM/ $WORKING/;
if [[ $? -ne 0 ]]; then
echo "Rsync failed!";
exit $?;
fi
echo "Update of upstream branch completed successfully!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment