mercurial/localrepo.py
changeset 9309 cfdcb7a465af
parent 9152 4017291c4c48
child 9425 6cfea6e4c892
equal deleted inserted replaced
9308:6fdd39f52f7f 9309:cfdcb7a465af
   649         if acquirefn:
   649         if acquirefn:
   650             acquirefn()
   650             acquirefn()
   651         return l
   651         return l
   652 
   652 
   653     def lock(self, wait=True):
   653     def lock(self, wait=True):
       
   654         '''Lock the repository store (.hg/store) and return a weak reference
       
   655         to the lock. Use this before modifying the store (e.g. committing or
       
   656         stripping). If you are opening a transaction, get a lock as well.)'''
   654         l = self._lockref and self._lockref()
   657         l = self._lockref and self._lockref()
   655         if l is not None and l.held:
   658         if l is not None and l.held:
   656             l.lock()
   659             l.lock()
   657             return l
   660             return l
   658 
   661 
   660                        _('repository %s') % self.origroot)
   663                        _('repository %s') % self.origroot)
   661         self._lockref = weakref.ref(l)
   664         self._lockref = weakref.ref(l)
   662         return l
   665         return l
   663 
   666 
   664     def wlock(self, wait=True):
   667     def wlock(self, wait=True):
       
   668         '''Lock the non-store parts of the repository (everything under
       
   669         .hg except .hg/store) and return a weak reference to the lock.
       
   670         Use this before modifying files in .hg.'''
   665         l = self._wlockref and self._wlockref()
   671         l = self._wlockref and self._wlockref()
   666         if l is not None and l.held:
   672         if l is not None and l.held:
   667             l.lock()
   673             l.lock()
   668             return l
   674             return l
   669 
   675