rust/hg-cpython/src/vfs.rs
changeset 52172 72bc29f01570
parent 52167 7be39c5110c9
child 52180 735bf027dd1d
--- a/rust/hg-cpython/src/vfs.rs	Mon Jul 29 20:35:44 2024 +0200
+++ b/rust/hg-cpython/src/vfs.rs	Mon Jul 29 20:39:34 2024 +0200
@@ -20,6 +20,7 @@
 /// Wrapper around a Python VFS object to call back into Python from `hg-core`.
 pub struct PyVfs {
     inner: PyObject,
+    base: PathBuf,
 }
 
 impl Clone for PyVfs {
@@ -28,13 +29,21 @@
         let py = gil.python();
         Self {
             inner: self.inner.clone_ref(py),
+            base: self.base.clone(),
         }
     }
 }
 
 impl PyVfs {
-    pub fn new(_py: Python, py_vfs: PyObject) -> PyResult<Self> {
-        Ok(Self { inner: py_vfs })
+    pub fn new(
+        _py: Python,
+        py_vfs: PyObject,
+        base: PathBuf,
+    ) -> PyResult<Self> {
+        Ok(Self {
+            inner: py_vfs,
+            base,
+        })
     }
 
     fn inner_open(
@@ -288,7 +297,6 @@
     }
 
     fn base(&self) -> &Path {
-        // This will only be useful in a later patch
-        todo!()
+        &self.base
     }
 }