~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: 2010-09-01 06:45:57 UTC
  • mfrom: (5247.2.41 more-ignored-exceptions)
  • Revision ID: pqm@pqm.ubuntu.com-20100901064557-qsxmjmp195ozbluf
(vila) Catch EPIPE when shutting down test servers. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2006-2010 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
68
68
    index as _mod_index,
69
69
    lru_cache,
70
70
    pack,
 
71
    patiencediff,
71
72
    progress,
 
73
    static_tuple,
72
74
    trace,
73
75
    tsort,
74
76
    tuned_gzip,
 
77
    ui,
75
78
    )
76
79
""")
77
80
from bzrlib import (
78
81
    errors,
79
82
    osutils,
80
 
    patiencediff,
81
83
    )
82
84
from bzrlib.errors import (
83
85
    FileExists,
1710
1712
            # There were index entries buffered at the end of the stream,
1711
1713
            # So these need to be added (if the index supports holding such
1712
1714
            # entries for later insertion)
 
1715
            all_entries = []
1713
1716
            for key in buffered_index_entries:
1714
1717
                index_entries = buffered_index_entries[key]
1715
 
                self._index.add_records(index_entries,
1716
 
                    missing_compression_parents=True)
 
1718
                all_entries.extend(index_entries)
 
1719
            self._index.add_records(
 
1720
                all_entries, missing_compression_parents=True)
1717
1721
 
1718
1722
    def get_missing_compression_parent_keys(self):
1719
1723
        """Return an iterable of keys of missing compression parents.
1752
1756
        :return: An iterator over (line, key).
1753
1757
        """
1754
1758
        if pb is None:
1755
 
            pb = progress.DummyProgress()
 
1759
            pb = ui.ui_factory.nested_progress_bar()
1756
1760
        keys = set(keys)
1757
1761
        total = len(keys)
1758
1762
        done = False
2365
2369
    FLAGS is a comma separated list of flags about the record. Values include
2366
2370
        no-eol, line-delta, fulltext.
2367
2371
    BYTE_OFFSET is the ascii representation of the byte offset in the data file
2368
 
        that the the compressed data starts at.
 
2372
        that the compressed data starts at.
2369
2373
    LENGTH is the ascii representation of the length of the data file.
2370
2374
    PARENT_ID a utf-8 revision id prefixed by a '.' that is a parent of
2371
2375
        REVISION_ID.
2942
2946
        if not random_id:
2943
2947
            present_nodes = self._get_entries(keys)
2944
2948
            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]
2945
2953
                if (value[0] != keys[key][0][0] or
2946
 
                    node_refs[:1] != keys[key][1][:1]):
 
2954
                    parents != passed_parents):
 
2955
                    node_refs = static_tuple.as_tuples(node_refs)
2947
2956
                    raise KnitCorrupt(self, "inconsistent details in add_records"
2948
 
                        ": %s %s" % ((value, node_refs), keys[key]))
 
2957
                        ": %s %s" % ((value, node_refs), passed))
2949
2958
                del keys[key]
2950
2959
        result = []
2951
2960
        if self._parents:
3408
3417
            raise exc_class, exc_value, exc_traceback
3409
3418
 
3410
3419
 
3411
 
# Deprecated, use PatienceSequenceMatcher instead
3412
 
KnitSequenceMatcher = patiencediff.PatienceSequenceMatcher
3413
 
 
3414
 
 
3415
3420
def annotate_knit(knit, revision_id):
3416
3421
    """Annotate a knit with no cached annotations.
3417
3422