~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/groupcompress.py

  • Committer: Andrew Bennetts
  • Date: 2009-12-03 05:57:41 UTC
  • mfrom: (4857 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4869.
  • Revision ID: andrew.bennetts@canonical.com-20091203055741-vmmg0fmjgjw2pwvu
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    knit,
32
32
    osutils,
33
33
    pack,
 
34
    static_tuple,
34
35
    trace,
35
36
    )
36
37
from bzrlib.btree_index import BTreeBuilder
1746
1747
                key = record.key
1747
1748
            self._unadded_refs[key] = record.parents
1748
1749
            yield found_sha1
1749
 
            keys_to_add.append((key, '%d %d' % (start_point, end_point),
1750
 
                (record.parents,)))
 
1750
            as_st = static_tuple.StaticTuple.from_sequence
 
1751
            if record.parents is not None:
 
1752
                parents = as_st([as_st(p) for p in record.parents])
 
1753
            else:
 
1754
                parents = None
 
1755
            refs = static_tuple.StaticTuple(parents)
 
1756
            keys_to_add.append((key, '%d %d' % (start_point, end_point), refs))
1751
1757
        if len(keys_to_add):
1752
1758
            flush()
1753
1759
        self._compressor = None
1877
1883
        if not random_id:
1878
1884
            present_nodes = self._get_entries(keys)
1879
1885
            for (index, key, value, node_refs) in present_nodes:
1880
 
                if node_refs != keys[key][1]:
1881
 
                    details = '%s %s %s' % (key, (value, node_refs), keys[key])
 
1886
                # Sometimes these are passed as a list rather than a tuple
 
1887
                node_refs = static_tuple.as_tuples(node_refs)
 
1888
                passed = static_tuple.as_tuples(keys[key])
 
1889
                if node_refs != passed[1]:
 
1890
                    details = '%s %s %s' % (key, (value, node_refs), passed)
1882
1891
                    if self._inconsistency_fatal:
1883
1892
                        raise errors.KnitCorrupt(self, "inconsistent details"
1884
1893
                                                 " in add_records: %s" %