[PATCH "] localrepo: explicit `_lock` arguments in `lock`

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Mar 5 08:31:16 EST 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1551712124 -3600
#      Mon Mar 04 16:08:44 2019 +0100
# Node ID c3ba4d32430605d3d85f13c8fca20fba695edb2f
# Parent  bbe72376f2a91b383370619b3a0f66cf4a5d8178
# EXP-Topic gratuitous
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r c3ba4d324306
localrepo: explicit `_lock` arguments in `lock`

The argument for `_lock` are non-trivial, having them passed explicitly makes
thing clearer in my opinion. This is a Gratuitous change, I expect it will save
me (and others) time in the future.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2224,8 +2224,12 @@ class localrepository(object):
             l.lock()
             return l
 
-        l = self._lock(self.svfs, "lock", wait, None,
-                       self.invalidate, _('repository %s') % self.origroot)
+        l = self._lock(vfs=self.svfs,
+                       lockname="lock",
+                       wait=wait,
+                       releasefn=None,
+                       acquirefn=self.invalidate,
+                       desc=_('repository %s') % self.origroot)
         self._lockref = weakref.ref(l)
         return l
 


More information about the Mercurial-devel mailing list