zshrc.d/30-functions-hg.zrc
changeset 10 ed98b8ea395d
parent 9 d7843f267d79
child 25 709f9a3b120e
equal deleted inserted replaced
9:d7843f267d79 10:ed98b8ea395d
     1 
     1 
       
     2 # Use the same arguments as hg pull
       
     3 # e.g. "hg_pull_and_see -u"
     2 function hg_pull_and_see() {
     4 function hg_pull_and_see() {
     3     if ! $HG_ROOT_CMD > /dev/null; then
     5     if ! $HG_ROOT_CMD > /dev/null; then
     4         print "Not a Mercurial repository!"
     6         print "Not a Mercurial repository!"
     5         return -1
     7         return -1
     6     fi
     8     fi
     7 
     9 
     8     local i=$(hg id --num)
    10     local i=$(hg id -r tip --num)
     9     local i_h=$(hg id --id)
    11     local i_h=$(hg id -r tip --id)
    10     hg pull -u
    12     hg pull $@
    11     local j=$(hg id --num)
    13     local j=$(hg id -r tip --num)
    12     local j_h=$(hg id --id)
    14     local j_h=$(hg id -r tip --id)
    13 
    15 
    14     if (( $i != $j ));then
    16     if (( $i != $j ));then
    15         print "\nChangelog from ${i_h} to ${j_h}..."
       
    16         hg log --quiet --style=changelog -r "not ancestors($i)"
    17         hg log --quiet --style=changelog -r "not ancestors($i)"
       
    18         print "\nPulled from ${i_h} to ${j_h}."
    17     fi
    19     fi
    18 }
    20 }