Created
September 10, 2012 13:09
-
-
Save reyjrar/3690818 to your computer and use it in GitHub Desktop.
How I work with mercurial!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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