Commits on Source (3)
-
Mitchell Kember authored
This adds Config::username which returns HGUSER, ui.username, or EMAIL in that order, similar to ui.username() in Python. I considered following the pattern of EDITOR, VISUAL, PAGER, etc. and using add_for_environment_variable, but it's not possible to get the same precendence as in Python that way (in particular HGUSER coming after the repo .hg/hgrc), at least not without significant changes. This will be used for 'rhg annotate -r wdir() -u' to annotate the username on lines that were changed in the working directory.
879029f03324 -
Mitchell Kember authored
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()'.
1a99e0c2d6d5 -
Mitchell Kember authored
This makes revset::resolve_single return RevisionOrWdir. Previously, it returned RevlogError::WDirUnsupported (leading to abort, not fallback) for 2147483647 and ffffffffffffffffffffffffffffffffffffffff. It did not recognize 'wdir()' itself, so that would lead to Python fallback. Now, it treats all 3 cases the same: it returns RevisionOrWdir::wdir() and lets the caller decide what to do. I changed rhg cat, files, and annotate to return HgError::unsupported in this case, since wdir is valid. I made `rhg status --change wdir()` behave the same as `rhg status`, conforming to the test in test-status.t.
bb30c89f1ffb
Showing
- rust/hg-core/src/config/mod.rs 27 additions, 0 deletionsrust/hg-core/src/config/mod.rs
- rust/hg-core/src/operations/cat.rs 5 additions, 1 deletionrust/hg-core/src/operations/cat.rs
- rust/hg-core/src/operations/list_tracked_files.rs 6 additions, 2 deletionsrust/hg-core/src/operations/list_tracked_files.rs
- rust/hg-core/src/revlog/mod.rs 39 additions, 0 deletionsrust/hg-core/src/revlog/mod.rs
- rust/hg-core/src/revset.rs 32 additions, 20 deletionsrust/hg-core/src/revset.rs
- rust/rhg/src/commands/annotate.rs 5 additions, 0 deletionsrust/rhg/src/commands/annotate.rs
- rust/rhg/src/commands/status.rs 10 additions, 5 deletionsrust/rhg/src/commands/status.rs