~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-09 21:42:24 UTC
  • mto: This revision was merged to the branch mainline in revision 3543.
  • Revision ID: john@arbash-meinel.com-20080709214224-r75k87r6a01pfc3h
Restore a real weave merge to 'bzr merge --weave'.

To do so efficiently, we only add the simple LCAs to the final weave
object, unless we run into complexities with the merge graph.
This gives the same effective result as adding all the texts,
with the advantage of not having to extract all of them.

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
 
659
        # This doesn't seem to be used anymore
 
660
        # yield 'unchanged', ''           # terminator
657
661
 
658
662
    def _extract(self, versions):
659
663
        """Yield annotation of lines in included set.
907
911
        
908
912
        :param create: If not True, only open an existing knit.
909
913
        """
910
 
        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)
911
916
        self._transport = transport
912
917
        self._filemode = filemode
913
918
        try: