This is an archive of the discontinued Mercurial Phabricator instance.

ui: move request exit handlers to global state
ClosedPublic

Authored by singhsrb on Oct 17 2017, 4:23 PM.

Details

Summary

Since the ui objects can be created with the 'load' class method, it
is possible to lose the exit handlers information from the old ui instance. For
example, running 'test-bad-extension.t' leads to this situation where chg
creates a new ui instance which does not copy the exit handlers from the
earlier ui instance. For exit handlers, which are special cases anyways, it
probably makes sense to have a global state of the handlers. This would ensure
that the exit handlers registered once are definitely executed at the end of
the request.

Test Plan

Ran all the tests without '--chg' option. This also fixes the
'test-bad-extension.t' with the '--chg' option.

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

singhsrb created this revision.Oct 17 2017, 4:23 PM
quark accepted this revision.Oct 17 2017, 5:18 PM
quark added a subscriber: quark.

This was discussed internally. Exit handlers should be per process (ex. "global"), non-copyable to avoid run them multiple times. So this change is a pure improvement.

durin42 accepted this revision.Oct 18 2017, 4:07 PM
This revision is now accepted and ready to land.Oct 18 2017, 4:07 PM
This revision was automatically updated to reflect the committed changes.