Update:

 

With a few modifications, I’ve managed to get some basics working (init, add, status, commit, log). However, the stumbling point (unsurprisingly) is buffer(). It’s not hard to write a class that has the functionality of buffer() (without the space optimisation that buffer() provides, obviously), but the catch comes when writing to a file.

 

I’m playing with subclassing array.array, but Jython can’t write an array.array to a file ,while CPython can. I’ve logged this as issue 1439.

 

PJDM

--
Peter Mayne
Hewlett-Packard
Canberra, ACT, Australia

From: Mayne, Peter
Sent: Wednesday, 12 August 2009 6:11 PM
To: jython-users@lists.sourceforge.net
Subject: [Jython-users] Mercurial again

 

I thought I’d give Mercurial another spin on Jython 2.5.0. I cloned hg-stable at changeset 9081:2de7d96593db.

 

hg init – works

hg add – works

hg status - works

hg ci – produces  the following traceback:

  File "/home/pjmayne/hg-stable/mercurial/cmdutil.py", line 1247, in commitforceeditor

    text = repo.ui.edit("\n".join(edittext), ctx.user())

  File "/home/pjmayne/hg-stable/mercurial/ui.py", line 321, in edit

    util.system("%s \"%s\"" % (editor, name),

  File "/home/pjmayne/hg-stable/mercurial/util.py", line 373, in system

    os.environ['HG'] = hgexecutable()

  File "/home/pjmayne/hg-stable/mercurial/util.py", line 337, in hgexecutable

    elif main_is_frozen():

  File "/home/pjmayne/hg-stable/mercurial/util.py", line 324, in main_is_frozen

    return (hasattr(sys, "frozen") or # new py2exe

  File "/home/pjmayne/hg-stable/mercurial/demandimport.py", line 76, in __getattribute__

    return getattr(self._module, attr)

AttributeError: type object 'org.python.modules.imp' has no attribute 'is_frozen'

 

This seems to be because module imp doesn’t implement is_frozen (and presumably related functionality). is it reasonable to request this for 2.5.1, or is it too esoteric?

 

If I comment out “demandimport.enable()” in hg to get past that issue:

 

$ ~/hg-stable/hg ci

Traceback (most recent call last):

  File "/home/pjmayne/hg-stable/hg", line 22, in <module>

    import mercurial.dispatch

  File "/home/pjmayne/hg-stable/mercurial/dispatch.py", line 10, in <module>

    import util, commands, hg, fancyopts, extensions, hook, error

  File "/home/pjmayne/hg-stable/mercurial/commands.py", line 12, in <module>

    import hg, util, revlog, bundlerepo, extensions, copies, context, error

  File "/home/pjmayne/hg-stable/mercurial/hg.py", line 11, in <module>

    import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo

  File "/home/pjmayne/hg-stable/mercurial/localrepo.py", line 10, in <module>

    import repo, changegroup, subrepo

  File "/home/pjmayne/hg-stable/mercurial/changegroup.py", line 10, in <module>

    import struct, os, bz2, zlib, tempfile

ImportError: No module named bz2

 

I gather that bz2 is coming in Jython 2.5.1. Any idea when this will be in the dev version so I can discover the next problem? :-)

 

I'd also like to add a vote for issue 1380 “Interpreter startup time regression”:

 

$ time ~/hg-stable/hg version

Mercurial Distributed SCM (version unknown)

 

Copyright (C) 2005-2009 Matt Mackall <mpm@selenic.com> and 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.

 

real    0m17.794s

user    0m17.185s

sys     0m0.368s

 

This compares to CPython:

 

$ time python ~/hg-stable/hg version

Mercurial Distributed SCM (version unknown)

 

Copyright (C) 2005-2009 Matt Mackall <mpm@selenic.com> and 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.

 

real    0m0.339s

user    0m0.296s

sys     0m0.040s

 

Thanks.

 

PJDM

--

Peter Mayne

Hewlett-Packard

Canberra, ACT, Australia