Mercurial > hg
comparison rust/hg-cpython/src/dirstate/item.rs @ 48045:32ef647821b2
dirstate: Skip no-op conversion in Rust DirstateMap::set_v1
Now that the `DirstateItem` python class is implemented in Rust containing
a `DirstateEntry` value, use that value directly instead of reconstructing
it from v1 data.
Also rename from `set_v1` since dirstate-v1 data is not used anymore.
Differential Revision: https://phab.mercurial-scm.org/D11487
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 22 Sep 2021 18:21:58 +0200 |
parents | 3e69bef2031a |
children | 98c0408324e6 |
comparison
equal
deleted
inserted
replaced
48044:d5528ac9b4f2 | 48045:32ef647821b2 |
---|---|
178 entry: DirstateEntry, | 178 entry: DirstateEntry, |
179 ) -> PyResult<PyObject> { | 179 ) -> PyResult<PyObject> { |
180 Ok(DirstateItem::create_instance(py, Cell::new(entry))?.into_object()) | 180 Ok(DirstateItem::create_instance(py, Cell::new(entry))?.into_object()) |
181 } | 181 } |
182 | 182 |
183 pub fn get_entry(&self, py: Python<'_>) -> DirstateEntry { | |
184 self.entry(py).get() | |
185 } | |
186 | |
183 // TODO: Use https://doc.rust-lang.org/std/cell/struct.Cell.html#method.update instead when it’s stable | 187 // TODO: Use https://doc.rust-lang.org/std/cell/struct.Cell.html#method.update instead when it’s stable |
184 pub fn update(&self, py: Python<'_>, f: impl FnOnce(&mut DirstateEntry)) { | 188 pub fn update(&self, py: Python<'_>, f: impl FnOnce(&mut DirstateEntry)) { |
185 let mut entry = self.entry(py).get(); | 189 let mut entry = self.entry(py).get(); |
186 f(&mut entry); | 190 f(&mut entry); |
187 self.entry(py).set(entry) | 191 self.entry(py).set(entry) |