hg-core: implement timestamp line parsing
Parse a changelog entry's timestamp line into a chrono::DateTime
and a map of commit extras. chrono
was chosen because it is already used by rhg
, and therefore doesn't seem like an overly opinionated choice.
Some things that might be notable for reviewers:
- The implementation attempts to support floating-point timestamps, since it seems like these are supported by the Python code (though I've never encountered them in practice).
- I've only implemented the minimal required unescaping functionality instead of fully reimplementing Python's
codecs.escape_decode
. It should correctly undo the escaping done bychangelog._string_escape
while not requiring a workaround present in the Python unescaping code to avoid unintentionally unescaping things that look like octal escape sequences. - Based on my reading of the Python code, it appears that the intention is to limit keys to ASCII alphanumeric characters plus hyphens and underscores, so the keys are decoded into
Strings
for convenience. Values are left as bytes. That said, I'm unsure if this was the right choice or if it would be better to just leave the keys as bytes as well.