Show More
@@ -25,14 +25,14 b' class bundlerevlog(revlog.revlog):' | |||||
25 | # (start). |
|
25 | # (start). | |
26 | # |
|
26 | # | |
27 | # basemap is indexed with revisions coming from the bundle, and it |
|
27 | # basemap is indexed with revisions coming from the bundle, and it | |
28 |
# maps to the |
|
28 | # maps to the revision that is the base of the corresponding delta. | |
29 | # |
|
29 | # | |
30 | # To differentiate a rev in the bundle from a rev in the revlog, we |
|
30 | # To differentiate a rev in the bundle from a rev in the revlog, we | |
31 | # check revision against basemap. |
|
31 | # check revision against basemap. | |
32 | opener = scmutil.readonlyvfs(opener) |
|
32 | opener = scmutil.readonlyvfs(opener) | |
33 | revlog.revlog.__init__(self, opener, indexfile) |
|
33 | revlog.revlog.__init__(self, opener, indexfile) | |
34 | self.bundle = bundle |
|
34 | self.bundle = bundle | |
35 | self.basemap = {} |
|
35 | self.basemap = {} # mapping rev to delta base rev | |
36 | n = len(self) |
|
36 | n = len(self) | |
37 | chain = None |
|
37 | chain = None | |
38 | self.bundlerevs = set() # used by 'bundle()' revset expression |
|
38 | self.bundlerevs = set() # used by 'bundle()' revset expression | |
@@ -61,10 +61,16 b' class bundlerevlog(revlog.revlog):' | |||||
61 | if p not in self.nodemap: |
|
61 | if p not in self.nodemap: | |
62 | raise error.LookupError(p, self.indexfile, |
|
62 | raise error.LookupError(p, self.indexfile, | |
63 | _("unknown parent")) |
|
63 | _("unknown parent")) | |
|
64 | ||||
|
65 | if deltabase not in self.nodemap: | |||
|
66 | raise LookupError(deltabase, self.indexfile, | |||
|
67 | _('unknown delta base')) | |||
|
68 | ||||
|
69 | baserev = self.rev(deltabase) | |||
64 | # start, size, full unc. size, base (unused), link, p1, p2, node |
|
70 | # start, size, full unc. size, base (unused), link, p1, p2, node | |
65 | e = (revlog.offset_type(start, 0), size, -1, -1, link, |
|
71 | e = (revlog.offset_type(start, 0), size, -1, -1, link, | |
66 | self.rev(p1), self.rev(p2), node) |
|
72 | self.rev(p1), self.rev(p2), node) | |
67 |
self.basemap[n] = |
|
73 | self.basemap[n] = baserev | |
68 | self.index.insert(-1, e) |
|
74 | self.index.insert(-1, e) | |
69 | self.nodemap[node] = n |
|
75 | self.nodemap[node] = n | |
70 | self.bundlerevs.add(n) |
|
76 | self.bundlerevs.add(n) | |
@@ -84,7 +90,7 b' class bundlerevlog(revlog.revlog):' | |||||
84 | """return or calculate a delta between two revisions""" |
|
90 | """return or calculate a delta between two revisions""" | |
85 | if rev1 in self.basemap and rev2 in self.basemap: |
|
91 | if rev1 in self.basemap and rev2 in self.basemap: | |
86 | # hot path for bundle |
|
92 | # hot path for bundle | |
87 |
revb = self. |
|
93 | revb = self.basemap[rev2] | |
88 | if revb == rev1: |
|
94 | if revb == rev1: | |
89 | return self._chunk(rev2) |
|
95 | return self._chunk(rev2) | |
90 | elif rev1 not in self.basemap and rev2 not in self.basemap: |
|
96 | elif rev1 not in self.basemap and rev2 not in self.basemap: | |
@@ -116,7 +122,7 b' class bundlerevlog(revlog.revlog):' | |||||
116 | text = self._cache[2] |
|
122 | text = self._cache[2] | |
117 | break |
|
123 | break | |
118 | chain.append(iterrev) |
|
124 | chain.append(iterrev) | |
119 |
iterrev = self. |
|
125 | iterrev = self.basemap[iterrev] | |
120 | if text is None: |
|
126 | if text is None: | |
121 | text = revlog.revlog.revision(self, iterrev) |
|
127 | text = revlog.revlog.revision(self, iterrev) | |
122 |
|
128 |
General Comments 0
You need to be logged in to leave comments.
Login now