Patchwork D664: changegroup: replace getsubset with makechangegroup

login
register
mail settings
Submitter phabricator
Date Sept. 11, 2017, 10:27 p.m.
Message ID <ecd9eac485a5fc2a85d0220f337642ec@localhost.localdomain>
Download mbox | patch
Permalink /patch/23796/
State Not Applicable
Headers show

Comments

phabricator - Sept. 11, 2017, 10:27 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf85dfde1731a: changegroup: replace getsubset with makechangegroup (authored by durham).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D664?vs=1691&id=1733

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

AFFECTED FILES
  mercurial/changegroup.py
  mercurial/exchange.py

CHANGE DETAILS




To: durham, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -963,12 +963,8 @@ 
                             or pushop.repo.changelog.filteredrevs):
         # push everything,
         # use the fast path, no race possible on push
-        bundler = changegroup.cg1packer(pushop.repo, bundlecaps)
-        cg = changegroup.getsubset(pushop.repo,
-                                   outgoing,
-                                   bundler,
-                                   'push',
-                                   fastpath=True)
+        cg = changegroup.makechangegroup(pushop.repo, outgoing, '01', 'push',
+                fastpath=True, bundlecaps=bundlecaps)
     else:
         cg = changegroup.getchangegroup(pushop.repo, 'push', outgoing,
                                         bundlecaps=bundlecaps)
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -912,6 +912,18 @@ 
         for node in nodes:
             repo.ui.debug("%s\n" % hex(node))
 
+def makestream(repo, outgoing, version, source, fastpath=False,
+               bundlecaps=None):
+    bundler = getbundler(version, repo, bundlecaps=bundlecaps)
+    return getsubsetraw(repo, outgoing, bundler, source, fastpath=fastpath)
+
+def makechangegroup(repo, outgoing, version, source, fastpath=False,
+                    bundlecaps=None):
+    cgstream = makestream(repo, outgoing, version, source,
+                          fastpath=fastpath, bundlecaps=bundlecaps)
+    return getunbundler(version, util.chunkbuffer(cgstream), None,
+                        {'clcount': len(outgoing.missing) })
+
 def getsubsetraw(repo, outgoing, bundler, source, fastpath=False):
     repo = repo.unfiltered()
     commonrevs = outgoing.common
@@ -928,11 +940,6 @@ 
     _changegroupinfo(repo, csets, source)
     return bundler.generate(commonrevs, csets, fastpathlinkrev, source)
 
-def getsubset(repo, outgoing, bundler, source, fastpath=False):
-    gengroup = getsubsetraw(repo, outgoing, bundler, source, fastpath)
-    return getunbundler(bundler.version, util.chunkbuffer(gengroup), None,
-                        {'clcount': len(outgoing.missing)})
-
 def changegroupsubset(repo, roots, heads, source, version='01'):
     """Compute a changegroup consisting of all the nodes that are
     descendants of any of the roots and ancestors of any of the heads.
@@ -947,8 +954,7 @@ 
     the changegroup a particular filenode or manifestnode belongs to.
     """
     outgoing = discovery.outgoing(repo, missingroots=roots, missingheads=heads)
-    bundler = getbundler(version, repo)
-    return getsubset(repo, outgoing, bundler, source)
+    return makechangegroup(repo, outgoing, version, source)
 
 def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None,
                            version='01'):
@@ -969,8 +975,8 @@ 
     precomputed sets in outgoing."""
     if not outgoing.missing:
         return None
-    bundler = getbundler(version, repo, bundlecaps)
-    return getsubset(repo, outgoing, bundler, source)
+    return makechangegroup(repo, outgoing, version, source,
+                           bundlecaps=bundlecaps)
 
 def getlocalchangegroup(repo, *args, **kwargs):
     repo.ui.deprecwarn('getlocalchangegroup is deprecated, use getchangegroup',