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