Patchwork D1949: streamclone: extract requirements formatting

login
register
mail settings
Submitter phabricator
Date Jan. 31, 2018, 5:28 p.m.
Message ID <5b587202b6b2171da37f681f43bcdc0b@localhost.localdomain>
Download mbox | patch
Permalink /patch/27096/
State Not Applicable
Headers show

Comments

phabricator - Jan. 31, 2018, 5:28 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG84965e5f3241: streamclone: extract requirements formatting (authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1949?vs=5021&id=5030

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

AFFECTED FILES
  mercurial/exchange.py

CHANGE DETAILS




To: lothiraldan, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -199,6 +199,14 @@ 
     else:
         raise error.Abort(_('%s: unknown bundle version %s') % (fname, version))
 
+def _formatrequirementsspec(requirements):
+    return urlreq.quote(','.join(sorted(requirements)))
+
+def _formatrequirementsparams(requirements):
+    requirements = _formatrequirementsspec(requirements)
+    params = "%s%s" % (urlreq.quote("requirements="), requirements)
+    return params
+
 def getbundlespec(ui, fh):
     """Infer the bundlespec from a bundle file handle.
 
@@ -247,8 +255,7 @@ 
         return '%s-%s' % (comp, version)
     elif isinstance(b, streamclone.streamcloneapplier):
         requirements = streamclone.readbundle1header(fh)[2]
-        params = 'requirements=%s' % ','.join(sorted(requirements))
-        return 'none-packed1;%s' % urlreq.quote(params)
+        return 'none-packed1;%s' % _formatrequirementsparams(requirements)
     else:
         raise error.Abort(_('unknown bundle type: %s') % b)