Request for guidance for compatibility with Mercurial 4.6+
Amenel Voglozin
amenelv at gmail.com
Mon Sep 10 17:12:16 EDT 2018
Many thanks. It makes total sense to be using ui instead of writing to
sys.stdout.
With this information, I was able to fix the set of tests but not to
pinpoint the relevant item in the release notes. It does not matter: I will
leave detailed explanation in the JavaHg source code.
Thank you!
Le lun. 10 sept. 2018 à 13:48, Yuya Nishihara <yuya at tcha.org> a écrit :
> On Mon, 10 Sep 2018 08:04:31 +0900, Yuya Nishihara wrote:
> > > 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.
> >
> > Any invalid outputs are sent to stderr since 4.6 for maximum
> debuggability.
> > Before, they were redirected to /dev/null.
> >
> > In this example, sys.stdout should be replaced by ui.fout.
>
> Never mind. In this particular example, we'll need to obtain a bare stdout
> instance from ui.fout.out.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20180910/f1066479/attachment.html>
More information about the Mercurial-devel
mailing list