should pushbuffer capture server messages?

Matt Mackall mpm at selenic.com
Thu Aug 15 15:55:41 CDT 2013


On Wed, 2013-08-14 at 18:33 -0700, Danek Duvall wrote:
> I'm maintaining an internal mercurial extensions (cadmium, for those who
> might remember it from the OpenSolaris days), which wraps
> findcommonoutgoing something like this:
> 
>     self.ui.pushbuffer()
>     try:
>         ui = hg.remoteui(self.ui, {})
>         pws = hg.peer(ui, {}, parent)
>         return discovery.findcommonoutgoing(self.repo, pws).missing
>     finally:
>         self.ui.popbuffer()
> 
> where "parent" is a repo URI string passed in to the method, self.repo is
> the local repo, and self.ui is self.repo.ui.
> 
> I'm upgrading the extension to support mercurial 2.7, and have come up with
> the code above.  Previously, the peer() call was a call to
> hg.repository(ui, parent), and that worked just fine.  But now, the peer()
> call emits a bunch of lines that the ssh server spits out to stderr.
> 
> Everything functions just fine, but I believe that the push/popbuffer calls
> were there to sop up that extraneous output, and that's no longer happening
> as of changeset 5884812686f7.  (Yes, we're pretty far behind :( )  It
> appears that we used to have a consistent ui object throughout, but with
> the introduction of peers, that changes around, and the new ui objects
> don't copy the buffer or buffering status.

It's actually not peers that's the issue, it's us removing some bugs in
the handling of ui objects. Before they were leaking local settings to
secondary repos, now they're cleanly separated.

> I notice that "hg sum --remote" shows the same garbage, so I'm not sure
> whether my expectations are off and the ssh server is being stupid and
> needs to be fixed, whether there's a bug in hg (in hg.remoteui()?) or
> whether my code is just not doing the right thing here.

Definitely sounds like the ssh server being stupid to me. Mercurial's
ssh sessions are pty-less, remote servers should create non-interactive
shells with zero spew. Test with 'ssh host date', if you get spew other
than the date, it's borked. Bonus negative points for it being on
stdout.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list