Patchwork D6438: narrow: pass the bundle to bundle2.widen_bundle() instead of generating there

login
register
mail settings
Submitter phabricator
Date May 28, 2019, 1:43 p.m.
Message ID <9f5842b69a74b90fa0892bbc25f3c909@localhost.localdomain>
Download mbox | patch
Permalink /patch/40249/
State Not Applicable
Headers show

Comments

phabricator - May 28, 2019, 1:43 p.m.
pulkit updated this revision to Diff 15273.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6438?vs=15240&id=15273

REVISION DETAIL
  https://phab.mercurial-scm.org/D6438

AFFECTED FILES
  hgext/narrow/narrowwirepeer.py
  mercurial/bundle2.py

CHANGE DETAILS




To: pulkit, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -2298,10 +2298,11 @@ 
     streamclone.applybundlev2(repo, part, filecount, bytecount,
                               requirements)
 
-def widen_bundle(repo, oldmatcher, newmatcher, common, known, cgversion,
-                 ellipses):
+def widen_bundle(bundler, repo, oldmatcher, newmatcher, common,
+                 known, cgversion, ellipses):
     """generates bundle2 for widening a narrow clone
 
+    bundler is the bundle to which data should be added
     repo is the localrepository instance
     oldmatcher matches what the client already has
     newmatcher matches what the client needs (including what it already has)
@@ -2312,7 +2313,6 @@ 
 
     returns bundle2 of the data required for extending
     """
-    bundler = bundle20(repo.ui)
     commonnodes = set()
     cl = repo.changelog
     for r in repo.revs("::%ln", common):
diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py
--- a/hgext/narrow/narrowwirepeer.py
+++ b/hgext/narrow/narrowwirepeer.py
@@ -80,15 +80,15 @@ 
             ellipses = bool(ellipses)
         cgversion = cgversion
 
+        bundler = bundle2.bundle20(repo.ui)
         if not ellipses:
             newmatch = narrowspec.match(repo.root, include=newincludes,
                                         exclude=newexcludes)
             oldmatch = narrowspec.match(repo.root, include=oldincludes,
                                         exclude=oldexcludes)
-            bundler = bundle2.widen_bundle(repo, oldmatch, newmatch, common,
-                                           known, cgversion, ellipses)
+            bundle2.widen_bundle(bundler, repo, oldmatch, newmatch, common,
+                                 known, cgversion, ellipses)
         else:
-            bundler = bundle2.bundle20(repo.ui)
             narrowbundle2.generateellipsesbundle2(bundler, repo, oldincludes,
                     oldexcludes, newincludes, newexcludes, cgversion, common,
                     list(common), known, None)