[PATCH] localrepo: document lock(), wlock() methods

Matt Mackall mpm at selenic.com
Tue Jul 21 20:10:33 CDT 2009


On Wed, 2009-07-22 at 00:29 +0000, Greg Ward wrote:
> # HG changeset patch
> # User Greg Ward <greg-hg at gerg.ca>
> # Date 1248222544 14400
> # Node ID 13910cfbd6519d1bbe09be7a11a9b710e3405c06
> # Parent  4a01bd7064a1a7a3e8e33631f0ab9aec745775db
> localrepo: document lock(), wlock() methods.
> 
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -651,6 +651,8 @@
>          return l
>  
>      def lock(self, wait=True):
> +        '''Take out a lock on the repository and return a weak reference
> +        to the lock.  Use this before modifying the repository.'''
>          l = self._lockref and self._lockref()
>          if l is not None and l.held:
>              l.lock()
> @@ -662,6 +664,9 @@
>          return l
>  
>      def wlock(self, wait=True):
> +        '''Take out a lock on the working copy and return a weak
> +        reference to the lock.  Use this before modifying files in the
> +        working copy.'''

Not quite correct. This can be thought of protecting everything in .hg
that isn't in .hg/store (which is covered by lock()). Stuff outside of 
.hg isn't really protected in the sense that the user is always free to
muck with it.

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial-devel mailing list