Mercurial > hg
comparison rust/hg-cpython/src/dirstate/dirstate_map.rs @ 47112:d5956136d19d
dirstate-tree: Give to `status()` mutable access to the `DirstateMap`
Differential Revision: https://phab.mercurial-scm.org/D10546
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 16 Apr 2021 12:12:04 +0200 |
parents | 33e5511b571a |
children | b6339a993b91 |
comparison
equal
deleted
inserted
replaced
47111:623c8e4ddc6d | 47112:d5956136d19d |
---|---|
6 // GNU General Public License version 2 or any later version. | 6 // GNU General Public License version 2 or any later version. |
7 | 7 |
8 //! Bindings for the `hg::dirstate::dirstate_map` file provided by the | 8 //! Bindings for the `hg::dirstate::dirstate_map` file provided by the |
9 //! `hg-core` package. | 9 //! `hg-core` package. |
10 | 10 |
11 use std::cell::{Ref, RefCell}; | 11 use std::cell::{RefCell, RefMut}; |
12 use std::convert::TryInto; | 12 use std::convert::TryInto; |
13 | 13 |
14 use cpython::{ | 14 use cpython::{ |
15 exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList, | 15 exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList, |
16 PyObject, PyResult, PySet, PyString, PyTuple, Python, PythonObject, | 16 PyObject, PyResult, PySet, PyString, PyTuple, Python, PythonObject, |
525 } | 525 } |
526 | 526 |
527 }); | 527 }); |
528 | 528 |
529 impl DirstateMap { | 529 impl DirstateMap { |
530 pub fn get_inner<'a>( | 530 pub fn get_inner_mut<'a>( |
531 &'a self, | 531 &'a self, |
532 py: Python<'a>, | 532 py: Python<'a>, |
533 ) -> Ref<'a, Box<dyn DirstateMapMethods + Send>> { | 533 ) -> RefMut<'a, Box<dyn DirstateMapMethods + Send>> { |
534 self.inner(py).borrow() | 534 self.inner(py).borrow_mut() |
535 } | 535 } |
536 fn translate_key( | 536 fn translate_key( |
537 py: Python, | 537 py: Python, |
538 res: (&HgPathBuf, &DirstateEntry), | 538 res: (&HgPathBuf, &DirstateEntry), |
539 ) -> PyResult<Option<PyBytes>> { | 539 ) -> PyResult<Option<PyBytes>> { |