This is an archive of the discontinued Mercurial Phabricator instance.

wireproto: use maybecapturestdio() for push responses (API)
ClosedPublic

Authored by indygreg on Feb 7 2018, 7:26 PM.

Details

Summary

The "pushres" and "pusherr" response types currently call
proto.restore() in the HTTP protocol. This completes the pairing
with proto.redirect() that occurs in the @wireprotocommand
functions. (But since the SSH protocol has a no-op redirect(),
it doesn't bother calling restore() because it would also be
a no-op.)

Having the disconnect between these paired calls is very confusing.
Knowing that you must use proto.redirect() if returning a "pushres"
or a "pusherr" is even wonkier.

We replace this confusing code with our new context manager for
[maybe] capturing output.

The "pushres" and "pusherr" types have gained an "output" argument
to their constructor and an attribute to hold captured data. The
HTTP protocol now retrieves output from these objects.

.. api::

``wireproto.pushres`` and ``wireproto.pusherr`` now explicitly
track stdio output.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Feb 7 2018, 7:26 PM
indygreg edited the summary of this revision. (Show Details)Feb 7 2018, 11:32 PM
indygreg updated this revision to Diff 5334.
indygreg updated this revision to Diff 5345.Feb 8 2018, 12:20 AM
durin42 accepted this revision.Feb 12 2018, 4:22 PM
This revision is now accepted and ready to land.Feb 12 2018, 4:22 PM
This revision was automatically updated to reflect the committed changes.