Skip to content


Setting up Mercurial with Dreamhost – Part 1

Part 1 details how to install. Part 2 is here (http://ucla.jamesyxu.com/?p=97)

This is just to document the process of installing Mercurial with Dreamhost. This post assumes you have ssh access and knows a thing or two about linux (since this is mainly a documentation for myself).

mkdir source
wget http://mercurial.selenic.com/release/mercurial-1.8.2.tar.gz

**I have a custom compiled Python 2.6 that somehow did not have bz2 package, these steps installs them**

wget http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz
tar xzf ..
make -f Makefile-libbz2_so
make
make install PREFIX=$HOME
cp libbz2.so.1.0.4 ~/lib/libbz2.so.1.0.4
ln -s ~/lib/libbz2.so.1.0.4 ~/lib/libbz2.so.1.0
cd ~/sources
wget http://www.python.org/ftp/python/2.6.1/Python-2.6.1.tar.bz2
tar jxf ..
./configure –prefix=$HOME
make
[We should not see bz2 on the not built module list now]
make install

[Now test the python still works:]
which python (confirm its the one we have in our own bin)
python (see it actually works…)
[Now test the python still works:]

**I have a custom compiled Python 2.6 that somehow did not have bz2 package, these steps installs them**
[So we are back in mercurial]

make all

**It now complains about missing docutils, this this happens, follow the steps below, this assumes your custom Python has setuptools**

easy_install docutils

**It now complains about missing docutils, this this happens, follow the steps below, this assumes your custom Python has setuptools**

vi ~/.bash_profile
export HGRCPATH=[HOME]/.hgrc
source ~/.bash_profile
hg –version

Now we have Mercurial installed. We can configure repos:

mkdir -p ~/hg/repos
vi ~/hg/hgweb.config
[web]
style = gitweb

cp ~/sources/mercurial-1.8.2/hgweb.cgi ~/hg
chmod +x ~/hg/hgweb.cgivi hgweb.cgi
vi hgweb.cgi
config = “[HOME]/hg/hgweb.config”
import sys; sys.path.insert(0, “[HOME]/lib/python”)

vi ~/hg/.htaccess
# Taken from http://www.pmwiki.org/wiki/Cookbook/CleanUrls#samedir
# Used at http://ggap.sf.net/hg/
Options +ExecCGI
RewriteEngine On #write base depending on where the base url lives
RewriteBase /hg
RewriteRule ^$ hgweb.cgi [L] # Send requests for files that exist to those files.
RewriteCond %{REQUEST_FILENAME} !-f # Send requests for directories that exist to those directories.
RewriteCond %{REQUEST_FILENAME} !-d # Send requests to hgweb.cgi, appending the rest of url.
RewriteRule (.*) hgweb.cgi/$1 [QSA,L]

Now we have everything! To have it linked to a domain, do:

ln -s ~/hg ~/[Sub domain]

Posted in Technology. Tagged with , , .