changeset 37847:d46a38c07b1a stable

merge with i18n
author Augie Fackler <augie@google.com>
date Tue, 22 May 2018 21:51:20 -0400
parents 13b2812cff2b (diff) bad736e65221 (current diff)
children 8c828beb7543
files
diffstat 50 files changed, 794 insertions(+), 183 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsigs	Fri May 04 18:55:57 2018 -0300
+++ b/.hgsigs	Tue May 22 21:51:20 2018 -0400
@@ -163,3 +163,4 @@
 7de7bd407251af2bc98e5b809c8598ee95830daf 0 iQJEBAABCAAuFiEEK8zhT1xnJaouqK63ucncgkqlvdUFAlrE4p0QHHJhZkBkdXJpbjQyLmNvbQAKCRC5ydyCSqW91c4UD/4tC+mBWxBw/JYm4vlFTKWLHopLEa1/uhFRK/uGsdgcCyexbCDbisjJpl3JTQb+wQDlZnUorm8zB206y418YqhJ7lCauRgcoqKka0e3kvKnwmklwmuGkwOIoruWxxhCcgRCT4C+jZ/ZE3Kre0CKnUvlASsHtbkqrCqFClEcIlPVohlccmjbpQXN+akB40tkMF5Xf0AMBPYG7UievmeHhz3pO/yex/Uc6RhgWAqD4zjA1bh+3REGs3CaoYgKUTXZw/XYI9cqAI0FobRuXSVbq2dqkXCFLfD+WizxUz55rZA+CP4pqLndwxGm4fLy4gk2iLHxKfrHsAul7n5e4tHmxDcOOa1K0fIJDBijuXoNfXN7nF4NQUlfpmtOxUxfniVohvXJeYV8ecepsDMSFqDtEtbdhsep5QDx85lGLNLQAA1f36swJzLBSqGw688Hjql2c9txK2eVrVxNp+M8tqn9qU/h2/firgu9a2DxQB45M7ISfkutmpizN5TNlEyElH0htHnKG7+AIbRAm4novCXfSzP8eepk0kVwj9QMIx/rw4aeicRdPWBTcDIG0gWELb0skunTQqeZwPPESwimntdmwCxfFksgT0t79ZEDAWWfxNLhJP/HWO2mYG5GUJOzNQ4rj/YXLcye6A4KkhvuZlVCaKAbnm60ivoG082HYuozV4qPOQ==
 ed5448edcbfa747b9154099e18630e49024fd47b 0 iQJEBAABCAAuFiEEK8zhT1xnJaouqK63ucncgkqlvdUFAlrXnuoQHHJhZkBkdXJpbjQyLmNvbQAKCRC5ydyCSqW91fSHEACBVg4FsCE2nN5aEKAQb7l7rG4XTQ9FbvoTYB3tkvmsLQSRfh2GB2ZDBOI7Vswo2UxXupr4qSkUQbeHrwrk9A1s5b/T5e4wSKZuFJOrkwLVZDFfUHumKomqdoVj/D8+LDt7Rz+Wm7OClO/4dTAsl2E4rkl7XPtqjC3jESGad8IBANlPVBhNUMER4eFcPZzq1qi2MrlJKEKpdeZEWJ/ow7gka/aTLqHMfRwhA3kS5X34Yai17kLQZGQdWISWYiM9Zd2b/FSTHZGy8rf9cvjXs3EXfEB5nePveDrFOfmuubVRDplO+/naJjNBqwxeB99jb7Fk3sekPZNW/NqR/w1jvQFA3OP9fS2g1OwfXMWyx6DvBJNfQwppNH3JUvA5PEiorul4GJ2nuubXk+Or1yzoRJtwOGz/GQi2BcsPKaL6niewrInFw18jMVhx/4Jbpu+glaim4EvT/PfJ5KdSwF7pJxsoiqvw7A2C2/DsZRbCeal9GrTulkNf/hgpCJOBK1DqVVq1O5MI/oYQ69HxgMq9Ip1OGJJhse3qjevBJbpNCosCpjb3htlo4go29H8yyGJb09i05WtNW2EQchrTHrlruFr7mKJ5h1mAYket74QQyaGzqwgD5kwSVnIcwHpfb8oiJTwA5R+LtbAQXWC/fFu1g1KEp/4hGOQoRU04+mYuPsrzaA==
 1ec874717d8a93b19e0d50628443e0ee5efab3a9 0 iQJEBAABCAAuFiEEK8zhT1xnJaouqK63ucncgkqlvdUFAlraM3wQHHJhZkBkdXJpbjQyLmNvbQAKCRC5ydyCSqW91RAJEACSnf/HWwS0/OZaqz4Hfh0UBgkXDmH1IC90Pc/kczf//WuXu5AVnnRHDziOlCYYZAnZ2iKu0EQI6GT2K2garaWkaEhukOnjz4WADVys6DAzJyw5iOXeEpIOlZH6hbYbsW3zVcPjiMPo8cY5tIYEy4E/8RcVly1SDtWxvt/nWYQd2MxObLrpU7bPP6a2Db4Vy8WpGRbZRJmOvDNworld5rB5M/OGgHyMa9hg2Hjn+cLtQSEJY4O92A6h2hix9xpDC7zzfoluD2piDslocTm/gyeln2BJJBAtr+aRoHO9hI0baq5yFRQLO8aqQRJJP8dXgYZIWgSU/9oVGPZoGotJyw24iiB37R/YCisKE+cEUjfVclHTDFCkzmYP2ZMbGaktohJeF7EMau0ZJ8II5F0ja3bj6GrwfpGGY5OOcQrzIYW7nB0msFWTljb34qN3nd7m+hQ5hji3Hp9CFXEbCboVmm46LqwukSDWTmnfcP8knxWbBlJ4xDxySwTtcHAJhnUmKxu7oe3D/0Ttdv7HscI40eeMdr01pLQ0Ee3a4OumQ1hn+oL+o+tlqg8PKT20q528CMHgSJp6aIlU7pEK81b+Zj6B57us4P97qSL6XLNUIfubADCaf/KUDwh1HvKhHXV2aRli1GX1REFsy0ItGZn0yhQxIDJKc/FKsEMBKvlVIHGQFw==
+6614cac550aea66d19c601e45efd1b7bd08d7c40 0 iQJVBAABCAA/FiEEOoFVFj0OIKUw/LeGR6Z/+qNGqs4FAlruOCQhHGtidWxsb2NrK21lcmN1cmlhbEByaW5nd29ybGQub3JnAAoJEEemf/qjRqrOENQQAI1ttaffqYucUEyBARP1GDlZMIGDJgNG7smPMU4Sw7YEzB9mcmxnBFlPx/9n973ucEnLJVONBSZq0VWIKJwPp1RMBpAHuGrMlhkMvYIAukg5EBN3YpA1UogHYycwLj2Ye7fNgiN5FIkaodt9++c4d1Lfu658A2pAeg8qUn5uJ77vVcZRp988u9eVDQfubS8P6bB4KZc87VDAUUeXy+AcS9KHGBmdRAabwU4m09VPZ4h8NEj3+YUPnKXBaNK9pXK5pnkmB8uFePayimnw6St6093oylQTVw/tfxGLBImnHw+6KCu2ut9r5PxXEVxVYpranGbS4jYqpzRtpQBxyo/Igu7fqrioR2rGLQL5NcHsoUEdOC7VW+0HgHjXKtRy7agmcFcgjFco47D3hor7Y16lwgm+RV2EWQ/u2M4Bbo1EWj1oxQ/0j5DOM5UeAJ3Jh64gb4sCDqJfADR8NQaxh7QiqYhn69IcjsEfzU/11VuqWXlQgghJhEEP/bojRyM0qee87CKLiTescafIfnRsNQhyhsKqdHU1QAp29cCqh3mzNxJH3PDYg4fjRaGW4PM7K5gmSXFn/Ifeza0cuZ4XLdYZ76Z1BG80pqBpKZy1unGob+RpItlSmO5jQw7OoRuf0q3Id92gawUDDLuQ7Xg3zOVqV8/wJBlHM7ZUz162bnNsO5Hn
--- a/.hgtags	Fri May 04 18:55:57 2018 -0300
+++ b/.hgtags	Tue May 22 21:51:20 2018 -0400
@@ -176,3 +176,4 @@
 7de7bd407251af2bc98e5b809c8598ee95830daf 4.5.3
 ed5448edcbfa747b9154099e18630e49024fd47b 4.6rc0
 1ec874717d8a93b19e0d50628443e0ee5efab3a9 4.6rc1
+6614cac550aea66d19c601e45efd1b7bd08d7c40 4.6
--- a/hgext/remotenames.py	Fri May 04 18:55:57 2018 -0300
+++ b/hgext/remotenames.py	Tue May 22 21:51:20 2018 -0400
@@ -6,7 +6,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-""" showing remotebookmarks and remotebranches in UI
+""" showing remotebookmarks and remotebranches in UI (EXPERIMENTAL)
 
 By default both remotebookmarks and remotebranches are turned on. Config knob to
 control the individually are as follows.
--- a/mercurial/bundle2.py	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/bundle2.py	Tue May 22 21:51:20 2018 -0400
@@ -1659,7 +1659,8 @@
             for n in sorted(closed):
                 yield n
 
-    bundler.newpart('cache:rev-branch-cache', data=generate())
+    bundler.newpart('cache:rev-branch-cache', data=generate(),
+                    mandatory=False)
 
 def _formatrequirementsspec(requirements):
     return urlreq.quote(','.join(sorted(requirements)))
