cd
test -f installed/mercurial-2.1.1.tar.gz &&
mv installed/mercurial-2.1.1.tar.gz .
test ! -f mercurial-2.1.1.tar.gz &&
wget http://mercurial.selenic.com/release/mercurial-2.1.1.tar.gz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "mercurial-*" -exec rm -r {} \;
tar xzvf ~/mercurial-2.1.1.tar.gz
cd mercurial-2.1.1
test $UID = 0 && chown -R root:root .
# I was getting this error trying 'make all':
# docutils: ImportError: No module named roman
# no luck Googling around, so I just ran 'make build' to skip the docs
# and 'make install-bin' instead of the regular install.
# Build it
make all
# Become root to install it
su
# Remove the Slackware version, if there is one
test -x /sbin/removepkg && /sbin/removepkg mercurial
# Install it
make install
# Make sure it's not broken
hg version
# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .