#!/bin/zsh # mercurial related stuff {{{ if check_com -c hg ; then # gnu like diff for mercurial # http://www.selenic.com/mercurial/wiki/index.cgi/TipsAndTricks #f5# GNU like diff for mercurial hgdi() { emulate -L zsh for i in $(hg status -marn "$@") ; diff -ubwd <(hg cat "$i") "$i" } # build debian package #a2# Alias for \kbd{hg-buildpackage} alias hbp='hg-buildpackage' # execute commands on the versioned patch-queue from the current repos alias mq='hg -R $(readlink -f $(hg root)/.hg/patches)' # diffstat for specific version of a mercurial repository # hgstat => display diffstat between last revision and tip # hgstat 1234 => display diffstat between revision 1234 and tip #f5# Diffstat for specific version of a mercurial repos hgstat() { emulate -L zsh [[ -n "$1" ]] && hg diff -r $1 -r tip | diffstat || hg export tip | diffstat } #f5# Get current mercurial tip via hg itself gethgclone() { emulate -L zsh setopt errreturn if [[ -f mercurial-tree/.hg ]] ; then cd mercurial-tree echo "Running hg pull for retreiving latest version..." hg pull echo "Finished update. Building mercurial" make local echo "Setting \$PATH to $PWD:\$PATH..." export PATH="$PWD:$PATH" else echo "Downloading mercurial via hg" hg clone http://selenic.com/repo/hg mercurial-tree cd mercurial-tree echo "Building mercurial" make local echo "Setting \$PATH to $PWD:\$PATH..." export PATH="$PWD:$PATH" echo "make sure you set it permanent via ~/.zshrc if you plan to use it permanently." # echo "Setting \$PYTHONPATH to PYTHONPATH=\${HOME}/lib/python," # export PYTHONPATH=${HOME}/lib/python fi } fi # end of check whether we have the 'hg'-executable # get current mercurial snapshot #f5# Get current mercurial snapshot gethgsnap() { emulate -L zsh setopt errreturn if [[ -f mercurial-snapshot.tar.gz ]] ; then echo "mercurial-snapshot.tar.gz exists already, skipping download." else echo "Downloading mercurial snapshot" wget http://www.selenic.com/mercurial/mercurial-snapshot.tar.gz fi echo "Unpacking mercurial-snapshot.tar.gz" tar zxf mercurial-snapshot.tar.gz cd mercurial-snapshot/ echo "Installing required build-dependencies" $SUDO apt-get update $SUDO apt-get install python2.4-dev echo "Building mercurial" make local echo "Setting \$PATH to $PWD:\$PATH..." export PATH="$PWD:$PATH" echo "make sure you set it permanent via ~/.zshrc if you plan to use it permanently." }