--- a/mercurial/cext/bdiff.c	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/cext/bdiff.c	Tue May 22 21:51:20 2018 -0400
@@ -261,7 +261,7 @@
                          void *priv)
 {
 	PyObject *rl = (PyObject *)priv;
-	PyObject *m = Py_BuildValue("llll", a1, a2, b1, b2);
+	PyObject *m = Py_BuildValue("LLLL", a1, a2, b1, b2);
 	if (!m)
 		return -1;
 	if (PyList_Append(rl, m) != 0) {
--- a/mercurial/debugcommands.py	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/debugcommands.py	Tue May 22 21:51:20 2018 -0400
@@ -352,7 +352,8 @@
     for part in gen.iterparts():
         if parttypes and part.type not in parttypes:
             continue
-        ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
+        msg = '%s -- %s (mandatory: %r)\n'
+        ui.write((msg % (part.type, _quasirepr(part.params), part.mandatory)))
         if part.type == 'changegroup':
             version = part.params.get('version', '01')
             cg = changegroup.getunbundler(version, part, 'UN')
@@ -462,6 +463,8 @@
 
 def _debugdisplaystyle(ui):
     ui.write(_('available style:\n'))
+    if not ui._styles:
+        return
     width = max(len(s) for s in ui._styles)
     for label, effects in sorted(ui._styles.items()):
         ui.write('%s' % label, label=label)
--- a/mercurial/exchange.py	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/exchange.py	Tue May 22 21:51:20 2018 -0400
@@ -8,7 +8,6 @@
 from __future__ import absolute_import
 
 import collections
-import errno
 import hashlib
 
 from .i18n import _
@@ -513,9 +512,7 @@
         pushop.trmanager = transactionmanager(pushop.repo,
                                               'push-response',
                                               pushop.remote.url())
-    except IOError as err:
-        if err.errno != errno.EACCES:
-            raise
+    except error.LockUnavailable as err:
         # source repo cannot be locked.
         # We do not abort the push, but just disable the local phase
         # synchronisation.
--- a/mercurial/filelog.py	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/filelog.py	Tue May 22 21:51:20 2018 -0400
@@ -135,7 +135,9 @@
             return False
         t = self.revision(node)
         m = revlog.parsemeta(t)[0]
-        if m and "copy" in m:
+        # copy and copyrev occur in pairs. In rare cases due to bugs,
+        # one can occur without the other.
+        if m and "copy" in m and "copyrev" in m:
             return (m["copy"], revlog.bin(m["copyrev"]))
         return False
 
--- a/mercurial/hgweb/hgweb_mod.py	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/hgweb/hgweb_mod.py	Tue May 22 21:51:20 2018 -0400
@@ -399,6 +399,12 @@
                 tag = 'W/"%d"' % self.mtime
                 if req.headers.get('If-None-Match') == tag:
                     res.status = '304 Not Modified'
+                    # Content-Type may be defined globally. It isn't valid on a
+                    # 304, so discard it.
+                    try:
+                        del res.headers[b'Content-Type']
+                    except KeyError:
+                        pass
                     # Response body not allowed on 304.
                     res.setbodybytes('')
                     return res.sendresponse()
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/hgweb/hgwebdir_mod.py	Tue May 22 21:51:20 2018 -0400
@@ -428,7 +428,10 @@
                                 uenv.iteritems()}
                     req = requestmod.parserequestfromenv(
                         uenv, reponame=virtualrepo,
-                        altbaseurl=self.ui.config('web', 'baseurl'))
+                        altbaseurl=self.ui.config('web', 'baseurl'),
+                        # Reuse wrapped body file object otherwise state
+                        # tracking can get confused.
+                        bodyfh=req.bodyfh)
                     try:
                         # ensure caller gets private copy of ui
                         repo = hg.repository(self.ui.copy(), real)
--- a/mercurial/hgweb/request.py	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/hgweb/request.py	Tue May 22 21:51:20 2018 -0400
@@ -124,7 +124,7 @@
     # WSGI environment dict, unmodified.
     rawenv = attr.ib()
 
-def parserequestfromenv(env, reponame=None, altbaseurl=None):
+def parserequestfromenv(env, reponame=None, altbaseurl=None, bodyfh=None):
     """Parse URL components from environment variables.
 
     WSGI defines request attributes via environment variables. This function
@@ -144,6 +144,9 @@
     if the request were to ``http://myserver:9000/prefix/rev/@``. In other
     words, ``wsgi.url_scheme``, ``SERVER_NAME``, ``SERVER_PORT``, and
     ``SCRIPT_NAME`` are all effectively replaced by components from this URL.
+
+    ``bodyfh`` can be used to specify a file object to read the request body
+    from. If not defined, ``wsgi.input`` from the environment dict is used.
     """
     # PEP 3333 defines the WSGI spec and is a useful reference for this code.
 
@@ -307,9 +310,11 @@
     if 'CONTENT_TYPE' in env and 'HTTP_CONTENT_TYPE' not in env:
         headers['Content-Type'] = env['CONTENT_TYPE']
 
-    bodyfh = env['wsgi.input']
-    if 'Content-Length' in headers:
-        bodyfh = util.cappedreader(bodyfh, int(headers['Content-Length']))
+    if bodyfh is None:
+        bodyfh = env['wsgi.input']
+        if 'Content-Length' in headers:
+            bodyfh = util.cappedreader(bodyfh,
+                                       int(headers['Content-Length'] or '0'))
 
     return parsedrequest(method=env['REQUEST_METHOD'],
                          url=fullurl, baseurl=baseurl,
@@ -468,6 +473,7 @@
                           if k.lower() not in ('date', 'etag', 'expires',
                                                'cache-control',
                                                'content-location',
+                                               'content-security-policy',
                                                'vary')}
             if badheaders:
                 raise error.ProgrammingError(
--- a/mercurial/httppeer.py	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/httppeer.py	Tue May 22 21:51:20 2018 -0400
@@ -277,9 +277,9 @@
 
     Returns the response object.
     """
+    dbg = ui.debug
     if (ui.debugflag
         and ui.configbool('devel', 'debug.peer-request')):
-        dbg = ui.debug
         line = 'devel-peer-request: %s\n'
         dbg(line % '%s %s' % (pycompat.bytesurl(req.get_method()),
                               pycompat.bytesurl(req.get_full_url())))
@@ -319,7 +319,7 @@
         ui.traceback()
         raise IOError(None, inst)
     finally:
-        if ui.configbool('devel', 'debug.peer-request'):
+        if ui.debugflag and ui.configbool('devel', 'debug.peer-request'):
             dbg(line % '  finished in %.4f seconds (%d)'
                 % (util.timer() - start, res.code))
 
@@ -328,13 +328,24 @@
 
     return res
 
+class RedirectedRepoError(error.RepoError):
+    def __init__(self, msg, respurl):
+        super(RedirectedRepoError, self).__init__(msg)
+        self.respurl = respurl
+
 def parsev1commandresponse(ui, baseurl, requrl, qs, resp, compressible,
                            allowcbor=False):
     # record the url we got redirected to
+    redirected = False
     respurl = pycompat.bytesurl(resp.geturl())
     if respurl.endswith(qs):
         respurl = respurl[:-len(qs)]
+        qsdropped = False
+    else:
+        qsdropped = True
+
     if baseurl.rstrip('/') != respurl.rstrip('/'):
+        redirected = True
         if not ui.quiet:
             ui.warn(_('real URL is %s\n') % respurl)
 
@@ -351,10 +362,16 @@
     # application/hg-changegroup. We don't support such old servers.
     if not proto.startswith('application/mercurial-'):
         ui.debug("requested URL: '%s'\n" % util.hidepassword(requrl))
-        raise error.RepoError(
-            _("'%s' does not appear to be an hg repository:\n"
-              "---%%<--- (%s)\n%s\n---%%<---\n")
-            % (safeurl, proto or 'no content-type', resp.read(1024)))
+        msg = _("'%s' does not appear to be an hg repository:\n"
+                "---%%<--- (%s)\n%s\n---%%<---\n") % (
+            safeurl, proto or 'no content-type', resp.read(1024))
+
+        # Some servers may strip the query string from the redirect. We
+        # raise a special error type so callers can react to this specially.
+        if redirected and qsdropped:
+            raise RedirectedRepoError(msg, respurl)
+        else:
+            raise error.RepoError(msg)
 
     try:
         subtype = proto.split('-', 1)[1]
@@ -434,8 +451,6 @@
 
     # End of ipeercommands interface.
 
-    # look up capabilities only when needed
-
     def _callstream(self, cmd, _compressible=False, **args):
         args = pycompat.byteskwargs(args)
 
@@ -853,12 +868,32 @@
     req, requrl, qs = makev1commandrequest(ui, requestbuilder, caps,
                                            capable, url, 'capabilities',
                                            args)
-
     resp = sendrequest(ui, opener, req)
 
-    respurl, ct, resp = parsev1commandresponse(ui, url, requrl, qs, resp,
-                                               compressible=False,
-                                               allowcbor=advertisev2)
+    # The server may redirect us to the repo root, stripping the
+    # ?cmd=capabilities query string from the URL. The server would likely
+    # return HTML in this case and ``parsev1commandresponse()`` would raise.
+    # We catch this special case and re-issue the capabilities request against
+    # the new URL.
+    #
+    # We should ideally not do this, as a redirect that drops the query
+    # string from the URL is arguably a server bug. (Garbage in, garbage out).
+    # However,  Mercurial clients for several years appeared to handle this
+    # issue without behavior degradation. And according to issue 5860, it may
+    # be a longstanding bug in some server implementations. So we allow a
+    # redirect that drops the query string to "just work."
+    try:
+        respurl, ct, resp = parsev1commandresponse(ui, url, requrl, qs, resp,
+                                                   compressible=False,
+                                                   allowcbor=advertisev2)
+    except RedirectedRepoError as e:
+        req, requrl, qs = makev1commandrequest(ui, requestbuilder, caps,
+                                               capable, e.respurl,
+                                               'capabilities', args)
+        resp = sendrequest(ui, opener, req)
+        respurl, ct, resp = parsev1commandresponse(ui, url, requrl, qs, resp,
+                                                   compressible=False,
+                                                   allowcbor=advertisev2)
 
     try:
         rawdata = resp.read()
--- a/mercurial/revlog.py	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/revlog.py	Tue May 22 21:51:20 2018 -0400
@@ -1466,7 +1466,7 @@
         if id in self._pcache:
             return self._pcache[id]
 
-        if len(id) < 40:
+        if len(id) <= 40:
             try:
                 # hex(node)[:...]
                 l = len(id) // 2  # grab an even number of digits
--- a/mercurial/revset.py	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/revset.py	Tue May 22 21:51:20 2018 -0400
@@ -2171,7 +2171,7 @@
 
 def match(ui, spec, lookup=None):
     """Create a matcher for a single revision spec"""
-    return matchany(ui, [spec], lookup=None)
+    return matchany(ui, [spec], lookup=lookup)
 
 def matchany(ui, specs, lookup=None, localalias=None):
     """Create a matcher that will include any revisions matching one of the
--- a/mercurial/templates/paper/changeset.tmpl	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/templates/paper/changeset.tmpl	Tue May 22 21:51:20 2018 -0400
@@ -73,9 +73,9 @@
   <th class="diffstat">diffstat</th>
   <td class="diffstat">
     {diffsummary}
-    <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
+    <a id="diffstatexpand" class="diffstattoggle" href="#">[<tt>+</tt>]</a>
     <div id="diffstatdetails" style="display:none;">
-      <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
+      <a class="diffstattoggle" href="#">[<tt>-</tt>]</a>
       <table class="diffstat-table stripes2">{diffstat}</table>
     </div>
   </td>
@@ -83,7 +83,7 @@
 </table>
 
 <div class="overflow">
-<div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+<div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
 <div class="sourcefirst"> line diff</div>
 <div class="stripes2 diffblocks">
 {diff}
--- a/mercurial/templates/paper/filediff.tmpl	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/templates/paper/filediff.tmpl	Tue May 22 21:51:20 2018 -0400
@@ -65,7 +65,7 @@
 </table>
 
 <div class="overflow">
-<div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+<div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
 <div class="sourcefirst"> line diff</div>
 <div class="stripes2 diffblocks">
 {diff}
--- a/mercurial/templates/paper/filerevision.tmpl	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/templates/paper/filerevision.tmpl	Tue May 22 21:51:20 2018 -0400
@@ -65,7 +65,7 @@
 </table>
 
 <div class="overflow">
-<div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+<div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
 <div class="sourcefirst"> line source</div>
 <pre class="sourcelines stripes4 wrap bottomline"
      data-logurl="{url|urlescape}log/{symrev}/{file|urlescape}"
--- a/mercurial/templates/static/mercurial.js	Fri May 04 18:55:57 2018 -0300
+++ b/mercurial/templates/static/mercurial.js	Tue May 22 21:51:20 2018 -0400
@@ -328,14 +328,15 @@
 	}
 }
 
