~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Andrew Bennetts
  • Date: 2008-07-28 06:53:44 UTC
  • mfrom: (3581 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3583.
  • Revision ID: andrew.bennetts@canonical.com-20080728065344-ocndjoycs903q6fz
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
214
214
    """
215
215
 
216
216
    __slots__ = ['_weave', '_parents', '_sha1s', '_names', '_name_map',
217
 
                 '_weave_name', '_matcher']
 
217
                 '_weave_name', '_matcher', '_allow_reserved']
218
218
    
219
 
    def __init__(self, weave_name=None, access_mode='w', matcher=None, get_scope=None):
 
219
    def __init__(self, weave_name=None, access_mode='w', matcher=None,
 
220
                 get_scope=None, allow_reserved=False):
220
221
        """Create a weave.
221
222
 
222
223
        :param get_scope: A callable that returns an opaque object to be used
239
240
        self._get_scope = get_scope
240
241
        self._scope = get_scope()
241
242
        self._access_mode = access_mode
 
243
        self._allow_reserved = allow_reserved
242
244
 
243
245
    def __repr__(self):
244
246
        return "Weave(%r)" % self._weave_name
278
280
 
279
281
    def _lookup(self, name):
280
282
        """Convert symbolic version name to index."""
281
 
        self.check_not_reserved_id(name)
 
283
        if not self._allow_reserved:
 
284
            self.check_not_reserved_id(name)
282
285
        try:
283
286
            return self._name_map[name]
284
287
        except KeyError:
653
656
                # not in either revision
654
657
                yield 'irrelevant', line
655
658
 
656
 
        yield 'unchanged', ''           # terminator
657
 
 
658
659
    def _extract(self, versions):
659
660
        """Yield annotation of lines in included set.
660
661
 
910
911
        
911
912
        :param create: If not True, only open an existing knit.
912
913
        """
913
 
        super(WeaveFile, self).__init__(name, access_mode, get_scope=get_scope)
 
914
        super(WeaveFile, self).__init__(name, access_mode, get_scope=get_scope,
 
915
            allow_reserved=False)
914
916
        self._transport = transport
915
917
        self._filemode = filemode
916
918
        try: