diff rust/hg-cpython/src/revlog.rs @ 51195:51cc12158f97

rust-index: add `pack_header` support
author Rapha?l Gom?s <rgomes@octobus.net>
date Thu, 03 Aug 2023 10:28:10 +0200
parents 4e6620b7fbbb
children 44fbb7dfb563
line wrap: on
line diff
--- a/rust/hg-cpython/src/revlog.rs	Mon Oct 30 10:34:48 2023 +0100
+++ b/rust/hg-cpython/src/revlog.rs	Thu Aug 03 10:28:10 2023 +0200
@@ -216,7 +216,12 @@
 
     /// return a binary packed version of the header
     def pack_header(&self, *args, **kw) -> PyResult<PyObject> {
-        self.call_cindex(py, "pack_header", args, kw)
+        let rindex = self.index(py).borrow();
+        let packed = rindex.pack_header(args.get_item(py, 0).extract(py)?);
+        let packed = PyBytes::new(py, &packed);
+        let cpacked = self.call_cindex(py, "pack_header", args, kw)?;
+        assert!(packed.as_object().compare(py, cpacked)?.is_eq());
+        Ok(packed.into_object())
     }
 
     /// get an index entry