Post your helper scripts!

Simon Harrison info at simonh.uk
Tue Sep 17 08:52:58 UTC 2024


Hi list. I have a possibly unusual workflow with most of my repo's.
When I've made some changes I'm happy with, I push to my default
server, push to a second server, then post a patch to my production
server, then pipe the patch using Alpine. I finally wrote a helper
script to save me some typing. I thought it might be interesting to see
what other users have created as well. Here's mine below (using RCS for
shared scripts by the way).


#!/bin/bash
# $Id: out.sh,v 1.6 2024/09/17 08:30:54 simon Exp simon $

# TODO
# * Read .hg/hgrc to find which [paths] are pushed to
# * Check if a push is necessary
# * Only send email patch if not already sent

UNCLEAN=$(hg status)
LAST_REV=$(hg identify --num)
LAST_PUSH=$(cat out.log)

echo "Last revision: $LAST_REV"
echo "Last push: $LAST_PUSH"

# if hg status is empty, directory is clean
if [[ -z $UNCLEAN ]]; then
    if [ $LAST_REV == $LAST_PUSH ]; then
        echo "Already pushed changes!"
        exit
    else
        hg push; hg push server2; hg email -r tip;
        echo $LAST_REV > out.log
        echo '...done!'
    fi
else
    echo "Uncommitted changes found:"
    echo "$UNCLEAN";
fi


More information about the Mercurial mailing list