~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Robert Collins
  • Date: 2006-05-04 11:53:51 UTC
  • mto: (1697.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1701.
  • Revision ID: robertc@robertcollins.net-20060504115351-79122d06d443d4a8
Teach Branch about break_lock.

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
    def __init__(self, *ignored, **ignored_too):
96
96
        raise NotImplementedError('The Branch class is abstract')
97
97
 
 
98
    def break_lock(self):
 
99
        """Break a lock if one is present from another instance.
 
100
 
 
101
        Uses the ui factory to ask for confirmation if the lock may be from
 
102
        an active process.
 
103
 
 
104
        This will probe the repository for its lock as well.
 
105
        """
 
106
        self.control_files.break_lock()
 
107
        self.repository.break_lock()
 
108
 
98
109
    @staticmethod
99
110
    @deprecated_method(zero_eight)
100
111
    def open_downlevel(base):
951
962
 
952
963
    def unlock(self):
953
964
        # TODO: test for failed two phase locks. This is known broken.
954
 
        self.repository.unlock()
955
 
        self.control_files.unlock()
 
965
        try:
 
966
            self.repository.unlock()
 
967
        finally:
 
968
            self.control_files.unlock()
956
969
        
957
970
    def peek_lock_mode(self):
958
971
        if self.control_files._lock_count == 0: