comparison mercurial/bundlerepo.py @ 2074:01ee43dda681

Fix bundle repos to use an index tuple consistent with revlogng The bundle repo code was adding a field to the index tuple, which confused the revlogng changes. This creates a new dict instead to maintain the extra bundle info.
author mason@suse.com
date Tue, 04 Apr 2006 16:38:43 -0400
parents 736b6c96bbbc
children c6c019fd5db1
comparison
equal deleted inserted replaced
2073:1e6745f78989 2074:01ee43dda681
29 # len(index[r]). If the tuple is bigger than 7, it is a bundle 29 # len(index[r]). If the tuple is bigger than 7, it is a bundle
30 # (it is bigger since we store the node to which the delta is) 30 # (it is bigger since we store the node to which the delta is)
31 # 31 #
32 revlog.revlog.__init__(self, opener, indexfile, datafile) 32 revlog.revlog.__init__(self, opener, indexfile, datafile)
33 self.bundlefile = bundlefile 33 self.bundlefile = bundlefile
34 self.basemap = {}
34 def chunkpositer(): 35 def chunkpositer():
35 for chunk in changegroup.chunkiter(bundlefile): 36 for chunk in changegroup.chunkiter(bundlefile):
36 pos = bundlefile.tell() 37 pos = bundlefile.tell()
37 yield chunk, pos - len(chunk) 38 yield chunk, pos - len(chunk)
38 n = self.count() 39 n = self.count()
56 link = linkmapper(cs) 57 link = linkmapper(cs)
57 58
58 if not prev: 59 if not prev:
59 prev = p1 60 prev = p1
60 # start, size, base is not used, link, p1, p2, delta ref 61 # start, size, base is not used, link, p1, p2, delta ref
61 e = (start, size, None, link, p1, p2, node, prev) 62 e = (start, size, None, link, p1, p2, node)
63 self.basemap[n] = prev
62 self.index.append(e) 64 self.index.append(e)
63 self.nodemap[node] = n 65 self.nodemap[node] = n
64 prev = node 66 prev = node
65 n += 1 67 n += 1
66 68
67 def bundle(self, rev): 69 def bundle(self, rev):
68 """is rev from the bundle""" 70 """is rev from the bundle"""
69 if rev < 0: 71 if rev < 0:
70 return False 72 return False
71 return len(self.index[rev]) > 7 73 return rev in self.basemap
72 def bundlebase(self, rev): return self.index[rev][7] 74 def bundlebase(self, rev): return self.basemap[rev]
73 def chunk(self, rev): 75 def chunk(self, rev, df=None):
74 # Warning: in case of bundle, the diff is against bundlebase, 76 # Warning: in case of bundle, the diff is against bundlebase,
75 # not against rev - 1 77 # not against rev - 1
76 # XXX: could use some caching 78 # XXX: could use some caching
77 if not self.bundle(rev): 79 if not self.bundle(rev):
78 return revlog.revlog.chunk(self, rev) 80 return revlog.revlog.chunk(self, rev)