zshrc.d/30-functions-hg.zrc
author Mikael Berthe <mikael@lilotux.net>
Sun, 15 Jul 2012 01:58:11 +0200
changeset 10 ed98b8ea395d
parent 9 d7843f267d79
child 25 709f9a3b120e
permissions -rw-r--r--
Improve hg_pull_and_see (accept hg pull argument)


# Use the same arguments as hg pull
# e.g. "hg_pull_and_see -u"
function hg_pull_and_see() {
    if ! $HG_ROOT_CMD > /dev/null; then
        print "Not a Mercurial repository!"
        return -1
    fi

    local i=$(hg id -r tip --num)
    local i_h=$(hg id -r tip --id)
    hg pull $@
    local j=$(hg id -r tip --num)
    local j_h=$(hg id -r tip --id)

    if (( $i != $j ));then
        hg log --quiet --style=changelog -r "not ancestors($i)"
        print "\nPulled from ${i_h} to ${j_h}."
    fi
}