Mercurial, SSH, and a local install

I have the latest and greatest version of Mercurial on
my laptop but the other machines I want to 'push' to
over ssh are either a shared host without Mercurial installed
or are pinned to a release of a distro
that has a very old version of Mercurial.
This means that I had to $ make install-home,
which leaves me with a problem,
which is that the installed Mercurial files won't be
on my Python path when I ssh in. That means I see
this when I ssh in from my laptop:

The easiest way I found to fix
this to add the following two lines to
the beginning of ~/bin/hg
on the server:

import sys
sys.path.append('/home/jcgregorio/lib/python')

Then I need to specify the exact location
of hg from the command line on the laptop, so it uses
my locally installed version on the server:

$ hg push --remotecmd ~/bin/hg ssh://bitworking.org/myproject/

That --remotecmd can be made to go away if I add it
to the config file for the project on the laptop. I created the file
.hg/hgrc and added the following lines:

[ui]
remotecmd = ~/bin/hg

Now I can finally run:

$ hg push ssh://bitworking.org/myproject/

I solved the problem by adding a couple of lines to .profile (or .bash_profile or whatever) on my shared host:

export PATH=~/bin:$PATH
export PYTHONPATH=~/lib/python:$PYTHONPATH

You might have to adjust that PYTHONPATH value, though. Depending on the way you installed Mercurial, it's probably something more like ~/lib/python2.5/site-packages.
Is there a reason this won't work for you?

I don't have root, but ~/bin contains all the executables that I have installed, and ~/lib/python contains all of the python libraries. Since all of them are available to me when I ssh in, I can simply forget about the difference between system wide installation and per user installation. As none of them have been modified, upgrading is a snap.

Like Sam, I went the invasive route on purpose, because I wanted the software and Python libs I had installed myself to always be used rather than the system-wide software.
Though you could make it slightly less invasive by sticking your personal bin and lib dirs at the end of the search paths:

export PATH=$PATH:~/bin
export PYTHONPATH=$PYTHONPATH:~/lib/python

That way your local software/libraries would only be used if they were not available system-wide.
(I know I'm telling you stuff that you already know... for some reason, I felt compelled to spell all this out. Sorry!)