zshrc.d/30-functions-hg.zrc
author Mikael Berthe <mikael@lilotux.net>
Sat, 14 Jul 2012 22:50:44 +0200
changeset 4 ca432c482cc9
child 9 d7843f267d79
permissions -rw-r--r--
Add hg_pull_and_see
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     1
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     2
function hg_pull_and_see() {
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     3
    if ! $HG_ROOT_CMD > /dev/null; then
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     4
        print "Not a Mercurial repository!"
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     5
        return -1
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     6
    fi
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     7
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     8
    local i=$(hg id -i)
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     9
    hg pull -u
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    10
    local j=$(hg id -i)
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    11
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    12
    if [[ $i != $j ]];then
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
        hg log --quiet -r${i}:tip --style=changelog
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    14
    fi
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    15
}