Show More
@@ -118,7 +118,9 b' impl DirsMultiset {' | |||
|
118 | 118 | entry.remove(); |
|
119 | 119 | } |
|
120 | 120 | Entry::Vacant(_) => { |
|
121 |
return Err(DirstateMapError::PathNotFound( |
|
|
121 | return Err(DirstateMapError::PathNotFound( | |
|
122 | path.to_owned(), | |
|
123 | )) | |
|
122 | 124 | } |
|
123 | 125 | }; |
|
124 | 126 |
@@ -9,9 +9,9 b'' | |||
|
9 | 9 | //! `hg-core` package. |
|
10 | 10 | //! |
|
11 | 11 | //! From Python, this will be seen as `mercurial.rustext.dagop` |
|
12 | use crate::conversion::{py_set, rev_pyiter_collect}; | |
|
12 | 13 | use cindex::Index; |
|
13 | 14 | use cpython::{PyDict, PyModule, PyObject, PyResult, Python}; |
|
14 | use crate::conversion::{py_set, rev_pyiter_collect}; | |
|
15 | 15 | use exceptions::GraphError; |
|
16 | 16 | use hg::dagops; |
|
17 | 17 | use hg::Revision; |
@@ -12,8 +12,8 b'' | |||
|
12 | 12 | //! existing Python exceptions if appropriate. |
|
13 | 13 | //! |
|
14 | 14 | //! [`GraphError`]: struct.GraphError.html |
|
15 |
use cpython::exc::{ |
|
|
16 |
use cpython::{PyErr, Python |
|
|
15 | use cpython::exc::{RuntimeError, ValueError}; | |
|
16 | use cpython::{exc, PyErr, Python}; | |
|
17 | 17 | use hg; |
|
18 | 18 | |
|
19 | 19 | py_exception!(rustext, GraphError, ValueError); |
@@ -28,10 +28,10 b' impl GraphError {' | |||
|
28 | 28 | match py |
|
29 | 29 | .import("mercurial.error") |
|
30 | 30 | .and_then(|m| m.get(py, "WdirUnsupported")) |
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
|
31 | { | |
|
32 | Err(e) => e, | |
|
33 | Ok(cls) => PyErr::from_instance(py, cls), | |
|
34 | } | |
|
35 | 35 | } |
|
36 | 36 | } |
|
37 | 37 | } |
@@ -50,23 +50,18 b' impl PatternError {' | |||
|
50 | 50 | } |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | ||
|
54 | 53 | impl PatternFileError { |
|
55 | 54 | pub fn pynew(py: Python, inner: hg::PatternFileError) -> PyErr { |
|
56 | 55 | match inner { |
|
57 | 56 | hg::PatternFileError::IO(e) => { |
|
58 | let value = ( | |
|
59 | e.raw_os_error().unwrap_or(2), | |
|
60 | e.to_string() | |
|
61 | ); | |
|
57 | let value = (e.raw_os_error().unwrap_or(2), e.to_string()); | |
|
62 | 58 | PyErr::new::<exc::IOError, _>(py, value) |
|
63 | 59 | } |
|
64 | hg::PatternFileError::Pattern(e, l) => { | |
|
65 | match e { | |
|
66 | hg::PatternError::UnsupportedSyntax(m) => | |
|
67 | PatternFileError::new(py, ("PatternFileError", m, l)) | |
|
60 | hg::PatternFileError::Pattern(e, l) => match e { | |
|
61 | hg::PatternError::UnsupportedSyntax(m) => { | |
|
62 | PatternFileError::new(py, ("PatternFileError", m, l)) | |
|
68 | 63 | } |
|
69 | } | |
|
64 | }, | |
|
70 | 65 | } |
|
71 | 66 | } |
|
72 | 67 | } |
@@ -28,9 +28,9 b' pub mod ancestors;' | |||
|
28 | 28 | mod cindex; |
|
29 | 29 | mod conversion; |
|
30 | 30 | pub mod dagops; |
|
31 | pub mod dirstate; | |
|
31 | 32 | pub mod discovery; |
|
32 | 33 | pub mod exceptions; |
|
33 | pub mod dirstate; | |
|
34 | 34 | pub mod filepatterns; |
|
35 | 35 | |
|
36 | 36 | py_module_initializer!(rustext, initrustext, PyInit_rustext, |py, m| { |
@@ -45,9 +45,21 b' py_module_initializer!(rustext, initrust' | |||
|
45 | 45 | m.add(py, "dagop", dagops::init_module(py, &dotted_name)?)?; |
|
46 | 46 | m.add(py, "discovery", discovery::init_module(py, &dotted_name)?)?; |
|
47 | 47 | m.add(py, "dirstate", dirstate::init_module(py, &dotted_name)?)?; |
|
48 | m.add(py, "filepatterns", filepatterns::init_module(py, &dotted_name)?)?; | |
|
48 | m.add( | |
|
49 | py, | |
|
50 | "filepatterns", | |
|
51 | filepatterns::init_module(py, &dotted_name)?, | |
|
52 | )?; | |
|
49 | 53 | m.add(py, "GraphError", py.get_type::<exceptions::GraphError>())?; |
|
50 | m.add(py, "PatternFileError", py.get_type::<exceptions::PatternFileError>())?; | |
|
51 | m.add(py, "PatternError", py.get_type::<exceptions::PatternError>())?; | |
|
54 | m.add( | |
|
55 | py, | |
|
56 | "PatternFileError", | |
|
57 | py.get_type::<exceptions::PatternFileError>(), | |
|
58 | )?; | |
|
59 | m.add( | |
|
60 | py, | |
|
61 | "PatternError", | |
|
62 | py.get_type::<exceptions::PatternError>(), | |
|
63 | )?; | |
|
52 | 64 | Ok(()) |
|
53 | 65 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now