~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-13 18:38:58 UTC
  • mfrom: (1863 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1869.
  • Revision ID: john@arbash-meinel.com-20060713183858-ebf4aa1f9ef8bb6e
[merge] bzr.dev 1863

Show diffs side-by-side

added added

removed removed

Lines of Context:
993
993
        return self.control_files.is_locked()
994
994
 
995
995
    def lock_write(self):
996
 
        # TODO: test for failed two phase locks. This is known broken.
997
 
        self.control_files.lock_write()
998
996
        self.repository.lock_write()
 
997
        try:
 
998
            self.control_files.lock_write()
 
999
        except:
 
1000
            self.repository.unlock()
 
1001
            raise
999
1002
 
1000
1003
    def lock_read(self):
1001
 
        # TODO: test for failed two phase locks. This is known broken.
1002
 
        self.control_files.lock_read()
1003
1004
        self.repository.lock_read()
 
1005
        try:
 
1006
            self.control_files.lock_read()
 
1007
        except:
 
1008
            self.repository.unlock()
 
1009
            raise
1004
1010
 
1005
1011
    def unlock(self):
1006
1012
        # TODO: test for failed two phase locks. This is known broken.
1007
1013
        try:
1008
 
            self.repository.unlock()
1009
 
        finally:
1010
1014
            self.control_files.unlock()
 
1015
        finally:
 
1016
            self.repository.unlock()
1011
1017
        
1012
1018
    def peek_lock_mode(self):
1013
1019
        if self.control_files._lock_count == 0: