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