[PATCH 2 of 3 V4] repovfs: add a ward to check if locks are properly taken

Yuya Nishihara yuya at tcha.org
Fri Jul 14 10:51:19 EDT 2017


On Fri, 14 Jul 2017 16:01:49 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1499769497 -7200
> #      Tue Jul 11 12:38:17 2017 +0200
> # Node ID cea0a88164c6d003b43fe542ec12def2662c1273
> # Parent  201d9cbd64a276db278552a8924206afb67b1a4c
> # EXP-Topic vfs.ward
> repovfs: add a ward to check if locks are properly taken

Queued, thanks.

> --- a/hgext/patchbomb.py	Tue Jul 11 12:27:58 2017 +0200
> +++ b/hgext/patchbomb.py	Tue Jul 11 12:38:17 2017 +0200
> @@ -122,6 +122,10 @@
>      cmdutil.extraexport.append('pullurl')
>      cmdutil.extraexportmap['pullurl'] = _addpullheader
>  
> +def reposetup(ui, repo):
> +    if not repo.local():
> +        return
> +    repo._wlockfreeprefix.add('last-email.txt')

Nit: It seems wrong to change class variable by reposetup(). Maybe
_wlockfreeprefix should be copied to repo instance.

>  def prompt(ui, prompt, default=None, rest=':'):
>      if default:
> diff -r 201d9cbd64a2 -r cea0a88164c6 mercurial/localrepo.py
> --- a/mercurial/localrepo.py	Tue Jul 11 12:27:58 2017 +0200
> +++ b/mercurial/localrepo.py	Tue Jul 11 12:38:17 2017 +0200
> @@ -289,6 +289,25 @@
>      # only functions defined in module of enabled extensions are invoked
>      featuresetupfuncs = set()
>  
> +    # list of prefix for file which can be written without 'wlock'
> +    # Extensions should extend this list when needed
> +    _wlockfreeprefix = set([# We migh consider requiring 'wlock' for the next
> +                            # two, but pretty much all the existing code assume
> +                            # wlock is not needed so we keep them excluded for
> +                            # now.
> +                            'hgrc',
> +                            'requires',
> +                            # XXX cache is a complicatged business someone
> +                            # should investigate this in depth at some point
> +                            'cache/',
> +                            # XXX shouldn't be dirstate covered by the wlock?
> +                            'dirstate',
> +                            # XXX bisect was still a bit too messy at the time
> +                            # this changeset was introduced. Someone should fix
> +                            # the remainig bit and drop this line
> +                            'bisect.state',
> +                            ])

I've updated it to a set literal.


More information about the Mercurial-devel mailing list