##// END OF EJS Templates
rhg: Align with Python on some revset parsing corner cases...
Simon Sapin -
r49161:8c29af0f default
parent child Browse files
Show More
@@ -18,6 +18,7 b' use super::patch;'
18 18 use crate::errors::HgError;
19 19 use crate::repo::Repo;
20 20 use crate::revlog::Revision;
21 use crate::NULL_REVISION;
21 22
22 23 #[derive(derive_more::From)]
23 24 pub enum RevlogError {
@@ -124,6 +125,10 b' impl Revlog {'
124 125 &self,
125 126 node: NodePrefix,
126 127 ) -> Result<Revision, RevlogError> {
128 if node.is_prefix_of(&NULL_NODE) {
129 return Ok(NULL_REVISION);
130 }
131
127 132 if let Some(nodemap) = &self.nodemap {
128 133 return nodemap
129 134 .find_bin(&self.index, node)?
@@ -45,8 +45,14 b' pub fn resolve_rev_number_or_hex_prefix('
45 45 input: &str,
46 46 revlog: &Revlog,
47 47 ) -> Result<Revision, RevlogError> {
48 // The Python equivalent of this is part of `revsymbol` in
49 // `mercurial/scmutil.py`
50
48 51 if let Ok(integer) = input.parse::<i32>() {
49 if integer >= 0 && revlog.has_rev(integer) {
52 if integer.to_string() == input
53 && integer >= 0
54 && revlog.has_rev(integer)
55 {
50 56 return Ok(integer);
51 57 }
52 58 }
@@ -126,6 +126,9 b' Specifying revisions by changeset ID'
126 126 [255]
127 127 $ $NO_FALLBACK rhg cat -r d file-2
128 128 2
129 $ $NO_FALLBACK rhg cat -r 0000 file-2
130 abort: invalid revision identifier: 0000
131 [255]
129 132
130 133 Cat files
131 134 $ cd $TESTTMP
General Comments 0
You need to be logged in to leave comments. Login now