Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 4913:46e39935ce33
rename and simplify do_lock
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 21 Jul 2007 16:02:09 -0500 |
parents | 312c845edef5 |
children | 9a2a73ea6135 |
comparison
equal
deleted
inserted
replaced
4912:312c845edef5 | 4913:46e39935ce33 |
---|---|
544 if hasattr(self, a): | 544 if hasattr(self, a): |
545 self.__delattr__(a) | 545 self.__delattr__(a) |
546 self.tagscache = None | 546 self.tagscache = None |
547 self.nodetagscache = None | 547 self.nodetagscache = None |
548 | 548 |
549 def do_lock(self, lockname, wait, releasefn=None, acquirefn=None, | 549 def _lock(self, lockname, wait, releasefn, acquirefn, desc): |
550 desc=None): | |
551 try: | 550 try: |
552 l = lock.lock(lockname, 0, releasefn, desc=desc) | 551 l = lock.lock(lockname, 0, releasefn, desc=desc) |
553 except lock.LockHeld, inst: | 552 except lock.LockHeld, inst: |
554 if not wait: | 553 if not wait: |
555 raise | 554 raise |
561 if acquirefn: | 560 if acquirefn: |
562 acquirefn() | 561 acquirefn() |
563 return l | 562 return l |
564 | 563 |
565 def lock(self, wait=1): | 564 def lock(self, wait=1): |
566 return self.do_lock(self.sjoin("lock"), wait, | 565 return self._lock(self.sjoin("lock"), wait, None, self.invalidate, |
567 acquirefn=self.invalidate, | 566 _('repository %s') % self.origroot) |
568 desc=_('repository %s') % self.origroot) | |
569 | 567 |
570 def wlock(self, wait=1): | 568 def wlock(self, wait=1): |
571 return self.do_lock(self.join("wlock"), wait, self.dirstate.write, | 569 return self._lock(self.join("wlock"), wait, self.dirstate.write, |
572 self.dirstate.invalidate, | 570 self.dirstate.invalidate, |
573 desc=_('working directory of %s') % self.origroot) | 571 _('working directory of %s') % self.origroot) |
574 | 572 |
575 def filecommit(self, fn, manifest1, manifest2, linkrev, transaction, changelist): | 573 def filecommit(self, fn, manifest1, manifest2, linkrev, transaction, changelist): |
576 """ | 574 """ |
577 commit an individual file as part of a larger transaction | 575 commit an individual file as part of a larger transaction |
578 """ | 576 """ |