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