@@ -479,5 +479,15 @@ def changegroupsubset(repo, roots, heads
discbases.extend([p for p in cl.parents(n) if p != nullid])
outgoing = discovery.outgoing(cl, discbases, heads)
bundler = bundle10(repo)
return getsubset(repo, outgoing, bundler, source)
+def getlocalbundle(repo, source, outgoing, bundlecaps=None):
+ """Like getbundle, but taking a discovery.outgoing as an argument.
+
+ This is only implemented for local repos and reuses potentially
+ precomputed sets in outgoing."""
+ if not outgoing.missing:
+ return None
+ bundler = bundle10(repo, bundlecaps)
+ return getsubset(repo, outgoing, bundler, source)
+
@@ -1140,11 +1140,11 @@ def bundle(ui, repo, fname, dest=None, *
heads = revs and map(repo.lookup, revs) or revs
outgoing = discovery.findcommonoutgoing(repo, other,
onlyheads=heads,
force=opts.get('force'),
portable=True)
- cg = repo.getlocalbundle('bundle', outgoing, bundlecaps)
+ cg = changegroup.getlocalbundle(repo, 'bundle', outgoing, bundlecaps)
if not cg:
scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded)
return 1
changegroup.writebundle(cg, fname, bundletype)
@@ -185,11 +185,12 @@ def _pushchangeset(pushop):
outgoing,
bundler,
'push',
fastpath=True)
else:
- cg = pushop.repo.getlocalbundle('push', outgoing, bundlecaps)
+ cg = changegroup.getlocalbundle(pushop.repo, 'push', outgoing,
+ bundlecaps)
# apply changegroup to remote
if unbundle:
# local repo finds heads on server, finds out what
# revs it must push. once revs transferred, if server
@@ -1677,20 +1677,10 @@ class localrepository(object):
pass
def push(self, remote, force=False, revs=None, newbranch=False):
return exchange.push(self, remote, force, revs, newbranch)
- def getlocalbundle(self, source, outgoing, bundlecaps=None):
- """Like getbundle, but taking a discovery.outgoing as an argument.
-
- This is only implemented for local repos and reuses potentially
- precomputed sets in outgoing."""
- if not outgoing.missing:
- return None
- bundler = changegroup.bundle10(self, bundlecaps)
- return changegroup.getsubset(self, outgoing, bundler, source)
-
def getbundle(self, source, heads=None, common=None, bundlecaps=None):
"""Like changegroupsubset, but returns the set difference between the
ancestors of heads and the ancestors common.
If heads is None, use the local heads. If common is None, use [nullid].
@@ -1704,13 +1694,13 @@ class localrepository(object):
common = [n for n in common if hasnode(n)]
else:
common = [nullid]
if not heads:
heads = cl.heads()
- return self.getlocalbundle(source,
- discovery.outgoing(cl, common, heads),
- bundlecaps=bundlecaps)
+ outgoing = discovery.outgoing(cl, common, heads)
+ return changegroup.getlocalbundle(self, source, outgoing,
+ bundlecaps=bundlecaps)
def changegroup(self, basenodes, source):
# to avoid a race we use changegroupsubset() (issue1320)
return changegroup.changegroupsubset(self, basenodes, self.heads(),
source)