##// END OF EJS Templates
bundle-ng: move bundler creation up in the stack...
Benoit Boissinot -
r19199:d6d0f1ed default
parent child Browse files
Show More
@@ -117,7 +117,8 b' def writerevs(ui, r1, r2, order, tr):'
117 unlookup = lambda x: int(x, 10)
117 unlookup = lambda x: int(x, 10)
118
118
119 try:
119 try:
120 bundler = changegroup.bundle10(lookup)
120 bundler = changegroup.bundle10()
121 bundler.start(lookup)
121 group = util.chunkbuffer(r1.group(order, bundler))
122 group = util.chunkbuffer(r1.group(order, bundler))
122 group = changegroup.unbundle10(group, "UN")
123 group = changegroup.unbundle10(group, "UN")
123 r2.addgroup(group, unlookup, tr)
124 r2.addgroup(group, unlookup, tr)
@@ -225,7 +225,9 b' def readbundle(fh, fname):'
225
225
226 class bundle10(object):
226 class bundle10(object):
227 deltaheader = _BUNDLE10_DELTA_HEADER
227 deltaheader = _BUNDLE10_DELTA_HEADER
228 def __init__(self, lookup):
228 def __init__(self):
229 pass
230 def start(self, lookup):
229 self._lookup = lookup
231 self._lookup = lookup
230 def close(self):
232 def close(self):
231 return closechunk()
233 return closechunk()
@@ -1840,7 +1840,9 b' class localrepository(object):'
1840 if revs is None and not outgoing.excluded:
1840 if revs is None and not outgoing.excluded:
1841 # push everything,
1841 # push everything,
1842 # use the fast path, no race possible on push
1842 # use the fast path, no race possible on push
1843 cg = self._changegroup(outgoing.missing, 'push')
1843 bundler = changegroup.bundle10()
1844 cg = self._changegroup(outgoing.missing, bundler,
1845 'push')
1844 else:
1846 else:
1845 cg = self.getlocalbundle('push', outgoing)
1847 cg = self.getlocalbundle('push', outgoing)
1846
1848
@@ -1986,7 +1988,8 b' class localrepository(object):'
1986 csets, bases, heads = cl.nodesbetween(bases, heads)
1988 csets, bases, heads = cl.nodesbetween(bases, heads)
1987 # We assume that all ancestors of bases are known
1989 # We assume that all ancestors of bases are known
1988 common = cl.ancestors([cl.rev(n) for n in bases])
1990 common = cl.ancestors([cl.rev(n) for n in bases])
1989 return self._changegroupsubset(common, csets, heads, source)
1991 bundler = changegroup.bundle10()
1992 return self._changegroupsubset(common, csets, heads, bundler, source)
1990
1993
1991 def getlocalbundle(self, source, outgoing):
1994 def getlocalbundle(self, source, outgoing):
1992 """Like getbundle, but taking a discovery.outgoing as an argument.
1995 """Like getbundle, but taking a discovery.outgoing as an argument.
@@ -1995,9 +1998,11 b' class localrepository(object):'
1995 precomputed sets in outgoing."""
1998 precomputed sets in outgoing."""
1996 if not outgoing.missing:
1999 if not outgoing.missing:
1997 return None
2000 return None
2001 bundler = changegroup.bundle10()
1998 return self._changegroupsubset(outgoing.common,
2002 return self._changegroupsubset(outgoing.common,
1999 outgoing.missing,
2003 outgoing.missing,
2000 outgoing.missingheads,
2004 outgoing.missingheads,
2005 bundler,
2001 source)
2006 source)
2002
2007
2003 def getbundle(self, source, heads=None, common=None):
2008 def getbundle(self, source, heads=None, common=None):
@@ -2021,7 +2026,7 b' class localrepository(object):'
2021 discovery.outgoing(cl, common, heads))
2026 discovery.outgoing(cl, common, heads))
2022
2027
2023 @unfilteredmethod
2028 @unfilteredmethod
2024 def _changegroupsubset(self, commonrevs, csets, heads, source):
2029 def _changegroupsubset(self, commonrevs, csets, heads, bundler, source):
2025
2030
2026 cl = self.changelog
2031 cl = self.changelog
2027 mf = self.manifest
2032 mf = self.manifest
@@ -2034,7 +2039,7 b' class localrepository(object):'
2034 # can we go through the fast path ?
2039 # can we go through the fast path ?
2035 heads.sort()
2040 heads.sort()
2036 if heads == sorted(self.heads()):
2041 if heads == sorted(self.heads()):
2037 return self._changegroup(csets, source)
2042 return self._changegroup(csets, bundler, source)
2038
2043
2039 # slow path
2044 # slow path
2040 self.hook('preoutgoing', throw=True, source=source)
2045 self.hook('preoutgoing', throw=True, source=source)
@@ -2076,7 +2081,7 b' class localrepository(object):'
2076 unit=_files, total=count[1])
2081 unit=_files, total=count[1])
2077 return fstate[1][x]
2082 return fstate[1][x]
2078
2083
2079 bundler = changegroup.bundle10(lookup)
2084 bundler.start(lookup)
2080 reorder = self.ui.config('bundle', 'reorder', 'auto')
2085 reorder = self.ui.config('bundle', 'reorder', 'auto')
2081 if reorder == 'auto':
2086 if reorder == 'auto':
2082 reorder = None
2087 reorder = None
@@ -2133,7 +2138,7 b' class localrepository(object):'
2133 return self.changegroupsubset(basenodes, self.heads(), source)
2138 return self.changegroupsubset(basenodes, self.heads(), source)
2134
2139
2135 @unfilteredmethod
2140 @unfilteredmethod
2136 def _changegroup(self, nodes, source):
2141 def _changegroup(self, nodes, bundler, source):
2137 """Compute the changegroup of all nodes that we have that a recipient
2142 """Compute the changegroup of all nodes that we have that a recipient
2138 doesn't. Return a chunkbuffer object whose read() method will return
2143 doesn't. Return a chunkbuffer object whose read() method will return
2139 successive changegroup chunks.
2144 successive changegroup chunks.
@@ -2184,7 +2189,7 b' class localrepository(object):'
2184 total=count[1], unit=_files)
2189 total=count[1], unit=_files)
2185 return cl.node(revlog.linkrev(revlog.rev(x)))
2190 return cl.node(revlog.linkrev(revlog.rev(x)))
2186
2191
2187 bundler = changegroup.bundle10(lookup)
2192 bundler.start(lookup)
2188 reorder = self.ui.config('bundle', 'reorder', 'auto')
2193 reorder = self.ui.config('bundle', 'reorder', 'auto')
2189 if reorder == 'auto':
2194 if reorder == 'auto':
2190 reorder = None
2195 reorder = None
General Comments 0
You need to be logged in to leave comments. Login now