changeset 46725:df247f58ecee

rhg: Fall back to Python for unsupported revset syntax rhg only supports a small subset of the syntax. On parse error, this gives Python a chance instead of aborting immediately. Differential Revision: https://phab.mercurial-scm.org/D10097
author Simon Sapin <simon.sapin@octobus.net>
date Tue, 02 Mar 2021 23:18:23 +0100
parents 78e6700ab009
children 92e3cfd63096
files rust/hg-core/src/revset.rs
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/revset.rs	Wed Mar 03 18:00:54 2021 +0100
+++ b/rust/hg-core/src/revset.rs	Tue Mar 02 23:18:23 2021 +0100
@@ -2,6 +2,7 @@
 //!
 //! <https://www.mercurial-scm.org/repo/hg/help/revsets>
 
+use crate::errors::HgError;
 use crate::repo::Repo;
 use crate::revlog::changelog::Changelog;
 use crate::revlog::revlog::{Revlog, RevlogError};
@@ -28,7 +29,10 @@
 
     // TODO: support for the rest of the language here.
 
-    Err(RevlogError::InvalidRevision)
+    Err(
+        HgError::unsupported(format!("cannot parse revset '{}'", input))
+            .into(),
+    )
 }
 
 /// Resolve the small subset of the language suitable for revlogs other than