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

merge bzr.dev r4164

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
    ConstantMapper,
104
104
    ContentFactory,
105
105
    ChunkedContentFactory,
 
106
    sort_groupcompress,
106
107
    VersionedFile,
107
108
    VersionedFiles,
108
109
    )
298
299
            if self._network_bytes is None:
299
300
                self._create_network_bytes()
300
301
            return self._network_bytes
 
302
        if ('-ft-' in self.storage_kind and
 
303
            storage_kind in ('chunked', 'fulltext')):
 
304
            adapter_key = (self.storage_kind, 'fulltext')
 
305
            adapter_factory = adapter_registry.get(adapter_key)
 
306
            adapter = adapter_factory(None)
 
307
            bytes = adapter.get_bytes(self)
 
308
            if storage_kind == 'chunked':
 
309
                return [bytes]
 
310
            else:
 
311
                return bytes
301
312
        if self._knit is not None:
 
313
            # Not redundant with direct conversion above - that only handles
 
314
            # fulltext cases.
302
315
            if storage_kind == 'chunked':
303
316
                return self._knit.get_lines(self.key[0])
304
317
            elif storage_kind == 'fulltext':
1316
1329
        if not keys:
1317
1330
            return
1318
1331
        if not self._index.has_graph:
1319
 
            # Cannot topological order when no graph has been stored.
 
1332
            # Cannot sort when no graph has been stored.
1320
1333
            ordering = 'unordered'
1321
1334
 
1322
1335
        remaining_keys = keys
1378
1391
                    needed_from_fallback.add(key)
1379
1392
        # Double index lookups here : need a unified api ?
1380
1393
        global_map, parent_maps = self._get_parent_map_with_sources(keys)
1381
 
        if ordering == 'topological':
1382
 
            # Global topological sort
1383
 
            present_keys = tsort.topo_sort(global_map)
 
1394
        if ordering in ('topological', 'groupcompress'):
 
1395
            if ordering == 'topological':
 
1396
                # Global topological sort
 
1397
                present_keys = tsort.topo_sort(global_map)
 
1398
            else:
 
1399
                present_keys = sort_groupcompress(global_map)
1384
1400
            # Now group by source:
1385
1401
            source_keys = []
1386
1402
            current_source = None
1396
1412
        else:
1397
1413
            if ordering != 'unordered':
1398
1414
                raise AssertionError('valid values for ordering are:'
1399
 
                    ' "unordered" or "topological" not: %r'
 
1415
                    ' "unordered", "groupcompress" or "topological" not: %r'
1400
1416
                    % (ordering,))
1401
1417
            # Just group by source; remote sources first.
1402
1418
            present_keys = []
1658
1674
         * If a requested key did not change any lines (or didn't have any
1659
1675
           lines), it may not be mentioned at all in the result.
1660
1676
 
 
1677
        :param pb: Progress bar supplied by caller.
1661
1678
        :return: An iterator over (line, key).
1662
1679
        """
1663
1680
        if pb is None:
1677
1694
                        key_records.append((key, details[0]))
1678
1695
                records_iter = enumerate(self._read_records_iter(key_records))
1679
1696
                for (key_idx, (key, data, sha_value)) in records_iter:
1680
 
                    pb.update('Walking content.', key_idx, total)
 
1697
                    pb.update('Walking content', key_idx, total)
1681
1698
                    compression_parent = build_details[key][1]
1682
1699
                    if compression_parent is None:
1683
1700
                        # fulltext
1713
1730
                source_keys.add(key)
1714
1731
                yield line, key
1715
1732
            keys.difference_update(source_keys)
1716
 
        pb.update('Walking content.', total, total)
 
1733
        pb.update('Walking content', total, total)
1717
1734
 
1718
1735
    def _make_line_delta(self, delta_seq, new_content):
1719
1736
        """Generate a line delta from delta_seq and new_content."""