diff rust/hg-core/src/revset.rs @ 46821:e8ae91b1a63d

rhg: raise wdir specific error for `hg debugdata` Helps remove the conditional in `test-debugcommands.t` for rhg. Differential Revision: https://phab.mercurial-scm.org/D10254
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 23 Mar 2021 19:58:49 +0530
parents df247f58ecee
children 21d25e9ee58e
line wrap: on
line diff
--- a/rust/hg-core/src/revset.rs	Sat Mar 20 02:03:57 2021 +0530
+++ b/rust/hg-core/src/revset.rs	Tue Mar 23 19:58:49 2021 +0530
@@ -7,7 +7,8 @@
 use crate::revlog::changelog::Changelog;
 use crate::revlog::revlog::{Revlog, RevlogError};
 use crate::revlog::NodePrefix;
-use crate::revlog::{Revision, NULL_REVISION};
+use crate::revlog::{Revision, NULL_REVISION, WORKING_DIRECTORY_HEX};
+use crate::Node;
 
 /// Resolve a query string into a single revision.
 ///
@@ -51,6 +52,10 @@
         }
     }
     if let Ok(prefix) = NodePrefix::from_hex(input) {
+        if prefix.is_prefix_of(&Node::from_hex(WORKING_DIRECTORY_HEX).unwrap())
+        {
+            return Err(RevlogError::WDirUnsupported);
+        }
         return revlog.get_node_rev(prefix);
     }
     Err(RevlogError::InvalidRevision)