##// END OF EJS Templates
localrepo: move the _changegroupsubset method in changegroup module...
Pierre-Yves David -
r20925:5174c48e default
parent child Browse files
Show More
@@ -428,3 +428,20 b' class bundle10(object):'
428 def builddeltaheader(self, node, p1n, p2n, basenode, linknode):
428 def builddeltaheader(self, node, p1n, p2n, basenode, linknode):
429 # do nothing with basenode, it is implicitly the previous one in HG10
429 # do nothing with basenode, it is implicitly the previous one in HG10
430 return struct.pack(self.deltaheader, node, p1n, p2n, linknode)
430 return struct.pack(self.deltaheader, node, p1n, p2n, linknode)
431
432 def getsubset(repo, outgoing, bundler, source, fastpath=False):
433 repo = repo.unfiltered()
434 commonrevs = outgoing.common
435 csets = outgoing.missing
436 heads = outgoing.missingheads
437 # We go through the fast path if we get told to, or if all (unfiltered
438 # heads have been requested (since we then know there all linkrevs will
439 # be pulled by the client).
440 heads.sort()
441 fastpathlinkrev = fastpath or (
442 repo.filtername is None and heads == sorted(repo.heads()))
443
444 repo.hook('preoutgoing', throw=True, source=source)
445 repo.changegroupinfo(csets, source)
446 gengroup = bundler.generate(commonrevs, csets, fastpathlinkrev, source)
447 return unbundle10(util.chunkbuffer(gengroup), 'UN')
@@ -181,7 +181,8 b' def _pushchangeset(pushop):'
181 # push everything,
181 # push everything,
182 # use the fast path, no race possible on push
182 # use the fast path, no race possible on push
183 bundler = changegroup.bundle10(pushop.repo, bundlecaps)
183 bundler = changegroup.bundle10(pushop.repo, bundlecaps)
184 cg = pushop.repo._changegroupsubset(outgoing,
184 cg = changegroup.getsubset(pushop.repo,
185 outgoing,
185 bundler,
186 bundler,
186 'push',
187 'push',
187 fastpath=True)
188 fastpath=True)
@@ -1714,7 +1714,7 b' class localrepository(object):'
1714 discbases.extend([p for p in cl.parents(n) if p != nullid])
1714 discbases.extend([p for p in cl.parents(n) if p != nullid])
1715 outgoing = discovery.outgoing(cl, discbases, heads)
1715 outgoing = discovery.outgoing(cl, discbases, heads)
1716 bundler = changegroup.bundle10(self)
1716 bundler = changegroup.bundle10(self)
1717 return self._changegroupsubset(outgoing, bundler, source)
1717 return changegroup.getsubset(self, outgoing, bundler, source)
1718
1718
1719 def getlocalbundle(self, source, outgoing, bundlecaps=None):
1719 def getlocalbundle(self, source, outgoing, bundlecaps=None):
1720 """Like getbundle, but taking a discovery.outgoing as an argument.
1720 """Like getbundle, but taking a discovery.outgoing as an argument.
@@ -1724,7 +1724,7 b' class localrepository(object):'
1724 if not outgoing.missing:
1724 if not outgoing.missing:
1725 return None
1725 return None
1726 bundler = changegroup.bundle10(self, bundlecaps)
1726 bundler = changegroup.bundle10(self, bundlecaps)
1727 return self._changegroupsubset(outgoing, bundler, source)
1727 return changegroup.getsubset(self, outgoing, bundler, source)
1728
1728
1729 def getbundle(self, source, heads=None, common=None, bundlecaps=None):
1729 def getbundle(self, source, heads=None, common=None, bundlecaps=None):
1730 """Like changegroupsubset, but returns the set difference between the
1730 """Like changegroupsubset, but returns the set difference between the
@@ -1747,24 +1747,6 b' class localrepository(object):'
1747 discovery.outgoing(cl, common, heads),
1747 discovery.outgoing(cl, common, heads),
1748 bundlecaps=bundlecaps)
1748 bundlecaps=bundlecaps)
1749
1749
1750 @unfilteredmethod
1751 def _changegroupsubset(self, outgoing, bundler, source,
1752 fastpath=False):
1753 commonrevs = outgoing.common
1754 csets = outgoing.missing
1755 heads = outgoing.missingheads
1756 # We go through the fast path if we get told to, or if all (unfiltered
1757 # heads have been requested (since we then know there all linkrevs will
1758 # be pulled by the client).
1759 heads.sort()
1760 fastpathlinkrev = fastpath or (
1761 self.filtername is None and heads == sorted(self.heads()))
1762
1763 self.hook('preoutgoing', throw=True, source=source)
1764 self.changegroupinfo(csets, source)
1765 gengroup = bundler.generate(commonrevs, csets, fastpathlinkrev, source)
1766 return changegroup.unbundle10(util.chunkbuffer(gengroup), 'UN')
1767
1768 def changegroup(self, basenodes, source):
1750 def changegroup(self, basenodes, source):
1769 # to avoid a race we use changegroupsubset() (issue1320)
1751 # to avoid a race we use changegroupsubset() (issue1320)
1770 return self.changegroupsubset(basenodes, self.heads(), source)
1752 return self.changegroupsubset(basenodes, self.heads(), source)
General Comments 0
You need to be logged in to leave comments. Login now