Mercurial > public > mercurial-scm > hg
comparison mercurial/bundlerepo.py @ 4979:06abdaf78788
revlog: add a magic null revision to our index
We expand our index by one entry so that index[nullrev] points to a
unique entry, the null revision. This naturally eliminates numerous
extra tests in the performance-sensitive index access functions, most
of which are now trivial again.
Adding new entries is now done with insert(-1, e) rather than
append(e).
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 23 Jul 2007 20:44:08 -0500 |
parents | e017d3a82e1d |
children | b4066fcbd6ba |
comparison
equal
deleted
inserted
replaced
4978:93d48a8fa496 | 4979:06abdaf78788 |
---|---|
56 link = linkmapper(cs) | 56 link = linkmapper(cs) |
57 | 57 |
58 if not prev: | 58 if not prev: |
59 prev = p1 | 59 prev = p1 |
60 # start, size, base is not used, link, p1, p2, delta ref | 60 # start, size, base is not used, link, p1, p2, delta ref |
61 if self.version == revlog.REVLOGV0: | 61 e = (revlog.offset_type(start, 0), size, -1, None, link, |
62 e = (start, size, None, link, p1, p2, node) | 62 self.rev(p1), self.rev(p2), node) |
63 else: | |
64 e = (revlog.offset_type(start, 0), size, -1, None, link, | |
65 self.rev(p1), self.rev(p2), node) | |
66 self.basemap[n] = prev | 63 self.basemap[n] = prev |
67 self.index.append(e) | 64 self.index.insert(-1, e) |
68 self.nodemap[node] = n | 65 self.nodemap[node] = n |
69 prev = node | 66 prev = node |
70 n += 1 | 67 n += 1 |
71 | 68 |
72 def bundle(self, rev): | 69 def bundle(self, rev): |