Show More
@@ -42,7 +42,7 b' from . import (' | |||
|
42 | 42 | ) |
|
43 | 43 | |
|
44 | 44 | class bundlerevlog(revlog.revlog): |
|
45 |
def __init__(self, opener, indexfile, |
|
|
45 | def __init__(self, opener, indexfile, cgunpacker, linkmapper): | |
|
46 | 46 | # How it works: |
|
47 | 47 | # To retrieve a revision, we need to know the offset of the revision in |
|
48 | 48 | # the bundle (an unbundle object). We store this offset in the index |
@@ -52,15 +52,15 b' class bundlerevlog(revlog.revlog):' | |||
|
52 | 52 | # check revision against repotiprev. |
|
53 | 53 | opener = vfsmod.readonlyvfs(opener) |
|
54 | 54 | revlog.revlog.__init__(self, opener, indexfile) |
|
55 |
self.bundle = |
|
|
55 | self.bundle = cgunpacker | |
|
56 | 56 | n = len(self) |
|
57 | 57 | self.repotiprev = n - 1 |
|
58 | 58 | self.bundlerevs = set() # used by 'bundle()' revset expression |
|
59 |
for deltadata in |
|
|
59 | for deltadata in cgunpacker.deltaiter(): | |
|
60 | 60 | node, p1, p2, cs, deltabase, delta, flags = deltadata |
|
61 | 61 | |
|
62 | 62 | size = len(delta) |
|
63 |
start = |
|
|
63 | start = cgunpacker.tell() - size | |
|
64 | 64 | |
|
65 | 65 | link = linkmapper(cs) |
|
66 | 66 | if node in self.nodemap: |
@@ -165,10 +165,10 b' class bundlerevlog(revlog.revlog):' | |||
|
165 | 165 | raise NotImplementedError |
|
166 | 166 | |
|
167 | 167 | class bundlechangelog(bundlerevlog, changelog.changelog): |
|
168 |
def __init__(self, opener, |
|
|
168 | def __init__(self, opener, cgunpacker): | |
|
169 | 169 | changelog.changelog.__init__(self, opener) |
|
170 | 170 | linkmapper = lambda x: x |
|
171 |
bundlerevlog.__init__(self, opener, self.indexfile, |
|
|
171 | bundlerevlog.__init__(self, opener, self.indexfile, cgunpacker, | |
|
172 | 172 | linkmapper) |
|
173 | 173 | |
|
174 | 174 | def baserevision(self, nodeorrev): |
@@ -186,9 +186,10 b' class bundlechangelog(bundlerevlog, chan' | |||
|
186 | 186 | self.filteredrevs = oldfilter |
|
187 | 187 | |
|
188 | 188 | class bundlemanifest(bundlerevlog, manifest.manifestrevlog): |
|
189 |
def __init__(self, opener, |
|
|
189 | def __init__(self, opener, cgunpacker, linkmapper, dirlogstarts=None, | |
|
190 | dir=''): | |
|
190 | 191 | manifest.manifestrevlog.__init__(self, opener, dir=dir) |
|
191 |
bundlerevlog.__init__(self, opener, self.indexfile, |
|
|
192 | bundlerevlog.__init__(self, opener, self.indexfile, cgunpacker, | |
|
192 | 193 | linkmapper) |
|
193 | 194 | if dirlogstarts is None: |
|
194 | 195 | dirlogstarts = {} |
@@ -217,9 +218,9 b' class bundlemanifest(bundlerevlog, manif' | |||
|
217 | 218 | return super(bundlemanifest, self).dirlog(d) |
|
218 | 219 | |
|
219 | 220 | class bundlefilelog(bundlerevlog, filelog.filelog): |
|
220 |
def __init__(self, opener, path, |
|
|
221 | def __init__(self, opener, path, cgunpacker, linkmapper): | |
|
221 | 222 | filelog.filelog.__init__(self, opener, path) |
|
222 |
bundlerevlog.__init__(self, opener, self.indexfile, |
|
|
223 | bundlerevlog.__init__(self, opener, self.indexfile, cgunpacker, | |
|
223 | 224 | linkmapper) |
|
224 | 225 | |
|
225 | 226 | def baserevision(self, nodeorrev): |
@@ -246,12 +247,12 b' class bundlephasecache(phases.phasecache' | |||
|
246 | 247 | self.invalidate() |
|
247 | 248 | self.dirty = True |
|
248 | 249 | |
|
249 | def _getfilestarts(bundle): | |
|
250 | 250 | bundlefilespos = {} |
|
251 | for chunkdata in iter(bundle.filelogheader, {}): | |
|
251 | def _getfilestarts(cgunpacker): | |
|
252 | for chunkdata in iter(cgunpacker.filelogheader, {}): | |
|
252 | 253 | fname = chunkdata['filename'] |
|
253 | 254 | bundlefilespos[fname] = bundle.tell() |
|
254 |
for chunk in iter(lambda: |
|
|
255 | for chunk in iter(lambda: cgunpacker.deltachunk(None), {}): | |
|
255 | 256 | pass |
|
256 | 257 | return bundlefilespos |
|
257 | 258 |
General Comments 0
You need to be logged in to leave comments.
Login now