wireprotoserver: ability to run an SSH server until an event is set
It seems useful to be able to start an SSH protocol server that
won't run forever and won't call sys.exit() when it stops. This
could be used to facilitate intra-process testing of the SSH
protocol, for example.
We teach the server function to loop until a threading.Event is set
and invent a new API to run the server until an event is set. It also
won't sys.exit() afterwards.
There aren't many callers of serve_forever(). So we could refactor
them relatively easily. But I was lazy.
threading.Event might be a bit heavyweight. An alternative would be
a list whose only elements is changed. We can't use a simple scalar
value like a bool or int because those types are immutable. Events
are what you use in systems programming for this use case, so the
use of threading.Event seems justified.
Differential Revision: https://phab.mercurial-scm.org/D2461
tests: fix run-tests environment cleanup on Python 3
Differential Revision: https://phab.mercurial-scm.org/D2521
templatekw: add compatlist() as a replacement for showlist()
Just like compatdict(), this is mostly a copy of showlist(). showchildren()
is ported to the new API as an example.
templatekw: add compatdict() as a replacement for showdict()
This is mostly a copy of showdict(), which will be deprecated later. See
the docstring for why it's called a "compat" dict.
showenvvars() is ported to the new API as an example.
templatekw: pass templater to _showlist() by an explicit argument
Prepares for switching to the (context, mapping) API.
hgweb: make templater mostly compatible with log templates
Prepares for gradually switching templatekw.showsuccsandmarkers() to new API.
This was a PoC showing how to reuse templatekw functions in hgweb. We could
remove rev, node, author, etc. from the commonentry() table, but we'll have
to carefully remove all corresponding symbols from webcommands.*(). Otherwise,
we would face the
issue5612.
Still templatekw.keywords aren't exported. Otherwise some tests would fail
because the atom template expects {files} to be empty in filelog, but
templatekw.showfiles() provides the {files} implementation.
log: do not invoke templatekw.showobsfate() as a function
Prepares for switching to the (context, mapping) API. I tried, but it appeared
not an one-off change to extract a non-template function from showobsfate(),
which deeply depends on the templater internals.
templatekw: inline getfiles()
It's just three lines. We don't need a separate function for that.
templatekw: factor out function to build a list of files per status
Removes copy-paste code before switching to the (context, mapping) API.