Mercurial > hg
comparison rust/hg-cpython/src/dirstate/dirstate_map.rs @ 49121:10edc54d18f1
rust-dirstatemap: remove `set_dirstate_entry`/`set_entry` methods
These methods were needed crutches before the Rust implementation caught up
to Python. Calling `set_entry` (whether from Python or Rust) was dangerous
since it didn't update any of the counters of the DirstateMap data structure,
while having no real way of knowing when to use it "correctly" except it you
were one of the 3 people who looked deep enough into the soul of this code.
Differential Revision: https://phab.mercurial-scm.org/D12519
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 29 Mar 2022 00:57:06 +0200 |
parents | 3df46f3a3d6c |
children | 861dd252e2dc |
comparison
equal
deleted
inserted
replaced
49120:3df46f3a3d6c | 49121:10edc54d18f1 |
---|---|
100 Some(entry) => { | 100 Some(entry) => { |
101 Ok(Some(DirstateItem::new_as_pyobject(py, entry)?)) | 101 Ok(Some(DirstateItem::new_as_pyobject(py, entry)?)) |
102 }, | 102 }, |
103 None => Ok(default) | 103 None => Ok(default) |
104 } | 104 } |
105 } | |
106 | |
107 def set_dirstate_item( | |
108 &self, | |
109 path: PyObject, | |
110 item: DirstateItem | |
111 ) -> PyResult<PyObject> { | |
112 let f = path.extract::<PyBytes>(py)?; | |
113 let filename = HgPath::new(f.data(py)); | |
114 self.inner(py) | |
115 .borrow_mut() | |
116 .set_entry(filename, item.get_entry(py)) | |
117 .map_err(|e| v2_error(py, e))?; | |
118 Ok(py.None()) | |
119 } | 105 } |
120 | 106 |
121 def set_tracked(&self, f: PyObject) -> PyResult<PyBool> { | 107 def set_tracked(&self, f: PyObject) -> PyResult<PyBool> { |
122 let bytes = f.extract::<PyBytes>(py)?; | 108 let bytes = f.extract::<PyBytes>(py)?; |
123 let path = HgPath::new(bytes.data(py)); | 109 let path = HgPath::new(bytes.data(py)); |