/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: John Arbash Meinel
  • Date: 2006-05-10 19:59:55 UTC
  • mfrom: (1704 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060510195955-df080afb1daa3a96
[merge] bzr.dev 1704

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
                            rename, splitpath, sha_file,
46
46
                            file_kind, abspath, normpath, pathjoin,
47
47
                            safe_unicode,
 
48
                            rmtree,
48
49
                            )
49
50
from bzrlib.textui import show_status
50
51
from bzrlib.trace import mutter, note
95
96
    def __init__(self, *ignored, **ignored_too):
96
97
        raise NotImplementedError('The Branch class is abstract')
97
98
 
 
99
    def break_lock(self):
 
100
        """Break a lock if one is present from another instance.
 
101
 
 
102
        Uses the ui factory to ask for confirmation if the lock may be from
 
103
        an active process.
 
104
 
 
105
        This will probe the repository for its lock as well.
 
106
        """
 
107
        self.control_files.break_lock()
 
108
        self.repository.break_lock()
 
109
        master = self.get_master_branch()
 
110
        if master is not None:
 
111
            master.break_lock()
 
112
 
98
113
    @staticmethod
99
114
    @deprecated_method(zero_eight)
100
115
    def open_downlevel(base):
154
169
        assert cfg.get_option("nickname") == nick
155
170
 
156
171
    nick = property(_get_nick, _set_nick)
157
 
        
 
172
 
 
173
    def is_locked(self):
 
174
        raise NotImplementedError('is_locked is abstract')
 
175
 
158
176
    def lock_write(self):
159
177
        raise NotImplementedError('lock_write is abstract')
160
 
        
 
178
 
161
179
    def lock_read(self):
162
180
        raise NotImplementedError('lock_read is abstract')
163
181
 
168
186
        """Return lock mode for the Branch: 'r', 'w' or None"""
169
187
        raise NotImplementedError(self.peek_lock_mode)
170
188
 
 
189
    def get_physical_lock_status(self):
 
190
        raise NotImplementedError('get_physical_lock_status is abstract')
 
191
 
171
192
    def abspath(self, name):
172
193
        """Return absolute filename for something in the branch
173
194
        
880
901
        # XXX: cache_root seems to be unused, 2006-01-13 mbp
881
902
        if hasattr(self, 'cache_root') and self.cache_root is not None:
882
903
            try:
883
 
                shutil.rmtree(self.cache_root)
 
904
                rmtree(self.cache_root)
884
905
            except:
885
906
                pass
886
907
            self.cache_root = None
939
960
        tree = self.repository.revision_tree(self.last_revision())
940
961
        return tree.inventory.root.file_id
941
962
 
 
963
    def is_locked(self):
 
964
        return self.control_files.is_locked()
 
965
 
942
966
    def lock_write(self):
943
967
        # TODO: test for failed two phase locks. This is known broken.
944
968
        self.control_files.lock_write()
951
975
 
952
976
    def unlock(self):
953
977
        # TODO: test for failed two phase locks. This is known broken.
954
 
        self.repository.unlock()
955
 
        self.control_files.unlock()
 
978
        try:
 
979
            self.repository.unlock()
 
980
        finally:
 
981
            self.control_files.unlock()
956
982
        
957
983
    def peek_lock_mode(self):
958
984
        if self.control_files._lock_count == 0:
960
986
        else:
961
987
            return self.control_files._lock_mode
962
988
 
 
989
    def get_physical_lock_status(self):
 
990
        return self.control_files.get_physical_lock_status()
 
991
 
963
992
    @needs_read_lock
964
993
    def print_file(self, file, revision_id):
965
994
        """See Branch.print_file."""