Show More
@@ -15,11 +15,7 b' from i18n import gettext as _' | |||
|
15 | 15 | from demandload import demandload |
|
16 | 16 | demandload(globals(), "util os struct") |
|
17 | 17 | |
|
18 | from changelog import changelog | |
|
19 | from manifest import manifest | |
|
20 | from filelog import filelog | |
|
21 | from localrepo import localrepository | |
|
22 | from revlog import * | |
|
18 | import localrepo, changelog, manifest, filelog, revlog | |
|
23 | 19 | |
|
24 | 20 | def getchunk(source): |
|
25 | 21 | """get a chunk from a group""" |
@@ -36,7 +32,7 b' def getchunk(source):' | |||
|
36 | 32 | % (len(d), l - 4)) |
|
37 | 33 | return d |
|
38 | 34 | |
|
39 | class bundlerevlog(revlog): | |
|
35 | class bundlerevlog(revlog.revlog): | |
|
40 | 36 | def __init__(self, opener, indexfile, datafile, bundlefile, |
|
41 | 37 | linkmapper=None): |
|
42 | 38 | # How it works: |
@@ -48,7 +44,7 b' class bundlerevlog(revlog):' | |||
|
48 | 44 | # len(index[r]). If the tuple is bigger than 7, it is a bundle |
|
49 | 45 | # (it is bigger since we store the node to which the delta is) |
|
50 | 46 | # |
|
51 | revlog.__init__(self, opener, indexfile, datafile) | |
|
47 | revlog.revlog.__init__(self, opener, indexfile, datafile) | |
|
52 | 48 | self.bundlefile = bundlefile |
|
53 | 49 | def genchunk(): |
|
54 | 50 | while 1: |
@@ -80,7 +76,6 b' class bundlerevlog(revlog):' | |||
|
80 | 76 | if not prev: |
|
81 | 77 | prev = p1 |
|
82 | 78 | # start, size, base is not used, link, p1, p2, delta ref |
|
83 | # warning: | |
|
84 | 79 | e = (start, size, None, link, p1, p2, node, prev) |
|
85 | 80 | self.index.append(e) |
|
86 | 81 | self.nodemap[node] = n |
@@ -98,7 +93,7 b' class bundlerevlog(revlog):' | |||
|
98 | 93 | # not against rev - 1 |
|
99 | 94 | # XXX: could use some caching |
|
100 | 95 | if not self.bundle(rev): |
|
101 | return revlog.chunk(self, rev) | |
|
96 | return revlog.revlog.chunk(self, rev) | |
|
102 | 97 | self.bundlefile.seek(self.start(rev)) |
|
103 | 98 | return self.bundlefile.read(self.length(rev)) |
|
104 | 99 | |
@@ -110,7 +105,7 b' class bundlerevlog(revlog):' | |||
|
110 | 105 | if revb == rev1: |
|
111 | 106 | return self.chunk(rev2) |
|
112 | 107 | elif not self.bundle(rev1) and not self.bundle(rev2): |
|
113 | return revlog.chunk(self, rev1, rev2) | |
|
108 | return revlog.revlog.chunk(self, rev1, rev2) | |
|
114 | 109 | |
|
115 | 110 | return self.diff(self.revision(self.node(rev1)), |
|
116 | 111 | self.revision(self.node(rev2))) |
@@ -132,14 +127,14 b' class bundlerevlog(revlog):' | |||
|
132 | 127 | iter_node = self.bundlebase(rev) |
|
133 | 128 | rev = self.rev(iter_node) |
|
134 | 129 | if text is None: |
|
135 | text = revlog.revision(self, iter_node) | |
|
130 | text = revlog.revlog.revision(self, iter_node) | |
|
136 | 131 | |
|
137 | 132 | while chain: |
|
138 | 133 | delta = self.chunk(chain.pop()) |
|
139 | 134 | text = self.patches(text, [delta]) |
|
140 | 135 | |
|
141 | 136 | p1, p2 = self.parents(node) |
|
142 | if node != hash(text, p1, p2): | |
|
137 | if node != revlog.hash(text, p1, p2): | |
|
143 | 138 | raise RevlogError(_("integrity check failed on %s:%d") |
|
144 | 139 | % (self.datafile, self.rev(node))) |
|
145 | 140 | |
@@ -155,27 +150,27 b' class bundlerevlog(revlog):' | |||
|
155 | 150 | def checksize(self): |
|
156 | 151 | raise NotImplementedError |
|
157 | 152 | |
|
158 | class bundlechangelog(bundlerevlog, changelog): | |
|
153 | class bundlechangelog(bundlerevlog, changelog.changelog): | |
|
159 | 154 | def __init__(self, opener, bundlefile): |
|
160 | changelog.__init__(self, opener) | |
|
155 | changelog.changelog.__init__(self, opener) | |
|
161 | 156 | bundlerevlog.__init__(self, opener, "00changelog.i", "00changelog.d", |
|
162 | 157 | bundlefile) |
|
163 | 158 | |
|
164 | class bundlemanifest(bundlerevlog, manifest): | |
|
159 | class bundlemanifest(bundlerevlog, manifest.manifest): | |
|
165 | 160 | def __init__(self, opener, bundlefile, linkmapper): |
|
166 | manifest.__init__(self, opener) | |
|
161 | manifest.manifest.__init__(self, opener) | |
|
167 | 162 | bundlerevlog.__init__(self, opener, self.indexfile, self.datafile, |
|
168 | 163 | bundlefile, linkmapper) |
|
169 | 164 | |
|
170 | class bundlefilelog(bundlerevlog, filelog): | |
|
165 | class bundlefilelog(bundlerevlog, filelog.filelog): | |
|
171 | 166 | def __init__(self, opener, path, bundlefile, linkmapper): |
|
172 | filelog.__init__(self, opener, path) | |
|
167 | filelog.filelog.__init__(self, opener, path) | |
|
173 | 168 | bundlerevlog.__init__(self, opener, self.indexfile, self.datafile, |
|
174 | 169 | bundlefile, linkmapper) |
|
175 | 170 | |
|
176 | class bundlerepository(localrepository): | |
|
171 | class bundlerepository(localrepo.localrepository): | |
|
177 | 172 | def __init__(self, ui, path, bundlename): |
|
178 | localrepository.__init__(self, ui, path) | |
|
173 | localrepo.localrepository.__init__(self, ui, path) | |
|
179 | 174 | f = open(bundlename, "rb") |
|
180 | 175 | s = os.fstat(f.fileno()) |
|
181 | 176 | self.bundlefile = f |
@@ -209,5 +204,5 b' class bundlerepository(localrepository):' | |||
|
209 | 204 | return bundlefilelog(self.opener, f, self.bundlefile, |
|
210 | 205 | self.changelog.rev) |
|
211 | 206 | else: |
|
212 | return filelog(self.opener, f) | |
|
207 | return filelog.filelog(self.opener, f) | |
|
213 | 208 |
General Comments 0
You need to be logged in to leave comments.
Login now