-function toggleDiffstat() {
+function toggleDiffstat(event) {
     var curdetails = document.getElementById('diffstatdetails').style.display;
     var curexpand = curdetails === 'none' ? 'inline' : 'none';
     document.getElementById('diffstatdetails').style.display = curexpand;
     document.getElementById('diffstatexpand').style.display = curdetails;
+    event.preventDefault();
 }
 
-function toggleLinewrap() {
+function toggleLinewrap(event) {
     function getLinewrap() {
         var nodes = document.getElementsByClassName('sourcelines');
         // if there are no such nodes, error is thrown here
@@ -360,6 +361,7 @@
     }
 
     setLinewrap(!getLinewrap());
+    event.preventDefault();
 }
 
 function format(str, replacements) {
@@ -551,6 +553,28 @@
     form.style.display = 'block';
 }
 
+function addDiffStatToggle() {
+    var els = document.getElementsByClassName("diffstattoggle");
+
+    for (var i = 0; i < els.length; i++) {
+        els[i].addEventListener("click", toggleDiffstat, false);
+    }
+}
+
+function addLineWrapToggle() {
+    var els = document.getElementsByClassName("linewraptoggle");
+
+    for (var i = 0; i < els.length; i++) {
+        var nodes = els[i].getElementsByClassName("linewraplink");
+
+        for (var j = 0; j < nodes.length; j++) {
+            nodes[j].addEventListener("click", toggleLinewrap, false);
+        }
+    }
+}
+
 document.addEventListener('DOMContentLoaded', function() {
    process_dates();
+   addDiffStatToggle();
+   addLineWrapToggle();
 }, false);
--- a/tests/test-bundle-phases.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-bundle-phases.t	Tue May 22 21:51:20 2018 -0400
@@ -38,12 +38,12 @@
   3 changesets found
   $ hg debugbundle bundle
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 3, targetphase: 2, version: 02}
+  changegroup -- {nbchanges: 3, targetphase: 2, version: 02} (mandatory: True)
       26805aba1e600a82e93661149f2313866a221a7b
       f585351a92f85104bff7c284233c338b10eb1df7
       9bc730a19041f9ec7cb33c626e811aa233efb18c
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
+  phase-heads -- {} (mandatory: True)
       26805aba1e600a82e93661149f2313866a221a7b draft
   $ hg strip --no-backup C
   $ hg unbundle -q bundle
@@ -228,14 +228,14 @@
   5 changesets found
   $ hg debugbundle bundle
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 5, targetphase: 2, version: 02}
+  changegroup -- {nbchanges: 5, targetphase: 2, version: 02} (mandatory: True)
       426bada5c67598ca65036d57d9e4b64b0c1ce7a0
       112478962961147124edd43549aedd1a335e44bf
       dc0947a82db884575bb76ea10ac97b08536bfa03
       4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
       03ca77807e919db8807c3749086dc36fb478cac0
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
+  phase-heads -- {} (mandatory: True)
       dc0947a82db884575bb76ea10ac97b08536bfa03 public
       03ca77807e919db8807c3749086dc36fb478cac0 draft
   $ hg strip --no-backup A
@@ -257,23 +257,23 @@
   2 changesets found
   $ hg debugbundle bundle
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 2, targetphase: 2, version: 02}
+  changegroup -- {nbchanges: 2, targetphase: 2, version: 02} (mandatory: True)
       112478962961147124edd43549aedd1a335e44bf
       4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
+  phase-heads -- {} (mandatory: True)
   $ rm bundle
 
   $ hg bundle --base A -r D bundle
   3 changesets found
   $ hg debugbundle bundle
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 3, targetphase: 2, version: 02}
+  changegroup -- {nbchanges: 3, targetphase: 2, version: 02} (mandatory: True)
       112478962961147124edd43549aedd1a335e44bf
       dc0947a82db884575bb76ea10ac97b08536bfa03
       4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
+  phase-heads -- {} (mandatory: True)
       dc0947a82db884575bb76ea10ac97b08536bfa03 public
   $ rm bundle
 
@@ -281,10 +281,10 @@
   2 changesets found
   $ hg debugbundle bundle
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 2, targetphase: 2, version: 02}
+  changegroup -- {nbchanges: 2, targetphase: 2, version: 02} (mandatory: True)
       4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4
       03ca77807e919db8807c3749086dc36fb478cac0
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
+  phase-heads -- {} (mandatory: True)
       03ca77807e919db8807c3749086dc36fb478cac0 draft
   $ rm bundle
--- a/tests/test-bundle-type.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-bundle-type.t	Tue May 22 21:51:20 2018 -0400
@@ -66,9 +66,9 @@
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
   none-v2
   
   % test bundle type bzip2
@@ -76,9 +76,9 @@
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
   bzip2-v2
   
   % test bundle type gzip
