/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

  • Committer: Andrew Bennetts
  • Date: 2007-08-30 08:11:54 UTC
  • mfrom: (2766 +trunk)
  • mto: (2535.3.55 repo-refactor)
  • mto: This revision was merged to the branch mainline in revision 2772.
  • Revision ID: andrew.bennetts@canonical.com-20070830081154-16hebp2xwr15x2hc
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
lazy_import(globals(), """
75
75
from bzrlib import (
76
76
    pack,
 
77
    trace,
77
78
    )
78
79
""")
79
80
from bzrlib import (
80
81
    cache_utf8,
 
82
    debug,
81
83
    diff,
82
84
    errors,
83
85
    osutils,
98
100
    RevisionAlreadyPresent,
99
101
    )
100
102
from bzrlib.tuned_gzip import GzipFile
101
 
from bzrlib.trace import mutter
102
103
from bzrlib.osutils import (
103
104
    contains_whitespace,
104
105
    contains_linebreaks,
767
768
 
768
769
    def versions(self):
769
770
        """See VersionedFile.versions."""
 
771
        if 'evil' in debug.debug_flags:
 
772
            trace.mutter_callsite(2, "versions scales with size of history")
770
773
        return self._index.get_versions()
771
774
 
772
775
    def has_version(self, version_id):
773
776
        """See VersionedFile.has_version."""
 
777
        if 'evil' in debug.debug_flags:
 
778
            trace.mutter_callsite(2, "has_version is a LBYL scenario")
774
779
        version_id = osutils.safe_revision_id(version_id)
775
780
        return self._index.has_version(version_id)
776
781
 
1164
1169
        versions = [osutils.safe_revision_id(v) for v in versions]
1165
1170
        return self._index.get_ancestry_with_ghosts(versions)
1166
1171
 
1167
 
    #@deprecated_method(zero_eight)
1168
 
    def walk(self, version_ids):
1169
 
        """See VersionedFile.walk."""
1170
 
        # We take the short path here, and extract all relevant texts
1171
 
        # and put them in a weave and let that do all the work.  Far
1172
 
        # from optimal, but is much simpler.
1173
 
        # FIXME RB 20060228 this really is inefficient!
1174
 
        from bzrlib.weave import Weave
1175
 
 
1176
 
        w = Weave(self.filename)
1177
 
        ancestry = set(self.get_ancestry(version_ids, topo_sorted=False))
1178
 
        sorted_graph = topo_sort(self._index.get_graph())
1179
 
        version_list = [vid for vid in sorted_graph if vid in ancestry]
1180
 
        
1181
 
        for version_id in version_list:
1182
 
            lines = self.get_lines(version_id)
1183
 
            w.add_lines(version_id, self.get_parents(version_id), lines)
1184
 
 
1185
 
        for lineno, insert_id, dset, line in w.walk(version_ids):
1186
 
            yield lineno, insert_id, dset, line
1187
 
 
1188
1172
    def plan_merge(self, ver_a, ver_b):
1189
1173
        """See VersionedFile.plan_merge."""
1190
1174
        ver_a = osutils.safe_revision_id(ver_a)