~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: Danny van Heumen
  • Date: 2010-03-09 21:42:11 UTC
  • mto: (4634.139.5 2.0)
  • mto: This revision was merged to the branch mainline in revision 5160.
  • Revision ID: danny@dannyvanheumen.nl-20100309214211-iqh42x6qcikgd9p3
Reverted now-useless TODO list.

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
68
68
    index as _mod_index,
69
69
    lru_cache,
70
70
    pack,
71
 
    patiencediff,
72
71
    progress,
73
 
    static_tuple,
74
72
    trace,
75
73
    tsort,
76
74
    tuned_gzip,
77
 
    ui,
78
75
    )
79
76
""")
80
77
from bzrlib import (
81
78
    errors,
82
79
    osutils,
 
80
    patiencediff,
83
81
    )
84
82
from bzrlib.errors import (
85
83
    FileExists,
1756
1754
        :return: An iterator over (line, key).
1757
1755
        """
1758
1756
        if pb is None:
1759
 
            pb = ui.ui_factory.nested_progress_bar()
 
1757
            pb = progress.DummyProgress()
1760
1758
        keys = set(keys)
1761
1759
        total = len(keys)
1762
1760
        done = False
2369
2367
    FLAGS is a comma separated list of flags about the record. Values include
2370
2368
        no-eol, line-delta, fulltext.
2371
2369
    BYTE_OFFSET is the ascii representation of the byte offset in the data file
2372
 
        that the compressed data starts at.
 
2370
        that the the compressed data starts at.
2373
2371
    LENGTH is the ascii representation of the length of the data file.
2374
2372
    PARENT_ID a utf-8 revision id prefixed by a '.' that is a parent of
2375
2373
        REVISION_ID.
2946
2944
        if not random_id:
2947
2945
            present_nodes = self._get_entries(keys)
2948
2946
            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
2947
                if (value[0] != keys[key][0][0] or
2954
 
                    parents != passed_parents):
2955
 
                    node_refs = static_tuple.as_tuples(node_refs)
 
2948
                    node_refs[:1] != keys[key][1][:1]):
2956
2949
                    raise KnitCorrupt(self, "inconsistent details in add_records"
2957
 
                        ": %s %s" % ((value, node_refs), passed))
 
2950
                        ": %s %s" % ((value, node_refs), keys[key]))
2958
2951
                del keys[key]
2959
2952
        result = []
2960
2953
        if self._parents:
3417
3410
            raise exc_class, exc_value, exc_traceback
3418
3411
 
3419
3412
 
 
3413
# Deprecated, use PatienceSequenceMatcher instead
 
3414
KnitSequenceMatcher = patiencediff.PatienceSequenceMatcher
 
3415
 
 
3416
 
3420
3417
def annotate_knit(knit, revision_id):
3421
3418
    """Annotate a knit with no cached annotations.
3422
3419
 
3705
3702
 
3706
3703
try:
3707
3704
    from bzrlib._knit_load_data_pyx import _load_data_c as _load_data
3708
 
except ImportError, e:
3709
 
    osutils.failed_to_load_extension(e)
 
3705
except ImportError:
3710
3706
    from bzrlib._knit_load_data_py import _load_data_py as _load_data