Skip to content
Snippets Groups Projects
Commit 1a99e0c2d6d5 authored by Mitchell Kember's avatar Mitchell Kember
Browse files

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
2 merge requests!1306rust-annotate: support -Tjson,!1255rust-annotate: add support for wdir
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment