diff --git a/rust/hg-core/src/revset.rs b/rust/hg-core/src/revset.rs index ba773bd99203dd1ca1f549ce375d8cbfc2fed24b_cnVzdC9oZy1jb3JlL3NyYy9yZXZzZXQucnM=..ddde80830aeab51944b229c19dc6372e1a603d32_cnVzdC9oZy1jb3JlL3NyYy9yZXZzZXQucnM= 100644 --- a/rust/hg-core/src/revset.rs +++ b/rust/hg-core/src/revset.rs @@ -18,8 +18,8 @@ ) -> Result<Revision, RevlogError> { let changelog = repo.changelog()?; - match resolve_rev_number_or_hex_prefix(input, &changelog.revlog) { - Err(RevlogError::InvalidRevision) => {} // Try other syntax - result => return result, + match input { + "null" => return Ok(NULL_REVISION), + _ => {} } @@ -24,5 +24,10 @@ } - if input == "null" { - return Ok(NULL_REVISION); + match resolve_rev_number_or_hex_prefix(input, &changelog.revlog) { + Err(RevlogError::InvalidRevision) => { + // TODO: support for the rest of the language here. + let msg = format!("cannot parse revset '{}'", input); + Err(HgError::unsupported(msg).into()) + } + result => return result, } @@ -28,11 +33,4 @@ } - - // TODO: support for the rest of the language here. - - Err( - HgError::unsupported(format!("cannot parse revset '{}'", input)) - .into(), - ) } /// Resolve the small subset of the language suitable for revlogs other than