/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/weave.py

  • Committer: Robert Collins
  • Date: 2008-04-04 00:06:58 UTC
  • mto: This revision was merged to the branch mainline in revision 3350.
  • Revision ID: robertc@robertcollins.net-20080404000658-uw2nmrw8t5kcqbly
Remove manual notification of transaction finishing on versioned files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
185
185
    __slots__ = ['_weave', '_parents', '_sha1s', '_names', '_name_map',
186
186
                 '_weave_name', '_matcher']
187
187
    
188
 
    def __init__(self, weave_name=None, access_mode='w', matcher=None):
 
188
    def __init__(self, weave_name=None, access_mode='w', matcher=None, get_scope=None):
189
189
        super(Weave, self).__init__(access_mode)
190
190
        self._weave = []
191
191
        self._parents = []
197
197
            self._matcher = bzrlib.patiencediff.PatienceSequenceMatcher
198
198
        else:
199
199
            self._matcher = matcher
 
200
        if get_scope is None:
 
201
            get_scope = lambda:None
 
202
        self.get_scope = get_scope
 
203
        self.scope = get_scope()
 
204
        self._access_mode = access_mode
200
205
 
201
206
    def __repr__(self):
202
207
        return "Weave(%r)" % self._weave_name
203
208
 
 
209
    def _check_write_ok(self):
 
210
        """Is the versioned file marked as 'finished' ? Raise if it is."""
 
211
        if self.get_scope() != self.scope:
 
212
            raise errors.OutSideTransaction()
 
213
        if self._access_mode != 'w':
 
214
            raise errors.ReadOnlyObjectDirtiedError(self)
 
215
 
204
216
    def copy(self):
205
217
        """Return a deep copy of self.
206
218
        
865
877
 
866
878
    WEAVE_SUFFIX = '.weave'
867
879
    
868
 
    def __init__(self, name, transport, filemode=None, create=False, access_mode='w'):
 
880
    def __init__(self, name, transport, filemode=None, create=False, access_mode='w', get_scope=None):
869
881
        """Create a WeaveFile.
870
882
        
871
883
        :param create: If not True, only open an existing knit.
872
884
        """
873
 
        super(WeaveFile, self).__init__(name, access_mode)
 
885
        super(WeaveFile, self).__init__(name, access_mode, get_scope=get_scope)
874
886
        self._transport = transport
875
887
        self._filemode = filemode
876
888
        try: