hgext/narrow/narrowbundle2.py
changeset 40071 e8132a8897da
parent 40070 8feae5b989bc
child 40072 1ea80ac13f19
--- a/hgext/narrow/narrowbundle2.py	Fri Sep 28 23:42:31 2018 +0300
+++ b/hgext/narrow/narrowbundle2.py	Tue Oct 02 17:09:56 2018 +0300
@@ -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,