zshrc.d/30-functions-hg.zrc
author Mikael Berthe <mikael@lilotux.net>
Sat, 14 Jul 2012 23:13:35 +0200
changeset 6 7671e95ab8b0
parent 4 ca432c482cc9
child 9 d7843f267d79
permissions -rw-r--r--
Change my local mkcd alias into a function I was grepping for my mkcd alias in the wrong terminal and found another version, which turned out to be a good thing as Frank's implementation looks better :) https://dev.0x50.de/projects/ftzsh/repository/revisions/master/entry/functions/mkcd
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
}