@@ -86,9 +86,9 @@
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {Compression: GZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
   gzip-v2
   
   % test bundle type none-v2
@@ -96,9 +96,9 @@
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
   none-v2
   
   % test bundle type v2
@@ -106,9 +106,9 @@
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
   bzip2-v2
   
   % test bundle type v1
@@ -171,9 +171,9 @@
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {Compression: ZS}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
   zstd-v2
   
   % test bundle type zstd-v2
@@ -181,9 +181,9 @@
   1 changesets found
   HG20\x00\x00 (esc)
   Stream params: {Compression: ZS}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
   zstd-v2
   
 
--- a/tests/test-bundle.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-bundle.t	Tue May 22 21:51:20 2018 -0400
@@ -803,7 +803,7 @@
   bundling: b 1/3 files (33.33%)
   bundling: b1 2/3 files (66.67%)
   bundling: x 3/3 files (100.00%)
-  bundle2-output-part: "cache:rev-branch-cache" streamed payload
+  bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
 
 #if repobundlerepo
 == Test for issue3441
--- a/tests/test-bundle2-format.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-bundle2-format.t	Tue May 22 21:51:20 2018 -0400
@@ -993,7 +993,7 @@
 
   $ hg debugbundle ../rev.hg2
   Stream params: {}
-  changegroup -- {}
+  changegroup -- {} (mandatory: False)
       32af7686d403cf45b5d95f2d70cebea587ac806a
       9520eea781bcca16c1e15acc0ba14335a0e8e5ba
       eea13746799a9e0bfd88f29d3c2e9dc9389f524f
@@ -1122,7 +1122,7 @@
   0370: 3b 19 fd af c5 3f f1 60 c3 17                   |;....?.`..|
   $ hg debugbundle ../rev.hg2.bz
   Stream params: {Compression: GZ}
-  changegroup -- {}
+  changegroup -- {} (mandatory: False)
       32af7686d403cf45b5d95f2d70cebea587ac806a
       9520eea781bcca16c1e15acc0ba14335a0e8e5ba
       eea13746799a9e0bfd88f29d3c2e9dc9389f524f
@@ -1209,7 +1209,7 @@
   0430: 2e e4 8a 70 a1 21 46 96 30 7a                   |...p.!F.0z|
   $ hg debugbundle ../rev.hg2.bz
   Stream params: {Compression: BZ}
-  changegroup -- {}
+  changegroup -- {} (mandatory: False)
       32af7686d403cf45b5d95f2d70cebea587ac806a
       9520eea781bcca16c1e15acc0ba14335a0e8e5ba
       eea13746799a9e0bfd88f29d3c2e9dc9389f524f
--- a/tests/test-check-commit.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-check-commit.t	Tue May 22 21:51:20 2018 -0400
@@ -8,16 +8,20 @@
 
   $ cd $TESTDIR/..
 
+  $ REVSET='not public() and ::. and not desc("# no-check-commit")'
+
   $ mkdir "$TESTTMP/p"
-  $ testrepohg export --git -o "$TESTTMP/p/%n-%h" \
-  > -r 'not public() and ::. and not desc("# no-check-commit")'
-  $ for f in `ls "$TESTTMP/p"`; do
-  >    contrib/check-commit < "$TESTTMP/p/$f" > "$TESTTMP/check-commit.out"
-  >    if [ $? -ne 0 ]; then
-  >        node="${f##*-}"
-  >        echo "Revision $node does not comply with rules"
-  >        echo '------------------------------------------------------'
-  >        cat ${TESTTMP}/check-commit.out
-  >        echo
-  >   fi
-  > done
+  $ REVS=`testrepohg log -r "$REVSET" -T.`
+  $ if [ -n "$REVS" ] ; then
+  >   testrepohg export --git -o "$TESTTMP/p/%n-%h" -r "$REVSET"
+  >   for f in `ls "$TESTTMP/p"`; do
+  >      contrib/check-commit < "$TESTTMP/p/$f" > "$TESTTMP/check-commit.out"
+  >      if [ $? -ne 0 ]; then
+  >          node="${f##*-}"
+  >          echo "Revision $node does not comply with rules"
+  >          echo '------------------------------------------------------'
+  >          cat ${TESTTMP}/check-commit.out
+  >          echo
+  >     fi
+  >   done
+  > fi
--- a/tests/test-clonebundles.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-clonebundles.t	Tue May 22 21:51:20 2018 -0400
@@ -186,10 +186,10 @@
   0150: 88 75 34 36 75 04 82 55 17 14 36 a4 38 10 04 d8 |.u46u..U..6.8...|
   0160: 21 01 9a b1 83 f7 e9 45 8b d2 56 c7 a3 1f 82 52 |!......E..V....R|
   0170: d7 8a 78 ed fc d5 76 f1 36 25 81 89 c7 ad ec 90 |..x...v.6%......|
-  0180: 54 47 75 2b 89 48 b1 b2 62 ce 8e ce 1e ae 56 41 |TGu+.H..b.....VA|
-  0190: ae 61 ba 4e 41 8e 7e ce 1e ba 60 01 a0 14 23 58 |.a.NA.~...`...#X|
+  0180: 54 47 75 2b 89 48 b1 b2 62 c9 89 c9 19 a9 56 45 |TGu+.H..b.....VE|
+  0190: a9 65 ba 49 45 89 79 c9 19 ba 60 01 a0 14 23 58 |.e.IE.y...`...#X|
   01a0: 81 35 c8 7d 40 cc 04 e2 a4 a4 a6 25 96 e6 94 60 |.5.}@......%...`|
-  01b0: 33 17 5f 54 00 00 01 1b 0a ec                   |3._T......|
+  01b0: 33 17 5f 54 00 00 d3 1b 0d 4c                   |3._T.....L|
 
   $ echo "http://localhost:$HGPORT1/full.hg" > server/.hg/clonebundles.manifest
   $ hg clone -U http://localhost:$HGPORT full-bundle
@@ -530,14 +530,14 @@
   $ cat hg.pid >> $DAEMON_PIDS
 
   $ hg -R server debuglfput gz-a.hg
-  14ee2f0b3f1d14aeeb2fe037e09fc295c3cf59f5
+  1f74b3d08286b9b3a16fb3fa185dd29219cbc6ae
 
   $ cat > server/.hg/clonebundles.manifest << EOF
-  > largefile://14ee2f0b3f1d14aeeb2fe037e09fc295c3cf59f5 BUNDLESPEC=gzip-v2
+  > largefile://1f74b3d08286b9b3a16fb3fa185dd29219cbc6ae BUNDLESPEC=gzip-v2
   > EOF
 
   $ hg clone -U http://localhost:$HGPORT largefile-provided --traceback
-  applying clone bundle from largefile://14ee2f0b3f1d14aeeb2fe037e09fc295c3cf59f5
+  applying clone bundle from largefile://1f74b3d08286b9b3a16fb3fa185dd29219cbc6ae
   adding changesets
   adding manifests
   adding file changes
--- a/tests/test-debugbundle.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-debugbundle.t	Tue May 22 21:51:20 2018 -0400
@@ -31,17 +31,17 @@
 
   $ hg debugbundle bundle2.hg
   Stream params: {}
-  changegroup -- {nbchanges: 2, version: 02}
+  changegroup -- {nbchanges: 2, version: 02} (mandatory: True)
       0e067c57feba1a5694ca4844f05588bb1bf82342
       991a3460af53952d10ec8a295d3d2cc2e5fa9690
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
 
 Quiet output
 
   $ hg debugbundle --quiet bundle2.hg
   Stream params: {}
-  changegroup -- {nbchanges: 2, version: 02}
-  cache:rev-branch-cache -- {}
+  changegroup -- {nbchanges: 2, version: 02} (mandatory: True)
+  cache:rev-branch-cache -- {} (mandatory: False)
 
 Verbose output:
 
@@ -64,7 +64,7 @@
 
   $ hg debugbundle --all bundle2.hg
   Stream params: {}
-  changegroup -- {nbchanges: 2, version: 02}
+  changegroup -- {nbchanges: 2, version: 02} (mandatory: True)
       format: id, p1, p2, cset, delta base, len(delta)
   
       changelog
@@ -80,6 +80,6 @@
   
       c
       b80de5d138758541c5f05265ad144ab9fa86d1db 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 991a3460af53952d10ec8a295d3d2cc2e5fa9690 0000000000000000000000000000000000000000 0
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
 
   $ cd ..
--- a/tests/test-debugcommands.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-debugcommands.t	Tue May 22 21:51:20 2018 -0400
@@ -333,6 +333,19 @@
   .hg/cache/rbc-names-v1
   .hg/cache/branch2-served
 
+Test debugcolor
+
+#if no-windows
+  $ hg debugcolor --style --color always | egrep 'mode|style|log\.'
+  color mode: ansi
+  available style:
+  \x1b[0;33mlog.changeset\x1b[0m:                      \x1b[0;33myellow\x1b[0m (esc)
+#endif
+
+  $ hg debugcolor --style --color never
+  color mode: None
+  available style:
+
   $ cd ..
 
 Test internal debugstacktrace command
--- a/tests/test-generaldelta.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-generaldelta.t	Tue May 22 21:51:20 2018 -0400
@@ -159,10 +159,10 @@
   saved backup bundle to $TESTTMP/aggressive/.hg/strip-backup/1c5d4dc9a8b8-6c68e60c-backup.hg
   $ hg debugbundle .hg/strip-backup/*
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       1c5d4dc9a8b8d6e1750966d343e94db665e7a1e9
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
+  phase-heads -- {} (mandatory: True)
       1c5d4dc9a8b8d6e1750966d343e94db665e7a1e9 draft
 
   $ cd ..
--- a/tests/test-getbundle.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-getbundle.t	Tue May 22 21:51:20 2018 -0400
@@ -170,7 +170,7 @@
   $ hg debuggetbundle repo bundle -t bundle2
   $ hg debugbundle bundle
   Stream params: {}
-  changegroup -- {version: 01}
+  changegroup -- {version: 01} (mandatory: True)
       7704483d56b2a7b5db54dcee7c62378ac629b348
       29a4d1f17bd3f0779ca0525bebb1cfb51067c738
       713346a995c363120712aed1aee7e04afd867638
--- a/tests/test-help.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-help.t	Tue May 22 21:51:20 2018 -0400
@@ -278,7 +278,6 @@
        purge         command to delete untracked files from the working
                      directory
        relink        recreates hardlinks between repository clones
-       remotenames   showing remotebookmarks and remotebranches in UI
        schemes       extend schemes with shortcuts to repository swarms
        share         share a common history between several working directories
        shelve        save and restore changes to the working directory
--- a/tests/test-hgweb-commands.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-hgweb-commands.t	Tue May 22 21:51:20 2018 -0400
@@ -17,7 +17,7 @@
   adding da/foo
   adding foo
   $ hg tag 1.0
-  $ hg bookmark something
+  $ hg bookmark some-thing
   $ hg bookmark -r0 anotherthing
   $ echo another > foo
   $ hg branch stable
@@ -87,7 +87,7 @@
       </tr>
       <tr>
        <th style="text-align:left;">bookmark</th>
-       <td>something</td>
+       <td>some-thing</td>
       </tr>
       <tr>
        <th style="text-align:left;">tag</th>
@@ -267,7 +267,7 @@
               </tr>
               <tr>
                   <th style="text-align:left;">bookmark</th>
-                  <td>something</td>
+                  <td>some-thing</td>
               </tr>
               <tr>
                   <th style="text-align:left;">tag</th>
@@ -770,7 +770,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/cad8025a2e87">branch commit with null character: </a>
-     <span class="phase">draft</span> <span class="branchhead">unstable</span> <span class="tag">tip</span> <span class="tag">something</span> 
+     <span class="phase">draft</span> <span class="branchhead">unstable</span> <span class="tag">tip</span> <span class="tag">some-thing</span> 
     </td>
    </tr>
    <tr>
@@ -916,9 +916,9 @@
     <td class="diffstat">
        2 files changed, 2 insertions(+), 0 deletions(-)
   
-      <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
+      <a id="diffstatexpand" class="diffstattoggle" href="#">[<tt>+</tt>]</a>
       <div id="diffstatdetails" style="display:none;">
-        <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
+        <a class="diffstattoggle" href="#">[<tt>-</tt>]</a>
         <table class="diffstat-table stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">da/foo</a></td>
       <td class="diffstat-total" align="right">1</td>
@@ -942,7 +942,7 @@
   </table>
   
   <div class="overflow">
-  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
   <div class="sourcefirst"> line diff</div>
   <div class="stripes2 diffblocks">
   <div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -1192,7 +1192,7 @@
   summary:     branch commit with null character: \x00 (esc)
   branch:      unstable
   tag:         tip
-  bookmark:    something
+  bookmark:    some-thing
   
   changeset:   1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
   revision:    2
@@ -1228,6 +1228,42 @@
   
   
 
+Revset query with foo-bar bookmark (issue5879)
+
+  $ get-with-headers.py $LOCALIP:$HGPORT 'log?rev=some-thing%25anotherthing&style=raw'
+  200 Script output follows
+  
+  
+  # HG changesets search
+  # Node ID cad8025a2e87f88c06259790adfa15acb4080123
+  # Query "some-thing%anotherthing"
+  # Mode revset expression search
+  
+  changeset:   cad8025a2e87f88c06259790adfa15acb4080123
+  revision:    3
+  user:        test
+  date:        Thu, 01 Jan 1970 00:00:00 +0000
+  summary:     branch commit with null character: \x00 (esc)
+  branch:      unstable
+  tag:         tip
+  bookmark:    some-thing
+  
+  changeset:   1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
+  revision:    2
+  user:        test
+  date:        Thu, 01 Jan 1970 00:00:00 +0000
+  summary:     branch
+  branch:      stable
+  
+  changeset:   a4f92ed23982be056b9852de5dfe873eaac7f0de
+  revision:    1
+  user:        test
+  date:        Thu, 01 Jan 1970 00:00:00 +0000
+  summary:     Added tag 1.0 for changeset 2ef0ac749a14
+  branch:      default
+  
+  
+
 File-related
 
   $ get-with-headers.py $LOCALIP:$HGPORT 'file/1/foo/?style=raw'
@@ -1342,7 +1378,7 @@
   </table>
   
   <div class="overflow">
-  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
   <div class="sourcefirst"> line source</div>
   <pre class="sourcelines stripes4 wrap bottomline"
        data-logurl="/log/1/foo"
@@ -1476,7 +1512,7 @@
   </table>
   
   <div class="overflow">
-  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
   <div class="sourcefirst"> line source</div>
   <pre class="sourcelines stripes4 wrap bottomline"
        data-logurl="/log/2/foo"
@@ -1515,7 +1551,7 @@
   $ get-with-headers.py $LOCALIP:$HGPORT 'raw-bookmarks'
   200 Script output follows
   
-  something	cad8025a2e87f88c06259790adfa15acb4080123
+  some-thing	cad8025a2e87f88c06259790adfa15acb4080123
   anotherthing	2ef0ac749a14e4f57a5a822464a0902c6f7f448f
   $ get-with-headers.py $LOCALIP:$HGPORT 'summary/?style=gitweb'
   200 Script output follows
@@ -1581,7 +1617,7 @@
   <td>
   <a class="list" href="/rev/cad8025a2e87?style=gitweb">
   <b>branch commit with null character: </b>
-  <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="unstable">unstable</span> <span class="tagtag" title="tip">tip</span> <span class="bookmarktag" title="something">something</span> </span>
+  <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="unstable">unstable</span> <span class="tagtag" title="tip">tip</span> <span class="bookmarktag" title="some-thing">some-thing</span> </span>
   </a>
   </td>
   <td class="link" nowrap>
@@ -1654,7 +1690,7 @@
   
   <tr class="parity0">
   <td class="age"><i class="age">Thu, 01 Jan 1970 00:00:00 +0000</i></td>
-  <td><a class="list" href="/rev/something?style=gitweb"><b>something</b></a></td>
+  <td><a class="list" href="/rev/some-thing?style=gitweb"><b>some-thing</b></a></td>
   <td class="link">
   <a href="/rev/cad8025a2e87?style=gitweb">changeset</a> |
   <a href="/log/cad8025a2e87?style=gitweb">changelog</a> |
@@ -1782,7 +1818,7 @@
     <span class="desc">
      <a class="list" href="/rev/cad8025a2e87?style=gitweb"><b>branch commit with null character: </b></a>
     </span>
-    <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="unstable">unstable</span> <span class="tagtag" title="tip">tip</span> <span class="bookmarktag" title="something">something</span> </span>
+    <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="unstable">unstable</span> <span class="tagtag" title="tip">tip</span> <span class="bookmarktag" title="some-thing">some-thing</span> </span>
     <div class="info">1970-01-01, by test</div>
    </div>
   </li>
@@ -1871,7 +1907,7 @@
   summary:     branch commit with null character: \x00 (esc)
   branch:      unstable
   tag:         tip
-  bookmark:    something
+  bookmark:    some-thing
   
   node:        (0, 0) (color 1)
   edge:        (0, 0) -> (0, 1) (color 1)
--- a/tests/test-hgweb-csp.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-hgweb-csp.t	Tue May 22 21:51:20 2018 -0400
@@ -54,6 +54,12 @@
   200 Script output follows
   content-security-policy: script-src https://example.com/ 'unsafe-inline'
 
+  $ get-with-headers.py --twice --headeronly localhost:$HGPORT repo1/static/style.css content-security-policy
+  200 Script output follows
+  content-security-policy: script-src https://example.com/ 'unsafe-inline'
+  304 Not Modified
+  content-security-policy: script-src https://example.com/ 'unsafe-inline'
+
 repo page should send CSP by default, include etag w/o nonce
 
   $ get-with-headers.py --headeronly localhost:$HGPORT repo1 content-security-policy etag
--- a/tests/test-hgweb-diffs.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-hgweb-diffs.t	Tue May 22 21:51:20 2018 -0400
@@ -122,9 +122,9 @@
     <td class="diffstat">
        2 files changed, 2 insertions(+), 0 deletions(-)
   
-      <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
+      <a id="diffstatexpand" class="diffstattoggle" href="#">[<tt>+</tt>]</a>
       <div id="diffstatdetails" style="display:none;">
-        <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
+        <a class="diffstattoggle" href="#">[<tt>-</tt>]</a>
         <table class="diffstat-table stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">a</a></td>
       <td class="diffstat-total" align="right">1</td>
@@ -148,7 +148,7 @@
   </table>
   
   <div class="overflow">
-  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
   <div class="sourcefirst"> line diff</div>
   <div class="stripes2 diffblocks">
   <div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -289,7 +289,7 @@
   </table>
   
   <div class="overflow">
-  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
   <div class="sourcefirst"> line diff</div>
   <div class="stripes2 diffblocks">
   <div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -419,9 +419,9 @@
     <td class="diffstat">
        2 files changed, 2 insertions(+), 0 deletions(-)
   
-      <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
+      <a id="diffstatexpand" class="diffstattoggle" href="#">[<tt>+</tt>]</a>
       <div id="diffstatdetails" style="display:none;">
-        <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
+        <a class="diffstattoggle" href="#">[<tt>-</tt>]</a>
         <table class="diffstat-table stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">a</a></td>
       <td class="diffstat-total" align="right">1</td>
@@ -445,7 +445,7 @@
   </table>
   
   <div class="overflow">
-  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
   <div class="sourcefirst"> line diff</div>
   <div class="stripes2 diffblocks">
   <div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -590,7 +590,7 @@
   </table>
   
   <div class="overflow">
-  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
   <div class="sourcefirst"> line diff</div>
   <div class="stripes2 diffblocks">
   <div class="bottomline inc-lineno"><pre class="sourcelines wrap">
--- a/tests/test-hgweb-removed.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-hgweb-removed.t	Tue May 22 21:51:20 2018 -0400
@@ -103,9 +103,9 @@
     <td class="diffstat">
        1 files changed, 0 insertions(+), 1 deletions(-)
   
-      <a id="diffstatexpand" href="javascript:toggleDiffstat()">[<tt>+</tt>]</a>
+      <a id="diffstatexpand" class="diffstattoggle" href="#">[<tt>+</tt>]</a>
       <div id="diffstatdetails" style="display:none;">
-        <a href="javascript:toggleDiffstat()">[<tt>-</tt>]</a>
+        <a class="diffstattoggle" href="#">[<tt>-</tt>]</a>
         <table class="diffstat-table stripes2">  <tr>
       <td class="diffstat-file"><a href="#l1.1">a</a></td>
       <td class="diffstat-total" align="right">1</td>
@@ -121,7 +121,7 @@
   </table>
   
   <div class="overflow">
-  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
   <div class="sourcefirst"> line diff</div>
   <div class="stripes2 diffblocks">
   <div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -225,7 +225,7 @@
   </table>
   
   <div class="overflow">
-  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
   <div class="sourcefirst"> line diff</div>
   <div class="stripes2 diffblocks">
   <div class="bottomline inc-lineno"><pre class="sourcelines wrap">
--- a/tests/test-hgweb.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-hgweb.t	Tue May 22 21:51:20 2018 -0400
@@ -875,4 +875,23 @@
   Internal Server Error (no-eol)
 
   $ killdaemons.py
+
+HTTP 304 works with hgwebdir (issue5844)
+
+  $ cat > hgweb.conf << EOF
+  > [paths]
+  > /repo = $TESTTMP/test
+  > EOF
+
+  $ hg serve --web-conf hgweb.conf -p $HGPORT -d --pid-file hg.pid -E error.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ get-with-headers.py --twice --headeronly localhost:$HGPORT 'repo/static/style.css' - date etag server
+  200 Script output follows
+  content-length: 2677
+  content-type: text/css
+  304 Not Modified
+
+  $ killdaemons.py
+
   $ cd ..
--- a/tests/test-highlight.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-highlight.t	Tue May 22 21:51:20 2018 -0400
@@ -146,7 +146,7 @@
   </table>
   
   <div class="overflow">
-  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
+  <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="#">on</a></div>
   <div class="sourcefirst"> line source</div>
   <pre class="sourcelines stripes4 wrap bottomline"
        data-logurl="/log/tip/primes.py"
--- a/tests/test-http-bad-server.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-http-bad-server.t	Tue May 22 21:51:20 2018 -0400
@@ -857,7 +857,7 @@
   write(41 from 41) -> (125) 23\\r\\n\x08LISTKEYS\x00\x00\x00\x02\x01\x00		namespacebookmarks\\r\\n (esc)
   write(9 from 9) -> (116) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc)
   write(9 from 9) -> (107) 4\\r\\n\x00\x00\x00\x1d\\r\\n (esc)
-  write(35 from 35) -> (72) 1d\\r\\n\x16CACHE:REV-BRANCH-CACHE\x00\x00\x00\x03\x00\x00\\r\\n (esc)
+  write(35 from 35) -> (72) 1d\\r\\n\x16cache:rev-branch-cache\x00\x00\x00\x03\x00\x00\\r\\n (esc)
   write(9 from 9) -> (63) 4\\r\\n\x00\x00\x00'\\r\\n (esc)
   write(45 from 45) -> (18) 27\\r\\n\x00\x00\x00\x07\x00\x00\x00\x01\x00\x00\x00\x00default\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\\r\\n (esc)
   write(9 from 9) -> (9) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc)
@@ -901,7 +901,7 @@
   write(41 from 41) -> (128) 23\\r\\n\x08LISTKEYS\x00\x00\x00\x02\x01\x00		namespacebookmarks\\r\\n (esc)
   write(9 from 9) -> (119) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc)
   write(9 from 9) -> (110) 4\\r\\n\x00\x00\x00\x1d\\r\\n (esc)
-  write(35 from 35) -> (75) 1d\\r\\n\x16CACHE:REV-BRANCH-CACHE\x00\x00\x00\x03\x00\x00\\r\\n (esc)
+  write(35 from 35) -> (75) 1d\\r\\n\x16cache:rev-branch-cache\x00\x00\x00\x03\x00\x00\\r\\n (esc)
   write(9 from 9) -> (66) 4\\r\\n\x00\x00\x00'\\r\\n (esc)
   write(45 from 45) -> (21) 27\\r\\n\x00\x00\x00\x07\x00\x00\x00\x01\x00\x00\x00\x00default\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\\r\\n (esc)
   write(9 from 9) -> (12) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc)
--- a/tests/test-http-protocol.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-http-protocol.t	Tue May 22 21:51:20 2018 -0400
@@ -257,7 +257,7 @@
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
   s>     Content-Type: application/mercurial-0.1\r\n
-  s>     Content-Length: 458\r\n
+  s>     Content-Length: *\r\n (glob)
   s>     \r\n
   s>     batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
   sending heads command
@@ -281,7 +281,7 @@
 
   $ killdaemons.py
   $ enablehttpv2 empty
-  $ hg -R empty serve -p $HGPORT -d --pid-file hg.pid
+  $ hg --config server.compressionengines=zlib -R empty serve -p $HGPORT -d --pid-file hg.pid
   $ cat hg.pid > $DAEMON_PIDS
 
 Client with HTTPv2 enabled automatically upgrades if the server supports it
@@ -305,7 +305,7 @@
   s>     Content-Type: application/mercurial-cbor\r\n
   s>     Content-Length: *\r\n (glob)
   s>     \r\n
-  s>     \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
+  s>     \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x81\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xc5batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
   sending heads command
   s>     POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
@@ -333,3 +333,394 @@
   response: [b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00']
 
   $ killdaemons.py
+
+HTTP client follows HTTP redirect on handshake to new repo
+
+  $ cd $TESTTMP
+
+  $ hg init redirector
+  $ hg init redirected
+  $ cd redirected
+  $ touch foo
+  $ hg -q commit -A -m initial
+  $ cd ..
+
+  $ cat > paths.conf << EOF
+  > [paths]
+  > / = $TESTTMP/*
+  > EOF
+
+  $ cat > redirectext.py << EOF
+  > from mercurial import extensions, wireprotoserver
+  > def wrappedcallhttp(orig, repo, req, res, proto, cmd):
+  >     path = req.advertisedurl[len(req.advertisedbaseurl):]
+  >     if not path.startswith(b'/redirector'):
+  >         return orig(repo, req, res, proto, cmd)
+  >     relpath = path[len(b'/redirector'):]
+  >     res.status = b'301 Redirect'
+  >     newurl = b'%s/redirected%s' % (req.baseurl, relpath)
+  >     if not repo.ui.configbool('testing', 'redirectqs', True) and b'?' in newurl:
+  >         newurl = newurl[0:newurl.index(b'?')]
+  >     res.headers[b'Location'] = newurl
+  >     res.headers[b'Content-Type'] = b'text/plain'
+  >     res.setbodybytes(b'redirected')
+  >     return True
+  > 
+  > extensions.wrapfunction(wireprotoserver, '_callhttp', wrappedcallhttp)
+  > EOF
+
+  $ hg --config extensions.redirect=$TESTTMP/redirectext.py \
+  >    --config server.compressionengines=zlib \
+  >     serve --web-conf paths.conf --pid-file hg.pid -p $HGPORT -d
+  $ cat hg.pid > $DAEMON_PIDS
+
+Verify our HTTP 301 is served properly
+
+  $ hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT << EOF
+  > httprequest GET /redirector?cmd=capabilities
+  >     user-agent: test
+  > EOF
+  using raw connection to peer
+  s>     GET /redirector?cmd=capabilities HTTP/1.1\r\n
+  s>     Accept-Encoding: identity\r\n
+  s>     user-agent: test\r\n
+  s>     host: $LOCALIP:$HGPORT\r\n (glob)
+  s>     \r\n
+  s> makefile('rb', None)
+  s>     HTTP/1.1 301 Redirect\r\n
+  s>     Server: testing stub value\r\n
+  s>     Date: $HTTP_DATE$\r\n
+  s>     Location: http://$LOCALIP:$HGPORT/redirected?cmd=capabilities\r\n (glob)
+  s>     Content-Type: text/plain\r\n
+  s>     Content-Length: 10\r\n
+  s>     \r\n
+  s>     redirected
+  s>     GET /redirected?cmd=capabilities HTTP/1.1\r\n
+  s>     Accept-Encoding: identity\r\n
+  s>     user-agent: test\r\n
+  s>     host: $LOCALIP:$HGPORT\r\n (glob)
+  s>     \r\n
+  s> makefile('rb', None)
+  s>     HTTP/1.1 200 Script output follows\r\n
+  s>     Server: testing stub value\r\n
+  s>     Date: $HTTP_DATE$\r\n
+  s>     Content-Type: application/mercurial-0.1\r\n
+  s>     Content-Length: 453\r\n
+  s>     \r\n
+  s>     batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
+
+Test with the HTTP peer
+
+  $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT/redirector << EOF
+  > command heads
+  > EOF
+  s>     GET /redirector?cmd=capabilities HTTP/1.1\r\n
+  s>     Accept-Encoding: identity\r\n
+  s>     accept: application/mercurial-0.1\r\n
+  s>     host: $LOCALIP:$HGPORT\r\n (glob)
+  s>     user-agent: Mercurial debugwireproto\r\n
+  s>     \r\n
+  s> makefile('rb', None)
+  s>     HTTP/1.1 301 Redirect\r\n
+  s>     Server: testing stub value\r\n
+  s>     Date: $HTTP_DATE$\r\n
+  s>     Location: http://$LOCALIP:$HGPORT/redirected?cmd=capabilities\r\n (glob)
+  s>     Content-Type: text/plain\r\n
+  s>     Content-Length: 10\r\n
+  s>     \r\n
+  s>     redirected
+  s>     GET /redirected?cmd=capabilities HTTP/1.1\r\n
+  s>     Accept-Encoding: identity\r\n
+  s>     accept: application/mercurial-0.1\r\n
+  s>     host: $LOCALIP:$HGPORT\r\n (glob)
+  s>     user-agent: Mercurial debugwireproto\r\n
+  s>     \r\n
+  s> makefile('rb', None)
+  s>     HTTP/1.1 200 Script output follows\r\n
+  s>     Server: testing stub value\r\n
+  s>     Date: $HTTP_DATE$\r\n
+  s>     Content-Type: application/mercurial-0.1\r\n
+  s>     Content-Length: 453\r\n
+  s>     \r\n
+  real URL is http://$LOCALIP:$HGPORT/redirected (glob)
+  s>     batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
+  sending heads command
+  s>     GET /redirected?cmd=heads HTTP/1.1\r\n
+  s>     Accept-Encoding: identity\r\n
+  s>     vary: X-HgProto-1\r\n
+  s>     x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
+  s>     accept: application/mercurial-0.1\r\n
+  s>     host: $LOCALIP:$HGPORT\r\n (glob)
+  s>     user-agent: Mercurial debugwireproto\r\n
+  s>     \r\n
+  s> makefile('rb', None)
+  s>     HTTP/1.1 200 Script output follows\r\n
+  s>     Server: testing stub value\r\n
+  s>     Date: $HTTP_DATE$\r\n
+  s>     Content-Type: application/mercurial-0.1\r\n
+  s>     Content-Length: 41\r\n
+  s>     \r\n
+  s>     96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n
+  response: [b'\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL']
+
+  $ killdaemons.py
+
+Now test a variation where we strip the query string from the redirect URL.
+(SCM Manager apparently did this and clients would recover from it)
+
+  $ hg --config extensions.redirect=$TESTTMP/redirectext.py \
+  >    --config server.compressionengines=zlib \
+  >    --config testing.redirectqs=false \
+  >     serve --web-conf paths.conf --pid-file hg.pid -p $HGPORT -d
+  $ cat hg.pid > $DAEMON_PIDS
+
+  $ hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT << EOF
+  > httprequest GET /redirector?cmd=capabilities
+  >     user-agent: test
+  > EOF
+  using raw connection to peer
+  s>     GET /redirector?cmd=capabilities HTTP/1.1\r\n
+  s>     Accept-Encoding: identity\r\n
+  s>     user-agent: test\r\n
+  s>     host: $LOCALIP:$HGPORT\r\n (glob)
+  s>     \r\n
+  s> makefile('rb', None)
+  s>     HTTP/1.1 301 Redirect\r\n
+  s>     Server: testing stub value\r\n
+  s>     Date: $HTTP_DATE$\r\n
+  s>     Location: http://$LOCALIP:$HGPORT/redirected\r\n (glob)
+  s>     Content-Type: text/plain\r\n
+  s>     Content-Length: 10\r\n
+  s>     \r\n
+  s>     redirected
+  s>     GET /redirected HTTP/1.1\r\n
+  s>     Accept-Encoding: identity\r\n
+  s>     user-agent: test\r\n
+  s>     host: $LOCALIP:$HGPORT\r\n (glob)
+  s>     \r\n
+  s> makefile('rb', None)
+  s>     HTTP/1.1 200 Script output follows\r\n
+  s>     Server: testing stub value\r\n
+  s>     Date: $HTTP_DATE$\r\n
+  s>     ETag: W/"*"\r\n (glob)
+  s>     Content-Type: text/html; charset=ascii\r\n
+  s>     Transfer-Encoding: chunked\r\n
+  s>     \r\n
+  s>     414\r\n
+  s>     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n
+  s>     <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">\n
+  s>     <head>\n
+  s>     <link rel="icon" href="/redirected/static/hgicon.png" type="image/png" />\n
+  s>     <meta name="robots" content="index, nofollow" />\n
+  s>     <link rel="stylesheet" href="/redirected/static/style-paper.css" type="text/css" />\n
+  s>     <script type="text/javascript" src="/redirected/static/mercurial.js"></script>\n
+  s>     \n
+  s>     <title>redirected: log</title>\n
+  s>     <link rel="alternate" type="application/atom+xml"\n
+  s>        href="/redirected/atom-log" title="Atom feed for redirected" />\n
+  s>     <link rel="alternate" type="application/rss+xml"\n
+  s>        href="/redirected/rss-log" title="RSS feed for redirected" />\n
+  s>     </head>\n
+  s>     <body>\n
+  s>     \n
+  s>     <div class="container">\n
+  s>     <div class="menu">\n
+  s>     <div class="logo">\n
+  s>     <a href="https://mercurial-scm.org/">\n
+  s>     <img src="/redirected/static/hglogo.png" alt="mercurial" /></a>\n
+  s>     </div>\n
+  s>     <ul>\n
+  s>     <li class="active">log</li>\n
+  s>     <li><a href="/redirected/graph/tip">graph</a></li>\n
+  s>     <li><a href="/redirected/tags">tags</a></li>\n
+  s>     <li><a href="
+  s>     \r\n
+  s>     810\r\n
+  s>     /redirected/bookmarks">bookmarks</a></li>\n
+  s>     <li><a href="/redirected/branches">branches</a></li>\n
+  s>     </ul>\n
+  s>     <ul>\n
+  s>     <li><a href="/redirected/rev/tip">changeset</a></li>\n
+  s>     <li><a href="/redirected/file/tip">browse</a></li>\n
+  s>     </ul>\n
+  s>     <ul>\n
+  s>     \n
+  s>     </ul>\n
+  s>     <ul>\n
+  s>      <li><a href="/redirected/help">help</a></li>\n
+  s>     </ul>\n
+  s>     <div class="atom-logo">\n
+  s>     <a href="/redirected/atom-log" title="subscribe to atom feed">\n
+  s>     <img class="atom-logo" src="/redirected/static/feed-icon-14x14.png" alt="atom feed" />\n
+  s>     </a>\n
+  s>     </div>\n
+  s>     </div>\n
+  s>     \n
+  s>     <div class="main">\n
+  s>     <h2 class="breadcrumb"><a href="/">Mercurial</a> &gt; <a href="/redirected">redirected</a> </h2>\n
+  s>     <h3>log</h3>\n
+  s>     \n
+  s>     \n
+  s>     <form class="search" action="/redirected/log">\n
+  s>     \n
+  s>     <p><input name="rev" id="search1" type="text" size="30" value="" /></p>\n
+  s>     <div id="hint">Find changesets by keywords (author, files, the commit message), revision\n
+  s>     number or hash, or <a href="/redirected/help/revsets">revset expression</a>.</div>\n
+  s>     </form>\n
+  s>     \n
+  s>     <div class="navigate">\n
+  s>     <a href="/redirected/shortlog/tip?revcount=30">less</a>\n
+  s>     <a href="/redirected/shortlog/tip?revcount=120">more</a>\n
+  s>     | rev 0: <a href="/redirected/shortlog/96ee1d7354c4">(0)</a> <a href="/redirected/shortlog/tip">tip</a> \n
+  s>     </div>\n
+  s>     \n
+  s>     <table class="bigtable">\n
+  s>     <thead>\n
+  s>      <tr>\n
+  s>       <th class="age">age</th>\n
+  s>       <th class="author">author</th>\n
+  s>       <th class="description">description</th>\n
+  s>      </tr>\n
+  s>     </thead>\n
+  s>     <tbody class="stripes2">\n
+  s>      <tr>\n
+  s>       <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>\n
+  s>       <td class="author">test</td>\n
+  s>       <td class="description">\n
+  s>        <a href="/redirected/rev/96ee1d7354c4">initial</a>\n
+  s>        <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> \n
+  s>       </td>\n
+  s>      </tr>\n
+  s>     \n
+  s>     </tbody>\n
+  s>     </table>\n
+  s>     \n
+  s>     <div class="navigate">\n
+  s>     <a href="/redirected/shortlog/tip?revcount=30">less</a>\n
+  s>     <a href="/redirected/shortlog/tip?revcount=120">more</a>\n
+  s>     | rev 0: <a href="/redirected/shortlog/96ee1d7354c4">(0)</a> <a href="/redirected/shortlog/tip">tip</a> \n
+  s>     </div>\n
+  s>     \n
+  s>     <script type="text/javascript">\n
+  s>         ajaxScrollInit(\n
+  s>                 \'/redirected/shortlog/%next%\',\n
+  s>                 \'\', <!-- NEXTHASH\n
+  s>                 function (htmlText) {
+  s>     \r\n
+  s>     14a\r\n
+  s>     \n
+  s>                     var m = htmlText.match(/\'(\\w+)\', <!-- NEXTHASH/);\n
+  s>                     return m ? m[1] : null;\n
+  s>                 },\n
+  s>                 \'.bigtable > tbody\',\n
+  s>                 \'<tr class="%class%">\\\n
+  s>                 <td colspan="3" style="text-align: center;">%text%</td>\\\n
+  s>                 </tr>\'\n
+  s>         );\n
+  s>     </script>\n
+  s>     \n
+  s>     </div>\n
+  s>     </div>\n
+  s>     \n
+  s>     \n
+  s>     \n
+  s>     </body>\n
+  s>     </html>\n
+  s>     \n
+  s>     \r\n
+  s>     0\r\n
+  s>     \r\n
+
+  $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT/redirector << EOF
+  > command heads
+  > EOF
+  s>     GET /redirector?cmd=capabilities HTTP/1.1\r\n
+  s>     Accept-Encoding: identity\r\n
+  s>     accept: application/mercurial-0.1\r\n
+  s>     host: $LOCALIP:$HGPORT\r\n (glob)
+  s>     user-agent: Mercurial debugwireproto\r\n
+  s>     \r\n
+  s> makefile('rb', None)
+  s>     HTTP/1.1 301 Redirect\r\n
+  s>     Server: testing stub value\r\n
+  s>     Date: $HTTP_DATE$\r\n
+  s>     Location: http://$LOCALIP:$HGPORT/redirected\r\n (glob)
+  s>     Content-Type: text/plain\r\n
+  s>     Content-Length: 10\r\n
+  s>     \r\n
+  s>     redirected
+  s>     GET /redirected HTTP/1.1\r\n
+  s>     Accept-Encoding: identity\r\n
+  s>     accept: application/mercurial-0.1\r\n
+  s>     host: $LOCALIP:$HGPORT\r\n (glob)
+  s>     user-agent: Mercurial debugwireproto\r\n
+  s>     \r\n
+  s> makefile('rb', None)
+  s>     HTTP/1.1 200 Script output follows\r\n
+  s>     Server: testing stub value\r\n
+  s>     Date: $HTTP_DATE$\r\n
+  s>     ETag: W/"*"\r\n (glob)
+  s>     Content-Type: text/html; charset=ascii\r\n
+  s>     Transfer-Encoding: chunked\r\n
+  s>     \r\n
+  real URL is http://$LOCALIP:$HGPORT/redirected (glob)
+  s>     414\r\n
+  s>     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n
+  s>     <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">\n
+  s>     <head>\n
+  s>     <link rel="icon" href="/redirected/static/hgicon.png" type="image/png" />\n
+  s>     <meta name="robots" content="index, nofollow" />\n
+  s>     <link rel="stylesheet" href="/redirected/static/style-paper.css" type="text/css" />\n
+  s>     <script type="text/javascript" src="/redirected/static/mercurial.js"></script>\n
+  s>     \n
+  s>     <title>redirected: log</title>\n
+  s>     <link rel="alternate" type="application/atom+xml"\n
+  s>        href="/redirected/atom-log" title="Atom feed for redirected" />\n
+  s>     <link rel="alternate" type="application/rss+xml"\n
+  s>        href="/redirected/rss-log" title="RSS feed for redirected" />\n
+  s>     </head>\n
+  s>     <body>\n
+  s>     \n
+  s>     <div class="container">\n
+  s>     <div class="menu">\n
+  s>     <div class="logo">\n
+  s>     <a href="https://mercurial-scm.org/">\n
+  s>     <img src="/redirected/static/hglogo.png" alt="mercurial" /></a>\n
+  s>     </div>\n
+  s>     <ul>\n
+  s>     <li class="active">log</li>\n
+  s>     <li><a href="/redirected/graph/tip">graph</a></li>\n
+  s>     <li><a href="/redirected/tags">tags</a
+  s>     GET /redirected?cmd=capabilities HTTP/1.1\r\n
+  s>     Accept-Encoding: identity\r\n
+  s>     accept: application/mercurial-0.1\r\n
+  s>     host: $LOCALIP:$HGPORT\r\n (glob)
+  s>     user-agent: Mercurial debugwireproto\r\n
+  s>     \r\n
+  s> makefile('rb', None)
+  s>     HTTP/1.1 200 Script output follows\r\n
+  s>     Server: testing stub value\r\n
+  s>     Date: $HTTP_DATE$\r\n
+  s>     Content-Type: application/mercurial-0.1\r\n
+  s>     Content-Length: 453\r\n
+  s>     \r\n
+  real URL is http://$LOCALIP:$HGPORT/redirected (glob)
+  s>     batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
+  sending heads command
+  s>     GET /redirected?cmd=heads HTTP/1.1\r\n
+  s>     Accept-Encoding: identity\r\n
+  s>     vary: X-HgProto-1\r\n
+  s>     x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
+  s>     accept: application/mercurial-0.1\r\n
+  s>     host: $LOCALIP:$HGPORT\r\n (glob)
+  s>     user-agent: Mercurial debugwireproto\r\n
+  s>     \r\n
+  s> makefile('rb', None)
+  s>     HTTP/1.1 200 Script output follows\r\n
+  s>     Server: testing stub value\r\n
+  s>     Date: $HTTP_DATE$\r\n
+  s>     Content-Type: application/mercurial-0.1\r\n
+  s>     Content-Length: 41\r\n
+  s>     \r\n
+  s>     96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n
+  response: [b'\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL']
--- a/tests/test-lfs-serve-access.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-lfs-serve-access.t	Tue May 22 21:51:20 2018 -0400
@@ -93,7 +93,7 @@
   bundle2-input-part: "listkeys" (params: 1 mandatory) supported
   bundle2-input-part: "phase-heads" supported
   bundle2-input-part: total payload size 24
-  bundle2-input-part: "cache:rev-branch-cache" supported
+  bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
   bundle2-input-part: total payload size 39
   bundle2-input-bundle: 3 parts total
   checking for updated bookmarks
--- a/tests/test-obsolete-changeset-exchange.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-obsolete-changeset-exchange.t	Tue May 22 21:51:20 2018 -0400
@@ -93,15 +93,15 @@
   1 changesets found
   $ hg debugbundle ../f89bcc95eba5.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       f89bcc95eba5174b1ccc3e33a82e84c96e8338ee
-  cache:rev-branch-cache -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
   $ hg debugbundle ../f89bcc95eba5-obs.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       f89bcc95eba5174b1ccc3e33a82e84c96e8338ee
-  cache:rev-branch-cache -- {}
-  obsmarkers -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
+  obsmarkers -- {} (mandatory: True)
       version: 1 (70 bytes)
       9d73aac1b2ed7d53835eaeec212ed41ea47da53a f89bcc95eba5174b1ccc3e33a82e84c96e8338ee 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
 
@@ -159,7 +159,7 @@
   bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
   bundle2-output-part: "listkeys" (params: 1 mandatory) empty payload
   bundle2-output-part: "phase-heads" 24 bytes payload
-  bundle2-output-part: "cache:rev-branch-cache" streamed payload
+  bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
   adding changesets
@@ -172,7 +172,7 @@
   bundle2-input-part: "listkeys" (params: 1 mandatory) supported
   bundle2-input-part: "phase-heads" supported
   bundle2-input-part: total payload size 24
-  bundle2-input-part: "cache:rev-branch-cache" supported
+  bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
   bundle2-input-part: total payload size 39
   bundle2-input-bundle: 3 parts total
   checking for updated bookmarks
--- a/tests/test-obsolete.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-obsolete.t	Tue May 22 21:51:20 2018 -0400
@@ -1452,10 +1452,10 @@
   
   $ hg debugbundle .hg/strip-backup/e008cf283490-*-backup.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       e008cf2834908e5d6b0f792a9d4b0e2272260fb8
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
+  phase-heads -- {} (mandatory: True)
       e008cf2834908e5d6b0f792a9d4b0e2272260fb8 draft
 
 #if repobundlerepo
@@ -1495,14 +1495,14 @@
   
   $ hg debugbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 2, version: 02}
+  changegroup -- {nbchanges: 2, version: 02} (mandatory: True)
       e016b03fd86fcccc54817d120b90b751aaf367d6
       b0551702f918510f01ae838ab03a463054c67b46
-  cache:rev-branch-cache -- {}
-  obsmarkers -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
+  obsmarkers -- {} (mandatory: True)
       version: 1 (92 bytes)
       e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
-  phase-heads -- {}
+  phase-heads -- {} (mandatory: True)
       b0551702f918510f01ae838ab03a463054c67b46 draft
 
   $ hg unbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
--- a/tests/test-patchbomb.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-patchbomb.t	Tue May 22 21:51:20 2018 -0400
@@ -388,15 +388,15 @@
   Content-Disposition: attachment; filename="bundle.hg"
   Content-Transfer-Encoding: base64
   
-  SEcyMAAAAA5Db21wcmVzc2lvbj1CWkJaaDkxQVkmU1kHdO0GAAAN////vFcSXL9/8H7R09C/578I
-  Ak0E4pe4SIIIgQSgGEQOcLABGYYNKiaaZGEyYjJhGTTRpiHogxGmTRiGRkNMIwhhPSbQJtpQiJkn
-  poyk9I0PUeoNNNBkeUAHqGgD0Ro0NNBoBoaMagNBoNCpNPUemp6QGmgyaPSGmQxGhkZDQbUaBkHp
-  MhoaANNMhkIyIauvSJPL4aUXjIQemQXkoaqOKqAQDIABsZALnf0yCLAyvmktzDWBCVHO6bb6kCqE
-  ZobVEhmMBjs0oQzekgs6PgZSyII8zy9mmG9To49ZlN6TaX5BxlS7cJiuICUdyjNQPIIdQs1Qqqqk
-  JZ2/BksYcU4HQyssZcpkoMco6gRc888KF9BO7BvuSuIPz7A4crBoaQB+euFU1ilz8yIBBmNBDgRX
-  pVh4zkmPiSKcqRJxcshMqh0vkKlgQDTcOujtdmnMVBZfQiPPemcHm2098VJyHBAOqOwluyIKyG92
-  JAR0CCu9SB5q9DyPHUdc5yB5CurIZHt3GM0dCiQRIN0EAcQNmTYTiHdi6B6Dc/ma0hrmSCQXBzfU
-  BEwthEg0YGaJf4u5IpwoSAO6doMA
+  SEcyMAAAAA5Db21wcmVzc2lvbj1CWkJaaDkxQVkmU1l91TAVAAAN////vFcSXL9/8H7R09C/578I
+  Ak0E4pe4SIIIgQSgGEQOcLABGYYNKgJgmhpp6mmjIZMCZNMhpgBBpkaYJpo9QaZMg02iaY2lCImK
+  emk02kmEAeoA0D01ANBoHqHqADTaj1NAAyZqA0Gg0KiYnqaepk0eoNDTCGj1A0eoyBoGjRkYBqAB
+  poNMmhkBhENSP0knlYZbqyEIYxkFdpDUS6roBDMgAGhkAqd92kEcgyeMo2MM366gpLNHjfKrhJPN
+  vdBCHAEDsYzAvzkHKxy5KWBAmh5e1nFttGChpsxrgmutRG0YrsSLWEBH9h95cbZEKFeUKYykRXHa
+  Bkt2OSgELsqqnWKeMudBR+YSZCOSHrwPz7B/Gfou7/L6QV6S0IgclBCitBVHMxMFq/vGwp5WHezM
+  JwhKTnH0OkMbmVjrAkQKR7VM2aNSXn+GzLOCzOQm0AJ1TLCpdSgnfFPcY7mGxAOyHXS1YEFVi5O9
+  I4EVBBd8VRgN4n1MAm8l6QQ+yB60hkeX/0ZZmKoQRINkEBxEDZU2HjIZMcwWRvZtbRIa5kgkGIb/
+  SkImFwIkDtQxyX+LuSKcKEg+6pgKgA==
   --===============*==-- (glob)
 
 with a specific bundle type
--- a/tests/test-phases-exchange.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-phases-exchange.t	Tue May 22 21:51:20 2018 -0400
@@ -1307,6 +1307,18 @@
   [1]
   $ chmod -R +w .hg
 
+3. Test that push is prevented if lock was already acquired (not a permission
+error, but EEXIST)
+
+  $ touch .hg/store/lock
+  $ hg push ../Phi --config ui.timeout=1
+  pushing to ../Phi
+  waiting for lock on repository $TESTTMP/Upsilon held by ''
+  abort: repository $TESTTMP/Upsilon: timed out waiting for lock held by ''
+  (lock might be very busy)
+  [255]
+  $ rm .hg/store/lock
+
   $ cd ..
 
 #endif
--- a/tests/test-push-http.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-push-http.t	Tue May 22 21:51:20 2018 -0400
@@ -380,3 +380,47 @@
 #endif
 
   $ cd ..
+
+Pushing via hgwebdir works
+
+  $ hg init hgwebdir
+  $ cd hgwebdir
+  $ echo 0 > a
+  $ hg -q commit -A -m initial
+  $ cd ..
+
+  $ cat > web.conf << EOF
+  > [paths]
+  > / = *
+  > [web]
+  > push_ssl = false
+  > allow_push = *
+  > EOF
+
+  $ hg serve --web-conf web.conf -p $HGPORT -d --pid-file hg.pid
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ hg clone http://localhost:$HGPORT/hgwebdir hgwebdir-local
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  new changesets 98a3f8f02ba7
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd hgwebdir-local
+  $ echo commit > a
+  $ hg commit -m 'local commit'
+
+  $ hg push
+  pushing to http://localhost:$HGPORT/hgwebdir
+  searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 1 changes to 1 files
+
+  $ killdaemons.py
+
+  $ cd ..
--- a/tests/test-rebase-conflicts.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-rebase-conflicts.t	Tue May 22 21:51:20 2018 -0400
@@ -298,7 +298,7 @@
   2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2
   bundle2-output-bundle: "HG20", (1 params) 3 parts total
   bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
-  bundle2-output-part: "cache:rev-branch-cache" streamed payload
+  bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg
   3 changesets found
@@ -308,7 +308,7 @@
   2a7f09cac94c7f4b73ebd5cd1a62d3b2e8e336bf
   bundle2-output-bundle: "HG20", 3 parts total
   bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
-  bundle2-output-part: "cache:rev-branch-cache" streamed payload
+  bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   adding branch
   bundle2-input-bundle: with-transaction
@@ -322,7 +322,7 @@
   adding f1.txt revisions
   added 2 changesets with 2 changes to 1 files
   bundle2-input-part: total payload size 1686
-  bundle2-input-part: "cache:rev-branch-cache" supported
+  bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
   bundle2-input-part: total payload size 74
   truncating cache/rbc-revs-v1 to 56
   bundle2-input-part: "phase-heads" supported
--- a/tests/test-shelve.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-shelve.t	Tue May 22 21:51:20 2018 -0400
@@ -1122,7 +1122,7 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg debugbundle .hg/shelved/*.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       45993d65fe9dc3c6d8764b9c3b07fa831ee7d92d
   $ cd ..
 
--- a/tests/test-stream-bundle-v2.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-stream-bundle-v2.t	Tue May 22 21:51:20 2018 -0400
@@ -46,7 +46,7 @@
   $ hg bundle -a --type="none-v2;stream=v2" bundle.hg
   $ hg debugbundle bundle.hg
   Stream params: {}
-  stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore}
+  stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore} (mandatory: True)
   $ hg debugbundle --spec bundle.hg
   none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore
 
--- a/tests/test-strip.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-strip.t	Tue May 22 21:51:20 2018 -0400
@@ -210,10 +210,10 @@
   
   $ hg debugbundle .hg/strip-backup/*
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 1, version: 02}
+  changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
       264128213d290d868c54642d13aeaa3675551a78
-  cache:rev-branch-cache -- {}
-  phase-heads -- {}
+  cache:rev-branch-cache -- {} (mandatory: False)
+  phase-heads -- {} (mandatory: True)
       264128213d290d868c54642d13aeaa3675551a78 draft
   $ hg unbundle .hg/strip-backup/*
   adding changesets
@@ -851,7 +851,7 @@
   d8db9d1372214336d2b5570f20ee468d2c72fa8b
   bundle2-output-bundle: "HG20", (1 params) 3 parts total
   bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
-  bundle2-output-part: "cache:rev-branch-cache" streamed payload
+  bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg
   updating the branch cache
--- a/tests/test-tags.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-tags.t	Tue May 22 21:51:20 2018 -0400
@@ -727,13 +727,13 @@
   4 changesets found
   $ hg debugbundle ./test-cache-in-bundle-all-rev.hg
   Stream params: {Compression: BZ}
-  changegroup -- {nbchanges: 4, version: 02}
+  changegroup -- {nbchanges: 4, version: 02} (mandatory: True)
       96ee1d7354c4ad7372047672c36a1f561e3a6a4c
       c4dab0c2fd337eb9191f80c3024830a4889a8f34
       f63cc8fe54e4d326f8d692805d70e092f851ddb1
       40f0358cb314c824a5929ee527308d90e023bc10
-  hgtagsfnodes -- {}
-  cache:rev-branch-cache -- {}
+  hgtagsfnodes -- {} (mandatory: True)
+  cache:rev-branch-cache -- {} (mandatory: False)
 
 Check that local clone includes cache data
 
--- a/tests/test-treediscovery.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-treediscovery.t	Tue May 22 21:51:20 2018 -0400
@@ -568,7 +568,6 @@
   "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
   "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
   "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
-  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
   "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
   "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+1827a5bb63e602382eb89dd58f2ac9f3b007ad91* (glob)
   "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
--- a/tests/test-wireproto-command-capabilities.t	Fri May 04 18:55:57 2018 -0300
+++ b/tests/test-wireproto-command-capabilities.t	Tue May 22 21:51:20 2018 -0400
@@ -1,6 +1,15 @@
   $ . $TESTDIR/wireprotohelpers.sh
 
   $ hg init server
+
+zstd isn't present in plain builds. Make tests easier by removing
+zstd from the equation.
+
+  $ cat >> server/.hg/hgrc << EOF
+  > [server]
+  > compressionengines = zlib
+  > EOF
+
   $ hg -R server serve -p $HGPORT -d --pid-file hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
@@ -21,7 +30,7 @@
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
   s>     Content-Type: application/mercurial-0.1\r\n
-  s>     Content-Length: 458\r\n
+  s>     Content-Length: *\r\n (glob)
   s>     \r\n
   s>     batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
 
@@ -46,7 +55,7 @@
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
   s>     Content-Type: application/mercurial-0.1\r\n
-  s>     Content-Length: 458\r\n
+  s>     Content-Length: *\r\n (glob)
   s>     \r\n
   s>     batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
 
@@ -82,7 +91,7 @@
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
   s>     Content-Type: application/mercurial-0.1\r\n
-  s>     Content-Length: 458\r\n
+  s>     Content-Length: *\r\n (glob)
   s>     \r\n
   s>     batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
 
@@ -107,7 +116,7 @@
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
   s>     Content-Type: application/mercurial-0.1\r\n
-  s>     Content-Length: 458\r\n
+  s>     Content-Length: *\r\n (glob)
   s>     \r\n
   s>     batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
 
@@ -132,9 +141,9 @@
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
   s>     Content-Type: application/mercurial-cbor\r\n
-  s>     Content-Length: 496\r\n
+  s>     Content-Length: *\r\n (glob)
   s>     \r\n
-  s>     \xa3Dapis\xa0GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
+  s>     \xa3Dapis\xa0GapibaseDapi/Nv1capabilitiesY\x01\xc5batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
   cbor> {b'apibase': b'api/', b'apis': {}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
 
 Restart server to enable HTTPv2
@@ -165,9 +174,9 @@
   s>     Server: testing stub value\r\n
   s>     Date: $HTTP_DATE$\r\n
   s>     Content-Type: application/mercurial-cbor\r\n
-  s>     Content-Length: 496\r\n
+  s>     Content-Length: *\r\n (glob)
   s>     \r\n
-  s>     \xa3Dapis\xa0GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
+  s>     \xa3Dapis\xa0GapibaseDapi/Nv1capabilitiesY\x01\xc5batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
   cbor> {b'apibase': b'api/', b'apis': {}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
 
 Request for HTTPv2 service returns information about it
@@ -193,8 +202,8 @@
   s>     Content-Type: application/mercurial-cbor\r\n
   s>     Content-Length: *\r\n (glob)
   s>     \r\n
-  s>     \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
-  cbor> {b'apibase': b'api/', b'apis': {b'exp-http-v2-0001': {b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0005'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
+  s>     \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x81\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xc5batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
+  cbor> {b'apibase': b'api/', b'apis': {b'exp-http-v2-0001': {b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0005'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}}, b'v1capabilities': b'batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash'}
 
 capabilities command returns expected info
 
@@ -218,7 +227,7 @@
   s>     Content-Type: application/mercurial-cbor\r\n
   s>     Content-Length: *\r\n (glob)
   s>     \r\n
-  s>     \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xcabatch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
+  s>     \xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x81\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005GapibaseDapi/Nv1capabilitiesY\x01\xc5batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
   sending capabilities command
   s>     POST /api/exp-http-v2-0001/ro/capabilities HTTP/1.1\r\n
   s>     Accept-Encoding: identity\r\n
@@ -236,13 +245,13 @@
   s>     Content-Type: application/mercurial-exp-framing-0005\r\n
   s>     Transfer-Encoding: chunked\r\n
   s>     \r\n
-  s>     1e2\r\n
-  s>     \xda\x01\x00\x01\x00\x02\x012
-  s>     \xa1FstatusBok\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005
+  s>     1d7\r\n
+  s>     \xcf\x01\x00\x01\x00\x02\x012
+  s>     \xa1FstatusBok\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x81\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0005
   s>     \r\n
-  received frame(size=474; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
+  received frame(size=463; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos)
   s>     0\r\n
   s>     \r\n
-  response: [{b'status': b'ok'}, {b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0005'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}]
+  response: [{b'status': b'ok'}, {b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0005'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}]
 
   $ cat error.log