/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 breezy/repository.py

Remove uses of needs_write_lock.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    registry,
42
42
    ui,
43
43
    )
44
 
from .decorators import needs_write_lock, only_raises
 
44
from .decorators import only_raises
45
45
from .inter import InterObject
46
46
from .lock import _RelockDebugMixin, LogicalLockResult
47
47
from .sixish import (
911
911
            return list(self.get_deltas_for_revisions(
912
912
                [r], specific_fileids=specific_fileids))[0]
913
913
 
914
 
    @needs_write_lock
915
914
    def store_revision_signature(self, gpg_strategy, plaintext, revision_id):
916
 
        signature = gpg_strategy.sign(plaintext)
917
 
        self.add_signature_text(revision_id, signature)
 
915
        with self.lock_write():
 
916
            signature = gpg_strategy.sign(plaintext)
 
917
            self.add_signature_text(revision_id, signature)
918
918
 
919
919
    def add_signature_text(self, revision_id, signature):
920
920
        """Store a signature text for a revision.
979
979
        """Return True if this repository is flagged as a shared repository."""
980
980
        raise NotImplementedError(self.is_shared)
981
981
 
982
 
    @needs_write_lock
983
982
    def reconcile(self, other=None, thorough=False):
984
983
        """Reconcile this repository."""
985
984
        from .reconcile import RepoReconciler
986
 
        reconciler = RepoReconciler(self, thorough=thorough)
987
 
        reconciler.reconcile()
988
 
        return reconciler
 
985
        with self.lock_write():
 
986
            reconciler = RepoReconciler(self, thorough=thorough)
 
987
            reconciler.reconcile()
 
988
            return reconciler
989
989
 
990
990
    def _refresh_data(self):
991
991
        """Helper called from lock_* to ensure coherency with disk.
1023
1023
        types it should be a no-op that just returns.
1024
1024
 
1025
1025
        This stub method does not require a lock, but subclasses should use
1026
 
        @needs_write_lock as this is a long running call it's reasonable to
 
1026
        self.write_lock as this is a long running call it's reasonable to
1027
1027
        implicitly lock for the user.
1028
1028
 
1029
1029
        :param hint: If not supplied, the whole repository is packed.
1096
1096
                [parents_provider, other_repository._make_parents_provider()])
1097
1097
        return graph.Graph(parents_provider)
1098
1098
 
1099
 
    @needs_write_lock
1100
1099
    def set_make_working_trees(self, new_value):
1101
1100
        """Set the policy flag for making working trees when creating branches.
1102
1101
 
1112
1111
        """Returns the policy for making working trees on new branches."""
1113
1112
        raise NotImplementedError(self.make_working_trees)
1114
1113
 
1115
 
    @needs_write_lock
1116
1114
    def sign_revision(self, revision_id, gpg_strategy):
1117
 
        testament = _mod_testament.Testament.from_revision(self, revision_id)
1118
 
        plaintext = testament.as_short_text()
1119
 
        self.store_revision_signature(gpg_strategy, plaintext, revision_id)
 
1115
        with self.lock_write():
 
1116
            testament = _mod_testament.Testament.from_revision(self, revision_id)
 
1117
            plaintext = testament.as_short_text()
 
1118
            self.store_revision_signature(gpg_strategy, plaintext, revision_id)
1120
1119
 
1121
1120
    def verify_revision_signature(self, revision_id, gpg_strategy):
1122
1121
        """Verify the signature on a revision.
1507
1506
    _optimisers = []
1508
1507
    """The available optimised InterRepository types."""
1509
1508
 
1510
 
    @needs_write_lock
1511
1509
    def copy_content(self, revision_id=None):
1512
1510
        """Make a complete copy of the content in self into destination.
1513
1511
 
1517
1515
        :param revision_id: Only copy the content needed to construct
1518
1516
                            revision_id and its parents.
1519
1517
        """
1520
 
        try:
1521
 
            self.target.set_make_working_trees(
1522
 
                self.source.make_working_trees())
1523
 
        except NotImplementedError:
1524
 
            pass
1525
 
        self.target.fetch(self.source, revision_id=revision_id)
 
1518
        with self.lock_write():
 
1519
            try:
 
1520
                self.target.set_make_working_trees(
 
1521
                    self.source.make_working_trees())
 
1522
            except NotImplementedError:
 
1523
                pass
 
1524
            self.target.fetch(self.source, revision_id=revision_id)
1526
1525
 
1527
 
    @needs_write_lock
1528
1526
    def fetch(self, revision_id=None, find_ghosts=False):
1529
1527
        """Fetch the content required to construct revision_id.
1530
1528