D9319: rust-status: properly translate OSError to Python
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Mon Nov 16 16:02:59 UTC 2020
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
This is probably never going to be called after the next few patches, but we
might as well make sure this is done correctly for the future rewrite.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D9319
AFFECTED FILES
rust/hg-cpython/src/dirstate/status.rs
CHANGE DETAILS
diff --git a/rust/hg-cpython/src/dirstate/status.rs b/rust/hg-cpython/src/dirstate/status.rs
--- a/rust/hg-cpython/src/dirstate/status.rs
+++ b/rust/hg-cpython/src/dirstate/status.rs
@@ -10,6 +10,7 @@
//! `rustext.dirstate.status`.
use crate::{dirstate::DirstateMap, exceptions::FallbackError};
+use cpython::exc::OSError;
use cpython::{
exc::ValueError, ObjectProtocol, PyBytes, PyErr, PyList, PyObject,
PyResult, PyTuple, Python, PythonObject, ToPyObject,
@@ -89,6 +90,7 @@
PyErr::new::<FallbackError, _>(py, &as_string)
}
+ StatusError::IO(e) => PyErr::new::<OSError, _>(py, e.to_string()),
e => PyErr::new::<ValueError, _>(py, e.to_string()),
}
}
To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list