D4838: narrow: start returning bundle2 from widen_bundle()
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Wed Oct 3 07:55:51 EDT 2018
pulkit updated this revision to Diff 11592.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D4838?vs=11573&id=11592
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
@@ -89,13 +89,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()
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
@@ -51,7 +51,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) -
@@ -61,11 +61,9 @@
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)
commonnodes = set()
cl = repo.changelog
for r in repo.revs("::%ln", common):
@@ -79,9 +77,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