~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: Aaron Bentley
  • Date: 2009-11-03 15:45:56 UTC
  • mto: (4634.97.2 2.0)
  • mto: This revision was merged to the branch mainline in revision 4798.
  • Revision ID: aaron@aaronbentley.com-20091103154556-e953dmegqbinyokq
Improve patch binary section handling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
69
69
    lru_cache,
70
70
    pack,
71
71
    progress,
72
 
    static_tuple,
73
72
    trace,
74
73
    tsort,
75
74
    tuned_gzip,
76
 
    ui,
77
75
    )
78
76
""")
79
77
from bzrlib import (
1712
1710
            # There were index entries buffered at the end of the stream,
1713
1711
            # So these need to be added (if the index supports holding such
1714
1712
            # entries for later insertion)
1715
 
            all_entries = []
1716
1713
            for key in buffered_index_entries:
1717
1714
                index_entries = buffered_index_entries[key]
1718
 
                all_entries.extend(index_entries)
1719
 
            self._index.add_records(
1720
 
                all_entries, missing_compression_parents=True)
 
1715
                self._index.add_records(index_entries,
 
1716
                    missing_compression_parents=True)
1721
1717
 
1722
1718
    def get_missing_compression_parent_keys(self):
1723
1719
        """Return an iterable of keys of missing compression parents.
1756
1752
        :return: An iterator over (line, key).
1757
1753
        """
1758
1754
        if pb is None:
1759
 
            pb = ui.ui_factory.nested_progress_bar()
 
1755
            pb = progress.DummyProgress()
1760
1756
        keys = set(keys)
1761
1757
        total = len(keys)
1762
1758
        done = False
2369
2365
    FLAGS is a comma separated list of flags about the record. Values include
2370
2366
        no-eol, line-delta, fulltext.
2371
2367
    BYTE_OFFSET is the ascii representation of the byte offset in the data file
2372
 
        that the compressed data starts at.
 
2368
        that the the compressed data starts at.
2373
2369
    LENGTH is the ascii representation of the length of the data file.
2374
2370
    PARENT_ID a utf-8 revision id prefixed by a '.' that is a parent of
2375
2371
        REVISION_ID.
2946
2942
        if not random_id:
2947
2943
            present_nodes = self._get_entries(keys)
2948
2944
            for (index, key, value, node_refs) in present_nodes:
2949
 
                parents = node_refs[:1]
2950
 
                # Sometimes these are passed as a list rather than a tuple
2951
 
                passed = static_tuple.as_tuples(keys[key])
2952
 
                passed_parents = passed[1][:1]
2953
2945
                if (value[0] != keys[key][0][0] or
2954
 
                    parents != passed_parents):
2955
 
                    node_refs = static_tuple.as_tuples(node_refs)
 
2946
                    node_refs[:1] != keys[key][1][:1]):
2956
2947
                    raise KnitCorrupt(self, "inconsistent details in add_records"
2957
 
                        ": %s %s" % ((value, node_refs), passed))
 
2948
                        ": %s %s" % ((value, node_refs), keys[key]))
2958
2949
                del keys[key]
2959
2950
        result = []
2960
2951
        if self._parents:
3709
3700
 
3710
3701
try:
3711
3702
    from bzrlib._knit_load_data_pyx import _load_data_c as _load_data
3712
 
except ImportError, e:
3713
 
    osutils.failed_to_load_extension(e)
 
3703
except ImportError:
3714
3704
    from bzrlib._knit_load_data_py import _load_data_py as _load_data