### vim:ft=zsh:foldmethod=marker
###
### shortcut for creating exports with hg

check_com_print hg || return 1

local ddir
ddir=${1} ; shift

if [[ ${ddir} == '-h' ]] ; then
    printf 'Usage: hgexport <destination-dir> COMMIT(s)...\n'
    return 0
fi
if [[ ! -d ${ddir} ]] ; then
    printf 'Destination directory (%s) does not exist. Abort.\n' ${ddir}
    return 1
fi

command hg export -o ${ddir}'/%b-%nof%N-%h.diff' "$@"