diff --git a/mercurial/interfaces/repository.py b/mercurial/interfaces/repository.py --- a/mercurial/interfaces/repository.py +++ b/mercurial/interfaces/repository.py @@ -1810,6 +1810,9 @@ class ilocalrepositorymain(interfaceutil def lock(wait=True): """Lock the repository store and return a lock instance.""" + def currentlock(): + """Return the lock if it's held or None.""" + def wlock(wait=True): """Lock the non-store parts of the repository.""" diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -3141,6 +3141,10 @@ class localrepository: """Returns the wlock if it's held, or None if it's not.""" return self._currentlock(self._wlockref) + def currentlock(self): + """Returns the lock if it's held, or None if it's not.""" + return self._currentlock(self._lockref) + def checkcommitpatterns(self, wctx, match, status, fail): """check for commit arguments that aren't committable""" if match.isexact() or match.prefix():