~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Robert Collins
  • Date: 2008-04-07 21:52:08 UTC
  • mto: This revision was merged to the branch mainline in revision 3350.
  • Revision ID: robertc@robertcollins.net-20080407215208-rg0qk19a7sanekl1
Review feedback.

Show diffs side-by-side

added added

removed removed

Lines of Context:
186
186
                 '_weave_name', '_matcher']
187
187
    
188
188
    def __init__(self, weave_name=None, access_mode='w', matcher=None, get_scope=None):
 
189
        """Create a weave.
 
190
 
 
191
        :param get_scope: A callable that returns an opaque object to be used
 
192
            for detecting when this weave goes out of scope (should stop
 
193
            answering requests or allowing mutation).
 
194
        """
189
195
        super(Weave, self).__init__(access_mode)
190
196
        self._weave = []
191
197
        self._parents = []
199
205
            self._matcher = matcher
200
206
        if get_scope is None:
201
207
            get_scope = lambda:None
202
 
        self.get_scope = get_scope
203
 
        self.scope = get_scope()
 
208
        self._get_scope = get_scope
 
209
        self._scope = get_scope()
204
210
        self._access_mode = access_mode
205
211
 
206
212
    def __repr__(self):
208
214
 
209
215
    def _check_write_ok(self):
210
216
        """Is the versioned file marked as 'finished' ? Raise if it is."""
211
 
        if self.get_scope() != self.scope:
 
217
        if self._get_scope() != self._scope:
212
218
            raise errors.OutSideTransaction()
213
219
        if self._access_mode != 'w':
214
220
            raise errors.ReadOnlyObjectDirtiedError(self)