Show More
@@ -490,3 +490,23 b' def getlocalbundle(repo, source, outgoin' | |||||
490 | bundler = bundle10(repo, bundlecaps) |
|
490 | bundler = bundle10(repo, bundlecaps) | |
491 | return getsubset(repo, outgoing, bundler, source) |
|
491 | return getsubset(repo, outgoing, bundler, source) | |
492 |
|
492 | |||
|
493 | def getbundle(repo, source, heads=None, common=None, bundlecaps=None): | |||
|
494 | """Like changegroupsubset, but returns the set difference between the | |||
|
495 | ancestors of heads and the ancestors common. | |||
|
496 | ||||
|
497 | If heads is None, use the local heads. If common is None, use [nullid]. | |||
|
498 | ||||
|
499 | The nodes in common might not all be known locally due to the way the | |||
|
500 | current discovery protocol works. | |||
|
501 | """ | |||
|
502 | cl = repo.changelog | |||
|
503 | if common: | |||
|
504 | hasnode = cl.hasnode | |||
|
505 | common = [n for n in common if hasnode(n)] | |||
|
506 | else: | |||
|
507 | common = [nullid] | |||
|
508 | if not heads: | |||
|
509 | heads = cl.heads() | |||
|
510 | outgoing = discovery.outgoing(cl, common, heads) | |||
|
511 | return getlocalbundle(repo, source, outgoing, bundlecaps=bundlecaps) | |||
|
512 |
@@ -1129,8 +1129,8 b' def bundle(ui, repo, fname, dest=None, *' | |||||
1129 | "a destination")) |
|
1129 | "a destination")) | |
1130 | common = [repo.lookup(rev) for rev in base] |
|
1130 | common = [repo.lookup(rev) for rev in base] | |
1131 | heads = revs and map(repo.lookup, revs) or revs |
|
1131 | heads = revs and map(repo.lookup, revs) or revs | |
1132 |
cg = |
|
1132 | cg = changegroup.getbundle(repo, 'bundle', heads=heads, common=common, | |
1133 | bundlecaps=bundlecaps) |
|
1133 | bundlecaps=bundlecaps) | |
1134 | outgoing = None |
|
1134 | outgoing = None | |
1135 | else: |
|
1135 | else: | |
1136 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
1136 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
@@ -6,7 +6,7 b'' | |||||
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 | from node import hex, nullid, short |
|
7 | from node import hex, nullid, short | |
8 | from i18n import _ |
|
8 | from i18n import _ | |
9 |
import peer, changegroup, subrepo, |
|
9 | import peer, changegroup, subrepo, pushkey, obsolete, repoview | |
10 | import changelog, dirstate, filelog, manifest, context, bookmarks, phases |
|
10 | import changelog, dirstate, filelog, manifest, context, bookmarks, phases | |
11 | import lock as lockmod |
|
11 | import lock as lockmod | |
12 | import transaction, store, encoding, exchange |
|
12 | import transaction, store, encoding, exchange | |
@@ -104,8 +104,8 b' class localpeer(peer.peerrepository):' | |||||
104 | return self._repo.known(nodes) |
|
104 | return self._repo.known(nodes) | |
105 |
|
105 | |||
106 | def getbundle(self, source, heads=None, common=None, bundlecaps=None): |
|
106 | def getbundle(self, source, heads=None, common=None, bundlecaps=None): | |
107 |
return self._repo |
|
107 | return changegroup.getbundle(self._repo, source, heads=heads, | |
108 | bundlecaps=None) |
|
108 | common=common, bundlecaps=None) | |
109 |
|
109 | |||
110 | # TODO We might want to move the next two calls into legacypeer and add |
|
110 | # TODO We might want to move the next two calls into legacypeer and add | |
111 | # unbundle instead. |
|
111 | # unbundle instead. | |
@@ -1683,27 +1683,6 b' class localrepository(object):' | |||||
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 getbundle(self, source, heads=None, common=None, bundlecaps=None): |
|
|||
1687 | """Like changegroupsubset, but returns the set difference between the |
|
|||
1688 | ancestors of heads and the ancestors common. |
|
|||
1689 |
|
||||
1690 | If heads is None, use the local heads. If common is None, use [nullid]. |
|
|||
1691 |
|
||||
1692 | The nodes in common might not all be known locally due to the way the |
|
|||
1693 | current discovery protocol works. |
|
|||
1694 | """ |
|
|||
1695 | cl = self.changelog |
|
|||
1696 | if common: |
|
|||
1697 | hasnode = cl.hasnode |
|
|||
1698 | common = [n for n in common if hasnode(n)] |
|
|||
1699 | else: |
|
|||
1700 | common = [nullid] |
|
|||
1701 | if not heads: |
|
|||
1702 | heads = cl.heads() |
|
|||
1703 | outgoing = discovery.outgoing(cl, common, heads) |
|
|||
1704 | return changegroup.getlocalbundle(self, source, outgoing, |
|
|||
1705 | bundlecaps=bundlecaps) |
|
|||
1706 |
|
||||
1707 | def changegroup(self, basenodes, source): |
|
1686 | def changegroup(self, basenodes, source): | |
1708 | # to avoid a race we use changegroupsubset() (issue1320) |
|
1687 | # to avoid a race we use changegroupsubset() (issue1320) | |
1709 | return changegroup.changegroupsubset(self, basenodes, self.heads(), |
|
1688 | return changegroup.changegroupsubset(self, basenodes, self.heads(), |
@@ -602,7 +602,7 b' def getbundle(repo, proto, others):' | |||||
602 | opts[k] = decodelist(v) |
|
602 | opts[k] = decodelist(v) | |
603 | elif k == 'bundlecaps': |
|
603 | elif k == 'bundlecaps': | |
604 | opts[k] = set(v.split(',')) |
|
604 | opts[k] = set(v.split(',')) | |
605 |
cg = |
|
605 | cg = changegroupmod.getbundle(repo, 'serve', **opts) | |
606 | return streamres(proto.groupchunks(cg)) |
|
606 | return streamres(proto.groupchunks(cg)) | |
607 |
|
607 | |||
608 | @wireprotocommand('heads') |
|
608 | @wireprotocommand('heads') |
General Comments 0
You need to be logged in to leave comments.
Login now