~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-12-05 16:14:07 UTC
  • mfrom: (3879.1.1 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20081205161407-zulgn2hssd85nsdk
(jam) Merge bzr 1.10-final back into bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1340
1340
                adapter = adapter_factory(self)
1341
1341
                adapters[adapter_key] = adapter
1342
1342
                return adapter
 
1343
        delta_types = set()
1343
1344
        if self._factory.annotated:
1344
1345
            # self is annotated, we need annotated knits to use directly.
1345
1346
            annotated = "annotated-"
1349
1350
            annotated = ""
1350
1351
            convertibles = set(["knit-annotated-ft-gz"])
1351
1352
            if self._max_delta_chain:
 
1353
                delta_types.add("knit-annotated-delta-gz")
1352
1354
                convertibles.add("knit-annotated-delta-gz")
1353
1355
        # The set of types we can cheaply adapt without needing basis texts.
1354
1356
        native_types = set()
1355
1357
        if self._max_delta_chain:
1356
1358
            native_types.add("knit-%sdelta-gz" % annotated)
 
1359
            delta_types.add("knit-%sdelta-gz" % annotated)
1357
1360
        native_types.add("knit-%sft-gz" % annotated)
1358
1361
        knit_types = native_types.union(convertibles)
1359
1362
        adapters = {}
1372
1375
        buffered_index_entries = {}
1373
1376
        for record in stream:
1374
1377
            parents = record.parents
 
1378
            if record.storage_kind in delta_types:
 
1379
                # TODO: eventually the record itself should track
 
1380
                #       compression_parent
 
1381
                compression_parent = parents[0]
 
1382
            else:
 
1383
                compression_parent = None
1375
1384
            # Raise an error when a record is missing.
1376
1385
            if record.storage_kind == 'absent':
1377
1386
                raise RevisionNotPresent([record.key], self)
1378
1387
            elif ((record.storage_kind in knit_types)
1379
 
                  and (not parents
 
1388
                  and (compression_parent is None
1380
1389
                       or not self._fallback_vfs
1381
 
                       or not self._index.missing_keys(parents)
1382
 
                       or self.missing_keys(parents))):
 
1390
                       or self._index.has_key(compression_parent)
 
1391
                       or not self.has_key(compression_parent))):
1383
1392
                # we can insert the knit record literally if either it has no
1384
1393
                # compression parent OR we already have its basis in this kvf
1385
1394
                # OR the basis is not present even in the fallbacks.  In the
1427
1436
                    #
1428
1437
                    # They're required to be physically in this
1429
1438
                    # KnitVersionedFiles, not in a fallback.
1430
 
                    compression_parent = parents[0]
1431
 
                    if self.missing_keys([compression_parent]):
 
1439
                    if not self._index.has_key(compression_parent):
1432
1440
                        pending = buffered_index_entries.setdefault(
1433
1441
                            compression_parent, [])
1434
1442
                        pending.append(index_entry)