changeset 48079:3da7bf75fdb2

rust-revset: support explicit `.` revision This is basically the same thing as not specifying a revision, except this is done in the revset resolution function. This allows calls like `rhg cat some-file -r .` to work without falling back. Differential Revision: https://phab.mercurial-scm.org/D11402
author Raphaël Gomès <rgomes@octobus.net>
date Sat, 11 Sep 2021 00:09:29 +0200
parents ddde80830aea
children 789475ef2b22
files rust/hg-core/src/revset.rs
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/revset.rs	Sat Sep 11 00:05:08 2021 +0200
+++ b/rust/hg-core/src/revset.rs	Sat Sep 11 00:09:29 2021 +0200
@@ -19,6 +19,10 @@
     let changelog = repo.changelog()?;
 
     match input {
+        "." => {
+            let p1 = repo.dirstate_parents()?.p1;
+            return Ok(changelog.revlog.rev_from_node(p1.into())?);
+        }
         "null" => return Ok(NULL_REVISION),
         _ => {}
     }