141 |
141 |
142 def changegroup(self, basenodes, source): |
142 def changegroup(self, basenodes, source): |
143 return self._repo.changegroup(basenodes, source) |
143 return self._repo.changegroup(basenodes, source) |
144 |
144 |
145 def changegroupsubset(self, bases, heads, source): |
145 def changegroupsubset(self, bases, heads, source): |
146 return self._repo.changegroupsubset(bases, heads, source) |
146 return changegroup.changegroupsubset(self._repo, bases, heads, source) |
147 |
147 |
148 class localrepository(object): |
148 class localrepository(object): |
149 |
149 |
150 supportedformats = set(('revlogv1', 'generaldelta')) |
150 supportedformats = set(('revlogv1', 'generaldelta')) |
151 _basesupported = supportedformats | set(('store', 'fncache', 'shared', |
151 _basesupported = supportedformats | set(('store', 'fncache', 'shared', |
1681 pass |
1681 pass |
1682 |
1682 |
1683 def push(self, remote, force=False, revs=None, newbranch=False): |
1683 def push(self, remote, force=False, revs=None, newbranch=False): |
1684 return exchange.push(self, remote, force, revs, newbranch) |
1684 return exchange.push(self, remote, force, revs, newbranch) |
1685 |
1685 |
1686 def changegroupsubset(self, roots, heads, source): |
|
1687 """Compute a changegroup consisting of all the nodes that are |
|
1688 descendants of any of the roots and ancestors of any of the heads. |
|
1689 Return a chunkbuffer object whose read() method will return |
|
1690 successive changegroup chunks. |
|
1691 |
|
1692 It is fairly complex as determining which filenodes and which |
|
1693 manifest nodes need to be included for the changeset to be complete |
|
1694 is non-trivial. |
|
1695 |
|
1696 Another wrinkle is doing the reverse, figuring out which changeset in |
|
1697 the changegroup a particular filenode or manifestnode belongs to. |
|
1698 """ |
|
1699 cl = self.changelog |
|
1700 if not roots: |
|
1701 roots = [nullid] |
|
1702 # TODO: remove call to nodesbetween. |
|
1703 csets, roots, heads = cl.nodesbetween(roots, heads) |
|
1704 discbases = [] |
|
1705 for n in roots: |
|
1706 discbases.extend([p for p in cl.parents(n) if p != nullid]) |
|
1707 outgoing = discovery.outgoing(cl, discbases, heads) |
|
1708 bundler = changegroup.bundle10(self) |
|
1709 return changegroup.getsubset(self, outgoing, bundler, source) |
|
1710 |
|
1711 def getlocalbundle(self, source, outgoing, bundlecaps=None): |
1686 def getlocalbundle(self, source, outgoing, bundlecaps=None): |
1712 """Like getbundle, but taking a discovery.outgoing as an argument. |
1687 """Like getbundle, but taking a discovery.outgoing as an argument. |
1713 |
1688 |
1714 This is only implemented for local repos and reuses potentially |
1689 This is only implemented for local repos and reuses potentially |
1715 precomputed sets in outgoing.""" |
1690 precomputed sets in outgoing.""" |
1739 discovery.outgoing(cl, common, heads), |
1714 discovery.outgoing(cl, common, heads), |
1740 bundlecaps=bundlecaps) |
1715 bundlecaps=bundlecaps) |
1741 |
1716 |
1742 def changegroup(self, basenodes, source): |
1717 def changegroup(self, basenodes, source): |
1743 # to avoid a race we use changegroupsubset() (issue1320) |
1718 # to avoid a race we use changegroupsubset() (issue1320) |
1744 return self.changegroupsubset(basenodes, self.heads(), source) |
1719 return changegroup.changegroupsubset(self, basenodes, self.heads(), |
|
1720 source) |
1745 |
1721 |
1746 @unfilteredmethod |
1722 @unfilteredmethod |
1747 def addchangegroup(self, source, srctype, url, emptyok=False): |
1723 def addchangegroup(self, source, srctype, url, emptyok=False): |
1748 """Add the changegroup returned by source.read() to this repo. |
1724 """Add the changegroup returned by source.read() to this repo. |
1749 srctype is a string like 'push', 'pull', or 'unbundle'. url is |
1725 srctype is a string like 'push', 'pull', or 'unbundle'. url is |