Use trailers, not headers.
Tidy up implementation of header-hopping.

Added a bunch of docstrings, and pulled several pieces out of the
one big, ugly function into their own separate functions.
Fix protobuf-format test.

The protobuf format no longer works when not writing with a revision,
so the tests that lazily use no revision must be updated to instead
use the "basic" protobuf format.