rust-revlog: add RevisionOrWdir
This type represents either a checked Revision or the wdir() pseudo-revision (revision 0x7fffffff, node ffffffffffffffffffffffffffffffffffffffff). You construct it with revision.into() or Revision::wdir(), and destructure it with rev.exclude_wdir() which returns Option<Revision>. I considered something like `enum RevisionOrWdir { Wdir, Revision(Revision) }`, but decided on `struct RevisionOrWdir(BaseRevision)` for a few reasons: - It's more ergonomic for the ways it actually gets used, in my opinion. - It also avoids the possibility of an invalid value Revision(0x7fffffff). - It remains 4 bytes rather than 8. - It maintains the ordering: wdir is greater than all other revisions. I'm planning to use this for 'rhg annotate -r wdir()'.
parent
879029f03324
No related branches found
No related tags found
Please register or sign in to comment