diff --git a/eden/scm/edenscmnative/bindings/modules/pymetalog/src/lib.rs b/eden/scm/edenscmnative/bindings/modules/pymetalog/src/lib.rs index f64cb4b2b3..7379a3add2 100644 --- a/eden/scm/edenscmnative/bindings/modules/pymetalog/src/lib.rs +++ b/eden/scm/edenscmnative/bindings/modules/pymetalog/src/lib.rs @@ -7,7 +7,7 @@ #![allow(non_camel_case_types)] -use ::metalog::{CommitOptions, Id20, MetaLog}; +use ::metalog::{CommitOptions, Id20, MetaLog, Repair}; use cpython::*; use cpython_ext::Bytes; use cpython_failure::ResultPyErrExt; @@ -106,4 +106,9 @@ py_class!(class metalog |py| { self.remove(py, &key)?; Ok(()) } + + @staticmethod + def repair(path: &str) -> PyResult { + MetaLog::repair(path).map_pyerr::(py).map(|s| PyUnicode::new(py, &s)) + } }); diff --git a/eden/scm/edenscmnative/bindings/modules/pymutationstore/src/lib.rs b/eden/scm/edenscmnative/bindings/modules/pymutationstore/src/lib.rs index 9e601ae919..8a11ad0759 100644 --- a/eden/scm/edenscmnative/bindings/modules/pymutationstore/src/lib.rs +++ b/eden/scm/edenscmnative/bindings/modules/pymutationstore/src/lib.rs @@ -15,7 +15,7 @@ use cpython::*; use cpython_failure::ResultPyErrExt; use thiserror::Error; -use ::mutationstore::{MutationEntry, MutationEntryOrigin, MutationStore}; +use ::mutationstore::{MutationEntry, MutationEntryOrigin, MutationStore, Repair}; use encoding::local_bytes_to_path; use types::node::Node; use vlqencoding::{VLQDecode, VLQEncode}; @@ -251,4 +251,9 @@ py_class!(class mutationstore |py| { } Ok(pyssets) } + + @staticmethod + def repair(path: &str) -> PyResult { + MutationStore::repair(path).map_pyerr::(py).map(|s| PyUnicode::new(py, &s)) + } }); diff --git a/eden/scm/edenscmnative/bindings/modules/pynodemap/src/lib.rs b/eden/scm/edenscmnative/bindings/modules/pynodemap/src/lib.rs index a383f4e8fa..a1371d19d2 100644 --- a/eden/scm/edenscmnative/bindings/modules/pynodemap/src/lib.rs +++ b/eden/scm/edenscmnative/bindings/modules/pynodemap/src/lib.rs @@ -11,7 +11,7 @@ use std::cell::RefCell; use cpython::*; -use ::nodemap::{NodeMap, NodeSet}; +use ::nodemap::{NodeMap, NodeSet, Repair}; use cpython_ext::Bytes; use cpython_failure::ResultPyErrExt; use encoding::local_bytes_to_path; @@ -86,6 +86,11 @@ py_class!(class nodemap |py| { .map_err(|e| PyErr::new::(py, format!("{}", e)))?; Ok(keys) } + + @staticmethod + def repair(path: &str) -> PyResult { + NodeMap::repair(path).map_pyerr::(py).map(|s| PyUnicode::new(py, &s)) + } }); py_class!(class nodeset |py| { @@ -123,4 +128,9 @@ py_class!(class nodeset |py| { .map_pyerr::(py)?; Ok(nodes) } + + @staticmethod + def repair(path: &str) -> PyResult { + NodeSet::repair(path).map_pyerr::(py).map(|s| PyUnicode::new(py, &s)) + } }); diff --git a/eden/scm/edenscmnative/bindings/modules/pyrevisionstore/src/lib.rs b/eden/scm/edenscmnative/bindings/modules/pyrevisionstore/src/lib.rs index ffe4005748..014d846995 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyrevisionstore/src/lib.rs +++ b/eden/scm/edenscmnative/bindings/modules/pyrevisionstore/src/lib.rs @@ -19,7 +19,7 @@ use anyhow::{format_err, Error}; use cpython::*; use parking_lot::RwLock; -use cpython_ext::{Bytes, PyErr}; +use cpython_ext::PyErr; use cpython_failure::ResultPyErrExt; use pyconfigparser::config; use revisionstore::{ @@ -410,9 +410,9 @@ py_class!(class indexedlogdatastore |py| { } @staticmethod - def repair(path: &PyBytes) -> PyResult { + def repair(path: &PyBytes) -> PyResult { let path = encoding::local_bytes_to_path(path.data(py)).map_pyerr::(py)?; - IndexedLogDataStore::repair(path).map_pyerr::(py).map(|s| Bytes::from(s)) + IndexedLogDataStore::repair(path).map_pyerr::(py).map(|s| PyUnicode::new(py, &s)) } def getdelta(&self, name: &PyBytes, node: &PyBytes) -> PyResult { @@ -463,9 +463,9 @@ py_class!(class indexedloghistorystore |py| { } @staticmethod - def repair(path: &PyBytes) -> PyResult { + def repair(path: &PyBytes) -> PyResult { let path = encoding::local_bytes_to_path(path.data(py)).map_pyerr::(py)?; - IndexedLogHistoryStore::repair(path).map_pyerr::(py).map(|s| Bytes::from(s)) + IndexedLogHistoryStore::repair(path).map_pyerr::(py).map(|s| PyUnicode::new(py, &s)) } def getmissing(&self, keys: &PyObject) -> PyResult { diff --git a/eden/scm/edenscmnative/bindings/modules/pyzstore/src/lib.rs b/eden/scm/edenscmnative/bindings/modules/pyzstore/src/lib.rs index 409ca722ab..ae2c8d72c1 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyzstore/src/lib.rs +++ b/eden/scm/edenscmnative/bindings/modules/pyzstore/src/lib.rs @@ -7,7 +7,7 @@ #![allow(non_camel_case_types)] -use ::zstore::{Id20, Zstore}; +use ::zstore::{Id20, Repair, Zstore}; use cpython::*; use cpython_ext::Bytes; use cpython_failure::ResultPyErrExt; @@ -66,4 +66,9 @@ py_class!(class zstore |py| { def __contains__(&self, id: Bytes) -> PyResult { self.contains(py, id) } + + @staticmethod + def repair(path: &str) -> PyResult { + Zstore::repair(path).map_pyerr::(py).map(|s| PyUnicode::new(py, &s)) + } });