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

login
register
mail settings
Submitter Pierre-Yves David
Date March 5, 2019, 1:31 p.m.
Message ID <c3ba4d32430605d3d85f.1551792676@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39061/
State Accepted
Headers show

Comments

Pierre-Yves David - March 5, 2019, 1:31 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Yuya Nishihara - March 6, 2019, 10:09 a.m.
On Tue, 05 Mar 2019 14:31:16 +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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`

Queued, thanks.

Patch

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