ui: add a context manager for silencing the ui (pushbuffer+popbuffer)
We often silence the ui by calling `ui.pushbuffer()` followed (a later
in the code) by `ui.popbuffer()`. These places can be identified by
the fact that they ignore the output returned from
`ui.popbuffer()`. Let's create a context manager for these cases, to
avoid repetition, and to avoid accidentally leaving the ui silent on
exceptions. I deliberately called the new function `silent()` instead
of `buffered()`, because it's just an implementation detail that it
uses `pushbuffer()` and `popbuffer()`. We could later optimize it to
not buffer the output.
Differential Revision: https://phab.mercurial-scm.org/D10884
shelve: don't swallow errors that happen when reverting the working copy
Same reasoning as the parent commit. The code in question here comes
from
fb8065de47b0 (unshelve: silence internal revert, 2014-08-15),
which says that it was to prepare for some upcoming revert changes. I
suppose those changes have happened by now but we fixed something
about it, because I don't see any unwanted changes in tests (no
changes at all in tests, in fact).
Differential Revision: https://phab.mercurial-scm.org/D10883
histedit: don't swallow errors that happen when updating the working copy
Commit
34165875fa5d (histedit: limit updated and merging output to
important updates, 2016-02-03) added a call to
`ui.pushbuffer(labeled=True, errors=True)`. I don't know if there was
a reason for the `errors=True` (nor the `labeled=True` bit, which I
removed in the previous commit). It seems bad to just discard the
errors, so let's not do that. By not doing that, we can also remove a
workaround for the lack of errors from `test-removeemptydirs.t`.
Differential Revision: https://phab.mercurial-scm.org/D10882