Request for guidance for compatibility with Mercurial 4.6+

Amenel Voglozin amenelv at gmail.com
Sun Sep 9 16:25:20 UTC 2018


Dear developers,

I am the maintainer of MercurialEclipse, and of JavaHg, which is more
relevant to the matter in this e-mail.

The compatibility table of MercurialEclipse, is always that of JavaHg,
currently Mercurial 3.7 to Mercurial 4.5.3. The test suite of JavaHg does
not yield the required 100% success rate with versions 4.6 and versions 4.7
due to a change of behavior on which I spent much time but I was not
successful in identifying it, let alone taking it into account for the
upcoming release of MercurialEclipse on October 1.

What I have done prior to sending this e-mail: I have read the release
notes and the upgrade notes, and I have downloaded the source code of
4.3.1, 4.5.3, 4.6 and 4.7 in order to compare files, but I know I am just
fumbling in the dark.

*The problem with version 4.6 is that commands sent to the command server
may provide output on stderr even though the return code is 0, which was
interpreted as the command being successful*.

This is a problem because the error checking model in JavaHg relies on
stderr being empty if the command is successful and the 'e' channel being
for errors. Maybe that these were wrong assumptions, but they held in our
(JavaHg's) test suite for all versions of Mercurial up to 4.5.3.

This was detected because the JavaHg test suite contains one test in
particular that makes the JavaHg extension write to stdout on an invalid
optional channel. Starting with 4.6, the data written by the extension to
stdout turns out on stderr, with this structure, which matches the one
defined in the command server protocol:

   - channel character: 1 byte
   - data length: 4 bytes
   - x bytes corresponding to the length announced in the previous item of
   this list.

Source code of the relevant command in the JavaHg extension (
https://bitbucket.org/aragost/javahg/src/6af11cef7ff67822719b76a2dc8824585ae6c796/src/test/resources/javahg-test.py?at=default&fileviewer=file-view-default#javahg-test.py-61
):

@command('javahg-write', [])
def writeToChannel(ui, repo, channel, msg):
    """write message to the given channel"""
    sys.stdout.write(struct.pack('>cI', channel, len(msg)) + msg)
    sys.stdout.flush()

This "output to stderr" did not happen in any of the versions I test JavaHg
against, i.e. 3.0—4.5.3. All previous versions provided an empty stderr. I
have not been able to figure out the explanation for this change in 4.6, so
that I could work around this change of behavior or take it into account.

*My request as to this issue is for some guidance to the entry in the
release notes that is relevant to this change of behavior or for more
information about the change*. Was it intentional? Are there specific
circumstances when this new behavior is exhibited?

My uneducated guess at this point is that extensions are maybe supposed to
use an API and not directly write to stdout and JavaHg got away with what
it's always done until some related rule was enforced in Mercurial.

Please, let me know if there are any specific details that I can provide.

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20180909/b86cd5c0/attachment.html>


More information about the Mercurial-devel mailing list