Mercurial > hg
changeset 50975:3aca98a35727
rust: remove unused error variant
All paths check that the working directory revision is not used.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 07 Aug 2023 15:07:48 +0200 |
parents | c950fdba7472 |
children | 9929c8a73488 |
files | rust/hg-core/src/revlog/mod.rs rust/hg-cpython/src/cindex.rs rust/hg-cpython/src/exceptions.rs |
diffstat | 3 files changed, 1 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/mod.rs Mon Aug 07 12:53:43 2023 +0200 +++ b/rust/hg-core/src/revlog/mod.rs Mon Aug 07 15:07:48 2023 +0200 @@ -76,7 +76,6 @@ #[derive(Clone, Debug, PartialEq)] pub enum GraphError { ParentOutOfRange(Revision), - WorkingDirectoryUnsupported, } /// The Mercurial Revlog Index
--- a/rust/hg-cpython/src/cindex.rs Mon Aug 07 12:53:43 2023 +0200 +++ b/rust/hg-cpython/src/cindex.rs Mon Aug 07 15:07:48 2023 +0200 @@ -15,7 +15,7 @@ PyObject, PyResult, PyTuple, Python, PythonObject, }; use hg::revlog::{Node, RevlogIndex}; -use hg::{Graph, GraphError, Revision, WORKING_DIRECTORY_REVISION}; +use hg::{Graph, GraphError, Revision}; use libc::{c_int, ssize_t}; const REVLOG_CABI_VERSION: c_int = 3; @@ -141,9 +141,6 @@ impl Graph for Index { /// wrap a call to the C extern parents function fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> { - if rev == WORKING_DIRECTORY_REVISION { - return Err(GraphError::WorkingDirectoryUnsupported); - } let mut res: [c_int; 2] = [0; 2]; let code = unsafe { (self.capi.index_parents)( @@ -170,9 +167,6 @@ Err(GraphError::ParentOutOfRange(rev)) => { Err(vcsgraph::graph::GraphReadError::KeyedInvalidKey(rev)) } - Err(GraphError::WorkingDirectoryUnsupported) => Err( - vcsgraph::graph::GraphReadError::WorkingDirectoryUnsupported, - ), } } }
--- a/rust/hg-cpython/src/exceptions.rs Mon Aug 07 12:53:43 2023 +0200 +++ b/rust/hg-cpython/src/exceptions.rs Mon Aug 07 15:07:48 2023 +0200 @@ -26,15 +26,6 @@ hg::GraphError::ParentOutOfRange(r) => { GraphError::new(py, ("ParentOutOfRange", r)) } - hg::GraphError::WorkingDirectoryUnsupported => { - match py - .import("mercurial.error") - .and_then(|m| m.get(py, "WdirUnsupported")) - { - Err(e) => e, - Ok(cls) => PyErr::from_instance(py, cls), - } - } } }