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 | } |
General Comments 0
You need to be logged in to leave comments.
Login now