« Dependency | Main | Dumb and Dumber »

Mercurial, Part III: running Trac with Mercurial on TextDrive

This post is a (very) terse description of how I set things up Trac + Mercurial integration on my TXD account, based loosely on TextDrive's own instructions for setting up Trac, instructions on the TracPlugin page and "Non-root Trac installation on Textdrive", which didn't quite work for me, as the CGI wouldn't load the Mercurial .egg plugin, but it sure got me started. You can see a previous post as to why you need to hold your own copy of Trac.

Install Trac 10.3.x locally:

    #mkdir ~/local
    # cd ~local
    # wget http://ftp.edgewall.com/pub/trac/trac-
    # tar xvzf trac-
    # mv trac- trac-
    # cd  trac-
    # python setup.py install --prefix=/users/home/$yourname/local/trac-
    # cd ..; ln -s trac- trac 
    # rm -rf   trac-; rm trac-

Have your account pickup your copy of 10.3.x trac instead of TXD's 0.9.x version:

    # nano ~./profile
    #export PYTHONPATH=${HOME}/local/trac/lib/python2.4/site-packages

You must set the PYTHONPATH - the tracd and trac-admin scripts are lightweight wrappers that use Python's import mechanism, not some fixed path, so Python's sys.path must be set to not point at TXD's version - don't waste half and hour figuring this out like I did. At this point you should be able to open a Python shell, "import trac", "print trac.__version__" and see a version number that is 10.3.something.

Get the Mercurial plugin for Trac:

    # mkdir ~/tmp; cd ~/tmp
    # svn co http://svn.edgewall.com/repos/trac/sandbox/mercurial-plugin
    # cd mercurial-plugin
    # python setup.py bdist_egg

That will put an .egg in ~/tmp/mercurial-plugin/dist (see TracMercurial for more details).

Create a trac site as per TXD's instructions, but use your copy of trac-admin:

    # mkdir ~/trac
    # ~/local/trac/bin/trac-admin ~/trac/$sampletrac initenv
    for the repository_type type 'hg'
    for the repository_path, type the local path to your mercurial repo 

Copy the .egg plugin to the trac project, it doesn't need to be globally installed:

    # cp ~/tmp/mercurial-plugin/dist/*.egg ~/trac/$sampletrac/plugins

If you had an exisiting Trac install, see TracMercurial for details on how to convert it.

Now, start tracd as per TXD's instructions and using the port they gave you, but use your copy of tracd instead:

 ~/local/trac/bin/tracd  -d -p XXXX \
--auth $sampletrac,/home/$username/etc/trac.digest.passwd,$your.tld \

Post script: a question on multiple projects under Trac

update: Bill Mill explains how to do it: "Just list each project consecutively on the tracd command line." Doh!

Trac looks nice, but can it support multiple projects under a single port? Mercurial branches tend to be cloned standalone repositories, so this will be needed.

See also:

April 9, 2007 06:19 PM


Bill Mill
(April 9, 2007 05:53 PM #)

It's not exactly graceful, but it works. Check it: http://billmill.org:9561

Just list each project consecutively on the tracd command line. My command line (this is TxD too, by the way, though running TxD's trac, but it still works on .10, because I do it at work):

tracd -d -p 9561 --auth *,/path/to/etc/trac.digest.passwd,my_realm /path/to/trac/cherry_blossom/ /path/to/trac/personal_code/ /path/to/trac/cmua/ /path/to/trac/buffet/

Bill de hOra
(April 9, 2007 06:05 PM #)

"Just list each project consecutively on the tracd command line."

Ahh. Thanks Bill!

Bill Mill
(April 9, 2007 07:00 PM #)

No problem!

Unfortunately, real support for multiple projects is probably pretty far off, despite the fact that it was feature request #1.

Post a comment

(you may use HTML tags for style)

Remember Me?

Trackback Pings

TrackBack URL for this entry:

Listed below are links to weblogs that reference Mercurial, Part III: running Trac with Mercurial on TextDrive:

» Dumb and Dumber from Bill de hÓra
Dumb: I bought two books recently. One was called "Information Retrieval: Algorithms and Heuristics" and was reading it over the weekend. Or trying to. By the time I got to the material on Bayesian, I was getting lost. However this... [Read More]

Tracked on April 9, 2007 05:54 PM