18 import localrepo, changelog, manifest, filelog, revlog, error |
18 import localrepo, changelog, manifest, filelog, revlog, error |
19 |
19 |
20 class bundlerevlog(revlog.revlog): |
20 class bundlerevlog(revlog.revlog): |
21 def __init__(self, opener, indexfile, bundle, linkmapper): |
21 def __init__(self, opener, indexfile, bundle, linkmapper): |
22 # How it works: |
22 # How it works: |
23 # to retrieve a revision, we need to know the offset of |
23 # To retrieve a revision, we need to know the offset of the revision in |
24 # the revision in the bundle (an unbundle object). |
24 # the bundle (an unbundle object). We store this offset in the index |
|
25 # (start). |
25 # |
26 # |
26 # We store this offset in the index (start), to differentiate a |
27 # basemap is indexed with revisions coming from the bundle, and it |
27 # rev in the bundle and from a rev in the revlog, we check |
28 # maps to the corresponding node that is the base of the corresponding |
28 # len(index[r]). If the tuple is bigger than 7, it is a bundle |
29 # delta. |
29 # (it is bigger since we store the node to which the delta is) |
|
30 # |
30 # |
|
31 # To differentiate a rev in the bundle from a rev in the revlog, we |
|
32 # check revision against basemap. |
31 opener = scmutil.readonlyvfs(opener) |
33 opener = scmutil.readonlyvfs(opener) |
32 revlog.revlog.__init__(self, opener, indexfile) |
34 revlog.revlog.__init__(self, opener, indexfile) |
33 self.bundle = bundle |
35 self.bundle = bundle |
34 self.basemap = {} |
36 self.basemap = {} |
35 n = len(self) |
37 n = len(self) |