rust/hg-cpython/src/revlog.rs
changeset 51234 59183a19954e
parent 51233 ca81cd96000a
child 51235 456e0fe702e8
equal deleted inserted replaced
51233:ca81cd96000a 51234:59183a19954e
   223     /// It is Python's responsibility to call `update_nodemap_data` again.
   223     /// It is Python's responsibility to call `update_nodemap_data` again.
   224     def clearcaches(&self, *args, **kw) -> PyResult<PyObject> {
   224     def clearcaches(&self, *args, **kw) -> PyResult<PyObject> {
   225         self.nt(py).borrow_mut().take();
   225         self.nt(py).borrow_mut().take();
   226         self.docket(py).borrow_mut().take();
   226         self.docket(py).borrow_mut().take();
   227         self.nodemap_mmap(py).borrow_mut().take();
   227         self.nodemap_mmap(py).borrow_mut().take();
   228         self.index(py).borrow_mut().clear_caches();
   228         self.index(py).borrow().clear_caches();
   229         self.call_cindex(py, "clearcaches", args, kw)
   229         self.call_cindex(py, "clearcaches", args, kw)
   230     }
   230     }
   231 
   231 
   232     /// return the raw binary string representing a revision
   232     /// return the raw binary string representing a revision
   233     def entry_binary(&self, *args, **kw) -> PyResult<PyObject> {
   233     def entry_binary(&self, *args, **kw) -> PyResult<PyObject> {
   847             ),
   847             ),
   848         })
   848         })
   849     }
   849     }
   850 
   850 
   851     fn inner_headrevs(&self, py: Python) -> PyResult<PyObject> {
   851     fn inner_headrevs(&self, py: Python) -> PyResult<PyObject> {
   852         let index = &mut *self.index(py).borrow_mut();
   852         let index = &*self.index(py).borrow();
   853         let as_vec: Vec<PyObject> = index
   853         let as_vec: Vec<PyObject> = index
   854             .head_revs()
   854             .head_revs()
   855             .map_err(|e| graph_error(py, e))?
   855             .map_err(|e| graph_error(py, e))?
   856             .iter()
   856             .iter()
   857             .map(|r| PyRevision::from(*r).into_py_object(py).into_object())
   857             .map(|r| PyRevision::from(*r).into_py_object(py).into_object())
   879     fn inner_ancestors(
   879     fn inner_ancestors(
   880         &self,
   880         &self,
   881         py: Python,
   881         py: Python,
   882         py_revs: &PyTuple,
   882         py_revs: &PyTuple,
   883     ) -> PyResult<PyObject> {
   883     ) -> PyResult<PyObject> {
   884         let index = &mut *self.index(py).borrow_mut();
   884         let index = &*self.index(py).borrow();
   885         let revs: Vec<_> = rev_pyiter_collect(py, py_revs.as_object(), index)?;
   885         let revs: Vec<_> = rev_pyiter_collect(py, py_revs.as_object(), index)?;
   886         let as_vec: Vec<_> = index
   886         let as_vec: Vec<_> = index
   887             .ancestors(&revs)
   887             .ancestors(&revs)
   888             .map_err(|e| graph_error(py, e))?
   888             .map_err(|e| graph_error(py, e))?
   889             .iter()
   889             .iter()
   895     fn inner_commonancestorsheads(
   895     fn inner_commonancestorsheads(
   896         &self,
   896         &self,
   897         py: Python,
   897         py: Python,
   898         py_revs: &PyTuple,
   898         py_revs: &PyTuple,
   899     ) -> PyResult<PyObject> {
   899     ) -> PyResult<PyObject> {
   900         let index = &mut *self.index(py).borrow_mut();
   900         let index = &*self.index(py).borrow();
   901         let revs: Vec<_> = rev_pyiter_collect(py, py_revs.as_object(), index)?;
   901         let revs: Vec<_> = rev_pyiter_collect(py, py_revs.as_object(), index)?;
   902         let as_vec: Vec<_> = index
   902         let as_vec: Vec<_> = index
   903             .common_ancestor_heads(&revs)
   903             .common_ancestor_heads(&revs)
   904             .map_err(|e| graph_error(py, e))?
   904             .map_err(|e| graph_error(py, e))?
   905             .iter()
   905             .iter()
   978         py: Python,
   978         py: Python,
   979         revs: PyObject,
   979         revs: PyObject,
   980         target_density: f64,
   980         target_density: f64,
   981         min_gap_size: usize,
   981         min_gap_size: usize,
   982     ) -> PyResult<PyObject> {
   982     ) -> PyResult<PyObject> {
   983         let index = &mut *self.index(py).borrow_mut();
   983         let index = &*self.index(py).borrow();
   984         let revs: Vec<_> = rev_pyiter_collect(py, &revs, index)?;
   984         let revs: Vec<_> = rev_pyiter_collect(py, &revs, index)?;
   985         let as_nested_vec =
   985         let as_nested_vec =
   986             index.slice_chunk_to_density(&revs, target_density, min_gap_size);
   986             index.slice_chunk_to_density(&revs, target_density, min_gap_size);
   987         let mut res = Vec::with_capacity(as_nested_vec.len());
   987         let mut res = Vec::with_capacity(as_nested_vec.len());
   988         let mut py_chunk = Vec::new();
   988         let mut py_chunk = Vec::new();