21
21
bt = wt.branch.repository.revision_tree(wt.last_revision())
22
22
file_id = wt.path2id(path)
23
file_weave = bt.get_weave(file_id)
23
file_weave = wt.branch.repository.get_inventory_weave()
24
#file_weave = bt.get_weave(file_id)
24
25
file_weave.enable_cache()
25
vf = MultiVersionedFile()
26
ancestry = set(file_weave.get_ancestry([bt.inventory[file_id].revision]))
28
for version_id in ancestry:
29
lines = [a + ' ' + l for a, l in file_weave.annotate_iter(version_id)]
30
files[version_id] = lines
26
revisions = set(file_weave.versions())
27
ft_set = set(r for r in revisions if file_weave._index.get_method(r)
29
vf = MultiVersionedFile(None)
31
#for version_id in revisions:
32
# lines = [a + ' ' + l for a, l in file_weave.annotate_iter(version_id)]
33
# files[version_id] = lines
31
34
#files = dict(izip(ancestry, file_weave.get_line_list(ancestry)))
32
while len(ancestry) > 0:
35
total = len(revisions)
36
while len(revisions) > 0:
34
for revision in ancestry:
38
for revision in revisions:
35
39
parents = file_weave.get_parents(revision)
36
40
if [p for p in parents if p not in vf._diffs] != []:
38
lines = files[revision]
39
vf.add_version(lines, revision, parents)
42
lines = file_weave.get_lines(revision)
43
vf.add_version(lines, revision, parents,
44
force_snapshot=(revision in ft_set))
40
45
added.add(revision)
41
ancestry = [r for r in ancestry if r not in added]
47
revisions = [r for r in revisions if r not in added]
48
print >> sys.stderr, "%.1f %%" % ((((total - len(revisions)) * 100.0)
50
print >> sys.stderr, file_weave
51
print >> sys.stderr, "%d fulltexts" % len(ft_set)
52
print >> sys.stderr, "%d snapshots" % len(vf._snapshots)
44
55
for revision_id in file_weave.get_ancestry(
49
60
file_weave.get_lines(revision_id))
50
61
open(revision_id + '.new', 'wb').writelines(
51
62
vf.get_line_list(revision_id)[0])
53
64
revisions = file_weave.get_ancestry(
54
65
[bt.inventory[file_id].revision])[-1:]
55
66
from bzrlib.lsprof import profile
65
77
for x in range(1000):
66
78
file_weave.get_line_list(revisions)
67
79
print time.clock() - start
69
revisions = file_weave.get_ancestry(
70
[bt.inventory[file_id].revision])
71
print >> sys.stderr, file_weave
73
ft_count = sum(1 for r in revisions if file_weave._index.get_method(r)
75
print >> sys.stderr, "%d fulltexts" % ft_count
76
s_count = sum(1 for r in revisions if vf._snapshots[r])
77
print >> sys.stderr, "%d snapshots" % s_count
81
revisions = file_weave.versions()
79
83
for revision, diff in vf._diffs.iteritems():