zshrc.d/30-functions-hg.zrc
author Mikael Berthe <mikael@lilotux.net>
Sun, 02 May 2021 12:58:39 +0200
changeset 48 604330c024f4
parent 42 2431e6a9344a
permissions -rw-r--r--
Fix key bindings with screen TERM


# 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

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

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