[PATCH] localrepo: do not lock working directory when not used

Matt Mackall mpm at selenic.com
Mon May 11 10:41:56 CDT 2009


On Fri, May 08, 2009 at 08:19:33AM +0000, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg <simohe at besonet.ch>
> # Date 1241769473 -7200
> # Node ID b41ce5fc6ed3cfff8906397af198281766c33f79
> # Parent  6a322b8eb548f3b8805e21efd70d4530dd7af3ae
> localrepo: do not lock working directory when not used
> 
> diff -r 6a322b8eb548 -r b41ce5fc6ed3 mercurial/localrepo.py
> --- a/mercurial/localrepo.py	Fre Mai 08 09:56:35 2009 +0200
> +++ b/mercurial/localrepo.py	Fre Mai 08 09:57:53 2009 +0200
> @@ -844,15 +844,14 @@
>          Revision information is passed in the context.memctx argument.
>          commitctx() does not touch the working directory.
>          """
> -        wlock = lock = None
> +        lock = None
>          try:
> -            wlock = self.wlock()
>              lock = self.lock()
>              return self._commitctx(ctx, force=True, force_editor=False,
>                                     empty_ok=True, use_dirstate=False,
>                                     update_dirstate=False)
>          finally:
> -            release(lock, wlock)
> +            release(lock)

When we reduce to a single lock, the pattern should be:

lock = self.lock()
try:
  ...
finally:
  lock.release()

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list