zshrc.d/30-functions-hg.zrc
author Mikael Berthe <mikael@lilotux.net>
Sun, 15 Jul 2012 01:37:40 +0200
changeset 9 d7843f267d79
parent 4 ca432c482cc9
child 10 ed98b8ea395d
permissions -rw-r--r--
Improve 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
9
d7843f267d79 Improve hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
     8
    local i=$(hg id --num)
d7843f267d79 Improve hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
     9
    local i_h=$(hg id --id)
4
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    10
    hg pull -u
9
d7843f267d79 Improve hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
    11
    local j=$(hg id --num)
d7843f267d79 Improve hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
    12
    local j_h=$(hg id --id)
4
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
9
d7843f267d79 Improve hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
    14
    if (( $i != $j ));then
d7843f267d79 Improve hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
    15
        print "\nChangelog from ${i_h} to ${j_h}..."
d7843f267d79 Improve hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
    16
        hg log --quiet --style=changelog -r "not ancestors($i)"
4
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    17
    fi
ca432c482cc9 Add hg_pull_and_see
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    18
}