/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: Robert Collins
  • Date: 2006-03-01 02:01:47 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060301020147-62bb5465f75fbf40
Start check tests for knits (pending), and remove dead code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
A knit is a versioned file implementation that supports efficient append only
23
23
updates.
 
24
 
 
25
Knit file layout:
 
26
lifeless: the data file is made up of "delta records".  each delta record has a delta header 
 
27
that contains; (1) a version id, (2) the size of the delta (in lines), and (3)  the digest of 
 
28
the -expanded data- (ie, the delta applied to the parent).  the delta also ends with a 
 
29
end-marker; simply "end VERSION"
 
30
 
 
31
delta can be line or full contents.a
 
32
... the 8's there are the index number of the annotation.
 
33
version robertc@robertcollins.net-20051003014215-ee2990904cc4c7ad 7 c7d23b2a5bd6ca00e8e266cec0ec228158ee9f9e
 
34
59,59,3
 
35
8
 
36
8         if ie.executable:
 
37
8             e.set('executable', 'yes')
 
38
130,130,2
 
39
8         if elt.get('executable') == 'yes':
 
40
8             ie.executable = True
 
41
end robertc@robertcollins.net-20051003014215-ee2990904cc4c7ad 
 
42
 
 
43
 
 
44
whats in an index:
 
45
09:33 < jrydberg> lifeless: each index is made up of a tuple of; version id, options, position, size, parents
 
46
09:33 < jrydberg> lifeless: the parents are currently dictionary compressed
 
47
09:33 < jrydberg> lifeless: (meaning it currently does not support ghosts)
 
48
09:33 < lifeless> right
 
49
09:33 < jrydberg> lifeless: the position and size is the range in the data file
 
50
 
 
51
 
 
52
so the index sequence is the dictionary compressed sequence number used
 
53
in the deltas to provide line annotation
 
54
 
24
55
"""
25
56
 
26
 
import os
 
57
# TODOS:
 
58
# 10:16 < lifeless> make partial index writes safe
 
59
# 10:16 < lifeless> implement 'knit.check()' like weave.check()
 
60
# 10:17 < lifeless> record known ghosts so we can detect when they are filled in rather than the current 'reweave 
 
61
#                    always' approach.
 
62
                  
 
63
 
27
64
import difflib
28
65
from difflib import SequenceMatcher
 
66
from gzip import GzipFile
 
67
import os
 
68
from StringIO import StringIO
29
69
 
30
70
from bzrlib.errors import FileExists, NoSuchFile, KnitError, \
31
71
        InvalidRevisionId, KnitCorrupt, KnitHeaderError, \
36
76
from bzrlib.versionedfile import VersionedFile
37
77
from bzrlib.tsort import topo_sort
38
78
 
39
 
from StringIO import StringIO
40
 
from gzip import GzipFile
41
 
import sha
42
79
 
43
80
# TODO: Split out code specific to this format into an associated object.
44
81
 
520
557
        # We take the short path here, and extract all relevant texts
521
558
        # and put them in a weave and let that do all the work.  Far
522
559
        # from optimal, but is much simpler.
 
560
        # FIXME RB 20060228 this really is inefficient!
523
561
        from bzrlib.weave import Weave
524
562
 
525
563
        w = Weave(self.filename)