equal
deleted
inserted
replaced
48 // All attributes also have to have a separate refcount data attribute for |
48 // All attributes also have to have a separate refcount data attribute for |
49 // leaks, with all methods that go along for reference sharing. |
49 // leaks, with all methods that go along for reference sharing. |
50 py_class!(pub class DirstateMap |py| { |
50 py_class!(pub class DirstateMap |py| { |
51 @shared data inner: Box<dyn DirstateMapMethods + Send>; |
51 @shared data inner: Box<dyn DirstateMapMethods + Send>; |
52 |
52 |
53 def __new__(_cls, _root: PyObject) -> PyResult<Self> { |
53 def __new__(_cls, use_dirstate_tree: bool) -> PyResult<Self> { |
54 let inner = Box::new(RustDirstateMap::default()); |
54 let inner = if use_dirstate_tree { |
|
55 Box::new(hg::dirstate_tree::dirstate_map::DirstateMap::new()) as _ |
|
56 } else { |
|
57 Box::new(RustDirstateMap::default()) as _ |
|
58 }; |
55 Self::create_instance(py, inner) |
59 Self::create_instance(py, inner) |
56 } |
60 } |
57 |
61 |
58 def clear(&self) -> PyResult<PyObject> { |
62 def clear(&self) -> PyResult<PyObject> { |
59 self.inner(py).borrow_mut().clear(); |
63 self.inner(py).borrow_mut().clear(); |