zsh/mercurial.zsh @ 4488c06ee076

hg: change editor to vim
author Steve Losh <steve@stevelosh.com>
date Sat, 15 May 2010 23:28:59 -0400
parents 663470382022
children 1a3ee92103ed
#!/usr/bin/env zsh

alias mq='hg -R $(hg root)/.hg/patches'
function tmd () {
    hg diff --no-color | mate
}
function tms () {
    hg show $1 | sed -E -e "s/\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g" | mate
}
alias calctime="sed -e 's/{t: *\([0-9]*\)*.*/\1/' | python -c 'import sys; print sum(map(int, sys.stdin.readlines())) / 60.0, \"hours\"'"
alias hgt='hg log -vd "`date -j \"+%Y-%m-%d\"`" -u steve | grep "{t:" | calctime'

function pull_everything() {
    for repo in $( ls -1 ); do
        if [[ -d $repo && -d $repo/.hg ]]; then
            echo "Pulling" $repo
            hg -R $repo pull -u
            echo
        fi
    done
}

function_bitb() {
    local P="$(hg paths 2>/dev/null | grep 'bitbucket.org' | head -1)"
    local URL="$(echo $P | sed -e's|.*\(bitbucket.org.*\)|http://\1|')"
    [[ -n $URL ]] && open $URL || echo "No BitBucket path found!"
}