diff mercurial/localrepo.py @ 9309:cfdcb7a465af

localrepo: document the locking scheme a little better - localrepo: document lock(), wlock() methods - lock: add class docstring
author Greg Ward <greg-hg@gerg.ca>
date Wed, 05 Aug 2009 14:42:57 +0200
parents 4017291c4c48
children 6cfea6e4c892
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Aug 05 17:20:47 2009 +0200
+++ b/mercurial/localrepo.py	Wed Aug 05 14:42:57 2009 +0200
@@ -651,6 +651,9 @@
         return l
 
     def lock(self, wait=True):
+        '''Lock the repository store (.hg/store) and return a weak reference
+        to the lock. Use this before modifying the store (e.g. committing or
+        stripping). If you are opening a transaction, get a lock as well.)'''
         l = self._lockref and self._lockref()
         if l is not None and l.held:
             l.lock()
@@ -662,6 +665,9 @@
         return l
 
     def wlock(self, wait=True):
+        '''Lock the non-store parts of the repository (everything under
+        .hg except .hg/store) and return a weak reference to the lock.
+        Use this before modifying files in .hg.'''
         l = self._wlockref and self._wlockref()
         if l is not None and l.held:
             l.lock()