D4838: narrow: start returning bundle2 from widen_bundle()
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Tue Oct 2 14:19:37 UTC 2018
pulkit created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4838
AFFECTED FILES
hgext/narrow/narrowbundle2.py
hgext/narrow/narrowwirepeer.py
CHANGE DETAILS
diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py
--- a/hgext/narrow/narrowwirepeer.py
+++ b/hgext/narrow/narrowwirepeer.py
@@ -86,13 +86,8 @@
bundler = bundle2.bundle20(repo.ui)
# get changegroup data
- cg = narrowbundle2.widen_bundle(repo, diffmatch, common, known, cgversion,
- ellipses)
- if cg is not None:
- part = bundler.newpart('changegroup', data=cg)
- part.addparam('version', cgversion)
- if 'treemanifest' in repo.requirements:
- part.addparam('treemanifest', '1')
+ bundler = narrowbundle2.widen_bundle(repo, diffmatch, common, known,
+ cgversion, ellipses)
chunks = bundler.getchunks()
prefercompressed = True
return wireprototypes.streamres(gen=chunks,
diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -52,7 +52,7 @@
return caps
def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses):
- """generates changegroup for widening a narrow clone
+ """generates bundle2 for widening a narrow clone
repo is the localrepository instance
diffmatcher is a differencemacther of '(newincludes, newexcludes) -
@@ -62,11 +62,10 @@
cgversion is the changegroup version to send
ellipses is boolean value telling whether to send ellipses data or not
- returns changegroup data of the changegroup built or return None if there
- are no common revs
+ returns bundle2 of the data required for extending
"""
- # XXX: This patch will start sending bundle2 after couple of patches when
- # called from the wireprotocol command
+ bundler = bundle2.bundle20(repo.ui)
+
common = repo.revs("::%ln", common)
commonnodes = set()
cl = repo.changelog
@@ -81,9 +80,12 @@
cgdata = packer.generate(set([nullid]), list(commonnodes), False,
'narrow_widen', changelog=False)
- return cgdata
+ part = bundler.newpart('changegroup', data=cgdata)
+ part.addparam('version', cgversion)
+ if 'treemanifest' in repo.requirements:
+ part.addparam('treemanifest', '1')
- return None
+ return bundler
# Serve a changegroup for a client with a narrow clone.
def getbundlechangegrouppart_narrow(bundler, repo, source,
To: pulkit, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list