1 _HGRC='/etc/mercurial/hgrc'
4 mkdir -p $(dirname ${_HGRC})
5 [ -e ${_HGRC} ] || : > ${_HGRC}
6 grep -q '^\[extensions\]$' ${_HGRC} || ([ -z $(<${_HGRC}) ] || echo >> ${_HGRC}; echo -e '[extensions]\n' >> ${_HGRC})
7 grep -q '^forest=' ${_HGRC} || sed 's/^\[extensions\]/&\nforest=/' -i ${_HGRC}
15 sed '/^forest=.*/d' -i ${_HGRC}
16 expr "$(<${_HGRC})" : '\(.*\)\[extensions\]$' > /tmp${_HGRC##*/} && mv /tmp${_HGRC##*/} ${_HGRC}; rm -f /tmp${_HGRC##*/}
17 [ -z $(<${_HGRC}) ] && rm ${_HGRC}
18 _HGRC=$(dirname ${_HGRC})
19 [ -z $(ls ${_HGRC}) ] && rm -r ${_HGRC}
24 [ "$(type -t "$op")" = "function" ] && $op "$@"