# HG changeset patch # User Pierre-Yves David # Date 1679606294 0 # Node ID 6901916458bdb7a0f45d42d2448d3c19d2d3fc09 # Parent 08f3875020d1a0074452cf3c29b96b5c71b5f011 localrepo: add a `currentlock` method It mirrors he `currentwlock` function. diff -r 08f3875020d1 -r 6901916458bd mercurial/interfaces/repository.py --- a/mercurial/interfaces/repository.py Thu Mar 23 11:24:47 2023 +0000 +++ b/mercurial/interfaces/repository.py Thu Mar 23 21:18:14 2023 +0000 @@ -1810,6 +1810,9 @@ 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 -r 08f3875020d1 -r 6901916458bd mercurial/localrepo.py --- a/mercurial/localrepo.py Thu Mar 23 11:24:47 2023 +0000 +++ b/mercurial/localrepo.py Thu Mar 23 21:18:14 2023 +0000 @@ -3141,6 +3141,10 @@ """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():