rust/hg-core/src/repo.rs
changeset 48417 5734b03ecf3e
parent 48409 005ae1a343f8
child 48419 c8659e61073d
--- a/rust/hg-core/src/repo.rs	Mon Nov 29 17:37:08 2021 +0100
+++ b/rust/hg-core/src/repo.rs	Mon Mar 22 09:07:10 2021 +0100
@@ -6,6 +6,7 @@
 use crate::errors::HgError;
 use crate::errors::HgResultExt;
 use crate::exit_codes;
+use crate::lock::{try_with_lock_no_wait, LockError};
 use crate::manifest::{Manifest, Manifestlog};
 use crate::revlog::filelog::Filelog;
 use crate::revlog::revlog::RevlogError;
@@ -243,6 +244,13 @@
         }
     }
 
+    pub fn try_with_wlock_no_wait<R>(
+        &self,
+        f: impl FnOnce() -> R,
+    ) -> Result<R, LockError> {
+        try_with_lock_no_wait(self.hg_vfs(), "wlock", f)
+    }
+
     pub fn has_dirstate_v2(&self) -> bool {
         self.requirements
             .contains(requirements::DIRSTATE_V2_REQUIREMENT)