~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
from bzrlib.decorators import needs_read_lock, needs_write_lock, only_raises
50
50
from bzrlib.hooks import HookPoint, Hooks
51
51
from bzrlib.inter import InterObject
 
52
from bzrlib.lock import _RelockDebugMixin
52
53
from bzrlib import registry
53
54
from bzrlib.symbol_versioning import (
54
55
    deprecated_in,
2079
2080
    _legacy_formats[0].network_name(), _legacy_formats[0].__class__)
2080
2081
 
2081
2082
 
2082
 
class BzrBranch(Branch):
 
2083
class BzrBranch(Branch, _RelockDebugMixin):
2083
2084
    """A branch stored in the actual filesystem.
2084
2085
 
2085
2086
    Note that it's "local" in the context of the filesystem; it doesn't
2131
2132
        return self.control_files.is_locked()
2132
2133
 
2133
2134
    def lock_write(self, token=None):
 
2135
        if not self.is_locked():
 
2136
            self._note_lock('w')
2134
2137
        # All-in-one needs to always unlock/lock.
2135
2138
        repo_control = getattr(self.repository, 'control_files', None)
2136
2139
        if self.control_files == repo_control or not self.is_locked():
2146
2149
            raise
2147
2150
 
2148
2151
    def lock_read(self):
 
2152
        if not self.is_locked():
 
2153
            self._note_lock('r')
2149
2154
        # All-in-one needs to always unlock/lock.
2150
2155
        repo_control = getattr(self.repository, 'control_files', None)
2151
2156
        if self.control_files == repo_control or not self.is_locked():