Since I really want to at least assess the scope of getting Mercurial to run on Jython, and it really is a bit closer, I decided to start reading the Mercurial book. At the same time, I am gearing up to play around with the Da Vinci Machine project, which is hosted on a Mercurial repo. So I'm doubly motivated to get a good understanding of hg. So, going along with the book, I first tried "hg version" (I have a local hg that points to Jython -- and I am quite sure it points to Jython this time). Woohoo! -- version works (you have to start somewhere...):
[frank@pacman ~]$ hg version
Mercurial Distributed SCM (version b8d750daadde+20090218)
Copyright (C) 2005-2008 Matt Mackalland others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Next I find that "hg help" works:
[frank@pacman ~]$ hg help init
hg init [-e CMD] [--remotecmd CMD] [DEST]
create a new repository in the given directory
Initialize a new repository in the given directory. If the given
directory does not exist, it is created.
If no directory is given, the current directory is used.
It is possible to specify an ssh:// URL as the destination.
Look at the help text for the pull command for important details
about ssh:// URLs.
options:
-e --ssh specify ssh command to use
--remotecmd specify hg command to run on the remote side
use "hg -v help init" to show global options
The next bit in the book uses "hg clone". Unfortunately "hg clone" uses buffer(), which Jython lacks. Jython has never supported the buffer() protocol from CPython, and almost certainly never will. For one thing, buffer() is very C-oriented, and buffer() did not make the cut into Python 3.0, so implementing buffer makes little sense for us. We may very well look into the buffer() replacements defined for 3.0, but that is something for another time. So I used regular hg to execute the clone.
Next "hg log" revealed a bug in Jython that was pretty easy to fix: we where
not handling writes past the end of the buffer in our cStringIO. That's a nice benefit of trying out larger apps on Jython -- they are good exercise :)
And so now "hg log" runs:
changeset: 4:2278160e78d4
tag: tip
user: Bryan O'Sullivan
date: Sat Aug 16 22:16:53 2008 +0200
summary: Trim comments.
changeset: 3:0272e0d5a517
user: Bryan O'Sullivan
date: Sat Aug 16 22:08:02 2008 +0200
summary: Get make to generate the final binary from a .o file.
changeset: 2:fef857204a0c
user: Bryan O'Sullivan
date: Sat Aug 16 22:05:04 2008 +0200
summary: Introduce a typo into hello.c.
changeset: 1:82e55d328c8c
user: mpm@selenic.com
date: Fri Aug 26 01:21:28 2005 -0700
summary: Create a makefile
changeset: 0:0a04b987be5a
user: mpm@selenic.com
date: Fri Aug 26 01:20:50 2005 -0700
summary: Create a standard "hello, world" program
So Jython's mercurial story isn't quite as good as I thought it was yesterday, but it is certainly much better than it was in 2007. If you are interested in Mercurial, I am finding the book to be extremely well written and easy to read, again you can find it here.
View comments