diff rust/hg-core/src/revset.rs @ 47962:8c29af0f6d6e

rhg: Align with Python on some revset parsing corner cases In particular: * A string of ASCII digits can be either an integer on a hex prefix * The NULL node ID should convert to the NULL revision number Differential Revision: https://phab.mercurial-scm.org/D11409
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 13 Sep 2021 17:23:42 +0200
parents 21d25e9ee58e
children 6f579618ea7b
line wrap: on
line diff
--- a/rust/hg-core/src/revset.rs	Mon Sep 13 15:42:39 2021 +0200
+++ b/rust/hg-core/src/revset.rs	Mon Sep 13 17:23:42 2021 +0200
@@ -45,8 +45,14 @@
     input: &str,
     revlog: &Revlog,
 ) -> Result<Revision, RevlogError> {
+    // The Python equivalent of this is part of `revsymbol` in
+    // `mercurial/scmutil.py`
+
     if let Ok(integer) = input.parse::<i32>() {
-        if integer >= 0 && revlog.has_rev(integer) {
+        if integer.to_string() == input
+            && integer >= 0
+            && revlog.has_rev(integer)
+        {
             return Ok(integer);
         }
     }