Mercurial 1.8.3 on Jython 2.5.2

Martin Geisler mg at aragost.com
Thu May 12 08:02:22 UTC 2011


Sébastien Deleuze <seb at deleuze.fr> writes:

> OK, understood, I tried to import java module, wich has nothing to do
> with posix ou windows modules.

Ah, so the java module is from Jython -- makes sense now that I think
about it :)

> I also tried with import windows, but if I do I got error sine it uses
> ctypes:
>
>     _kernel32 = ctypes.windll.kernel32
>   File "C:\jython2.5.2\Lib\site-packages\mercurial\demandimport.py", line 76, in
>  __getattribute__
>     return getattr(self._module, attr)
> AttributeError: 'module' object has no attribute 'windll'
>
> From what I understand, the only way to make it work is to write a
> pure equivalent of posix.py or win32.py. Do you think it is technicaly
> possible ?

That is what Matt commented on: we use ctypes to get access to low-level
details like the number of hardlinks for a file. So I think you need to
implement this in Java.

To get something running, then I think I would create a mercurial.java
module with empty stub functions:

  def posixfile(name, mode='r', buffering=-1):
      pass

  def openhardlinks():
      pass

  ...

Then add a third branch to the if-statement in util.py so that java.py
is imported in your environment.

> A major issue may be that java runtime don't care about file
> permissions (at least in java6/7, it may be the case in java 8), but
> for read only capabilities it may be not an issue for me.

Mercurial does also not care about permissions: if we can read the files
in a repository, then you can use 'hg log', 'hg clone', etc on it. If
you can also write, then you can use 'hg commit', and so on.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/



More information about the Mercurial mailing list