changeset 35454:786289423e97

merge with stable
author Augie Fackler <augie@google.com>
date Tue, 19 Dec 2017 16:27:24 -0500
parents 44fd4cfc6c0a (diff) 058c725925e3 (current diff)
children 02ea370c2baa
files mercurial/cmdutil.py mercurial/debugcommands.py mercurial/hgweb/webutil.py tests/test-diffstat.t tests/test-hgweb-diffs.t
diffstat 431 files changed, 13849 insertions(+), 6290 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Dec 17 18:43:05 2017 +0900
+++ b/.hgignore	Tue Dec 19 16:27:24 2017 -0500
@@ -24,6 +24,7 @@
 tests/.hypothesis
 tests/hypothesis-generated
 tests/annotated
+tests/exceptions
 tests/*.err
 tests/htmlcov
 build
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.jshintrc	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,11 @@
+{
+    // Enforcing
+    "eqeqeq"        : true,     // true: Require triple equals (===) for comparison
+    "forin"         : true,     // true: Require filtering for..in loops with obj.hasOwnProperty()
+    "freeze"        : true,     // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
+    "nonbsp"        : true,     // true: Prohibit "non-breaking whitespace" characters.
+    "undef"         : true,     // true: Require all non-global variables to be declared (prevents global leaks)
+
+    // Environments
+    "browser"       : true      // Web Browser (window, document, etc)
+}
--- a/contrib/check-code.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/contrib/check-code.py	Tue Dec 19 16:27:24 2017 -0500
@@ -135,7 +135,6 @@
     (r'if\s*!', "don't use '!' to negate exit status"),
     (r'/dev/u?random', "don't use entropy, use /dev/zero"),
     (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
-    (r'^( *)\t', "don't use tabs to indent"),
     (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)',
      "put a backslash-escaped newline after sed 'i' command"),
     (r'^diff *-\w*[uU].*$\n(^  \$ |^$)', "prefix diff -u/-U with cmp"),
@@ -148,7 +147,9 @@
     (r'\bsed\b.*[^\\]\\n', "don't use 'sed ... \\n', use a \\ and a newline"),
     (r'env.*-u', "don't use 'env -u VAR', use 'unset VAR'"),
     (r'cp.* -r ', "don't use 'cp -r', use 'cp -R'"),
-    (r'grep.* -[ABC] ', "don't use grep's context flags"),
+    (r'grep.* -[ABC]', "don't use grep's context flags"),
+    (r'find.*-printf',
+     "don't use 'find -printf', it doesn't exist on BSD find(1)"),
   ],
   # warnings
   [
@@ -165,7 +166,6 @@
     (r"<<(\S+)((.|\n)*?\n\1)", rephere),
 ]
 
-winglobmsg = "use (glob) to match Windows paths too"
 uprefix = r"^  \$ "
 utestpats = [
   [
@@ -181,25 +181,11 @@
     (uprefix + r'.*:\.\S*/', "x:.y in a path does not work on msys, rewrite "
      "as x://.y, or see `hg log -k msys` for alternatives", r'-\S+:\.|' #-Rxxx
      '# no-msys'), # in test-pull.t which is skipped on windows
-    (r'^  saved backup bundle to \$TESTTMP.*\.hg$', winglobmsg),
-    (r'^  changeset .* references (corrupted|missing) \$TESTTMP/.*[^)]$',
-     winglobmsg),
-    (r'^  pulling from \$TESTTMP/.*[^)]$', winglobmsg,
-     '\$TESTTMP/unix-repo$'), # in test-issue1802.t which skipped on windows
-    (r'^  reverting (?!subrepo ).*/.*[^)]$', winglobmsg),
-    (r'^  cloning subrepo \S+/.*[^)]$', winglobmsg),
-    (r'^  pushing to \$TESTTMP/.*[^)]$', winglobmsg),
-    (r'^  pushing subrepo \S+/\S+ to.*[^)]$', winglobmsg),
-    (r'^  moving \S+/.*[^)]$', winglobmsg),
-    (r'^  no changes made to subrepo since.*/.*[^)]$', winglobmsg),
-    (r'^  .*: largefile \S+ not available from file:.*/.*[^)]$', winglobmsg),
-    (r'^  .*file://\$TESTTMP',
-     'write "file:/*/$TESTTMP" + (glob) to match on windows too'),
     (r'^  [^$>].*27\.0\.0\.1',
      'use $LOCALIP not an explicit loopback address'),
-    (r'^  [^$>].*\$LOCALIP.*[^)]$',
+    (r'^  (?![>$] ).*\$LOCALIP.*[^)]$',
      'mark $LOCALIP output lines with (glob) to help tests in BSD jails'),
-    (r'^  (cat|find): .*: No such file or directory',
+    (r'^  (cat|find): .*: \$ENOENT\$',
      'use test -f to test for file existence'),
     (r'^  diff -[^ -]*p',
      "don't use (external) diff with -p for portability"),
@@ -223,6 +209,7 @@
   ]
 ]
 
+# transform plain test rules to unified test's
 for i in [0, 1]:
     for tp in testpats[i]:
         p = tp[0]
@@ -233,6 +220,11 @@
             p = r"^  [$>] .*(%s)" % p
         utestpats[i].append((p, m) + tp[2:])
 
+# don't transform the following rules:
+# "  > \t" and "  \t" should be allowed in unified tests
+testpats[0].append((r'^( *)\t', "don't use tabs to indent"))
+utestpats[0].append((r'^( ?)\t', "don't use tabs to indent"))
+
 utestfilters = [
     (r"<<(\S+)((.|\n)*?\n  > \1)", rephere),
     (r"( +)(#([^!][^\n]*\S)?)", repcomment),
--- a/contrib/perf.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/contrib/perf.py	Tue Dec 19 16:27:24 2017 -0500
@@ -488,6 +488,122 @@
     timer(d)
     fm.end()
 
+@command('perfbundleread', formatteropts, 'BUNDLE')
+def perfbundleread(ui, repo, bundlepath, **opts):
+    """Benchmark reading of bundle files.
+
+    This command is meant to isolate the I/O part of bundle reading as
+    much as possible.
+    """
+    from mercurial import (
+        bundle2,
+        exchange,
+        streamclone,
+    )
+
+    def makebench(fn):
+        def run():
+            with open(bundlepath, 'rb') as fh:
+                bundle = exchange.readbundle(ui, fh, bundlepath)
+                fn(bundle)
+
+        return run
+
+    def makereadnbytes(size):
+        def run():
+            with open(bundlepath, 'rb') as fh:
+                bundle = exchange.readbundle(ui, fh, bundlepath)
+                while bundle.read(size):
+                    pass
+
+        return run
+
+    def makestdioread(size):
+        def run():
+            with open(bundlepath, 'rb') as fh:
+                while fh.read(size):
+                    pass
+
+        return run
+
+    # bundle1
+
+    def deltaiter(bundle):
+        for delta in bundle.deltaiter():
+            pass
+
+    def iterchunks(bundle):
+        for chunk in bundle.getchunks():
+            pass
+
+    # bundle2
+
+    def forwardchunks(bundle):
+        for chunk in bundle._forwardchunks():
+            pass
+
+    def iterparts(bundle):
+        for part in bundle.iterparts():
+            pass
+
+    def iterpartsseekable(bundle):
+        for part in bundle.iterparts(seekable=True):
+            pass
+
+    def seek(bundle):
+        for part in bundle.iterparts(seekable=True):
+            part.seek(0, os.SEEK_END)
+
+    def makepartreadnbytes(size):
+        def run():
+            with open(bundlepath, 'rb') as fh:
+                bundle = exchange.readbundle(ui, fh, bundlepath)
+                for part in bundle.iterparts():
+                    while part.read(size):
+                        pass
+
+        return run
+
+    benches = [
+        (makestdioread(8192), 'read(8k)'),
+        (makestdioread(16384), 'read(16k)'),
+        (makestdioread(32768), 'read(32k)'),
+        (makestdioread(131072), 'read(128k)'),
+    ]
+
+    with open(bundlepath, 'rb') as fh:
+        bundle = exchange.readbundle(ui, fh, bundlepath)
+
+        if isinstance(bundle, changegroup.cg1unpacker):
+            benches.extend([
+                (makebench(deltaiter), 'cg1 deltaiter()'),
+                (makebench(iterchunks), 'cg1 getchunks()'),
+                (makereadnbytes(8192), 'cg1 read(8k)'),
+                (makereadnbytes(16384), 'cg1 read(16k)'),
+                (makereadnbytes(32768), 'cg1 read(32k)'),
+                (makereadnbytes(131072), 'cg1 read(128k)'),
+            ])
+        elif isinstance(bundle, bundle2.unbundle20):
+            benches.extend([
+                (makebench(forwardchunks), 'bundle2 forwardchunks()'),
+                (makebench(iterparts), 'bundle2 iterparts()'),
+                (makebench(iterpartsseekable), 'bundle2 iterparts() seekable'),
+                (makebench(seek), 'bundle2 part seek()'),
+                (makepartreadnbytes(8192), 'bundle2 part read(8k)'),
+                (makepartreadnbytes(16384), 'bundle2 part read(16k)'),
+                (makepartreadnbytes(32768), 'bundle2 part read(32k)'),
+                (makepartreadnbytes(131072), 'bundle2 part read(128k)'),
+            ])
+        elif isinstance(bundle, streamclone.streamcloneapplier):
+            raise error.Abort('stream clone bundles not supported')
+        else:
+            raise error.Abort('unhandled bundle type: %s' % type(bundle))
+
+    for fn, title in benches:
+        timer, fm = gettimer(ui, opts)
+        timer(fn, title=title)
+        fm.end()
+
 @command('perfchangegroupchangelog', formatteropts +
          [('', 'version', '02', 'changegroup version'),
           ('r', 'rev', '', 'revisions to add to changegroup')])
@@ -525,8 +641,8 @@
     dirstate = repo.dirstate
     'a' in dirstate
     def d():
-        dirstate.dirs()
-        del dirstate._map.dirs
+        dirstate.hasdir('a')
+        del dirstate._map._dirs
     timer(d)
     fm.end()
 
@@ -545,8 +661,8 @@
     timer, fm = gettimer(ui, opts)
     "a" in repo.dirstate
     def d():
-        "a" in repo.dirstate._map.dirs
-        del repo.dirstate._map.dirs
+        repo.dirstate.hasdir("a")
+        del repo.dirstate._map._dirs
     timer(d)
     fm.end()
 
@@ -569,7 +685,7 @@
     def d():
         dirstate._map.dirfoldmap.get('a')
         del dirstate._map.dirfoldmap
-        del dirstate._map.dirs
+        del dirstate._map._dirs
     timer(d)
     fm.end()
 
--- a/contrib/python3-whitelist	Sun Dec 17 18:43:05 2017 +0900
+++ b/contrib/python3-whitelist	Tue Dec 19 16:27:24 2017 -0500
@@ -1,5 +1,8 @@
+test-add.t
+test-addremove-similar.t
 test-addremove.t
 test-ancestor.py
+test-automv.t
 test-backwards-remove.t
 test-bheads.t
 test-bisect2.t
@@ -7,6 +10,7 @@
 test-bookmarks-strip.t
 test-branch-tag-confict.t
 test-casecollision.t
+test-cat.t
 test-changelog-exec.t
 test-check-commit.t
 test-check-execute.t
@@ -14,7 +18,9 @@
 test-check-pyflakes.t
 test-check-pylint.t
 test-check-shbang.t
+test-children.t
 test-commit-unresolved.t
+test-completion.t
 test-contrib-check-code.t
 test-contrib-check-commit.t
 test-debugrename.t
@@ -33,11 +39,16 @@
 test-empty.t
 test-encoding-func.py
 test-excessive-merge.t
+test-execute-bit.t
+test-gpg.t
 test-hghave.t
 test-imports-checker.t
 test-issue1089.t
+test-issue1502.t
+test-issue1802.t
 test-issue1877.t
 test-issue1993.t
+test-issue522.t
 test-issue612.t
 test-issue619.t
 test-issue672.t
@@ -46,30 +57,65 @@
 test-locate.t
 test-lrucachedict.py
 test-manifest.py
+test-manifest-merging.t
 test-match.py
 test-merge-default.t
+test-merge-internal-tools-pattern.t
+test-merge-remove.t
+test-merge-revert.t
+test-merge-revert2.t
+test-merge-subrepos.t
+test-merge10.t
 test-merge2.t
 test-merge4.t
 test-merge5.t
+test-merge6.t
+test-merge7.t
+test-merge8.t
+test-mq-qimport-fail-cleanup.t
 test-permissions.t
+test-push-checkheads-partial-C1.t
+test-push-checkheads-partial-C2.t
+test-push-checkheads-partial-C3.t
+test-push-checkheads-partial-C4.t
 test-push-checkheads-pruned-B1.t
+test-push-checkheads-pruned-B2.t
+test-push-checkheads-pruned-B3.t
+test-push-checkheads-pruned-B4.t
+test-push-checkheads-pruned-B5.t
 test-push-checkheads-pruned-B6.t
 test-push-checkheads-pruned-B7.t
+test-push-checkheads-pruned-B8.t
 test-push-checkheads-superceed-A1.t
+test-push-checkheads-superceed-A2.t
+test-push-checkheads-superceed-A3.t
 test-push-checkheads-superceed-A4.t
 test-push-checkheads-superceed-A5.t
+test-push-checkheads-superceed-A6.t
+test-push-checkheads-superceed-A7.t
 test-push-checkheads-superceed-A8.t
 test-push-checkheads-unpushed-D1.t
+test-push-checkheads-unpushed-D2.t
+test-push-checkheads-unpushed-D3.t
+test-push-checkheads-unpushed-D4.t
+test-push-checkheads-unpushed-D5.t
 test-push-checkheads-unpushed-D6.t
 test-push-checkheads-unpushed-D7.t
+test-rename-dir-merge.t
 test-rename-merge1.t
 test-rename.t
+test-revert-flags.t
+test-revert-unknown.t
+test-revlog-group-emptyiter.t
 test-revlog-packentry.t
 test-run-tests.py
 test-show-stack.t
+test-simple-update.t
 test-status-terse.t
-test-terse-status.t
+test-uncommit.t
 test-unified-test.t
+test-unrelated-pull.t
 test-update-issue1456.t
+test-update-names.t
 test-update-reverse.t
 test-xdg.t
--- a/contrib/synthrepo.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/contrib/synthrepo.py	Tue Dec 19 16:27:24 2017 -0500
@@ -369,14 +369,14 @@
             while not validpath(path):
                 path = pickpath()
             data = '%s contents\n' % path
-            files[path] = context.memfilectx(repo, path, data)
+            files[path] = data
             dir = os.path.dirname(path)
             while dir and dir not in dirs:
                 dirs.add(dir)
                 dir = os.path.dirname(dir)
 
         def filectxfn(repo, memctx, path):
-            return files[path]
+            return context.memfilectx(repo, memctx, path, files[path])
 
         ui.progress(_synthesizing, None)
         message = 'synthesized wide repo with %d files' % (len(files),)
@@ -444,14 +444,12 @@
                 for __ in xrange(add):
                     lines.insert(random.randint(0, len(lines)), makeline())
                 path = fctx.path()
-                changes[path] = context.memfilectx(repo, path,
-                                                   '\n'.join(lines) + '\n')
+                changes[path] = '\n'.join(lines) + '\n'
             for __ in xrange(pick(filesremoved)):
                 path = random.choice(mfk)
                 for __ in xrange(10):
                     path = random.choice(mfk)
                     if path not in changes:
-                        changes[path] = None
                         break
         if filesadded:
             dirs = list(pctx.dirs())
@@ -466,9 +464,11 @@
                 pathstr = '/'.join(filter(None, path))
             data = '\n'.join(makeline()
                              for __ in xrange(pick(linesinfilesadded))) + '\n'
-            changes[pathstr] = context.memfilectx(repo, pathstr, data)
+            changes[pathstr] = data
         def filectxfn(repo, memctx, path):
-            return changes[path]
+            if path not in changes:
+                return None
+            return context.memfilectx(repo, memctx, path, changes[path])
         if not changes:
             continue
         if revs:
--- a/contrib/wix/help.wxs	Sun Dec 17 18:43:05 2017 +0900
+++ b/contrib/wix/help.wxs	Tue Dec 19 16:27:24 2017 -0500
@@ -23,6 +23,7 @@
           <File Name="environment.txt" />
           <File Name="extensions.txt" />
           <File Name="filesets.txt" />
+          <File Name="flags.txt" />
           <File Name="glossary.txt" />
           <File Name="hgignore.txt" />
           <File Name="hgweb.txt" />
--- a/contrib/wix/templates.wxs	Sun Dec 17 18:43:05 2017 +0900
+++ b/contrib/wix/templates.wxs	Tue Dec 19 16:27:24 2017 -0500
@@ -42,6 +42,7 @@
         <Directory Id="templates.jsondir" Name="json">
           <Component Id="templates.json" Guid="$(var.templates.json.guid)" Win64='$(var.IsX64)'>
             <File Id="json.changelist.tmpl" Name="changelist.tmpl" KeyPath="yes" />
+            <File Id="json.graph.tmpl"      Name="graph.tmpl" />
             <File Id="json.map"             Name="map" />
           </Component>
         </Directory>
@@ -85,6 +86,7 @@
             <File Id="gitweb.filerevision.tmpl"   Name="filerevision.tmpl" />
             <File Id="gitweb.footer.tmpl"         Name="footer.tmpl" />
             <File Id="gitweb.graph.tmpl"          Name="graph.tmpl" />
+            <File Id="gitweb.graphentry.tmpl"     Name="graphentry.tmpl" />
             <File Id="gitweb.header.tmpl"         Name="header.tmpl" />
             <File Id="gitweb.index.tmpl"          Name="index.tmpl" />
             <File Id="gitweb.manifest.tmpl"       Name="manifest.tmpl" />
@@ -114,6 +116,7 @@
             <File Id="monoblue.filerevision.tmpl"   Name="filerevision.tmpl" />
             <File Id="monoblue.footer.tmpl"         Name="footer.tmpl" />
             <File Id="monoblue.graph.tmpl"          Name="graph.tmpl" />
+            <File Id="monoblue.graphentry.tmpl"     Name="graphentry.tmpl" />
             <File Id="monoblue.header.tmpl"         Name="header.tmpl" />
             <File Id="monoblue.index.tmpl"          Name="index.tmpl" />
             <File Id="monoblue.manifest.tmpl"       Name="manifest.tmpl" />
@@ -143,6 +146,7 @@
             <File Id="paper.filerevision.tmpl"  Name="filerevision.tmpl" />
             <File Id="paper.footer.tmpl"        Name="footer.tmpl" />
             <File Id="paper.graph.tmpl"         Name="graph.tmpl" />
+            <File Id="paper.graphentry.tmpl"    Name="graphentry.tmpl" />
             <File Id="paper.header.tmpl"        Name="header.tmpl" />
             <File Id="paper.index.tmpl"         Name="index.tmpl" />
             <File Id="paper.manifest.tmpl"      Name="manifest.tmpl" />
@@ -208,6 +212,7 @@
             <File Id="spartan.filerevision.tmpl"   Name="filerevision.tmpl" />
             <File Id="spartan.footer.tmpl"         Name="footer.tmpl" />
             <File Id="spartan.graph.tmpl"          Name="graph.tmpl" />
+            <File Id="spartan.graphentry.tmpl"     Name="graphentry.tmpl" />
             <File Id="spartan.header.tmpl"         Name="header.tmpl" />
             <File Id="spartan.index.tmpl"          Name="index.tmpl" />
             <File Id="spartan.manifest.tmpl"       Name="manifest.tmpl" />
--- a/hgext/amend.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/amend.py	Tue Dec 19 16:27:24 2017 -0500
@@ -17,6 +17,7 @@
     cmdutil,
     commands,
     error,
+    pycompat,
     registrar,
 )
 
@@ -46,10 +47,11 @@
 
     See :hg:`help commit` for more details.
     """
+    opts = pycompat.byteskwargs(opts)
     if len(opts['note']) > 255:
         raise error.Abort(_("cannot store a note of more than 255 bytes"))
     with repo.wlock(), repo.lock():
         if not opts.get('logfile'):
             opts['message'] = opts.get('message') or repo['.'].description()
         opts['amend'] = True
-        return commands._docommit(ui, repo, *pats, **opts)
+        return commands._docommit(ui, repo, *pats, **pycompat.strkwargs(opts))
--- a/hgext/automv.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/automv.py	Tue Dec 19 16:27:24 2017 -0500
@@ -32,6 +32,7 @@
     copies,
     error,
     extensions,
+    pycompat,
     registrar,
     scmutil,
     similar
@@ -53,6 +54,7 @@
 
 def mvcheck(orig, ui, repo, *pats, **opts):
     """Hook to check for moves at commit time"""
+    opts = pycompat.byteskwargs(opts)
     renames = None
     disabled = opts.pop('no_automv', False)
     if not disabled:
@@ -68,7 +70,7 @@
     with repo.wlock():
         if renames is not None:
             scmutil._markchanges(repo, (), (), renames)
-        return orig(ui, repo, *pats, **opts)
+        return orig(ui, repo, *pats, **pycompat.strkwargs(opts))
 
 def _interestingfiles(repo, matcher):
     """Find what files were added or removed in this commit.
--- a/hgext/blackbox.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/blackbox.py	Tue Dec 19 16:27:24 2017 -0500
@@ -226,7 +226,7 @@
     if not repo.vfs.exists('blackbox.log'):
         return
 
-    limit = opts.get('limit')
+    limit = opts.get(r'limit')
     fp = repo.vfs('blackbox.log', 'r')
     lines = fp.read().split('\n')
 
--- a/hgext/bugzilla.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/bugzilla.py	Tue Dec 19 16:27:24 2017 -0500
@@ -580,7 +580,7 @@
             self.ui.warn(_("Bugzilla/MySQL cannot update bug state\n"))
 
         (user, userid) = self.get_bugzilla_user(committer)
-        now = time.strftime('%Y-%m-%d %H:%M:%S')
+        now = time.strftime(r'%Y-%m-%d %H:%M:%S')
         self.run('''insert into longdescs
                     (bug_id, who, bug_when, thetext)
                     values (%s, %s, %s, %s)''',
--- a/hgext/children.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/children.py	Tue Dec 19 16:27:24 2017 -0500
@@ -19,6 +19,7 @@
 from mercurial.i18n import _
 from mercurial import (
     cmdutil,
+    pycompat,
     registrar,
 )
 
@@ -55,6 +56,7 @@
     See :hg:`help log` and :hg:`help revsets.children`.
 
     """
+    opts = pycompat.byteskwargs(opts)
     rev = opts.get('rev')
     if file_:
         fctx = repo.filectx(file_, changeid=rev)
--- a/hgext/churn.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/churn.py	Tue Dec 19 16:27:24 2017 -0500
@@ -19,6 +19,7 @@
     cmdutil,
     encoding,
     patch,
+    pycompat,
     registrar,
     scmutil,
     util,
@@ -45,6 +46,7 @@
 
 def countrate(ui, repo, amap, *pats, **opts):
     """Calculate stats"""
+    opts = pycompat.byteskwargs(opts)
     if opts.get('dateformat'):
         def getkey(ctx):
             t, tz = ctx.date()
@@ -154,7 +156,7 @@
         return s + " " * (l - encoding.colwidth(s))
 
     amap = {}
-    aliases = opts.get('aliases')
+    aliases = opts.get(r'aliases')
     if not aliases and os.path.exists(repo.wjoin('.hgchurn')):
         aliases = repo.wjoin('.hgchurn')
     if aliases:
@@ -172,7 +174,7 @@
     if not rate:
         return
 
-    if opts.get('sort'):
+    if opts.get(r'sort'):
         rate.sort()
     else:
         rate.sort(key=lambda x: (-sum(x[1]), x))
@@ -185,7 +187,7 @@
     ui.debug("assuming %i character terminal\n" % ttywidth)
     width = ttywidth - maxname - 2 - 2 - 2
 
-    if opts.get('diffstat'):
+    if opts.get(r'diffstat'):
         width -= 15
         def format(name, diffstat):
             added, removed = diffstat
--- a/hgext/commitextras.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/commitextras.py	Tue Dec 19 16:27:24 2017 -0500
@@ -46,7 +46,7 @@
     origcommit = repo.commit
     try:
         def _wrappedcommit(*innerpats, **inneropts):
-            extras = opts.get('extra')
+            extras = opts.get(r'extra')
             if extras:
                 for raw in extras:
                     if '=' not in raw:
@@ -65,7 +65,7 @@
                         msg = _("key '%s' is used internally, can't be set "
                                 "manually")
                         raise error.Abort(msg % k)
-                    inneropts['extra'][k] = v
+                    inneropts[r'extra'][k] = v
             return origcommit(*innerpats, **inneropts)
 
         # This __dict__ logic is needed because the normal
--- a/hgext/convert/bzr.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/bzr.py	Tue Dec 19 16:27:24 2017 -0500
@@ -44,8 +44,8 @@
 class bzr_source(common.converter_source):
     """Reads Bazaar repositories by using the Bazaar Python libraries"""
 
-    def __init__(self, ui, path, revs=None):
-        super(bzr_source, self).__init__(ui, path, revs=revs)
+    def __init__(self, ui, repotype, path, revs=None):
+        super(bzr_source, self).__init__(ui, repotype, path, revs=revs)
 
         if not os.path.exists(os.path.join(path, '.bzr')):
             raise common.NoRepo(_('%s does not look like a Bazaar repository')
--- a/hgext/convert/common.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/common.py	Tue Dec 19 16:27:24 2017 -0500
@@ -73,12 +73,13 @@
 class converter_source(object):
     """Conversion source interface"""
 
-    def __init__(self, ui, path=None, revs=None):
+    def __init__(self, ui, repotype, path=None, revs=None):
         """Initialize conversion source (or raise NoRepo("message")
         exception if path is not a valid repository)"""
         self.ui = ui
         self.path = path
         self.revs = revs
+        self.repotype = repotype
 
         self.encoding = 'utf-8'
 
@@ -218,7 +219,7 @@
 class converter_sink(object):
     """Conversion sink (target) interface"""
 
-    def __init__(self, ui, path):
+    def __init__(self, ui, repotype, path):
         """Initialize conversion sink (or raise NoRepo("message")
         exception if path is not a valid repository)
 
@@ -227,6 +228,7 @@
         self.ui = ui
         self.path = path
         self.created = []
+        self.repotype = repotype
 
     def revmapfile(self):
         """Path to a file that will contain lines
--- a/hgext/convert/convcmd.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/convcmd.py	Tue Dec 19 16:27:24 2017 -0500
@@ -15,6 +15,7 @@
     encoding,
     error,
     hg,
+    scmutil,
     util,
 )
 
@@ -114,7 +115,7 @@
     for name, source, sortmode in source_converters:
         try:
             if not type or name == type:
-                return source(ui, path, revs), sortmode
+                return source(ui, name, path, revs), sortmode
         except (NoRepo, MissingTool) as inst:
             exceptions.append(inst)
     if not ui.quiet:
@@ -128,7 +129,7 @@
     for name, sink in sink_converters:
         try:
             if not type or name == type:
-                return sink(ui, path)
+                return sink(ui, name, path)
         except NoRepo as inst:
             ui.note(_("convert: %s\n") % inst)
         except MissingTool as inst:
@@ -449,7 +450,7 @@
         commit = self.commitcache[rev]
         full = self.opts.get('full')
         changes = self.source.getchanges(rev, full)
-        if isinstance(changes, basestring):
+        if isinstance(changes, bytes):
             if changes == SKIPREV:
                 dest = SKIPREV
             else:
@@ -575,6 +576,7 @@
         ui.status(_("assuming destination %s\n") % dest)
 
     destc = convertsink(ui, dest, opts.get('dest_type'))
+    destc = scmutil.wrapconvertsink(destc)
 
     try:
         srcc, defaultsort = convertsource(ui, src, opts.get('source_type'),
--- a/hgext/convert/cvs.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/cvs.py	Tue Dec 19 16:27:24 2017 -0500
@@ -32,8 +32,8 @@
 NoRepo = common.NoRepo
 
 class convert_cvs(converter_source):
-    def __init__(self, ui, path, revs=None):
-        super(convert_cvs, self).__init__(ui, path, revs=revs)
+    def __init__(self, ui, repotype, path, revs=None):
+        super(convert_cvs, self).__init__(ui, repotype, path, revs=revs)
 
         cvs = os.path.join(path, "CVS")
         if not os.path.exists(cvs):
--- a/hgext/convert/darcs.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/darcs.py	Tue Dec 19 16:27:24 2017 -0500
@@ -40,8 +40,8 @@
                 pass
 
 class darcs_source(common.converter_source, common.commandline):
-    def __init__(self, ui, path, revs=None):
-        common.converter_source.__init__(self, ui, path, revs=revs)
+    def __init__(self, ui, repotype, path, revs=None):
+        common.converter_source.__init__(self, ui, repotype, path, revs=revs)
         common.commandline.__init__(self, ui, 'darcs')
 
         # check for _darcs, ElementTree so that we can easily skip
--- a/hgext/convert/filemap.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/filemap.py	Tue Dec 19 16:27:24 2017 -0500
@@ -172,7 +172,7 @@
 
 class filemap_source(common.converter_source):
     def __init__(self, ui, baseconverter, filemap):
-        super(filemap_source, self).__init__(ui)
+        super(filemap_source, self).__init__(ui, baseconverter.repotype)
         self.base = baseconverter
         self.filemapper = filemapper(ui, filemap)
         self.commits = {}
--- a/hgext/convert/git.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/git.py	Tue Dec 19 16:27:24 2017 -0500
@@ -66,8 +66,8 @@
     def gitpipe(self, *args, **kwargs):
         return self._gitcmd(self._run3, *args, **kwargs)
 
-    def __init__(self, ui, path, revs=None):
-        super(convert_git, self).__init__(ui, path, revs=revs)
+    def __init__(self, ui, repotype, path, revs=None):
+        super(convert_git, self).__init__(ui, repotype, path, revs=revs)
         common.commandline.__init__(self, ui, 'git')
 
         # Pass an absolute path to git to prevent from ever being interpreted
--- a/hgext/convert/gnuarch.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/gnuarch.py	Tue Dec 19 16:27:24 2017 -0500
@@ -36,8 +36,8 @@
             self.ren_files = {}
             self.ren_dirs = {}
 
-    def __init__(self, ui, path, revs=None):
-        super(gnuarch_source, self).__init__(ui, path, revs=revs)
+    def __init__(self, ui, repotype, path, revs=None):
+        super(gnuarch_source, self).__init__(ui, repotype, path, revs=revs)
 
         if not os.path.exists(os.path.join(path, '{arch}')):
             raise common.NoRepo(_("%s does not look like a GNU Arch repository")
--- a/hgext/convert/hg.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/hg.py	Tue Dec 19 16:27:24 2017 -0500
@@ -45,8 +45,8 @@
 sha1re = re.compile(r'\b[0-9a-f]{12,40}\b')
 
 class mercurial_sink(common.converter_sink):
-    def __init__(self, ui, path):
-        common.converter_sink.__init__(self, ui, path)
+    def __init__(self, ui, repotype, path):
+        common.converter_sink.__init__(self, ui, repotype, path)
         self.branchnames = ui.configbool('convert', 'hg.usebranchnames')
         self.clonebranches = ui.configbool('convert', 'hg.clonebranches')
         self.tagsbranch = ui.config('convert', 'hg.tagsbranch')
@@ -253,7 +253,7 @@
                 data = self._rewritetags(source, revmap, data)
             if f == '.hgsubstate':
                 data = self._rewritesubstate(source, data)
-            return context.memfilectx(self.repo, f, data, 'l' in mode,
+            return context.memfilectx(self.repo, memctx, f, data, 'l' in mode,
                                       'x' in mode, copies.get(f))
 
         pl = []
@@ -401,7 +401,7 @@
 
         data = "".join(newlines)
         def getfilectx(repo, memctx, f):
-            return context.memfilectx(repo, f, data, False, False, None)
+            return context.memfilectx(repo, memctx, f, data, False, False, None)
 
         self.ui.status(_("updating tags\n"))
         date = "%s 0" % int(time.mktime(time.gmtime()))
@@ -444,8 +444,8 @@
         return rev in self.repo
 
 class mercurial_source(common.converter_source):
-    def __init__(self, ui, path, revs=None):
-        common.converter_source.__init__(self, ui, path, revs)
+    def __init__(self, ui, repotype, path, revs=None):
+        common.converter_source.__init__(self, ui, repotype, path, revs)
         self.ignoreerrors = ui.configbool('convert', 'hg.ignoreerrors')
         self.ignored = set()
         self.saverev = ui.configbool('convert', 'hg.saverev')
--- a/hgext/convert/monotone.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/monotone.py	Tue Dec 19 16:27:24 2017 -0500
@@ -19,8 +19,8 @@
 from . import common
 
 class monotone_source(common.converter_source, common.commandline):
-    def __init__(self, ui, path=None, revs=None):
-        common.converter_source.__init__(self, ui, path, revs)
+    def __init__(self, ui, repotype, path=None, revs=None):
+        common.converter_source.__init__(self, ui, repotype, path, revs)
         if revs and len(revs) > 1:
             raise error.Abort(_('monotone source does not support specifying '
                                'multiple revs'))
--- a/hgext/convert/p4.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/p4.py	Tue Dec 19 16:27:24 2017 -0500
@@ -43,11 +43,11 @@
     return filename
 
 class p4_source(common.converter_source):
-    def __init__(self, ui, path, revs=None):
+    def __init__(self, ui, repotype, path, revs=None):
         # avoid import cycle
         from . import convcmd
 
-        super(p4_source, self).__init__(ui, path, revs=revs)
+        super(p4_source, self).__init__(ui, repotype, path, revs=revs)
 
         if "/" in path and not path.startswith('//'):
             raise common.NoRepo(_('%s does not look like a P4 repository') %
--- a/hgext/convert/subversion.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/convert/subversion.py	Tue Dec 19 16:27:24 2017 -0500
@@ -285,8 +285,8 @@
 # the parent module. A revision has at most one parent.
 #
 class svn_source(converter_source):
-    def __init__(self, ui, url, revs=None):
-        super(svn_source, self).__init__(ui, url, revs=revs)
+    def __init__(self, ui, repotype, url, revs=None):
+        super(svn_source, self).__init__(ui, repotype, url, revs=revs)
 
         if not (url.startswith('svn://') or url.startswith('svn+ssh://') or
                 (os.path.exists(url) and
@@ -1112,9 +1112,9 @@
     def authorfile(self):
         return self.join('hg-authormap')
 
-    def __init__(self, ui, path):
+    def __init__(self, ui, repotype, path):
 
-        converter_sink.__init__(self, ui, path)
+        converter_sink.__init__(self, ui, repotype, path)
         commandline.__init__(self, ui, 'svn')
         self.delete = []
         self.setexec = []
--- a/hgext/extdiff.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/extdiff.py	Tue Dec 19 16:27:24 2017 -0500
@@ -338,6 +338,7 @@
     that revision is compared to the working directory, and, when no
     revisions are specified, the working directory files are compared
     to its parent.'''
+    opts = pycompat.byteskwargs(opts)
     program = opts.get('program')
     option = opts.get('option')
     if not program:
@@ -369,6 +370,7 @@
         self._cmdline = cmdline
 
     def __call__(self, ui, repo, *pats, **opts):
+        opts = pycompat.byteskwargs(opts)
         options = ' '.join(map(util.shellquote, opts['option']))
         if options:
             options = ' ' + options
--- a/hgext/fetch.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/fetch.py	Tue Dec 19 16:27:24 2017 -0500
@@ -19,6 +19,7 @@
     exchange,
     hg,
     lock,
+    pycompat,
     registrar,
     util,
 )
@@ -60,6 +61,7 @@
     Returns 0 on success.
     '''
 
+    opts = pycompat.byteskwargs(opts)
     date = opts.get('date')
     if date:
         opts['date'] = util.parsedate(date)
--- a/hgext/fsmonitor/__init__.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/fsmonitor/__init__.py	Tue Dec 19 16:27:24 2017 -0500
@@ -117,7 +117,6 @@
 from mercurial.i18n import _
 from mercurial.node import (
     hex,
-    nullid,
 )
 
 from mercurial import (
@@ -165,9 +164,6 @@
 configitem('experimental', 'fsmonitor.transaction_notify',
     default=False,
 )
-configitem('experimental', 'fsmonitor.wc_change_notify',
-    default=False,
-)
 
 # This extension is incompatible with the following blacklisted extensions
 # and will disable itself when encountering one of these:
@@ -224,16 +220,21 @@
     Whenever full is False, ignored is False, and the Watchman client is
     available, use Watchman combined with saved state to possibly return only a
     subset of files.'''
-    def bail():
+    def bail(reason):
+        self._ui.debug('fsmonitor: fallback to core status, %s\n' % reason)
         return orig(match, subrepos, unknown, ignored, full=True)
 
-    if full or ignored or not self._watchmanclient.available():
-        return bail()
+    if full:
+        return bail('full rewalk requested')
+    if ignored:
+        return bail('listing ignored files')
+    if not self._watchmanclient.available():
+        return bail('client unavailable')
     state = self._fsmonitorstate
     clock, ignorehash, notefiles = state.get()
     if not clock:
         if state.walk_on_invalidate:
-            return bail()
+            return bail('no clock')
         # Initial NULL clock value, see
         # https://facebook.github.io/watchman/docs/clockspec.html
         clock = 'c:0:0'
@@ -263,7 +264,7 @@
         if _hashignore(ignore) != ignorehash and clock != 'c:0:0':
             # ignore list changed -- can't rely on Watchman state any more
             if state.walk_on_invalidate:
-                return bail()
+                return bail('ignore rules changed')
             notefiles = []
             clock = 'c:0:0'
     else:
@@ -273,7 +274,11 @@
 
     matchfn = match.matchfn
     matchalways = match.always()
-    dmap = self._map._map
+    dmap = self._map
+    if util.safehasattr(dmap, '_map'):
+        # for better performance, directly access the inner dirstate map if the
+        # standard dirstate implementation is in use.
+        dmap = dmap._map
     nonnormalset = self._map.nonnormalset
 
     copymap = self._map.copymap
@@ -334,7 +339,7 @@
     except Exception as ex:
         _handleunavailable(self._ui, state, ex)
         self._watchmanclient.clearconnection()
-        return bail()
+        return bail('exception during run')
     else:
         # We need to propagate the last observed clock up so that we
         # can use it for our next query
@@ -342,7 +347,7 @@
         if result['is_fresh_instance']:
             if state.walk_on_invalidate:
                 state.invalidate()
-                return bail()
+                return bail('fresh instance')
             fresh_instance = True
             # Ignore any prior noteable files from the state info
             notefiles = []
@@ -600,14 +605,6 @@
             self._fsmonitorstate.invalidate()
             return super(fsmonitordirstate, self).invalidate(*args, **kwargs)
 
-        if dirstate._ui.configbool(
-            "experimental", "fsmonitor.wc_change_notify"):
-            def setparents(self, p1, p2=nullid):
-                with state_update(self._repo, name="hg.wc_change",
-                                  oldnode=self._pl[0], newnode=p1,
-                                  partial=False):
-                    return super(fsmonitordirstate, self).setparents(p1, p2)
-
     dirstate.__class__ = fsmonitordirstate
     dirstate._fsmonitorinit(repo)
 
@@ -662,14 +659,18 @@
         self.enter()
 
     def enter(self):
-        # We explicitly need to take a lock here, before we proceed to update
-        # watchman about the update operation, so that we don't race with
-        # some other actor.  merge.update is going to take the wlock almost
-        # immediately anyway, so this is effectively extending the lock
-        # around a couple of short sanity checks.
+        # Make sure we have a wlock prior to sending notifications to watchman.
+        # We don't want to race with other actors. In the update case,
+        # merge.update is going to take the wlock almost immediately. We are
+        # effectively extending the lock around several short sanity checks.
         if self.oldnode is None:
             self.oldnode = self.repo['.'].node()
-        self._lock = self.repo.wlock()
+
+        if self.repo.currentwlock() is None:
+            if util.safehasattr(self.repo, 'wlocknostateupdate'):
+                self._lock = self.repo.wlocknostateupdate()
+            else:
+                self._lock = self.repo.wlock()
         self.need_leave = self._state(
             'state-enter',
             hex(self.oldnode))
@@ -790,32 +791,34 @@
                 orig = super(fsmonitorrepo, self).status
                 return overridestatus(orig, self, *args, **kwargs)
 
-            if ui.configbool("experimental", "fsmonitor.transaction_notify"):
-                def transaction(self, *args, **kwargs):
-                    tr = super(fsmonitorrepo, self).transaction(
-                               *args, **kwargs)
-                    if tr.count != 1:
-                        return tr
-                    stateupdate = state_update(self, name="hg.transaction")
-                    stateupdate.enter()
+            def wlocknostateupdate(self, *args, **kwargs):
+                return super(fsmonitorrepo, self).wlock(*args, **kwargs)
+
+            def wlock(self, *args, **kwargs):
+                l = super(fsmonitorrepo, self).wlock(*args, **kwargs)
+                if not ui.configbool(
+                    "experimental", "fsmonitor.transaction_notify"):
+                    return l
+                if l.held != 1:
+                    return l
+                origrelease = l.releasefn
 
-                    class fsmonitortrans(tr.__class__):
-                        def _abort(self):
-                            try:
-                                result = super(fsmonitortrans, self)._abort()
-                            finally:
-                                stateupdate.exit(abort=True)
-                            return result
+                def staterelease():
+                    if origrelease:
+                        origrelease()
+                    if l.stateupdate:
+                        l.stateupdate.exit()
+                        l.stateupdate = None
 
-                        def close(self):
-                            try:
-                                result = super(fsmonitortrans, self).close()
-                            finally:
-                                if self.count == 0:
-                                    stateupdate.exit()
-                            return result
-
-                    tr.__class__ = fsmonitortrans
-                    return tr
+                try:
+                    l.stateupdate = None
+                    l.stateupdate = state_update(self, name="hg.transaction")
+                    l.stateupdate.enter()
+                    l.releasefn = staterelease
+                except Exception as e:
+                    # Swallow any errors; fire and forget
+                    self.ui.log(
+                        'watchman', 'Exception in state update %s\n', e)
+                return l
 
         repo.__class__ = fsmonitorrepo
--- a/hgext/gpg.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/gpg.py	Tue Dec 19 16:27:24 2017 -0500
@@ -106,7 +106,7 @@
 def newgpg(ui, **opts):
     """create a new gpg instance"""
     gpgpath = ui.config("gpg", "cmd")
-    gpgkey = opts.get('key')
+    gpgkey = opts.get(r'key')
     if not gpgkey:
         gpgkey = ui.config("gpg", "key")
     return gpg(gpgpath, gpgkey)
@@ -253,6 +253,7 @@
 
 def _dosign(ui, repo, *revs, **opts):
     mygpg = newgpg(ui, **opts)
+    opts = pycompat.byteskwargs(opts)
     sigver = "0"
     sigmessage = ""
 
@@ -312,7 +313,8 @@
                              % hgnode.short(n)
                              for n in nodes])
     try:
-        editor = cmdutil.getcommiteditor(editform='gpg.sign', **opts)
+        editor = cmdutil.getcommiteditor(editform='gpg.sign',
+                                         **pycompat.strkwargs(opts))
         repo.commit(message, opts['user'], opts['date'], match=msigs,
                     editor=editor)
     except ValueError as inst:
--- a/hgext/graphlog.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/graphlog.py	Tue Dec 19 16:27:24 2017 -0500
@@ -66,5 +66,5 @@
 
     This is an alias to :hg:`log -G`.
     """
-    opts['graph'] = True
+    opts[r'graph'] = True
     return commands.log(ui, repo, *pats, **opts)
--- a/hgext/hgk.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/hgk.py	Tue Dec 19 16:27:24 2017 -0500
@@ -48,6 +48,7 @@
     commands,
     obsolete,
     patch,
+    pycompat,
     registrar,
     scmutil,
     util,
@@ -79,6 +80,7 @@
     inferrepo=True)
 def difftree(ui, repo, node1=None, node2=None, *files, **opts):
     """diff trees from two commits"""
+
     def __difftree(repo, node1, node2, files=None):
         assert node2 is not None
         if files is None:
@@ -102,7 +104,7 @@
     ##
 
     while True:
-        if opts['stdin']:
+        if opts[r'stdin']:
             try:
                 line = util.bytesinput(ui.fin, ui.fout).split(' ')
                 node1 = line[0]
@@ -118,8 +120,8 @@
         else:
             node2 = node1
             node1 = repo.changelog.parents(node1)[0]
-        if opts['patch']:
-            if opts['pretty']:
+        if opts[r'patch']:
+            if opts[r'pretty']:
                 catcommit(ui, repo, node2, "")
             m = scmutil.match(repo[node1], files)
             diffopts = patch.difffeatureopts(ui)
@@ -130,7 +132,7 @@
                 ui.write(chunk)
         else:
             __difftree(repo, node1, node2, files=files)
-        if not opts['stdin']:
+        if not opts[r'stdin']:
             break
 
 def catcommit(ui, repo, n, prefix, ctx=None):
@@ -183,7 +185,7 @@
     # strings
     #
     prefix = ""
-    if opts['stdin']:
+    if opts[r'stdin']:
         try:
             (type, r) = util.bytesinput(ui.fin, ui.fout).split(' ')
             prefix = "    "
@@ -201,7 +203,7 @@
             return 1
         n = repo.lookup(r)
         catcommit(ui, repo, n, prefix)
-        if opts['stdin']:
+        if opts[r'stdin']:
             try:
                 (type, r) = util.bytesinput(ui.fin, ui.fout).split(' ')
             except EOFError:
@@ -340,7 +342,7 @@
     else:
         full = None
     copy = [x for x in revs]
-    revtree(ui, copy, repo, full, opts['max_count'], opts['parents'])
+    revtree(ui, copy, repo, full, opts[r'max_count'], opts[r'parents'])
 
 @command('view',
     [('l', 'limit', '',
@@ -348,6 +350,7 @@
     _('[-l LIMIT] [REVRANGE]'))
 def view(ui, repo, *etc, **opts):
     "start interactive history viewer"
+    opts = pycompat.byteskwargs(opts)
     os.chdir(repo.root)
     optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v])
     if repo.filtername is None:
--- a/hgext/highlight/highlight.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/highlight/highlight.py	Tue Dec 19 16:27:24 2017 -0500
@@ -22,8 +22,12 @@
     import pygments
     import pygments.formatters
     import pygments.lexers
+    import pygments.plugin
     import pygments.util
 
+    for unused in pygments.plugin.find_plugin_lexers():
+        pass
+
 highlight = pygments.highlight
 ClassNotFound = pygments.util.ClassNotFound
 guess_lexer = pygments.lexers.guess_lexer
--- a/hgext/histedit.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/histedit.py	Tue Dec 19 16:27:24 2017 -0500
@@ -203,6 +203,7 @@
     mergeutil,
     node,
     obsolete,
+    pycompat,
     registrar,
     repair,
     scmutil,
@@ -542,9 +543,9 @@
     def commitfunc(**kwargs):
         overrides = {('phases', 'new-commit'): phasemin}
         with repo.ui.configoverride(overrides, 'histedit'):
-            extra = kwargs.get('extra', {}).copy()
+            extra = kwargs.get(r'extra', {}).copy()
             extra['histedit_source'] = src.hex()
-            kwargs['extra'] = extra
+            kwargs[r'extra'] = extra
             return repo.commit(**kwargs)
     return commitfunc
 
@@ -602,7 +603,7 @@
         if path in headmf:
             fctx = last[path]
             flags = fctx.flags()
-            mctx = context.memfilectx(repo,
+            mctx = context.memfilectx(repo, ctx,
                                       fctx.path(), fctx.data(),
                                       islink='l' in flags,
                                       isexec='x' in flags,
@@ -917,7 +918,8 @@
      ('o', 'outgoing', False, _('changesets not found in destination')),
      ('f', 'force', False,
       _('force outgoing even for unrelated repositories')),
-     ('r', 'rev', [], _('first revision to be edited'), _('REV'))],
+     ('r', 'rev', [], _('first revision to be edited'), _('REV'))] +
+    cmdutil.formatteropts,
      _("[OPTIONS] ([ANCESTOR] | --outgoing [URL])"))
 def histedit(ui, repo, *freeargs, **opts):
     """interactively edit changeset history
@@ -1094,6 +1096,9 @@
                     _('histedit requires exactly one ancestor revision'))
 
 def _histedit(ui, repo, state, *freeargs, **opts):
+    opts = pycompat.byteskwargs(opts)
+    fm = ui.formatter('histedit', opts)
+    fm.startitem()
     goal = _getgoal(opts)
     revs = opts.get('rev', [])
     rules = opts.get('commands', '')
@@ -1116,7 +1121,8 @@
         _newhistedit(ui, repo, state, revs, freeargs, opts)
 
     _continuehistedit(ui, repo, state)
-    _finishhistedit(ui, repo, state)
+    _finishhistedit(ui, repo, state, fm)
+    fm.end()
 
 def _continuehistedit(ui, repo, state):
     """This function runs after either:
@@ -1163,7 +1169,7 @@
     state.write()
     ui.progress(_("editing"), None)
 
-def _finishhistedit(ui, repo, state):
+def _finishhistedit(ui, repo, state, fm):
     """This action runs when histedit is finishing its session"""
     repo.ui.pushbuffer()
     hg.update(repo, state.parentctxnode, quietempty=True)
@@ -1197,6 +1203,13 @@
     mapping = {k: v for k, v in mapping.items()
                if k in nodemap and all(n in nodemap for n in v)}
     scmutil.cleanupnodes(repo, mapping, 'histedit')
+    hf = fm.hexfunc
+    fl = fm.formatlist
+    fd = fm.formatdict
+    nodechanges = fd({hf(oldn): fl([hf(n) for n in newn], name='node')
+                      for oldn, newn in mapping.iteritems()},
+                     key="oldnode", value="newnodes")
+    fm.data(nodechanges=nodechanges)
 
     state.clear()
     if os.path.exists(repo.sjoin('undo')):
--- a/hgext/journal.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/journal.py	Tue Dec 19 16:27:24 2017 -0500
@@ -30,6 +30,7 @@
     localrepo,
     lock,
     node,
+    pycompat,
     registrar,
     util,
 )
@@ -133,7 +134,7 @@
 
     Note that by default entries go from most recent to oldest.
     """
-    order = kwargs.pop('order', max)
+    order = kwargs.pop(r'order', max)
     iterables = [iter(it) for it in iterables]
     # this tracks still active iterables; iterables are deleted as they are
     # exhausted, which is why this is a dictionary and why each entry also
@@ -303,7 +304,7 @@
             # default to 600 seconds timeout
             l = lock.lock(
                 vfs, 'namejournal.lock',
-                int(self.ui.config("ui", "timeout")), desc=desc)
+                self.ui.configint("ui", "timeout"), desc=desc)
             self.ui.warn(_("got lock after %s seconds\n") % l.delay)
         self._lockref = weakref.ref(l)
         return l
@@ -458,6 +459,7 @@
     `hg journal -T json` can be used to produce machine readable output.
 
     """
+    opts = pycompat.byteskwargs(opts)
     name = '.'
     if opts.get('all'):
         if args:
--- a/hgext/keyword.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/keyword.py	Tue Dec 19 16:27:24 2017 -0500
@@ -104,6 +104,7 @@
     match,
     patch,
     pathutil,
+    pycompat,
     registrar,
     scmutil,
     templatefilters,
@@ -380,6 +381,7 @@
     '''Bails out if [keyword] configuration is not active.
     Returns status of working directory.'''
     if kwt:
+        opts = pycompat.byteskwargs(opts)
         return repo.status(match=scmutil.match(wctx, pats, opts), clean=True,
                            unknown=opts.get('unknown') or opts.get('all'))
     if ui.configitems('keyword'):
@@ -436,16 +438,16 @@
     ui.setconfig('keywordset', 'svn', svn, 'keyword')
 
     uikwmaps = ui.configitems('keywordmaps')
-    if args or opts.get('rcfile'):
+    if args or opts.get(r'rcfile'):
         ui.status(_('\n\tconfiguration using custom keyword template maps\n'))
         if uikwmaps:
             ui.status(_('\textending current template maps\n'))
-        if opts.get('default') or not uikwmaps:
+        if opts.get(r'default') or not uikwmaps:
             if svn:
                 ui.status(_('\toverriding default svn keywordset\n'))
             else:
                 ui.status(_('\toverriding default cvs keywordset\n'))
-        if opts.get('rcfile'):
+        if opts.get(r'rcfile'):
             ui.readconfig(opts.get('rcfile'))
         if args:
             # simulate hgrc parsing
@@ -453,7 +455,7 @@
             repo.vfs.write('hgrc', rcmaps)
             ui.readconfig(repo.vfs.join('hgrc'))
         kwmaps = dict(ui.configitems('keywordmaps'))
-    elif opts.get('default'):
+    elif opts.get(r'default'):
         if svn:
             ui.status(_('\n\tconfiguration using default svn keywordset\n'))
         else:
@@ -543,6 +545,7 @@
     else:
         cwd = ''
     files = []
+    opts = pycompat.byteskwargs(opts)
     if not opts.get('unknown') or opts.get('all'):
         files = sorted(status.modified + status.added + status.clean)
     kwfiles = kwt.iskwfile(files, wctx)
--- a/hgext/largefiles/lfcommands.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/largefiles/lfcommands.py	Tue Dec 19 16:27:24 2017 -0500
@@ -24,6 +24,7 @@
     lock,
     match as matchmod,
     node,
+    pycompat,
     registrar,
     scmutil,
     util,
@@ -74,6 +75,7 @@
     Use --to-normal to convert largefiles back to normal files; after
     this, the DEST repository can be used without largefiles at all.'''
 
+    opts = pycompat.byteskwargs(opts)
     if opts['to_normal']:
         tolfile = False
     else:
@@ -177,7 +179,7 @@
             convcmd.converter = converter
 
             try:
-                convcmd.convert(ui, src, dest)
+                convcmd.convert(ui, src, dest, source_type='hg', dest_type='hg')
             finally:
                 convcmd.converter = orig
         success = True
@@ -259,7 +261,8 @@
                 # doesn't change after rename or copy
                 renamed = lfutil.standin(renamed[0])
 
-            return context.memfilectx(repo, f, lfiletohash[srcfname] + '\n',
+            return context.memfilectx(repo, memctx, f,
+                                      lfiletohash[srcfname] + '\n',
                                       'l' in fctx.flags(), 'x' in fctx.flags(),
                                       renamed)
         else:
@@ -311,7 +314,7 @@
     data = fctx.data()
     if f == '.hgtags':
         data = _converttags (repo.ui, revmap, data)
-    return context.memfilectx(repo, f, data, 'l' in fctx.flags(),
+    return context.memfilectx(repo, ctx, f, data, 'l' in fctx.flags(),
                               'x' in fctx.flags(), renamed)
 
 # Remap tag data using a revision map
@@ -579,7 +582,7 @@
     """
     repo.lfpullsource = source
 
-    revs = opts.get('rev', [])
+    revs = opts.get(r'rev', [])
     if not revs:
         raise error.Abort(_('no revisions specified'))
     revs = scmutil.revrange(repo, revs)
--- a/hgext/largefiles/lfutil.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/largefiles/lfutil.py	Tue Dec 19 16:27:24 2017 -0500
@@ -69,31 +69,31 @@
     to preserve download bandwidth and storage space.'''
     return os.path.join(_usercachedir(ui), hash)
 
-def _usercachedir(ui):
+def _usercachedir(ui, name=longname):
     '''Return the location of the "global" largefiles cache.'''
-    path = ui.configpath(longname, 'usercache')
+    path = ui.configpath(name, 'usercache')
     if path:
         return path
     if pycompat.iswindows:
         appdata = encoding.environ.get('LOCALAPPDATA',\
                         encoding.environ.get('APPDATA'))
         if appdata:
-            return os.path.join(appdata, longname)
+            return os.path.join(appdata, name)
     elif pycompat.isdarwin:
         home = encoding.environ.get('HOME')
         if home:
-            return os.path.join(home, 'Library', 'Caches', longname)
+            return os.path.join(home, 'Library', 'Caches', name)
     elif pycompat.isposix:
         path = encoding.environ.get('XDG_CACHE_HOME')
         if path:
-            return os.path.join(path, longname)
+            return os.path.join(path, name)
         home = encoding.environ.get('HOME')
         if home:
-            return os.path.join(home, '.cache', longname)
+            return os.path.join(home, '.cache', name)
     else:
         raise error.Abort(_('unknown operating system: %s\n')
                           % pycompat.osname)
-    raise error.Abort(_('unknown %s usercache location') % longname)
+    raise error.Abort(_('unknown %s usercache location') % name)
 
 def inusercache(ui, hash):
     path = usercachepath(ui, hash)
--- a/hgext/largefiles/overrides.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/largefiles/overrides.py	Tue Dec 19 16:27:24 2017 -0500
@@ -21,6 +21,7 @@
     hg,
     match as matchmod,
     pathutil,
+    pycompat,
     registrar,
     scmutil,
     smartset,
@@ -156,7 +157,7 @@
     # Need to lock, otherwise there could be a race condition between
     # when standins are created and added to the repo.
     with repo.wlock():
-        if not opts.get('dry_run'):
+        if not opts.get(r'dry_run'):
             standins = []
             lfdirstate = lfutil.openlfdirstate(ui, repo)
             for f in lfnames:
@@ -177,7 +178,7 @@
     return added, bad
 
 def removelargefiles(ui, repo, isaddremove, matcher, **opts):
-    after = opts.get('after')
+    after = opts.get(r'after')
     m = composelargefilematcher(matcher, repo[None].manifest())
     try:
         repo.lfstatus = True
@@ -221,11 +222,11 @@
                     name = m.rel(f)
                 ui.status(_('removing %s\n') % name)
 
-            if not opts.get('dry_run'):
+            if not opts.get(r'dry_run'):
                 if not after:
                     repo.wvfs.unlinkpath(f, ignoremissing=True)
 
-        if opts.get('dry_run'):
+        if opts.get(r'dry_run'):
             return result
 
         remove = [lfutil.standin(f) for f in remove]
@@ -252,7 +253,7 @@
 # -- Wrappers: modify existing commands --------------------------------
 
 def overrideadd(orig, ui, repo, *pats, **opts):
-    if opts.get('normal') and opts.get('large'):
+    if opts.get(r'normal') and opts.get(r'large'):
         raise error.Abort(_('--normal cannot be used with --large'))
     return orig(ui, repo, *pats, **opts)
 
@@ -403,9 +404,9 @@
         setattr(cmdutil, '_makenofollowlogfilematcher', oldmakelogfilematcher)
 
 def overrideverify(orig, ui, repo, *pats, **opts):
-    large = opts.pop('large', False)
-    all = opts.pop('lfa', False)
-    contents = opts.pop('lfc', False)
+    large = opts.pop(r'large', False)
+    all = opts.pop(r'lfa', False)
+    contents = opts.pop(r'lfc', False)
 
     result = orig(ui, repo, *pats, **opts)
     if large or all or contents:
@@ -413,7 +414,7 @@
     return result
 
 def overridedebugstate(orig, ui, repo, *pats, **opts):
-    large = opts.pop('large', False)
+    large = opts.pop(r'large', False)
     if large:
         class fakerepo(object):
             dirstate = lfutil.openlfdirstate(ui, repo)
@@ -802,8 +803,8 @@
     repo.lfpullsource = source
     result = orig(ui, repo, source, **opts)
     revspostpull = len(repo)
-    lfrevs = opts.get('lfrev', [])
-    if opts.get('all_largefiles'):
+    lfrevs = opts.get(r'lfrev', [])
+    if opts.get(r'all_largefiles'):
         lfrevs.append('pulled()')
     if lfrevs and revspostpull > revsprepull:
         numcached = 0
@@ -820,7 +821,7 @@
 
 def overridepush(orig, ui, repo, *args, **kwargs):
     """Override push command and store --lfrev parameters in opargs"""
-    lfrevs = kwargs.pop('lfrev', None)
+    lfrevs = kwargs.pop(r'lfrev', None)
     if lfrevs:
         opargs = kwargs.setdefault('opargs', {})
         opargs['lfrevs'] = scmutil.revrange(repo, lfrevs)
@@ -828,7 +829,7 @@
 
 def exchangepushoperation(orig, *args, **kwargs):
     """Override pushoperation constructor and store lfrevs parameter"""
-    lfrevs = kwargs.pop('lfrevs', None)
+    lfrevs = kwargs.pop(r'lfrevs', None)
     pushop = orig(*args, **kwargs)
     pushop.lfrevs = lfrevs
     return pushop
@@ -865,7 +866,7 @@
     d = dest
     if d is None:
         d = hg.defaultdest(source)
-    if opts.get('all_largefiles') and not hg.islocal(d):
+    if opts.get(r'all_largefiles') and not hg.islocal(d):
             raise error.Abort(_(
             '--all-largefiles is incompatible with non-local destination %s') %
             d)
@@ -893,7 +894,7 @@
         # Caching is implicitly limited to 'rev' option, since the dest repo was
         # truncated at that point.  The user may expect a download count with
         # this option, so attempt whether or not this is a largefile repo.
-        if opts.get('all_largefiles'):
+        if opts.get(r'all_largefiles'):
             success, missing = lfcommands.downloadlfiles(ui, repo, None)
 
             if missing != 0:
@@ -913,7 +914,7 @@
     if not util.safehasattr(repo, '_largefilesenabled'):
         return orig(ui, repo, **opts)
 
-    resuming = opts.get('continue')
+    resuming = opts.get(r'continue')
     repo._lfcommithooks.append(lfutil.automatedcommithook(resuming))
     repo._lfstatuswriters.append(lambda *msg, **opts: None)
     try:
@@ -1272,6 +1273,7 @@
     repo.status = overridestatus
     orig(ui, repo, *dirs, **opts)
     repo.status = oldstatus
+
 def overriderollback(orig, ui, repo, **opts):
     with repo.wlock():
         before = repo.dirstate.parents()
@@ -1310,7 +1312,7 @@
     return result
 
 def overridetransplant(orig, ui, repo, *revs, **opts):
-    resuming = opts.get('continue')
+    resuming = opts.get(r'continue')
     repo._lfcommithooks.append(lfutil.automatedcommithook(resuming))
     repo._lfstatuswriters.append(lambda *msg, **opts: None)
     try:
@@ -1321,6 +1323,7 @@
     return result
 
 def overridecat(orig, ui, repo, file1, *pats, **opts):
+    opts = pycompat.byteskwargs(opts)
     ctx = scmutil.revsingle(repo, opts.get('rev'))
     err = 1
     notbad = set()
@@ -1382,7 +1385,7 @@
 
 def mergeupdate(orig, repo, node, branchmerge, force,
                 *args, **kwargs):
-    matcher = kwargs.get('matcher', None)
+    matcher = kwargs.get(r'matcher', None)
     # note if this is a partial update
     partial = matcher and not matcher.always()
     with repo.wlock():
@@ -1437,7 +1440,7 @@
         # Make sure the merge runs on disk, not in-memory. largefiles is not a
         # good candidate for in-memory merge (large files, custom dirstate,
         # matcher usage).
-        kwargs['wc'] = repo[None]
+        kwargs[r'wc'] = repo[None]
         result = orig(repo, node, branchmerge, force, *args, **kwargs)
 
         newstandins = lfutil.getstandinsstate(repo)
@@ -1470,3 +1473,9 @@
                                 printmessage=False, normallookup=True)
 
     return result
+
+def upgraderequirements(orig, repo):
+    reqs = orig(repo)
+    if 'largefiles' in repo.requirements:
+        reqs.add('largefiles')
+    return reqs
--- a/hgext/largefiles/proto.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/largefiles/proto.py	Tue Dec 19 16:27:24 2017 -0500
@@ -176,7 +176,7 @@
     if cmd == 'heads' and self.capable('largefiles'):
         cmd = 'lheads'
     if cmd == 'batch' and self.capable('largefiles'):
-        args['cmds'] = args['cmds'].replace('heads ', 'lheads ')
+        args[r'cmds'] = args[r'cmds'].replace('heads ', 'lheads ')
     return ssholdcallstream(self, cmd, **args)
 
 headsre = re.compile(r'(^|;)heads\b')
@@ -185,5 +185,5 @@
     if cmd == 'heads' and self.capable('largefiles'):
         cmd = 'lheads'
     if cmd == 'batch' and self.capable('largefiles'):
-        args['cmds'] = headsre.sub('lheads', args['cmds'])
+        args[r'cmds'] = headsre.sub('lheads', args[r'cmds'])
     return httpoldcallstream(self, cmd, **args)
--- a/hgext/largefiles/reposetup.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/largefiles/reposetup.py	Tue Dec 19 16:27:24 2017 -0500
@@ -138,7 +138,7 @@
                         sf = lfutil.standin(f)
                         if sf in dirstate:
                             newfiles.append(sf)
-                        elif sf in dirstate.dirs():
+                        elif dirstate.hasdir(sf):
                             # Directory entries could be regular or
                             # standin, check both
                             newfiles.extend((f, sf))
@@ -156,7 +156,7 @@
                     def sfindirstate(f):
                         sf = lfutil.standin(f)
                         dirstate = self.dirstate
-                        return sf in dirstate or sf in dirstate.dirs()
+                        return sf in dirstate or dirstate.hasdir(sf)
 
                     match._files = [f for f in match._files
                                     if sfindirstate(f)]
--- a/hgext/largefiles/uisetup.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/largefiles/uisetup.py	Tue Dec 19 16:27:24 2017 -0500
@@ -30,6 +30,7 @@
     scmutil,
     sshpeer,
     subrepo,
+    upgrade,
     wireproto,
 )
 
@@ -60,6 +61,12 @@
 
     extensions.wrapfunction(copies, 'pathcopies', overrides.copiespathcopies)
 
+    extensions.wrapfunction(upgrade, 'preservedrequirements',
+                            overrides.upgraderequirements)
+
+    extensions.wrapfunction(upgrade, 'supporteddestrequirements',
+                            overrides.upgraderequirements)
+
     # Subrepos call status function
     entry = extensions.wrapcommand(commands.table, 'status',
                                    overrides.overridestatus)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/lfs/__init__.py	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,205 @@
+# lfs - hash-preserving large file support using Git-LFS protocol
+#
+# Copyright 2017 Facebook, Inc.
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+"""lfs - large file support (EXPERIMENTAL)
+
+Configs::
+
+    [lfs]
+    # Remote endpoint. Multiple protocols are supported:
+    # - http(s)://user:pass@example.com/path
+    #   git-lfs endpoint
+    # - file:///tmp/path
+    #   local filesystem, usually for testing
+    # if unset, lfs will prompt setting this when it must use this value.
+    # (default: unset)
+    url = https://example.com/lfs
+
+    # size of a file to make it use LFS
+    threshold = 10M
+
+    # how many times to retry before giving up on transferring an object
+    retry = 5
+
+    # the local directory to store lfs files for sharing across local clones.
+    # If not set, the cache is located in an OS specific cache location.
+    usercache = /path/to/global/cache
+"""
+
+from __future__ import absolute_import
+
+from mercurial.i18n import _
+
+from mercurial import (
+    bundle2,
+    changegroup,
+    context,
+    exchange,
+    extensions,
+    filelog,
+    hg,
+    localrepo,
+    registrar,
+    revlog,
+    scmutil,
+    upgrade,
+    vfs as vfsmod,
+)
+
+from . import (
+    blobstore,
+    wrapper,
+)
+
+# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
+# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
+# be specifying the version(s) of Mercurial they are tested with, or
+# leave the attribute unspecified.
+testedwith = 'ships-with-hg-core'
+
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('experimental', 'lfs.user-agent',
+    default=None,
+)
+
+configitem('lfs', 'url',
+    default=configitem.dynamicdefault,
+)
+configitem('lfs', 'usercache',
+    default=None,
+)
+configitem('lfs', 'threshold',
+    default=None,
+)
+configitem('lfs', 'retry',
+    default=5,
+)
+# Deprecated
+configitem('lfs', 'remotestore',
+    default=None,
+)
+# Deprecated
+configitem('lfs', 'dummy',
+    default=None,
+)
+# Deprecated
+configitem('lfs', 'git-lfs',
+    default=None,
+)
+
+cmdtable = {}
+command = registrar.command(cmdtable)
+
+templatekeyword = registrar.templatekeyword()
+
+def featuresetup(ui, supported):
+    # don't die on seeing a repo with the lfs requirement
+    supported |= {'lfs'}
+
+def uisetup(ui):
+    localrepo.localrepository.featuresetupfuncs.add(featuresetup)
+
+def reposetup(ui, repo):
+    # Nothing to do with a remote repo
+    if not repo.local():
+        return
+
+    threshold = repo.ui.configbytes('lfs', 'threshold')
+
+    repo.svfs.options['lfsthreshold'] = threshold
+    repo.svfs.lfslocalblobstore = blobstore.local(repo)
+    repo.svfs.lfsremoteblobstore = blobstore.remote(repo)
+
+    # Push hook
+    repo.prepushoutgoinghooks.add('lfs', wrapper.prepush)
+
+    if 'lfs' not in repo.requirements:
+        def checkrequireslfs(ui, repo, **kwargs):
+            if 'lfs' not in repo.requirements:
+                ctx = repo[kwargs['node']]
+                # TODO: is there a way to just walk the files in the commit?
+                if any(ctx[f].islfs() for f in ctx.files() if f in ctx):
+                    repo.requirements.add('lfs')
+                    repo._writerequirements()
+
+        ui.setconfig('hooks', 'commit.lfs', checkrequireslfs, 'lfs')
+
+def wrapfilelog(filelog):
+    wrapfunction = extensions.wrapfunction
+
+    wrapfunction(filelog, 'addrevision', wrapper.filelogaddrevision)
+    wrapfunction(filelog, 'renamed', wrapper.filelogrenamed)
+    wrapfunction(filelog, 'size', wrapper.filelogsize)
+
+def extsetup(ui):
+    wrapfilelog(filelog.filelog)
+
+    wrapfunction = extensions.wrapfunction
+
+    wrapfunction(scmutil, 'wrapconvertsink', wrapper.convertsink)
+
+    wrapfunction(upgrade, '_finishdatamigration',
+                 wrapper.upgradefinishdatamigration)
+
+    wrapfunction(upgrade, 'preservedrequirements',
+                 wrapper.upgraderequirements)
+
+    wrapfunction(upgrade, 'supporteddestrequirements',
+                 wrapper.upgraderequirements)
+
+    wrapfunction(changegroup,
+                 'supportedoutgoingversions',
+                 wrapper.supportedoutgoingversions)
+    wrapfunction(changegroup,
+                 'allsupportedversions',
+                 wrapper.allsupportedversions)
+
+    wrapfunction(context.basefilectx, 'cmp', wrapper.filectxcmp)
+    wrapfunction(context.basefilectx, 'isbinary', wrapper.filectxisbinary)
+    context.basefilectx.islfs = wrapper.filectxislfs
+
+    revlog.addflagprocessor(
+        revlog.REVIDX_EXTSTORED,
+        (
+            wrapper.readfromstore,
+            wrapper.writetostore,
+            wrapper.bypasscheckhash,
+        ),
+    )
+
+    wrapfunction(hg, 'clone', wrapper.hgclone)
+    wrapfunction(hg, 'postshare', wrapper.hgpostshare)
+
+    # Make bundle choose changegroup3 instead of changegroup2. This affects
+    # "hg bundle" command. Note: it does not cover all bundle formats like
+    # "packed1". Using "packed1" with lfs will likely cause trouble.
+    names = [k for k, v in exchange._bundlespeccgversions.items() if v == '02']
+    for k in names:
+        exchange._bundlespeccgversions[k] = '03'
+
+    # bundlerepo uses "vfsmod.readonlyvfs(othervfs)", we need to make sure lfs
+    # options and blob stores are passed from othervfs to the new readonlyvfs.
+    wrapfunction(vfsmod.readonlyvfs, '__init__', wrapper.vfsinit)
+
+    # when writing a bundle via "hg bundle" command, upload related LFS blobs
+    wrapfunction(bundle2, 'writenewbundle', wrapper.writenewbundle)
+
+@templatekeyword('lfs_files')
+def lfsfiles(repo, ctx, **args):
+    """List of strings. LFS files added or modified by the changeset."""
+    pointers = wrapper.pointersfromctx(ctx) # {path: pointer}
+    return sorted(pointers.keys())
+
+@command('debuglfsupload',
+         [('r', 'rev', [], _('upload large files introduced by REV'))])
+def debuglfsupload(ui, repo, **opts):
+    """upload lfs blobs added by the working copy parent or given revisions"""
+    revs = opts.get('rev', [])
+    pointers = wrapper.extractpointers(repo, scmutil.revrange(repo, revs))
+    wrapper.uploadblobs(repo, pointers)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/lfs/blobstore.py	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,389 @@
+# blobstore.py - local and remote (speaking Git-LFS protocol) blob storages
+#
+# Copyright 2017 Facebook, Inc.
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from __future__ import absolute_import
+
+import json
+import os
+import re
+
+from mercurial.i18n import _
+
+from mercurial import (
+    error,
+    pathutil,
+    url as urlmod,
+    util,
+    vfs as vfsmod,
+    worker,
+)
+
+from ..largefiles import lfutil
+
+# 64 bytes for SHA256
+_lfsre = re.compile(r'\A[a-f0-9]{64}\Z')
+
+class lfsvfs(vfsmod.vfs):
+    def join(self, path):
+        """split the path at first two characters, like: XX/XXXXX..."""
+        if not _lfsre.match(path):
+            raise error.ProgrammingError('unexpected lfs path: %s' % path)
+        return super(lfsvfs, self).join(path[0:2], path[2:])
+
+    def walk(self, path=None, onerror=None):
+        """Yield (dirpath, [], oids) tuple for blobs under path
+
+        Oids only exist in the root of this vfs, so dirpath is always ''.
+        """
+        root = os.path.normpath(self.base)
+        # when dirpath == root, dirpath[prefixlen:] becomes empty
+        # because len(dirpath) < prefixlen.
+        prefixlen = len(pathutil.normasprefix(root))
+        oids = []
+
+        for dirpath, dirs, files in os.walk(self.reljoin(self.base, path or ''),
+                                            onerror=onerror):
+            dirpath = dirpath[prefixlen:]
+
+            # Silently skip unexpected files and directories
+            if len(dirpath) == 2:
+                oids.extend([dirpath + f for f in files
+                             if _lfsre.match(dirpath + f)])
+
+        yield ('', [], oids)
+
+class filewithprogress(object):
+    """a file-like object that supports __len__ and read.
+
+    Useful to provide progress information for how many bytes are read.
+    """
+
+    def __init__(self, fp, callback):
+        self._fp = fp
+        self._callback = callback # func(readsize)
+        fp.seek(0, os.SEEK_END)
+        self._len = fp.tell()
+        fp.seek(0)
+
+    def __len__(self):
+        return self._len
+
+    def read(self, size):
+        if self._fp is None:
+            return b''
+        data = self._fp.read(size)
+        if data:
+            if self._callback:
+                self._callback(len(data))
+        else:
+            self._fp.close()
+            self._fp = None
+        return data
+
+class local(object):
+    """Local blobstore for large file contents.
+
+    This blobstore is used both as a cache and as a staging area for large blobs
+    to be uploaded to the remote blobstore.
+    """
+
+    def __init__(self, repo):
+        fullpath = repo.svfs.join('lfs/objects')
+        self.vfs = lfsvfs(fullpath)
+        usercache = lfutil._usercachedir(repo.ui, 'lfs')
+        self.cachevfs = lfsvfs(usercache)
+
+    def write(self, oid, data):
+        """Write blob to local blobstore."""
+        with self.vfs(oid, 'wb', atomictemp=True) as fp:
+            fp.write(data)
+
+        # XXX: should we verify the content of the cache, and hardlink back to
+        # the local store on success, but truncate, write and link on failure?
+        if not self.cachevfs.exists(oid):
+            lfutil.link(self.vfs.join(oid), self.cachevfs.join(oid))
+
+    def read(self, oid):
+        """Read blob from local blobstore."""
+        if not self.vfs.exists(oid):
+            lfutil.link(self.cachevfs.join(oid), self.vfs.join(oid))
+        return self.vfs.read(oid)
+
+    def has(self, oid):
+        """Returns True if the local blobstore contains the requested blob,
+        False otherwise."""
+        return self.cachevfs.exists(oid) or self.vfs.exists(oid)
+
+class _gitlfsremote(object):
+
+    def __init__(self, repo, url):
+        ui = repo.ui
+        self.ui = ui
+        baseurl, authinfo = url.authinfo()
+        self.baseurl = baseurl.rstrip('/')
+        useragent = repo.ui.config('experimental', 'lfs.user-agent')
+        if not useragent:
+            useragent = 'mercurial/%s git/2.15.1' % util.version()
+        self.urlopener = urlmod.opener(ui, authinfo, useragent)
+        self.retry = ui.configint('lfs', 'retry')
+
+    def writebatch(self, pointers, fromstore):
+        """Batch upload from local to remote blobstore."""
+        self._batch(pointers, fromstore, 'upload')
+
+    def readbatch(self, pointers, tostore):
+        """Batch download from remote to local blostore."""
+        self._batch(pointers, tostore, 'download')
+
+    def _batchrequest(self, pointers, action):
+        """Get metadata about objects pointed by pointers for given action
+
+        Return decoded JSON object like {'objects': [{'oid': '', 'size': 1}]}
+        See https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md
+        """
+        objects = [{'oid': p.oid(), 'size': p.size()} for p in pointers]
+        requestdata = json.dumps({
+            'objects': objects,
+            'operation': action,
+        })
+        batchreq = util.urlreq.request('%s/objects/batch' % self.baseurl,
+                                       data=requestdata)
+        batchreq.add_header('Accept', 'application/vnd.git-lfs+json')
+        batchreq.add_header('Content-Type', 'application/vnd.git-lfs+json')
+        try:
+            rawjson = self.urlopener.open(batchreq).read()
+        except util.urlerr.httperror as ex:
+            raise LfsRemoteError(_('LFS HTTP error: %s (action=%s)')
+                                 % (ex, action))
+        try:
+            response = json.loads(rawjson)
+        except ValueError:
+            raise LfsRemoteError(_('LFS server returns invalid JSON: %s')
+                                 % rawjson)
+        return response
+
+    def _checkforservererror(self, pointers, responses):
+        """Scans errors from objects
+
+        Returns LfsRemoteError if any objects has an error"""
+        for response in responses:
+            error = response.get('error')
+            if error:
+                ptrmap = {p.oid(): p for p in pointers}
+                p = ptrmap.get(response['oid'], None)
+                if error['code'] == 404 and p:
+                    filename = getattr(p, 'filename', 'unknown')
+                    raise LfsRemoteError(
+                        _(('LFS server error. Remote object '
+                          'for file %s not found: %r')) % (filename, response))
+                raise LfsRemoteError(_('LFS server error: %r') % response)
+
+    def _extractobjects(self, response, pointers, action):
+        """extract objects from response of the batch API
+
+        response: parsed JSON object returned by batch API
+        return response['objects'] filtered by action
+        raise if any object has an error
+        """
+        # Scan errors from objects - fail early
+        objects = response.get('objects', [])
+        self._checkforservererror(pointers, objects)
+
+        # Filter objects with given action. Practically, this skips uploading
+        # objects which exist in the server.
+        filteredobjects = [o for o in objects if action in o.get('actions', [])]
+        # But for downloading, we want all objects. Therefore missing objects
+        # should be considered an error.
+        if action == 'download':
+            if len(filteredobjects) < len(objects):
+                missing = [o.get('oid', '?')
+                           for o in objects
+                           if action not in o.get('actions', [])]
+                raise LfsRemoteError(
+                    _('LFS server claims required objects do not exist:\n%s')
+                    % '\n'.join(missing))
+
+        return filteredobjects
+
+    def _basictransfer(self, obj, action, localstore):
+        """Download or upload a single object using basic transfer protocol
+
+        obj: dict, an object description returned by batch API
+        action: string, one of ['upload', 'download']
+        localstore: blobstore.local
+
+        See https://github.com/git-lfs/git-lfs/blob/master/docs/api/\
+        basic-transfers.md
+        """
+        oid = str(obj['oid'])
+
+        href = str(obj['actions'][action].get('href'))
+        headers = obj['actions'][action].get('header', {}).items()
+
+        request = util.urlreq.request(href)
+        if action == 'upload':
+            # If uploading blobs, read data from local blobstore.
+            request.data = filewithprogress(localstore.vfs(oid), None)
+            request.get_method = lambda: 'PUT'
+
+        for k, v in headers:
+            request.add_header(k, v)
+
+        response = b''
+        try:
+            req = self.urlopener.open(request)
+            while True:
+                data = req.read(1048576)
+                if not data:
+                    break
+                response += data
+        except util.urlerr.httperror as ex:
+            raise LfsRemoteError(_('HTTP error: %s (oid=%s, action=%s)')
+                                 % (ex, oid, action))
+
+        if action == 'download':
+            # If downloading blobs, store downloaded data to local blobstore
+            localstore.write(oid, response)
+
+    def _batch(self, pointers, localstore, action):
+        if action not in ['upload', 'download']:
+            raise error.ProgrammingError('invalid Git-LFS action: %s' % action)
+
+        response = self._batchrequest(pointers, action)
+        objects = self._extractobjects(response, pointers, action)
+        total = sum(x.get('size', 0) for x in objects)
+        sizes = {}
+        for obj in objects:
+            sizes[obj.get('oid')] = obj.get('size', 0)
+        topic = {'upload': _('lfs uploading'),
+                 'download': _('lfs downloading')}[action]
+        if self.ui.verbose and len(objects) > 1:
+            self.ui.write(_('lfs: need to transfer %d objects (%s)\n')
+                          % (len(objects), util.bytecount(total)))
+        self.ui.progress(topic, 0, total=total)
+        def transfer(chunk):
+            for obj in chunk:
+                objsize = obj.get('size', 0)
+                if self.ui.verbose:
+                    if action == 'download':
+                        msg = _('lfs: downloading %s (%s)\n')
+                    elif action == 'upload':
+                        msg = _('lfs: uploading %s (%s)\n')
+                    self.ui.write(msg % (obj.get('oid'),
+                                  util.bytecount(objsize)))
+                retry = self.retry
+                while True:
+                    try:
+                        self._basictransfer(obj, action, localstore)
+                        yield 1, obj.get('oid')
+                        break
+                    except Exception as ex:
+                        if retry > 0:
+                            if self.ui.verbose:
+                                self.ui.write(
+                                    _('lfs: failed: %r (remaining retry %d)\n')
+                                    % (ex, retry))
+                            retry -= 1
+                            continue
+                        raise
+
+        oids = worker.worker(self.ui, 0.1, transfer, (),
+                             sorted(objects, key=lambda o: o.get('oid')))
+        processed = 0
+        for _one, oid in oids:
+            processed += sizes[oid]
+            self.ui.progress(topic, processed, total=total)
+            if self.ui.verbose:
+                self.ui.write(_('lfs: processed: %s\n') % oid)
+        self.ui.progress(topic, pos=None, total=total)
+
+    def __del__(self):
+        # copied from mercurial/httppeer.py
+        urlopener = getattr(self, 'urlopener', None)
+        if urlopener:
+            for h in urlopener.handlers:
+                h.close()
+                getattr(h, "close_all", lambda : None)()
+
+class _dummyremote(object):
+    """Dummy store storing blobs to temp directory."""
+
+    def __init__(self, repo, url):
+        fullpath = repo.vfs.join('lfs', url.path)
+        self.vfs = lfsvfs(fullpath)
+
+    def writebatch(self, pointers, fromstore):
+        for p in pointers:
+            content = fromstore.read(p.oid())
+            with self.vfs(p.oid(), 'wb', atomictemp=True) as fp:
+                fp.write(content)
+
+    def readbatch(self, pointers, tostore):
+        for p in pointers:
+            content = self.vfs.read(p.oid())
+            tostore.write(p.oid(), content)
+
+class _nullremote(object):
+    """Null store storing blobs to /dev/null."""
+
+    def __init__(self, repo, url):
+        pass
+
+    def writebatch(self, pointers, fromstore):
+        pass
+
+    def readbatch(self, pointers, tostore):
+        pass
+
+class _promptremote(object):
+    """Prompt user to set lfs.url when accessed."""
+
+    def __init__(self, repo, url):
+        pass
+
+    def writebatch(self, pointers, fromstore, ui=None):
+        self._prompt()
+
+    def readbatch(self, pointers, tostore, ui=None):
+        self._prompt()
+
+    def _prompt(self):
+        raise error.Abort(_('lfs.url needs to be configured'))
+
+_storemap = {
+    'https': _gitlfsremote,
+    'http': _gitlfsremote,
+    'file': _dummyremote,
+    'null': _nullremote,
+    None: _promptremote,
+}
+
+def remote(repo):
+    """remotestore factory. return a store in _storemap depending on config"""
+    defaulturl = ''
+
+    # convert deprecated configs to the new url. TODO: remove this if other
+    # places are migrated to the new url config.
+    # deprecated config: lfs.remotestore
+    deprecatedstore = repo.ui.config('lfs', 'remotestore')
+    if deprecatedstore == 'dummy':
+        # deprecated config: lfs.remotepath
+        defaulturl = 'file://' + repo.ui.config('lfs', 'remotepath')
+    elif deprecatedstore == 'git-lfs':
+        # deprecated config: lfs.remoteurl
+        defaulturl = repo.ui.config('lfs', 'remoteurl')
+    elif deprecatedstore == 'null':
+        defaulturl = 'null://'
+
+    url = util.url(repo.ui.config('lfs', 'url', defaulturl))
+    scheme = url.scheme
+    if scheme not in _storemap:
+        raise error.Abort(_('lfs: unknown url scheme: %s') % scheme)
+    return _storemap[scheme](repo, url)
+
+class LfsRemoteError(error.RevlogError):
+    pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/lfs/pointer.py	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,73 @@
+# pointer.py - Git-LFS pointer serialization
+#
+# Copyright 2017 Facebook, Inc.
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from __future__ import absolute_import
+
+import re
+
+from mercurial.i18n import _
+
+from mercurial import (
+    error,
+)
+
+class InvalidPointer(error.RevlogError):
+    pass
+
+class gitlfspointer(dict):
+    VERSION = 'https://git-lfs.github.com/spec/v1'
+
+    def __init__(self, *args, **kwargs):
+        self['version'] = self.VERSION
+        super(gitlfspointer, self).__init__(*args, **kwargs)
+
+    @classmethod
+    def deserialize(cls, text):
+        try:
+            return cls(l.split(' ', 1) for l in text.splitlines()).validate()
+        except ValueError: # l.split returns 1 item instead of 2
+            raise InvalidPointer(_('cannot parse git-lfs text: %r') % text)
+
+    def serialize(self):
+        sortkeyfunc = lambda x: (x[0] != 'version', x)
+        items = sorted(self.validate().iteritems(), key=sortkeyfunc)
+        return ''.join('%s %s\n' % (k, v) for k, v in items)
+
+    def oid(self):
+        return self['oid'].split(':')[-1]
+
+    def size(self):
+        return int(self['size'])
+
+    # regular expressions used by _validate
+    # see https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md
+    _keyre = re.compile(r'\A[a-z0-9.-]+\Z')
+    _valuere = re.compile(r'\A[^\n]*\Z')
+    _requiredre = {
+        'size': re.compile(r'\A[0-9]+\Z'),
+        'oid': re.compile(r'\Asha256:[0-9a-f]{64}\Z'),
+        'version': re.compile(r'\A%s\Z' % re.escape(VERSION)),
+    }
+
+    def validate(self):
+        """raise InvalidPointer on error. return self if there is no error"""
+        requiredcount = 0
+        for k, v in self.iteritems():
+            if k in self._requiredre:
+                if not self._requiredre[k].match(v):
+                    raise InvalidPointer(_('unexpected value: %s=%r') % (k, v))
+                requiredcount += 1
+            elif not self._keyre.match(k):
+                raise InvalidPointer(_('unexpected key: %s') % k)
+            if not self._valuere.match(v):
+                raise InvalidPointer(_('unexpected value: %s=%r') % (k, v))
+        if len(self._requiredre) != requiredcount:
+            miss = sorted(set(self._requiredre.keys()).difference(self.keys()))
+            raise InvalidPointer(_('missed keys: %s') % ', '.join(miss))
+        return self
+
+deserialize = gitlfspointer.deserialize
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext/lfs/wrapper.py	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,323 @@
+# wrapper.py - methods wrapping core mercurial logic
+#
+# Copyright 2017 Facebook, Inc.
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from __future__ import absolute_import
+
+import hashlib
+
+from mercurial.i18n import _
+from mercurial.node import bin, nullid, short
+
+from mercurial import (
+    error,
+    filelog,
+    revlog,
+    util,
+)
+
+from ..largefiles import lfutil
+
+from . import (
+    blobstore,
+    pointer,
+)
+
+def supportedoutgoingversions(orig, repo):
+    versions = orig(repo)
+    versions.discard('01')
+    versions.discard('02')
+    versions.add('03')
+    return versions
+
+def allsupportedversions(orig, ui):
+    versions = orig(ui)
+    versions.add('03')
+    return versions
+
+def bypasscheckhash(self, text):
+    return False
+
+def readfromstore(self, text):
+    """Read filelog content from local blobstore transform for flagprocessor.
+
+    Default tranform for flagprocessor, returning contents from blobstore.
+    Returns a 2-typle (text, validatehash) where validatehash is True as the
+    contents of the blobstore should be checked using checkhash.
+    """
+    p = pointer.deserialize(text)
+    oid = p.oid()
+    store = self.opener.lfslocalblobstore
+    if not store.has(oid):
+        p.filename = getattr(self, 'indexfile', None)
+        self.opener.lfsremoteblobstore.readbatch([p], store)
+    text = store.read(oid)
+
+    # pack hg filelog metadata
+    hgmeta = {}
+    for k in p.keys():
+        if k.startswith('x-hg-'):
+            name = k[len('x-hg-'):]
+            hgmeta[name] = p[k]
+    if hgmeta or text.startswith('\1\n'):
+        text = filelog.packmeta(hgmeta, text)
+
+    return (text, True)
+
+def writetostore(self, text):
+    # hg filelog metadata (includes rename, etc)
+    hgmeta, offset = filelog.parsemeta(text)
+    if offset and offset > 0:
+        # lfs blob does not contain hg filelog metadata
+        text = text[offset:]
+
+    # git-lfs only supports sha256
+    oid = hashlib.sha256(text).hexdigest()
+    self.opener.lfslocalblobstore.write(oid, text)
+
+    # replace contents with metadata
+    longoid = 'sha256:%s' % oid
+    metadata = pointer.gitlfspointer(oid=longoid, size=str(len(text)))
+
+    # by default, we expect the content to be binary. however, LFS could also
+    # be used for non-binary content. add a special entry for non-binary data.
+    # this will be used by filectx.isbinary().
+    if not util.binary(text):
+        # not hg filelog metadata (affecting commit hash), no "x-hg-" prefix
+        metadata['x-is-binary'] = '0'
+
+    # translate hg filelog metadata to lfs metadata with "x-hg-" prefix
+    if hgmeta is not None:
+        for k, v in hgmeta.iteritems():
+            metadata['x-hg-%s' % k] = v
+
+    rawtext = metadata.serialize()
+    return (rawtext, False)
+
+def _islfs(rlog, node=None, rev=None):
+    if rev is None:
+        if node is None:
+            # both None - likely working copy content where node is not ready
+            return False
+        rev = rlog.rev(node)
+    else:
+        node = rlog.node(rev)
+    if node == nullid:
+        return False
+    flags = rlog.flags(rev)
+    return bool(flags & revlog.REVIDX_EXTSTORED)
+
+def filelogaddrevision(orig, self, text, transaction, link, p1, p2,
+                       cachedelta=None, node=None,
+                       flags=revlog.REVIDX_DEFAULT_FLAGS, **kwds):
+    threshold = self.opener.options['lfsthreshold']
+    textlen = len(text)
+    # exclude hg rename meta from file size
+    meta, offset = filelog.parsemeta(text)
+    if offset:
+        textlen -= offset
+
+    if threshold and textlen > threshold:
+        flags |= revlog.REVIDX_EXTSTORED
+
+    return orig(self, text, transaction, link, p1, p2, cachedelta=cachedelta,
+                node=node, flags=flags, **kwds)
+
+def filelogrenamed(orig, self, node):
+    if _islfs(self, node):
+        rawtext = self.revision(node, raw=True)
+        if not rawtext:
+            return False
+        metadata = pointer.deserialize(rawtext)
+        if 'x-hg-copy' in metadata and 'x-hg-copyrev' in metadata:
+            return metadata['x-hg-copy'], bin(metadata['x-hg-copyrev'])
+        else:
+            return False
+    return orig(self, node)
+
+def filelogsize(orig, self, rev):
+    if _islfs(self, rev=rev):
+        # fast path: use lfs metadata to answer size
+        rawtext = self.revision(rev, raw=True)
+        metadata = pointer.deserialize(rawtext)
+        return int(metadata['size'])
+    return orig(self, rev)
+
+def filectxcmp(orig, self, fctx):
+    """returns True if text is different than fctx"""
+    # some fctx (ex. hg-git) is not based on basefilectx and do not have islfs
+    if self.islfs() and getattr(fctx, 'islfs', lambda: False)():
+        # fast path: check LFS oid
+        p1 = pointer.deserialize(self.rawdata())
+        p2 = pointer.deserialize(fctx.rawdata())
+        return p1.oid() != p2.oid()
+    return orig(self, fctx)
+
+def filectxisbinary(orig, self):
+    if self.islfs():
+        # fast path: use lfs metadata to answer isbinary
+        metadata = pointer.deserialize(self.rawdata())
+        # if lfs metadata says nothing, assume it's binary by default
+        return bool(int(metadata.get('x-is-binary', 1)))
+    return orig(self)
+
+def filectxislfs(self):
+    return _islfs(self.filelog(), self.filenode())
+
+def convertsink(orig, sink):
+    sink = orig(sink)
+    if sink.repotype == 'hg':
+        class lfssink(sink.__class__):
+            def putcommit(self, files, copies, parents, commit, source, revmap,
+                          full, cleanp2):
+                pc = super(lfssink, self).putcommit
+                node = pc(files, copies, parents, commit, source, revmap, full,
+                          cleanp2)
+
+                if 'lfs' not in self.repo.requirements:
+                    ctx = self.repo[node]
+
+                    # The file list may contain removed files, so check for
+                    # membership before assuming it is in the context.
+                    if any(f in ctx and ctx[f].islfs() for f, n in files):
+                        self.repo.requirements.add('lfs')
+                        self.repo._writerequirements()
+
+                        # Permanently enable lfs locally
+                        with self.repo.vfs('hgrc', 'a', text=True) as fp:
+                            fp.write('\n[extensions]\nlfs=\n')
+
+                return node
+
+        sink.__class__ = lfssink
+
+    return sink
+
+def vfsinit(orig, self, othervfs):
+    orig(self, othervfs)
+    # copy lfs related options
+    for k, v in othervfs.options.items():
+        if k.startswith('lfs'):
+            self.options[k] = v
+    # also copy lfs blobstores. note: this can run before reposetup, so lfs
+    # blobstore attributes are not always ready at this time.
+    for name in ['lfslocalblobstore', 'lfsremoteblobstore']:
+        if util.safehasattr(othervfs, name):
+            setattr(self, name, getattr(othervfs, name))
+
+def hgclone(orig, ui, opts, *args, **kwargs):
+    result = orig(ui, opts, *args, **kwargs)
+
+    if result is not None:
+        sourcerepo, destrepo = result
+        repo = destrepo.local()
+
+        # When cloning to a remote repo (like through SSH), no repo is available
+        # from the peer.  Therefore the hgrc can't be updated.
+        if not repo:
+            return result
+
+        # If lfs is required for this repo, permanently enable it locally
+        if 'lfs' in repo.requirements:
+            with repo.vfs('hgrc', 'a', text=True) as fp:
+                fp.write('\n[extensions]\nlfs=\n')
+
+    return result
+
+def hgpostshare(orig, sourcerepo, destrepo, bookmarks=True, defaultpath=None):
+    orig(sourcerepo, destrepo, bookmarks, defaultpath)
+
+    # If lfs is required for this repo, permanently enable it locally
+    if 'lfs' in destrepo.requirements:
+        with destrepo.vfs('hgrc', 'a', text=True) as fp:
+            fp.write('\n[extensions]\nlfs=\n')
+
+def _canskipupload(repo):
+    # if remotestore is a null store, upload is a no-op and can be skipped
+    return isinstance(repo.svfs.lfsremoteblobstore, blobstore._nullremote)
+
+def candownload(repo):
+    # if remotestore is a null store, downloads will lead to nothing
+    return not isinstance(repo.svfs.lfsremoteblobstore, blobstore._nullremote)
+
+def uploadblobsfromrevs(repo, revs):
+    '''upload lfs blobs introduced by revs
+
+    Note: also used by other extensions e. g. infinitepush. avoid renaming.
+    '''
+    if _canskipupload(repo):
+        return
+    pointers = extractpointers(repo, revs)
+    uploadblobs(repo, pointers)
+
+def prepush(pushop):
+    """Prepush hook.
+
+    Read through the revisions to push, looking for filelog entries that can be
+    deserialized into metadata so that we can block the push on their upload to
+    the remote blobstore.
+    """
+    return uploadblobsfromrevs(pushop.repo, pushop.outgoing.missing)
+
+def writenewbundle(orig, ui, repo, source, filename, bundletype, outgoing,
+                   *args, **kwargs):
+    """upload LFS blobs added by outgoing revisions on 'hg bundle'"""
+    uploadblobsfromrevs(repo, outgoing.missing)
+    return orig(ui, repo, source, filename, bundletype, outgoing, *args,
+                **kwargs)
+
+def extractpointers(repo, revs):
+    """return a list of lfs pointers added by given revs"""
+    ui = repo.ui
+    if ui.debugflag:
+        ui.write(_('lfs: computing set of blobs to upload\n'))
+    pointers = {}
+    for r in revs:
+        ctx = repo[r]
+        for p in pointersfromctx(ctx).values():
+            pointers[p.oid()] = p
+    return pointers.values()
+
+def pointersfromctx(ctx):
+    """return a dict {path: pointer} for given single changectx"""
+    result = {}
+    for f in ctx.files():
+        if f not in ctx:
+            continue
+        fctx = ctx[f]
+        if not _islfs(fctx.filelog(), fctx.filenode()):
+            continue
+        try:
+            result[f] = pointer.deserialize(fctx.rawdata())
+        except pointer.InvalidPointer as ex:
+            raise error.Abort(_('lfs: corrupted pointer (%s@%s): %s\n')
+                              % (f, short(ctx.node()), ex))
+    return result
+
+def uploadblobs(repo, pointers):
+    """upload given pointers from local blobstore"""
+    if not pointers:
+        return
+
+    remoteblob = repo.svfs.lfsremoteblobstore
+    remoteblob.writebatch(pointers, repo.svfs.lfslocalblobstore)
+
+def upgradefinishdatamigration(orig, ui, srcrepo, dstrepo, requirements):
+    orig(ui, srcrepo, dstrepo, requirements)
+
+    srclfsvfs = srcrepo.svfs.lfslocalblobstore.vfs
+    dstlfsvfs = dstrepo.svfs.lfslocalblobstore.vfs
+
+    for dirpath, dirs, files in srclfsvfs.walk():
+        for oid in files:
+            ui.write(_('copying lfs blob %s\n') % oid)
+            lfutil.link(srclfsvfs.join(oid), dstlfsvfs.join(oid))
+
+def upgraderequirements(orig, repo):
+    reqs = orig(repo)
+    if 'lfs' in repo.requirements:
+        reqs.add('lfs')
+    return reqs
--- a/hgext/logtoprocess.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/logtoprocess.py	Tue Dec 19 16:27:24 2017 -0500
@@ -124,8 +124,6 @@
                 env = dict(itertools.chain(encoding.environ.items(),
                                            msgpairs, optpairs),
                            EVENT=event, HGPID=str(os.getpid()))
-                # Connect stdin to /dev/null to prevent child processes messing
-                # with mercurial's stdin.
                 runshellcommand(script, env)
             return super(logtoprocessui, self).log(event, *msg, **opts)
 
--- a/hgext/mq.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/mq.py	Tue Dec 19 16:27:24 2017 -0500
@@ -565,7 +565,7 @@
                 return index
         return None
 
-    guard_re = re.compile(r'\s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)')
+    guard_re = re.compile(br'\s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)')
 
     def parseseries(self):
         self.series = []
--- a/hgext/patchbomb.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/patchbomb.py	Tue Dec 19 16:27:24 2017 -0500
@@ -89,6 +89,7 @@
     mail,
     node as nodemod,
     patch,
+    pycompat,
     registrar,
     repair,
     scmutil,
@@ -318,7 +319,7 @@
     tmpfn = os.path.join(tmpdir, 'bundle')
     btype = ui.config('patchbomb', 'bundletype')
     if btype:
-        opts['type'] = btype
+        opts[r'type'] = btype
     try:
         commands.bundle(ui, repo, tmpfn, dest, **opts)
         return util.readfile(tmpfn)
@@ -338,8 +339,8 @@
     the user through the editor.
     """
     ui = repo.ui
-    if opts.get('desc'):
-        body = open(opts.get('desc')).read()
+    if opts.get(r'desc'):
+        body = open(opts.get(r'desc')).read()
     else:
         ui.write(_('\nWrite the introductory message for the '
                    'patch series.\n\n'))
@@ -359,21 +360,21 @@
     """
     ui = repo.ui
     _charsets = mail._charsets(ui)
-    subj = (opts.get('subject')
+    subj = (opts.get(r'subject')
             or prompt(ui, 'Subject:', 'A bundle for your repository'))
 
     body = _getdescription(repo, '', sender, **opts)
     msg = emailmod.MIMEMultipart.MIMEMultipart()
     if body:
-        msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test')))
+        msg.attach(mail.mimeencode(ui, body, _charsets, opts.get(r'test')))
     datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle')
     datapart.set_payload(bundle)
-    bundlename = '%s.hg' % opts.get('bundlename', 'bundle')
+    bundlename = '%s.hg' % opts.get(r'bundlename', 'bundle')
     datapart.add_header('Content-Disposition', 'attachment',
                         filename=bundlename)
     emailmod.Encoders.encode_base64(datapart)
     msg.attach(datapart)
-    msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test'))
+    msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get(r'test'))
     return [(msg, subj, None)]
 
 def _makeintro(repo, sender, revs, patches, **opts):
@@ -384,9 +385,9 @@
     _charsets = mail._charsets(ui)
 
     # use the last revision which is likely to be a bookmarked head
-    prefix = _formatprefix(ui, repo, revs.last(), opts.get('flag'),
+    prefix = _formatprefix(ui, repo, revs.last(), opts.get(r'flag'),
                            0, len(patches), numbered=True)
-    subj = (opts.get('subject') or
+    subj = (opts.get(r'subject') or
             prompt(ui, '(optional) Subject: ', rest=prefix, default=''))
     if not subj:
         return None         # skip intro if the user doesn't bother
@@ -394,7 +395,7 @@
     subj = prefix + ' ' + subj
 
     body = ''
-    if opts.get('diffstat'):
+    if opts.get(r'diffstat'):
         # generate a cumulative diffstat of the whole patch series
         diffstat = patch.diffstat(sum(patches, []))
         body = '\n' + diffstat
@@ -402,9 +403,9 @@
         diffstat = None
 
     body = _getdescription(repo, body, sender, **opts)
-    msg = mail.mimeencode(ui, body, _charsets, opts.get('test'))
+    msg = mail.mimeencode(ui, body, _charsets, opts.get(r'test'))
     msg['Subject'] = mail.headencode(ui, subj, _charsets,
-                                     opts.get('test'))
+                                     opts.get(r'test'))
     return (msg, subj, diffstat)
 
 def _getpatchmsgs(repo, sender, revs, patchnames=None, **opts):
@@ -414,6 +415,7 @@
 
     This function returns a list of "email" tuples (subject, content, None).
     """
+    bytesopts = pycompat.byteskwargs(opts)
     ui = repo.ui
     _charsets = mail._charsets(ui)
     patches = list(_getpatches(repo, revs, **opts))
@@ -423,7 +425,7 @@
              % len(patches))
 
     # build the intro message, or skip it if the user declines
-    if introwanted(ui, opts, len(patches)):
+    if introwanted(ui, bytesopts, len(patches)):
         msg = _makeintro(repo, sender, revs, patches, **opts)
         if msg:
             msgs.append(msg)
@@ -437,8 +439,8 @@
     for i, (r, p) in enumerate(zip(revs, patches)):
         if patchnames:
             name = patchnames[i]
-        msg = makepatch(ui, repo, r, p, opts, _charsets, i + 1,
-                        len(patches), numbered, name)
+        msg = makepatch(ui, repo, r, p, bytesopts, _charsets,
+                        i + 1, len(patches), numbered, name)
         msgs.append(msg)
 
     return msgs
@@ -579,6 +581,7 @@
     Before using this command, you will need to enable email in your
     hgrc. See the [email] section in hgrc(5) for details.
     '''
+    opts = pycompat.byteskwargs(opts)
 
     _charsets = mail._charsets(ui)
 
@@ -672,12 +675,13 @@
               prompt(ui, 'From', ui.username()))
 
     if bundle:
-        bundledata = _getbundle(repo, dest, **opts)
-        bundleopts = opts.copy()
-        bundleopts.pop('bundle', None)  # already processed
+        stropts = pycompat.strkwargs(opts)
+        bundledata = _getbundle(repo, dest, **stropts)
+        bundleopts = stropts.copy()
+        bundleopts.pop(r'bundle', None)  # already processed
         msgs = _getbundlemsgs(repo, sender, bundledata, **bundleopts)
     else:
-        msgs = _getpatchmsgs(repo, sender, revs, **opts)
+        msgs = _getpatchmsgs(repo, sender, revs, **pycompat.strkwargs(opts))
 
     showaddrs = []
 
--- a/hgext/rebase.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/rebase.py	Tue Dec 19 16:27:24 2017 -0500
@@ -21,7 +21,6 @@
 
 from mercurial.i18n import _
 from mercurial.node import (
-    hex,
     nullid,
     nullrev,
     short,
@@ -43,6 +42,7 @@
     obsutil,
     patch,
     phases,
+    pycompat,
     registrar,
     repair,
     revset,
@@ -53,7 +53,6 @@
 )
 
 release = lock.release
-templateopts = cmdutil.templateopts
 
 # The following constants are used throughout the rebase module. The ordering of
 # their values must be maintained.
@@ -137,7 +136,7 @@
 
 class rebaseruntime(object):
     """This class is a container for rebase runtime state"""
-    def __init__(self, repo, ui, opts=None):
+    def __init__(self, repo, ui, inmemory=False, opts=None):
         if opts is None:
             opts = {}
 
@@ -179,6 +178,8 @@
         # other extensions
         self.keepopen = opts.get('keepopen', False)
         self.obsoletenotrebased = {}
+        self.obsoletewithoutsuccessorindestination = set()
+        self.inmemory = inmemory
 
     @property
     def repo(self):
@@ -311,9 +312,10 @@
         if not self.ui.configbool('experimental', 'rebaseskipobsolete'):
             return
         obsoleteset = set(obsoleterevs)
-        self.obsoletenotrebased = _computeobsoletenotrebased(self.repo,
-                                    obsoleteset, destmap)
+        self.obsoletenotrebased, self.obsoletewithoutsuccessorindestination = \
+            _computeobsoletenotrebased(self.repo, obsoleteset, destmap)
         skippedset = set(self.obsoletenotrebased)
+        skippedset.update(self.obsoletewithoutsuccessorindestination)
         _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
     def _prepareabortorcontinue(self, isabort):
@@ -380,7 +382,20 @@
 
         self.prepared = True
 
+    def _assignworkingcopy(self):
+        if self.inmemory:
+            from mercurial.context import overlayworkingctx
+            self.wctx = overlayworkingctx(self.repo)
+            self.repo.ui.debug("rebasing in-memory\n")
+        else:
+            self.wctx = self.repo[None]
+            self.repo.ui.debug("rebasing on disk\n")
+        self.repo.ui.log("rebase", "", {
+            'rebase_imm_used': self.wctx.isinmemory()
+        })
+
     def _performrebase(self, tr):
+        self._assignworkingcopy()
         repo, ui = self.repo, self.ui
         if self.keepbranchesf:
             # insert _savebranch at the start of extrafns so if
@@ -419,12 +434,26 @@
     def _performrebasesubset(self, tr, subset, pos, total):
         repo, ui, opts = self.repo, self.ui, self.opts
         sortedrevs = repo.revs('sort(%ld, -topo)', subset)
+        allowdivergence = self.ui.configbool(
+            'experimental', 'evolution.allowdivergence')
+        if not allowdivergence:
+            sortedrevs -= repo.revs(
+                'descendants(%ld) and not %ld',
+                self.obsoletewithoutsuccessorindestination,
+                self.obsoletewithoutsuccessorindestination,
+            )
         for rev in sortedrevs:
             dest = self.destmap[rev]
             ctx = repo[rev]
             desc = _ctxdesc(ctx)
             if self.state[rev] == rev:
                 ui.status(_('already rebased %s\n') % desc)
+            elif (not allowdivergence
+                  and rev in self.obsoletewithoutsuccessorindestination):
+                msg = _('note: not rebasing %s and its descendants as '
+                        'this would cause divergence\n') % desc
+                repo.ui.status(msg)
+                self.skipped.add(rev)
             elif rev in self.obsoletenotrebased:
                 succ = self.obsoletenotrebased[rev]
                 if succ is None:
@@ -459,22 +488,35 @@
                         ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
                                      'rebase')
                         stats = rebasenode(repo, rev, p1, base, self.state,
-                                           self.collapsef, dest)
+                                           self.collapsef, dest, wctx=self.wctx)
                         if stats and stats[3] > 0:
-                            raise error.InterventionRequired(
-                                _('unresolved conflicts (see hg '
-                                  'resolve, then hg rebase --continue)'))
+                            if self.wctx.isinmemory():
+                                raise error.InMemoryMergeConflictsError()
+                            else:
+                                raise error.InterventionRequired(
+                                    _('unresolved conflicts (see hg '
+                                      'resolve, then hg rebase --continue)'))
                     finally:
                         ui.setconfig('ui', 'forcemerge', '', 'rebase')
                 if not self.collapsef:
                     merging = p2 != nullrev
                     editform = cmdutil.mergeeditform(merging, 'rebase')
                     editor = cmdutil.getcommiteditor(editform=editform, **opts)
-                    newnode = concludenode(repo, rev, p1, p2,
-                                           extrafn=_makeextrafn(self.extrafns),
-                                           editor=editor,
-                                           keepbranches=self.keepbranchesf,
-                                           date=self.date)
+                    if self.wctx.isinmemory():
+                        newnode = concludememorynode(repo, rev, p1, p2,
+                            wctx=self.wctx,
+                            extrafn=_makeextrafn(self.extrafns),
+                            editor=editor,
+                            keepbranches=self.keepbranchesf,
+                            date=self.date)
+                        mergemod.mergestate.clean(repo)
+                    else:
+                        newnode = concludenode(repo, rev, p1, p2,
+                            extrafn=_makeextrafn(self.extrafns),
+                            editor=editor,
+                            keepbranches=self.keepbranchesf,
+                            date=self.date)
+
                     if newnode is None:
                         # If it ended up being a no-op commit, then the normal
                         # merge state clean-up path doesn't happen, so do it
@@ -482,7 +524,10 @@
                         mergemod.mergestate.clean(repo)
                 else:
                     # Skip commit if we are collapsing
-                    repo.setparents(repo[p1].node())
+                    if self.wctx.isinmemory():
+                        self.wctx.setbase(repo[p1])
+                    else:
+                        repo.setparents(repo[p1].node())
                     newnode = None
                 # Update the state
                 if newnode is not None:
@@ -524,13 +569,22 @@
             dsguard = None
             if ui.configbool('rebase', 'singletransaction'):
                 dsguard = dirstateguard.dirstateguard(repo, 'rebase')
-            with util.acceptintervention(dsguard):
-                newnode = concludenode(repo, revtoreuse, p1, self.external,
-                                       commitmsg=commitmsg,
-                                       extrafn=_makeextrafn(self.extrafns),
-                                       editor=editor,
-                                       keepbranches=self.keepbranchesf,
-                                       date=self.date)
+            if self.inmemory:
+                newnode = concludememorynode(repo, revtoreuse, p1,
+                    self.external,
+                    commitmsg=commitmsg,
+                    extrafn=_makeextrafn(self.extrafns),
+                    editor=editor,
+                    keepbranches=self.keepbranchesf,
+                    date=self.date, wctx=self.wctx)
+            else:
+                with util.acceptintervention(dsguard):
+                    newnode = concludenode(repo, revtoreuse, p1, self.external,
+                        commitmsg=commitmsg,
+                        extrafn=_makeextrafn(self.extrafns),
+                        editor=editor,
+                        keepbranches=self.keepbranchesf,
+                        date=self.date)
             if newnode is not None:
                 newrev = repo[newnode].rev()
                 for oldrev in self.state.iterkeys():
@@ -545,7 +599,8 @@
         if newwd < 0:
             # original directory is a parent of rebase set root or ignored
             newwd = self.originalwd
-        if newwd not in [c.rev() for c in repo[None].parents()]:
+        if (newwd not in [c.rev() for c in repo[None].parents()] and
+                not self.inmemory):
             ui.note(_("update back to initial working directory parent\n"))
             hg.updaterepo(repo, newwd, False)
 
@@ -594,7 +649,7 @@
     ('t', 'tool', '', _('specify merge tool')),
     ('c', 'continue', False, _('continue an interrupted rebase')),
     ('a', 'abort', False, _('abort an interrupted rebase'))] +
-     templateopts,
+    cmdutil.formatteropts,
     _('[-s REV | -b REV] [-d REV] [OPTION]'))
 def rebase(ui, repo, **opts):
     """move changeset (and descendants) to a different branch
@@ -628,6 +683,11 @@
       4. If you do not specify any of ``--rev``, ``source``, or ``--base``,
          rebase will use ``--base .`` as above.
 
+    If ``--source`` or ``--rev`` is used, special names ``SRC`` and ``ALLSRC``
+    can be used in ``--dest``. Destination would be calculated per source
+    revision with ``SRC`` substituted by that single source revision and
+    ``ALLSRC`` substituted by all source revisions.
+
     Rebase will destroy original changesets unless you use ``--keep``.
     It will also move your bookmarks (even if you do).
 
@@ -676,6 +736,12 @@
 
           hg rebase -r "branch(featureX)" -d 1.3 --keepbranches
 
+      - stabilize orphaned changesets so history looks linear::
+
+          hg rebase -r 'orphan()-obsolete()'\
+ -d 'first(max((successors(max(roots(ALLSRC) & ::SRC)^)-obsolete())::) +\
+ max(::((roots(ALLSRC) & ::SRC)^)-obsolete()))'
+
     Configuration Options:
 
     You can make rebase require a destination if you set the following config
@@ -693,13 +759,40 @@
       [rebase]
       singletransaction = True
 
+    By default, rebase writes to the working copy, but you can configure it to
+    run in-memory for for better performance, and to allow it to run if the
+    working copy is dirty::
+
+      [rebase]
+      experimental.inmemory = True
+
     Return Values:
 
     Returns 0 on success, 1 if nothing to rebase or there are
     unresolved conflicts.
 
     """
-    rbsrt = rebaseruntime(repo, ui, opts)
+    inmemory = ui.configbool('rebase', 'experimental.inmemory')
+    if opts.get('continue') or opts.get('abort'):
+        # in-memory rebase is not compatible with resuming rebases.
+        inmemory = False
+
+    if inmemory:
+        try:
+            # in-memory merge doesn't support conflicts, so if we hit any, abort
+            # and re-run as an on-disk merge.
+            return _origrebase(ui, repo, inmemory=inmemory, **opts)
+        except error.InMemoryMergeConflictsError:
+            ui.warn(_('hit merge conflicts; re-running rebase without in-memory'
+                      ' merge\n'))
+            _origrebase(ui, repo, **{'abort': True})
+            return _origrebase(ui, repo, inmemory=False, **opts)
+    else:
+        return _origrebase(ui, repo, **opts)
+
+def _origrebase(ui, repo, inmemory=False, **opts):
+    opts = pycompat.byteskwargs(opts)
+    rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 
     with repo.wlock(), repo.lock():
         # Validate input and define rebasing points
@@ -746,7 +839,7 @@
             if retcode is not None:
                 return retcode
         else:
-            destmap = _definedestmap(ui, repo, destf, srcf, basef, revf,
+            destmap = _definedestmap(ui, repo, rbsrt, destf, srcf, basef, revf,
                                      destspace=destspace)
             retcode = rbsrt._preparenewrebase(destmap)
             if retcode is not None:
@@ -766,8 +859,8 @@
 
         rbsrt._finishrebase()
 
-def _definedestmap(ui, repo, destf=None, srcf=None, basef=None, revf=None,
-                   destspace=None):
+def _definedestmap(ui, repo, rbsrt, destf=None, srcf=None, basef=None,
+                   revf=None, destspace=None):
     """use revisions argument to define destmap {srcrev: destrev}"""
     if revf is None:
         revf = []
@@ -781,8 +874,9 @@
     if revf and srcf:
         raise error.Abort(_('cannot specify both a revision and a source'))
 
-    cmdutil.checkunfinished(repo)
-    cmdutil.bailifchanged(repo)
+    if not rbsrt.inmemory:
+        cmdutil.checkunfinished(repo)
+        cmdutil.bailifchanged(repo)
 
     if ui.configbool('commands', 'rebase.requiredest') and not destf:
         raise error.Abort(_('you must specify a destination'),
@@ -855,6 +949,23 @@
                 ui.status(_('nothing to rebase from %s to %s\n') %
                           ('+'.join(str(repo[r]) for r in base), dest))
             return None
+    # If rebasing the working copy parent, force in-memory merge to be off.
+    #
+    # This is because the extra work of checking out the newly rebased commit
+    # outweights the benefits of rebasing in-memory, and executing an extra
+    # update command adds a bit of overhead, so better to just do it on disk. In
+    # all other cases leave it on.
+    #
+    # Note that there are cases where this isn't true -- e.g., rebasing large
+    # stacks that include the WCP. However, I'm not yet sure where the cutoff
+    # is.
+    rebasingwcp = repo['.'].rev() in rebaseset
+    ui.log("rebase", "", {'rebase_rebasing_wcp': rebasingwcp})
+    if rbsrt.inmemory and rebasingwcp:
+        rbsrt.inmemory = False
+        # Check these since we did not before.
+        cmdutil.checkunfinished(repo)
+        cmdutil.bailifchanged(repo)
 
     if not destf:
         dest = repo[_destrebase(repo, rebaseset, destspace=destspace)]
@@ -868,8 +979,6 @@
             # fast path: try to resolve dest without SRC alias
             dest = scmutil.revsingle(repo, destf, localalias=alias)
         except error.RepoLookupError:
-            if not ui.configbool('experimental', 'rebase.multidest'):
-                raise
             # multi-dest path: resolve dest for each SRC separately
             destmap = {}
             for r in rebaseset:
@@ -920,6 +1029,44 @@
                      (max(destancestors),
                       ', '.join(str(p) for p in sorted(parents))))
 
+def concludememorynode(repo, rev, p1, p2, wctx=None,
+                       commitmsg=None, editor=None, extrafn=None,
+                       keepbranches=False, date=None):
+    '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev
+    but also store useful information in extra.
+    Return node of committed revision.'''
+    ctx = repo[rev]
+    if commitmsg is None:
+        commitmsg = ctx.description()
+    keepbranch = keepbranches and repo[p1].branch() != ctx.branch()
+    extra = {'rebase_source': ctx.hex()}
+    if extrafn:
+        extrafn(ctx, extra)
+
+    destphase = max(ctx.phase(), phases.draft)
+    overrides = {('phases', 'new-commit'): destphase}
+    with repo.ui.configoverride(overrides, 'rebase'):
+        if keepbranch:
+            repo.ui.setconfig('ui', 'allowemptycommit', True)
+        # Replicates the empty check in ``repo.commit``.
+        if wctx.isempty() and not repo.ui.configbool('ui', 'allowemptycommit'):
+            return None
+
+        if date is None:
+            date = ctx.date()
+
+        # By convention, ``extra['branch']`` (set by extrafn) clobbers
+        # ``branch`` (used when passing ``--keepbranches``).
+        branch = repo[p1].branch()
+        if 'branch' in extra:
+            branch = extra['branch']
+
+        memctx = wctx.tomemctx(commitmsg, parents=(p1, p2), date=date,
+            extra=extra, user=ctx.user(), branch=branch, editor=editor)
+        commitres = repo.commitctx(memctx)
+        wctx.clean() # Might be reused
+        return commitres
+
 def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None,
                  keepbranches=False, date=None):
     '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev
@@ -952,24 +1099,29 @@
         repo.dirstate.setbranch(repo[newnode].branch())
         return newnode
 
-def rebasenode(repo, rev, p1, base, state, collapse, dest):
+def rebasenode(repo, rev, p1, base, state, collapse, dest, wctx):
     'Rebase a single revision rev on top of p1 using base as merge ancestor'
     # Merge phase
     # Update to destination and merge it with local
-    if repo['.'].rev() != p1:
-        repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1]))
-        mergemod.update(repo, p1, False, True)
+    if wctx.isinmemory():
+        wctx.setbase(repo[p1])
     else:
-        repo.ui.debug(" already in destination\n")
-    repo.dirstate.write(repo.currenttransaction())
+        if repo['.'].rev() != p1:
+            repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1]))
+            mergemod.update(repo, p1, False, True)
+        else:
+            repo.ui.debug(" already in destination\n")
+        # This is, alas, necessary to invalidate workingctx's manifest cache,
+        # as well as other data we litter on it in other places.
+        wctx = repo[None]
+        repo.dirstate.write(repo.currenttransaction())
     repo.ui.debug(" merge against %d:%s\n" % (rev, repo[rev]))
     if base is not None:
         repo.ui.debug("   detach base %d:%s\n" % (base, repo[base]))
     # When collapsing in-place, the parent is the common ancestor, we
     # have to allow merging with it.
-    wctx = repo[None]
     stats = mergemod.update(repo, rev, True, True, base, collapse,
-                            labels=['dest', 'source'])
+                            labels=['dest', 'source'], wc=wctx)
     if collapse:
         copies.duplicatecopies(repo, wctx, rev, dest)
     else:
@@ -1546,22 +1698,26 @@
                 replacements[oldnode] = succs
     scmutil.cleanupnodes(repo, replacements, 'rebase', moves)
     if fm:
-        nodechanges = {hex(oldn): [hex(n) for n in newn]
-                       for oldn, newn in replacements.iteritems()}
+        hf = fm.hexfunc
+        fl = fm.formatlist
+        fd = fm.formatdict
+        nodechanges = fd({hf(oldn): fl([hf(n) for n in newn], name='node')
+                          for oldn, newn in replacements.iteritems()},
+                         key="oldnode", value="newnodes")
         fm.data(nodechanges=nodechanges)
 
 def pullrebase(orig, ui, repo, *args, **opts):
     'Call rebase after pull if the latter has been invoked with --rebase'
     ret = None
-    if opts.get('rebase'):
+    if opts.get(r'rebase'):
         if ui.configbool('commands', 'rebase.requiredest'):
             msg = _('rebase destination required by configuration')
             hint = _('use hg pull followed by hg rebase -d DEST')
             raise error.Abort(msg, hint=hint)
 
         with repo.wlock(), repo.lock():
-            if opts.get('update'):
-                del opts['update']
+            if opts.get(r'update'):
+                del opts[r'update']
                 ui.debug('--update and --rebase are not compatible, ignoring '
                          'the update flag\n')
 
@@ -1582,15 +1738,15 @@
             if revspostpull > revsprepull:
                 # --rev option from pull conflict with rebase own --rev
                 # dropping it
-                if 'rev' in opts:
-                    del opts['rev']
+                if r'rev' in opts:
+                    del opts[r'rev']
                 # positional argument from pull conflicts with rebase's own
                 # --source.
-                if 'source' in opts:
-                    del opts['source']
+                if r'source' in opts:
+                    del opts[r'source']
                 # revsprepull is the len of the repo, not revnum of tip.
                 destspace = list(repo.changelog.revs(start=revsprepull))
-                opts['_destspace'] = destspace
+                opts[r'_destspace'] = destspace
                 try:
                     rebase(ui, repo, **opts)
                 except error.NoMergeDestAbort:
@@ -1604,7 +1760,7 @@
                         # with warning and trumpets
                         commands.update(ui, repo)
     else:
-        if opts.get('tool'):
+        if opts.get(r'tool'):
             raise error.Abort(_('--tool can only be used with --rebase'))
         ret = orig(ui, repo, *args, **opts)
 
@@ -1615,11 +1771,16 @@
     return set(r for r in revs if repo[r].obsolete())
 
 def _computeobsoletenotrebased(repo, rebaseobsrevs, destmap):
-    """return a mapping obsolete => successor for all obsolete nodes to be
-    rebased that have a successors in the destination
+    """Return (obsoletenotrebased, obsoletewithoutsuccessorindestination).
+
+    `obsoletenotrebased` is a mapping mapping obsolete => successor for all
+    obsolete nodes to be rebased given in `rebaseobsrevs`.
 
-    obsolete => None entries in the mapping indicate nodes with no successor"""
+    `obsoletewithoutsuccessorindestination` is a set with obsolete revisions
+    without a successor in destination.
+    """
     obsoletenotrebased = {}
+    obsoletewithoutsuccessorindestination = set([])
 
     assert repo.filtername is None
     cl = repo.changelog
@@ -1640,8 +1801,15 @@
                 if cl.isancestor(succnode, destnode):
                     obsoletenotrebased[srcrev] = nodemap[succnode]
                     break
+            else:
+                # If 'srcrev' has a successor in rebase set but none in
+                # destination (which would be catched above), we shall skip it
+                # and its descendants to avoid divergence.
+                if any(nodemap[s] in destmap
+                       for s in successors if s != srcnode):
+                    obsoletewithoutsuccessorindestination.add(srcrev)
 
-    return obsoletenotrebased
+    return obsoletenotrebased, obsoletewithoutsuccessorindestination
 
 def summaryhook(ui, repo):
     if not repo.vfs.exists('rebasestate'):
--- a/hgext/record.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/record.py	Tue Dec 19 16:27:24 2017 -0500
@@ -68,13 +68,13 @@
         raise error.Abort(_('running non-interactively, use %s instead') %
                          'commit')
 
-    opts["interactive"] = True
+    opts[r"interactive"] = True
     overrides = {('experimental', 'crecord'): False}
     with ui.configoverride(overrides, 'record'):
         return commands.commit(ui, repo, *pats, **opts)
 
 def qrefresh(origfn, ui, repo, *pats, **opts):
-    if not opts['interactive']:
+    if not opts[r'interactive']:
         return origfn(ui, repo, *pats, **opts)
 
     mq = extensions.find('mq')
@@ -112,7 +112,7 @@
     repo.mq.checkpatchname(patch)
 
     def committomq(ui, repo, *pats, **opts):
-        opts['checkname'] = False
+        opts[r'checkname'] = False
         mq.new(ui, repo, patch, *pats, **opts)
 
     overrides = {('experimental', 'crecord'): False}
@@ -121,7 +121,7 @@
                          cmdutil.recordfilter, *pats, **opts)
 
 def qnew(origfn, ui, repo, patch, *args, **opts):
-    if opts['interactive']:
+    if opts[r'interactive']:
         return _qrecord(None, ui, repo, patch, *args, **opts)
     return origfn(ui, repo, patch, *args, **opts)
 
--- a/hgext/releasenotes.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/releasenotes.py	Tue Dec 19 16:27:24 2017 -0500
@@ -25,6 +25,7 @@
     error,
     minirst,
     node,
+    pycompat,
     registrar,
     scmutil,
     util,
@@ -570,6 +571,8 @@
     admonitions along with their title. This also includes the custom
     admonitions (if any).
     """
+
+    opts = pycompat.byteskwargs(opts)
     sections = releasenotessections(ui, repo)
 
     listflag = opts.get('list')
--- a/hgext/shelve.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/shelve.py	Tue Dec 19 16:27:24 2017 -0500
@@ -43,6 +43,7 @@
     node as nodemod,
     patch,
     phases,
+    pycompat,
     registrar,
     repair,
     scmutil,
@@ -380,7 +381,7 @@
             editor_ = False
             if editor:
                 editor_ = cmdutil.getcommiteditor(editform='shelve.shelve',
-                                                  **opts)
+                                                  **pycompat.strkwargs(opts))
             with repo.ui.configoverride(overrides):
                 return repo.commit(message, shelveuser, opts.get('date'),
                                    match, editor=editor_, extra=extra)
@@ -389,6 +390,7 @@
                 repo.mq.checkapplied = saved
 
     def interactivecommitfunc(ui, repo, *pats, **opts):
+        opts = pycompat.byteskwargs(opts)
         match = scmutil.match(repo['.'], pats, {})
         message = opts['message']
         return commitfunc(ui, repo, message, match, opts)
@@ -465,7 +467,7 @@
         else:
             node = cmdutil.dorecord(ui, repo, commitfunc, None,
                                     False, cmdutil.recordfilter, *pats,
-                                    **opts)
+                                    **pycompat.strkwargs(opts))
         if not node:
             _nothingtoshelvemessaging(ui, repo, pats, opts)
             return 1
@@ -852,6 +854,7 @@
         return _dounshelve(ui, repo, *shelved, **opts)
 
 def _dounshelve(ui, repo, *shelved, **opts):
+    opts = pycompat.byteskwargs(opts)
     abortf = opts.get('abort')
     continuef = opts.get('continue')
     if not abortf and not continuef:
@@ -1010,6 +1013,7 @@
     To delete specific shelved changes, use ``--delete``. To delete
     all shelved changes, use ``--cleanup``.
     '''
+    opts = pycompat.byteskwargs(opts)
     allowables = [
         ('addremove', {'create'}), # 'create' is pseudo action
         ('unknown', {'create'}),
--- a/hgext/sparse.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/sparse.py	Tue Dec 19 16:27:24 2017 -0500
@@ -82,6 +82,7 @@
     extensions,
     hg,
     match as matchmod,
+    pycompat,
     registrar,
     sparse,
     util,
@@ -286,6 +287,7 @@
 
     Returns 0 if editing the sparse checkout succeeds.
     """
+    opts = pycompat.byteskwargs(opts)
     include = opts.get('include')
     exclude = opts.get('exclude')
     force = opts.get('force')
--- a/hgext/uncommit.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/hgext/uncommit.py	Tue Dec 19 16:27:24 2017 -0500
@@ -28,8 +28,10 @@
     copies,
     error,
     node,
-    obsolete,
+    obsutil,
+    pycompat,
     registrar,
+    rewriteutil,
     scmutil,
 )
 
@@ -75,7 +77,7 @@
         if path not in contentctx:
             return None
         fctx = contentctx[path]
-        mctx = context.memfilectx(repo, fctx.path(), fctx.data(),
+        mctx = context.memfilectx(repo, memctx, fctx.path(), fctx.data(),
                                   fctx.islink(),
                                   fctx.isexec(),
                                   copied=copied.get(path))
@@ -96,15 +98,13 @@
         newid = repo.commitctx(new)
     return newid
 
-def _uncommitdirstate(repo, oldctx, match):
-    """Fix the dirstate after switching the working directory from
-    oldctx to a copy of oldctx not containing changed files matched by
-    match.
+def _fixdirstate(repo, oldctx, newctx, status):
+    """ fix the dirstate after switching the working directory from oldctx to
+    newctx which can be result of either unamend or uncommit.
     """
-    ctx = repo['.']
     ds = repo.dirstate
     copies = dict(ds.copies())
-    s = repo.status(oldctx.p1(), oldctx, match=match)
+    s = status
     for f in s.modified:
         if ds[f] == 'r':
             # modified + removed -> removed
@@ -136,7 +136,7 @@
                   for dst, src in oldcopies.iteritems())
     # Adjust the dirstate copies
     for dst, src in copies.iteritems():
-        if (src not in ctx or dst in ctx or ds[dst] != 'a'):
+        if (src not in newctx or dst in newctx or ds[dst] != 'a'):
             src = None
         ds.copy(src, dst)
 
@@ -152,25 +152,17 @@
     deleted in the changeset will be left unchanged, and so will remain
     modified in the working directory.
     """
+    opts = pycompat.byteskwargs(opts)
 
     with repo.wlock(), repo.lock():
-        wctx = repo[None]
 
         if not pats and not repo.ui.configbool('experimental',
                                                 'uncommitondirtywdir'):
             cmdutil.bailifchanged(repo)
-        if wctx.parents()[0].node() == node.nullid:
-            raise error.Abort(_("cannot uncommit null changeset"))
-        if len(wctx.parents()) > 1:
-            raise error.Abort(_("cannot uncommit while merging"))
         old = repo['.']
-        if not old.mutable():
-            raise error.Abort(_('cannot uncommit public changesets'))
+        rewriteutil.precheck(repo, [old.rev()], 'uncommit')
         if len(old.parents()) > 1:
             raise error.Abort(_("cannot uncommit merge changeset"))
-        allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
-        if not allowunstable and old.children():
-            raise error.Abort(_('cannot uncommit changeset with children'))
 
         with repo.transaction('uncommit'):
             match = scmutil.match(old, pats, opts)
@@ -191,4 +183,75 @@
 
             with repo.dirstate.parentchange():
                 repo.dirstate.setparents(newid, node.nullid)
-                _uncommitdirstate(repo, old, match)
+                s = repo.status(old.p1(), old, match=match)
+                _fixdirstate(repo, old, repo[newid], s)
+
+def predecessormarkers(ctx):
+    """yields the obsolete markers marking the given changeset as a successor"""
+    for data in ctx.repo().obsstore.predecessors.get(ctx.node(), ()):
+        yield obsutil.marker(ctx.repo(), data)
+
+@command('^unamend', [])
+def unamend(ui, repo, **opts):
+    """
+    undo the most recent amend operation on a current changeset
+
+    This command will roll back to the previous version of a changeset,
+    leaving working directory in state in which it was before running
+    `hg amend` (e.g. files modified as part of an amend will be
+    marked as modified `hg status`)
+    """
+
+    unfi = repo.unfiltered()
+    with repo.wlock(), repo.lock(), repo.transaction('unamend'):
+
+        # identify the commit from which to unamend
+        curctx = repo['.']
+
+        rewriteutil.precheck(repo, [curctx.rev()], 'unamend')
+
+        # identify the commit to which to unamend
+        markers = list(predecessormarkers(curctx))
+        if len(markers) != 1:
+            e = _("changeset must have one predecessor, found %i predecessors")
+            raise error.Abort(e % len(markers))
+
+        prednode = markers[0].prednode()
+        predctx = unfi[prednode]
+
+        # add an extra so that we get a new hash
+        # note: allowing unamend to undo an unamend is an intentional feature
+        extras = predctx.extra()
+        extras['unamend_source'] = curctx.hex()
+
+        def filectxfn(repo, ctx_, path):
+            try:
+                return predctx.filectx(path)
+            except KeyError:
+                return None
+
+        # Make a new commit same as predctx
+        newctx = context.memctx(repo,
+                                parents=(predctx.p1(), predctx.p2()),
+                                text=predctx.description(),
+                                files=predctx.files(),
+                                filectxfn=filectxfn,
+                                user=predctx.user(),
+                                date=predctx.date(),
+                                extra=extras)
+        # phase handling
+        commitphase = curctx.phase()
+        overrides = {('phases', 'new-commit'): commitphase}
+        with repo.ui.configoverride(overrides, 'uncommit'):
+            newprednode = repo.commitctx(newctx)
+
+        newpredctx = repo[newprednode]
+        dirstate = repo.dirstate
+
+        with dirstate.parentchange():
+            dirstate.setparents(newprednode, node.nullid)
+            s = repo.status(predctx, curctx)
+            _fixdirstate(repo, curctx, newpredctx, s)
+
+        mapping = {curctx.node(): (newprednode,)}
+        scmutil.cleanupnodes(repo, mapping, 'unamend')
--- a/i18n/de.po	Sun Dec 17 18:43:05 2017 +0900
+++ b/i18n/de.po	Tue Dec 19 16:27:24 2017 -0500
@@ -9744,86 +9744,9 @@
 msgid "child process failed to start"
 msgstr ""
 
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "changeset:   %s\n"
-msgstr "Änderung:        %s\n"
-
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "branch:      %s\n"
-msgstr "Zweig:           %s\n"
-
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "bookmark:    %s\n"
-msgstr "Lesezeichen:     %s\n"
-
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "tag:         %s\n"
-msgstr "Marke:           %s\n"
-
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "phase:       %s\n"
-msgstr "Phase:       %s\n"
-
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "parent:      %s\n"
-msgstr "Vorgänger:       %s\n"
-
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "manifest:    %d:%s\n"
-msgstr "Manifest:        %d:%s\n"
-
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "user:        %s\n"
-msgstr "Nutzer:          %s\n"
-
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "date:        %s\n"
-msgstr "Datum:           %s\n"
-
-#. i18n: column positioning for "hg log"
-msgid "files:"
-msgstr "Dateien:"
-
-#. i18n: column positioning for "hg log"
-msgid "files+:"
-msgstr "Dateien+:"
-
-#. i18n: column positioning for "hg log"
-msgid "files-:"
-msgstr "Dateien-:"
-
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "files:       %s\n"
-msgstr "Dateien:         %s\n"
-
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "copies:      %s\n"
-msgstr "Kopien:          %s\n"
-
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "extra:       %s=%s\n"
-msgstr "Extra:           %s=%s\n"
-
 msgid "description:\n"
 msgstr "Beschreibung:\n"
 
-#. i18n: column positioning for "hg log"
-#, python-format
-msgid "summary:     %s\n"
-msgstr "Zusammenfassung: %s\n"
-
 #, python-format
 msgid "%s: no key named '%s'"
 msgstr "%s: kein Schlüsselwort '%s'"
@@ -23194,6 +23117,45 @@
 ":emailuser: Beliebiger Text. Gibt den Nutzerteil einer E-Mail-Adresse\n"
 "    (vor dem @-Zeichen) zurück."
 
+#. i18n: column positioning for "hg log"
+#, python-format
+msgid ""
+"bookmark:    %s\n"
+"branch:      %s\n"
+"changeset:   %s\n"
+"copies:      %s\n"
+"date:        %s\n"
+"extra:       %s=%s\n"
+"files+:      %s\n"
+"files-:      %s\n"
+"files:       %s\n"
+"instability: %s\n"
+"manifest:    %s\n"
+"obsolete:    %s\n"
+"parent:      %s\n"
+"phase:       %s\n"
+"summary:     %s\n"
+"tag:         %s\n"
+"user:        %s\n"
+msgstr ""
+"Lesezeichen:     %s\n"
+"Zweig:           %s\n"
+"Änderung:        %s\n"
+"Kopien:          %s\n"
+"Datum:           %s\n"
+"Extra:           %s=%s\n"
+"Dateien+:        %s\n"
+"Dateien-:        %s\n"
+"Dateien:         %s\n"
+"instability:     %s\n"
+"Manifest:        %s\n"
+"obsolete:        %s\n"
+"Vorgänger:       %s\n"
+"Phase:           %s\n"
+"Zusammenfassung: %s\n"
+"Marke:           %s\n"
+"Nutzer:          %s\n"
+
 msgid ":author: String. The unmodified author of the changeset."
 msgstr ":author: Zeichenkette. Der unveränderte Autor eines Änderungssatzes."
 
--- a/mercurial/__init__.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/__init__.py	Tue Dec 19 16:27:24 2017 -0500
@@ -31,9 +31,6 @@
             # Only handle Mercurial-related modules.
             if not fullname.startswith(('mercurial.', 'hgext.', 'hgext3rd.')):
                 return None
-            # selectors2 is already dual-version clean, don't try and mangle it
-            if fullname.startswith('mercurial.selectors2'):
-                return None
             # third-party packages are expected to be dual-version clean
             if fullname.startswith('mercurial.thirdparty'):
                 return None
--- a/mercurial/archival.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/archival.py	Tue Dec 19 16:27:24 2017 -0500
@@ -126,7 +126,7 @@
         def __init__(self, *args, **kw):
             timestamp = None
             if 'timestamp' in kw:
-                timestamp = kw.pop('timestamp')
+                timestamp = kw.pop(r'timestamp')
             if timestamp is None:
                 self.timestamp = time.time()
             else:
@@ -262,6 +262,7 @@
     def __init__(self, name, mtime):
         self.basedir = name
         self.opener = vfsmod.vfs(self.basedir)
+        self.mtime = mtime
 
     def addfile(self, name, mode, islink, data):
         if islink:
@@ -272,6 +273,8 @@
         f.close()
         destfile = os.path.join(self.basedir, name)
         os.chmod(destfile, mode)
+        if self.mtime is not None:
+            os.utime(destfile, (self.mtime, self.mtime))
 
     def done(self):
         pass
@@ -299,7 +302,12 @@
 
     matchfn is function to filter names of files to write to archive.
 
-    prefix is name of path to put before every archive member.'''
+    prefix is name of path to put before every archive member.
+
+    mtime is the modified time, in seconds, or None to use the changeset time.
+
+    subrepos tells whether to include subrepos.
+    '''
 
     if kind == 'files':
         if prefix:
--- a/mercurial/bookmarks.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/bookmarks.py	Tue Dec 19 16:27:24 2017 -0500
@@ -8,12 +8,14 @@
 from __future__ import absolute_import
 
 import errno
+import struct
 
 from .i18n import _
 from .node import (
     bin,
     hex,
     short,
+    wdirid,
 )
 from . import (
     encoding,
@@ -550,6 +552,60 @@
         binremotemarks[name] = bin(node)
     return binremotemarks
 
+_binaryentry = struct.Struct('>20sH')
+
+def binaryencode(bookmarks):
+    """encode a '(bookmark, node)' iterable into a binary stream
+
+    the binary format is:
+
+        <node><bookmark-length><bookmark-name>
+
+    :node: is a 20 bytes binary node,
+    :bookmark-length: an unsigned short,
+    :bookmark-name: the name of the bookmark (of length <bookmark-length>)
+
+    wdirid (all bits set) will be used as a special value for "missing"
+    """
+    binarydata = []
+    for book, node in bookmarks:
+        if not node: # None or ''
+            node = wdirid
+        binarydata.append(_binaryentry.pack(node, len(book)))
+        binarydata.append(book)
+    return ''.join(binarydata)
+
+def binarydecode(stream):
+    """decode a binary stream into an '(bookmark, node)' iterable
+
+    the binary format is:
+
+        <node><bookmark-length><bookmark-name>
+
+    :node: is a 20 bytes binary node,
+    :bookmark-length: an unsigned short,
+    :bookmark-name: the name of the bookmark (of length <bookmark-length>))
+
+    wdirid (all bits set) will be used as a special value for "missing"
+    """
+    entrysize = _binaryentry.size
+    books = []
+    while True:
+        entry = stream.read(entrysize)
+        if len(entry) < entrysize:
+            if entry:
+                raise error.Abort(_('bad bookmark stream'))
+            break
+        node, length = _binaryentry.unpack(entry)
+        bookmark = stream.read(length)
+        if len(bookmark) < length:
+            if entry:
+                raise error.Abort(_('bad bookmark stream'))
+        if node == wdirid:
+            node = None
+        books.append((bookmark, node))
+    return books
+
 def updatefromremote(ui, repo, remotemarks, path, trfunc, explicit=()):
     ui.debug("checking for updated bookmarks\n")
     localmarks = repo._bookmarks
--- a/mercurial/bundle2.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/bundle2.py	Tue Dec 19 16:27:24 2017 -0500
@@ -148,6 +148,7 @@
 from __future__ import absolute_import, division
 
 import errno
+import os
 import re
 import string
 import struct
@@ -155,6 +156,7 @@
 
 from .i18n import _
 from . import (
+    bookmarks,
     changegroup,
     error,
     node as nodemod,
@@ -299,6 +301,8 @@
         self.captureoutput = captureoutput
         self.hookargs = {}
         self._gettransaction = transactiongetter
+        # carries value that can modify part behavior
+        self.modes = {}
 
     def gettransaction(self):
         transaction = self._gettransaction()
@@ -362,7 +366,7 @@
                 self.count = count
                 self.current = p
                 yield p
-                p.seek(0, 2)
+                p.consume()
                 self.current = None
         self.iterator = func()
         return self.iterator
@@ -384,11 +388,11 @@
             try:
                 if self.current:
                     # consume the part content to not corrupt the stream.
-                    self.current.seek(0, 2)
+                    self.current.consume()
 
                 for part in self.iterator:
                     # consume the bundle content
-                    part.seek(0, 2)
+                    part.consume()
             except Exception:
                 seekerror = True
 
@@ -844,8 +848,9 @@
             yield self._readexact(size)
 
 
-    def iterparts(self):
+    def iterparts(self, seekable=False):
         """yield all parts contained in the stream"""
+        cls = seekableunbundlepart if seekable else unbundlepart
         # make sure param have been loaded
         self.params
         # From there, payload need to be decompressed
@@ -853,13 +858,12 @@
         indebug(self.ui, 'start extraction of bundle2 parts')
         headerblock = self._readpartheader()
         while headerblock is not None:
-            part = unbundlepart(self.ui, headerblock, self._fp)
+            part = cls(self.ui, headerblock, self._fp)
             yield part
-            # Seek to the end of the part to force it's consumption so the next
-            # part can be read. But then seek back to the beginning so the
-            # code consuming this generator has a part that starts at 0.
-            part.seek(0, 2)
-            part.seek(0)
+            # Ensure part is fully consumed so we can start reading the next
+            # part.
+            part.consume()
+
             headerblock = self._readpartheader()
         indebug(self.ui, 'end of bundle2 stream')
 
@@ -1164,7 +1168,7 @@
             raise
         finally:
             if not hardabort:
-                part.seek(0, 2)
+                part.consume()
         self.ui.debug('bundle2-input-stream-interrupt:'
                       ' closing out of band context\n')
 
@@ -1186,6 +1190,55 @@
     def gettransaction(self):
         raise TransactionUnavailable('no repo access from stream interruption')
 
+def decodepayloadchunks(ui, fh):
+    """Reads bundle2 part payload data into chunks.
+
+    Part payload data consists of framed chunks. This function takes
+    a file handle and emits those chunks.
+    """
+    dolog = ui.configbool('devel', 'bundle2.debug')
+    debug = ui.debug
+
+    headerstruct = struct.Struct(_fpayloadsize)
+    headersize = headerstruct.size
+    unpack = headerstruct.unpack
+
+    readexactly = changegroup.readexactly
+    read = fh.read
+
+    chunksize = unpack(readexactly(fh, headersize))[0]
+    indebug(ui, 'payload chunk size: %i' % chunksize)
+
+    # changegroup.readexactly() is inlined below for performance.
+    while chunksize:
+        if chunksize >= 0:
+            s = read(chunksize)
+            if len(s) < chunksize:
+                raise error.Abort(_('stream ended unexpectedly '
+                                    ' (got %d bytes, expected %d)') %
+                                  (len(s), chunksize))
+
+            yield s
+        elif chunksize == flaginterrupt:
+            # Interrupt "signal" detected. The regular stream is interrupted
+            # and a bundle2 part follows. Consume it.
+            interrupthandler(ui, fh)()
+        else:
+            raise error.BundleValueError(
+                'negative payload chunk size: %s' % chunksize)
+
+        s = read(headersize)
+        if len(s) < headersize:
+            raise error.Abort(_('stream ended unexpectedly '
+                                ' (got %d bytes, expected %d)') %
+                              (len(s), chunksize))
+
+        chunksize = unpack(s)[0]
+
+        # indebug() inlined for performance.
+        if dolog:
+            debug('bundle2-input: payload chunk size: %i\n' % chunksize)
+
 class unbundlepart(unpackermixin):
     """a bundle part read from a bundle"""
 
@@ -1206,10 +1259,8 @@
         self.advisoryparams = None
         self.params = None
         self.mandatorykeys = ()
-        self._payloadstream = None
         self._readheader()
         self._mandatory = None
-        self._chunkindex = [] #(payload, file) position tuples for chunk starts
         self._pos = 0
 
     def _fromheader(self, size):
@@ -1236,46 +1287,6 @@
         self.params.update(self.advisoryparams)
         self.mandatorykeys = frozenset(p[0] for p in mandatoryparams)
 
-    def _payloadchunks(self, chunknum=0):
-        '''seek to specified chunk and start yielding data'''
-        if len(self._chunkindex) == 0:
-            assert chunknum == 0, 'Must start with chunk 0'
-            self._chunkindex.append((0, self._tellfp()))
-        else:
-            assert chunknum < len(self._chunkindex), \
-                   'Unknown chunk %d' % chunknum
-            self._seekfp(self._chunkindex[chunknum][1])
-
-        pos = self._chunkindex[chunknum][0]
-        payloadsize = self._unpack(_fpayloadsize)[0]
-        indebug(self.ui, 'payload chunk size: %i' % payloadsize)
-        while payloadsize:
-            if payloadsize == flaginterrupt:
-                # interruption detection, the handler will now read a
-                # single part and process it.
-                interrupthandler(self.ui, self._fp)()
-            elif payloadsize < 0:
-                msg = 'negative payload chunk size: %i' %  payloadsize
-                raise error.BundleValueError(msg)
-            else:
-                result = self._readexact(payloadsize)
-                chunknum += 1
-                pos += payloadsize
-                if chunknum == len(self._chunkindex):
-                    self._chunkindex.append((pos, self._tellfp()))
-                yield result
-            payloadsize = self._unpack(_fpayloadsize)[0]
-            indebug(self.ui, 'payload chunk size: %i' % payloadsize)
-
-    def _findchunk(self, pos):
-        '''for a given payload position, return a chunk number and offset'''
-        for chunk, (ppos, fpos) in enumerate(self._chunkindex):
-            if ppos == pos:
-                return chunk, 0
-            elif ppos > pos:
-                return chunk - 1, pos - self._chunkindex[chunk - 1][0]
-        raise ValueError('Unknown chunk')
-
     def _readheader(self):
         """read the header and setup the object"""
         typesize = self._unpackheader(_fparttypesize)[0]
@@ -1311,6 +1322,24 @@
         # we read the data, tell it
         self._initialized = True
 
+    def _payloadchunks(self):
+        """Generator of decoded chunks in the payload."""
+        return decodepayloadchunks(self.ui, self._fp)
+
+    def consume(self):
+        """Read the part payload until completion.
+
+        By consuming the part data, the underlying stream read offset will
+        be advanced to the next part (or end of stream).
+        """
+        if self.consumed:
+            return
+
+        chunk = self.read(32768)
+        while chunk:
+            self._pos += len(chunk)
+            chunk = self.read(32768)
+
     def read(self, size=None):
         """read payload data"""
         if not self._initialized:
@@ -1327,23 +1356,82 @@
             self.consumed = True
         return data
 
+class seekableunbundlepart(unbundlepart):
+    """A bundle2 part in a bundle that is seekable.
+
+    Regular ``unbundlepart`` instances can only be read once. This class
+    extends ``unbundlepart`` to enable bi-directional seeking within the
+    part.
+
+    Bundle2 part data consists of framed chunks. Offsets when seeking
+    refer to the decoded data, not the offsets in the underlying bundle2
+    stream.
+
+    To facilitate quickly seeking within the decoded data, instances of this
+    class maintain a mapping between offsets in the underlying stream and
+    the decoded payload. This mapping will consume memory in proportion
+    to the number of chunks within the payload (which almost certainly
+    increases in proportion with the size of the part).
+    """
+    def __init__(self, ui, header, fp):
+        # (payload, file) offsets for chunk starts.
+        self._chunkindex = []
+
+        super(seekableunbundlepart, self).__init__(ui, header, fp)
+
+    def _payloadchunks(self, chunknum=0):
+        '''seek to specified chunk and start yielding data'''
+        if len(self._chunkindex) == 0:
+            assert chunknum == 0, 'Must start with chunk 0'
+            self._chunkindex.append((0, self._tellfp()))
+        else:
+            assert chunknum < len(self._chunkindex), \
+                   'Unknown chunk %d' % chunknum
+            self._seekfp(self._chunkindex[chunknum][1])
+
+        pos = self._chunkindex[chunknum][0]
+
+        for chunk in decodepayloadchunks(self.ui, self._fp):
+            chunknum += 1
+            pos += len(chunk)
+            if chunknum == len(self._chunkindex):
+                self._chunkindex.append((pos, self._tellfp()))
+
+            yield chunk
+
+    def _findchunk(self, pos):
+        '''for a given payload position, return a chunk number and offset'''
+        for chunk, (ppos, fpos) in enumerate(self._chunkindex):
+            if ppos == pos:
+                return chunk, 0
+            elif ppos > pos:
+                return chunk - 1, pos - self._chunkindex[chunk - 1][0]
+        raise ValueError('Unknown chunk')
+
     def tell(self):
         return self._pos
 
-    def seek(self, offset, whence=0):
-        if whence == 0:
+    def seek(self, offset, whence=os.SEEK_SET):
+        if whence == os.SEEK_SET:
             newpos = offset
-        elif whence == 1:
+        elif whence == os.SEEK_CUR:
             newpos = self._pos + offset
-        elif whence == 2:
+        elif whence == os.SEEK_END:
             if not self.consumed:
-                self.read()
+                # Can't use self.consume() here because it advances self._pos.
+                chunk = self.read(32768)
+                while chunk:
+                    chunk = self.read(32768)
             newpos = self._chunkindex[-1][0] - offset
         else:
             raise ValueError('Unknown whence value: %r' % (whence,))
 
         if newpos > self._chunkindex[-1][0] and not self.consumed:
-            self.read()
+            # Can't use self.consume() here because it advances self._pos.
+            chunk = self.read(32768)
+            while chunk:
+                chunk = self.read(32668)
+
         if not 0 <= newpos <= self._chunkindex[-1][0]:
             raise ValueError('Offset out of range')
 
@@ -1389,6 +1477,7 @@
 # These are only the static capabilities.
 # Check the 'getrepocaps' function for the rest.
 capabilities = {'HG20': (),
+                'bookmarks': (),
                 'error': ('abort', 'unsupportedcontent', 'pushraced',
                           'pushkey'),
                 'listkeys': (),
@@ -1702,6 +1791,34 @@
     replyto = int(inpart.params['in-reply-to'])
     op.records.add('changegroup', {'return': ret}, replyto)
 
+@parthandler('check:bookmarks')
+def handlecheckbookmarks(op, inpart):
+    """check location of bookmarks
+
+    This part is to be used to detect push race regarding bookmark, it
+    contains binary encoded (bookmark, node) tuple. If the local state does
+    not marks the one in the part, a PushRaced exception is raised
+    """
+    bookdata = bookmarks.binarydecode(inpart)
+
+    msgstandard = ('repository changed while pushing - please try again '
+                   '(bookmark "%s" move from %s to %s)')
+    msgmissing = ('repository changed while pushing - please try again '
+                  '(bookmark "%s" is missing, expected %s)')
+    msgexist = ('repository changed while pushing - please try again '
+                '(bookmark "%s" set on %s, expected missing)')
+    for book, node in bookdata:
+        currentnode = op.repo._bookmarks.get(book)
+        if currentnode != node:
+            if node is None:
+                finalmsg = msgexist % (book, nodemod.short(currentnode))
+            elif currentnode is None:
+                finalmsg = msgmissing % (book, nodemod.short(node))
+            else:
+                finalmsg = msgstandard % (book, nodemod.short(node),
+                                          nodemod.short(currentnode))
+            raise error.PushRaced(finalmsg)
+
 @parthandler('check:heads')
 def handlecheckheads(op, inpart):
     """check that head of the repo did not change
@@ -1861,6 +1978,60 @@
                 kwargs[key] = inpart.params[key]
         raise error.PushkeyFailed(partid=str(inpart.id), **kwargs)
 
+@parthandler('bookmarks')
+def handlebookmark(op, inpart):
+    """transmit bookmark information
+
+    The part contains binary encoded bookmark information.
+
+    The exact behavior of this part can be controlled by the 'bookmarks' mode
+    on the bundle operation.
+
+    When mode is 'apply' (the default) the bookmark information is applied as
+    is to the unbundling repository. Make sure a 'check:bookmarks' part is
+    issued earlier to check for push races in such update. This behavior is
+    suitable for pushing.
+
+    When mode is 'records', the information is recorded into the 'bookmarks'
+    records of the bundle operation. This behavior is suitable for pulling.
+    """
+    changes = bookmarks.binarydecode(inpart)
+
+    pushkeycompat = op.repo.ui.configbool('server', 'bookmarks-pushkey-compat')
+    bookmarksmode = op.modes.get('bookmarks', 'apply')
+
+    if bookmarksmode == 'apply':
+        tr = op.gettransaction()
+        bookstore = op.repo._bookmarks
+        if pushkeycompat:
+            allhooks = []
+            for book, node in changes:
+                hookargs = tr.hookargs.copy()
+                hookargs['pushkeycompat'] = '1'
+                hookargs['namespace'] = 'bookmark'
+                hookargs['key'] = book
+                hookargs['old'] = nodemod.hex(bookstore.get(book, ''))
+                hookargs['new'] = nodemod.hex(node if node is not None else '')
+                allhooks.append(hookargs)
+
+            for hookargs in allhooks:
+                op.repo.hook('prepushkey', throw=True, **hookargs)
+
+        bookstore.applychanges(op.repo, op.gettransaction(), changes)
+
+        if pushkeycompat:
+            def runhook():
+                for hookargs in allhooks:
+                    op.repo.hook('prepushkey', **hookargs)
+            op.repo._afterlock(runhook)
+
+    elif bookmarksmode == 'records':
+        for book, node in changes:
+            record = {'bookmark': book, 'node': node}
+            op.records.add('bookmarks', record)
+    else:
+        raise error.ProgrammingError('unkown bookmark mode: %s' % bookmarksmode)
+
 @parthandler('phase-heads')
 def handlephases(op, inpart):
     """apply phases from bundle part to repo"""
--- a/mercurial/bundlerepo.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/bundlerepo.py	Tue Dec 19 16:27:24 2017 -0500
@@ -42,7 +42,7 @@
 )
 
 class bundlerevlog(revlog.revlog):
-    def __init__(self, opener, indexfile, bundle, linkmapper):
+    def __init__(self, opener, indexfile, cgunpacker, linkmapper):
         # How it works:
         # To retrieve a revision, we need to know the offset of the revision in
         # the bundle (an unbundle object). We store this offset in the index
@@ -52,15 +52,15 @@
         # check revision against repotiprev.
         opener = vfsmod.readonlyvfs(opener)
         revlog.revlog.__init__(self, opener, indexfile)
-        self.bundle = bundle
+        self.bundle = cgunpacker
         n = len(self)
         self.repotiprev = n - 1
         self.bundlerevs = set() # used by 'bundle()' revset expression
-        for deltadata in bundle.deltaiter():
+        for deltadata in cgunpacker.deltaiter():
             node, p1, p2, cs, deltabase, delta, flags = deltadata
 
             size = len(delta)
-            start = bundle.tell() - size
+            start = cgunpacker.tell() - size
 
             link = linkmapper(cs)
             if node in self.nodemap:
@@ -86,7 +86,7 @@
             self.bundlerevs.add(n)
             n += 1
 
-    def _chunk(self, rev):
+    def _chunk(self, rev, df=None):
         # Warning: in case of bundle, the diff is against what we stored as
         # delta base, not against rev - 1
         # XXX: could use some caching
@@ -108,7 +108,7 @@
         return mdiff.textdiff(self.revision(rev1, raw=True),
                               self.revision(rev2, raw=True))
 
-    def revision(self, nodeorrev, raw=False):
+    def revision(self, nodeorrev, _df=None, raw=False):
         """return an uncompressed revision of a given node or revision
         number.
         """
@@ -152,20 +152,23 @@
         # needs to override 'baserevision' and make more specific call here.
         return revlog.revlog.revision(self, nodeorrev, raw=True)
 
-    def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
+    def addrevision(self, *args, **kwargs):
+        raise NotImplementedError
+
+    def addgroup(self, *args, **kwargs):
         raise NotImplementedError
-    def addgroup(self, deltas, transaction, addrevisioncb=None):
+
+    def strip(self, *args, **kwargs):
         raise NotImplementedError
-    def strip(self, rev, minlink):
-        raise NotImplementedError
+
     def checksize(self):
         raise NotImplementedError
 
 class bundlechangelog(bundlerevlog, changelog.changelog):
-    def __init__(self, opener, bundle):
+    def __init__(self, opener, cgunpacker):
         changelog.changelog.__init__(self, opener)
         linkmapper = lambda x: x
-        bundlerevlog.__init__(self, opener, self.indexfile, bundle,
+        bundlerevlog.__init__(self, opener, self.indexfile, cgunpacker,
                               linkmapper)
 
     def baserevision(self, nodeorrev):
@@ -183,9 +186,10 @@
             self.filteredrevs = oldfilter
 
 class bundlemanifest(bundlerevlog, manifest.manifestrevlog):
-    def __init__(self, opener, bundle, linkmapper, dirlogstarts=None, dir=''):
+    def __init__(self, opener, cgunpacker, linkmapper, dirlogstarts=None,
+                 dir=''):
         manifest.manifestrevlog.__init__(self, opener, dir=dir)
-        bundlerevlog.__init__(self, opener, self.indexfile, bundle,
+        bundlerevlog.__init__(self, opener, self.indexfile, cgunpacker,
                               linkmapper)
         if dirlogstarts is None:
             dirlogstarts = {}
@@ -214,9 +218,9 @@
         return super(bundlemanifest, self).dirlog(d)
 
 class bundlefilelog(bundlerevlog, filelog.filelog):
-    def __init__(self, opener, path, bundle, linkmapper):
+    def __init__(self, opener, path, cgunpacker, linkmapper):
         filelog.filelog.__init__(self, opener, path)
-        bundlerevlog.__init__(self, opener, self.indexfile, bundle,
+        bundlerevlog.__init__(self, opener, self.indexfile, cgunpacker,
                               linkmapper)
 
     def baserevision(self, nodeorrev):
@@ -243,82 +247,106 @@
         self.invalidate()
         self.dirty = True
 
-def _getfilestarts(bundle):
-    bundlefilespos = {}
-    for chunkdata in iter(bundle.filelogheader, {}):
+def _getfilestarts(cgunpacker):
+    filespos = {}
+    for chunkdata in iter(cgunpacker.filelogheader, {}):
         fname = chunkdata['filename']
-        bundlefilespos[fname] = bundle.tell()
-        for chunk in iter(lambda: bundle.deltachunk(None), {}):
+        filespos[fname] = cgunpacker.tell()
+        for chunk in iter(lambda: cgunpacker.deltachunk(None), {}):
             pass
-    return bundlefilespos
+    return filespos
 
 class bundlerepository(localrepo.localrepository):
-    def __init__(self, ui, path, bundlename):
+    """A repository instance that is a union of a local repo and a bundle.
+
+    Instances represent a read-only repository composed of a local repository
+    with the contents of a bundle file applied. The repository instance is
+    conceptually similar to the state of a repository after an
+    ``hg unbundle`` operation. However, the contents of the bundle are never
+    applied to the actual base repository.
+    """
+    def __init__(self, ui, repopath, bundlepath):
         self._tempparent = None
         try:
-            localrepo.localrepository.__init__(self, ui, path)
+            localrepo.localrepository.__init__(self, ui, repopath)
         except error.RepoError:
             self._tempparent = tempfile.mkdtemp()
             localrepo.instance(ui, self._tempparent, 1)
             localrepo.localrepository.__init__(self, ui, self._tempparent)
         self.ui.setconfig('phases', 'publish', False, 'bundlerepo')
 
-        if path:
-            self._url = 'bundle:' + util.expandpath(path) + '+' + bundlename
+        if repopath:
+            self._url = 'bundle:' + util.expandpath(repopath) + '+' + bundlepath
         else:
-            self._url = 'bundle:' + bundlename
+            self._url = 'bundle:' + bundlepath
 
         self.tempfile = None
-        f = util.posixfile(bundlename, "rb")
-        self.bundlefile = self.bundle = exchange.readbundle(ui, f, bundlename)
+        f = util.posixfile(bundlepath, "rb")
+        bundle = exchange.readbundle(ui, f, bundlepath)
 
-        if isinstance(self.bundle, bundle2.unbundle20):
-            hadchangegroup = False
-            for part in self.bundle.iterparts():
+        if isinstance(bundle, bundle2.unbundle20):
+            self._bundlefile = bundle
+            self._cgunpacker = None
+
+            cgpart = None
+            for part in bundle.iterparts(seekable=True):
                 if part.type == 'changegroup':
-                    if hadchangegroup:
+                    if cgpart:
                         raise NotImplementedError("can't process "
                                                   "multiple changegroups")
-                    hadchangegroup = True
+                    cgpart = part
 
-                self._handlebundle2part(part)
+                self._handlebundle2part(bundle, part)
 
-            if not hadchangegroup:
+            if not cgpart:
                 raise error.Abort(_("No changegroups found"))
 
-        elif self.bundle.compressed():
-            f = self._writetempbundle(self.bundle.read, '.hg10un',
-                                      header='HG10UN')
-            self.bundlefile = self.bundle = exchange.readbundle(ui, f,
-                                                                bundlename,
-                                                                self.vfs)
+            # This is required to placate a later consumer, which expects
+            # the payload offset to be at the beginning of the changegroup.
+            # We need to do this after the iterparts() generator advances
+            # because iterparts() will seek to end of payload after the
+            # generator returns control to iterparts().
+            cgpart.seek(0, os.SEEK_SET)
 
-        # dict with the mapping 'filename' -> position in the bundle
-        self.bundlefilespos = {}
+        elif isinstance(bundle, changegroup.cg1unpacker):
+            if bundle.compressed():
+                f = self._writetempbundle(bundle.read, '.hg10un',
+                                          header='HG10UN')
+                bundle = exchange.readbundle(ui, f, bundlepath, self.vfs)
+
+            self._bundlefile = bundle
+            self._cgunpacker = bundle
+        else:
+            raise error.Abort(_('bundle type %s cannot be read') %
+                              type(bundle))
+
+        # dict with the mapping 'filename' -> position in the changegroup.
+        self._cgfilespos = {}
 
         self.firstnewrev = self.changelog.repotiprev + 1
         phases.retractboundary(self, None, phases.draft,
                                [ctx.node() for ctx in self[self.firstnewrev:]])
 
-    def _handlebundle2part(self, part):
-        if part.type == 'changegroup':
-            cgstream = part
-            version = part.params.get('version', '01')
-            legalcgvers = changegroup.supportedincomingversions(self)
-            if version not in legalcgvers:
-                msg = _('Unsupported changegroup version: %s')
-                raise error.Abort(msg % version)
-            if self.bundle.compressed():
-                cgstream = self._writetempbundle(part.read,
-                                                 ".cg%sun" % version)
+    def _handlebundle2part(self, bundle, part):
+        if part.type != 'changegroup':
+            return
 
-            self.bundle = changegroup.getunbundler(version, cgstream, 'UN')
+        cgstream = part
+        version = part.params.get('version', '01')
+        legalcgvers = changegroup.supportedincomingversions(self)
+        if version not in legalcgvers:
+            msg = _('Unsupported changegroup version: %s')
+            raise error.Abort(msg % version)
+        if bundle.compressed():
+            cgstream = self._writetempbundle(part.read, '.cg%sun' % version)
+
+        self._cgunpacker = changegroup.getunbundler(version, cgstream, 'UN')
 
     def _writetempbundle(self, readfn, suffix, header=''):
         """Write a temporary file to disk
         """
         fdtemp, temp = self.vfs.mkstemp(prefix="hg-bundle-",
-                                        suffix=".hg10un")
+                                        suffix=suffix)
         self.tempfile = temp
 
         with os.fdopen(fdtemp, pycompat.sysstr('wb')) as fptemp:
@@ -338,20 +366,29 @@
     @localrepo.unfilteredpropertycache
     def changelog(self):
         # consume the header if it exists
-        self.bundle.changelogheader()
-        c = bundlechangelog(self.svfs, self.bundle)
-        self.manstart = self.bundle.tell()
+        self._cgunpacker.changelogheader()
+        c = bundlechangelog(self.svfs, self._cgunpacker)
+        self.manstart = self._cgunpacker.tell()
         return c
 
     def _constructmanifest(self):
-        self.bundle.seek(self.manstart)
+        self._cgunpacker.seek(self.manstart)
         # consume the header if it exists
-        self.bundle.manifestheader()
+        self._cgunpacker.manifestheader()
         linkmapper = self.unfiltered().changelog.rev
-        m = bundlemanifest(self.svfs, self.bundle, linkmapper)
-        self.filestart = self.bundle.tell()
+        m = bundlemanifest(self.svfs, self._cgunpacker, linkmapper)
+        self.filestart = self._cgunpacker.tell()
         return m
 
+    def _consumemanifest(self):
+        """Consumes the manifest portion of the bundle, setting filestart so the
+        file portion can be read."""
+        self._cgunpacker.seek(self.manstart)
+        self._cgunpacker.manifestheader()
+        for delta in self._cgunpacker.deltaiter():
+            pass
+        self.filestart = self._cgunpacker.tell()
+
     @localrepo.unfilteredpropertycache
     def manstart(self):
         self.changelog
@@ -360,26 +397,34 @@
     @localrepo.unfilteredpropertycache
     def filestart(self):
         self.manifestlog
+
+        # If filestart was not set by self.manifestlog, that means the
+        # manifestlog implementation did not consume the manifests from the
+        # changegroup (ex: it might be consuming trees from a separate bundle2
+        # part instead). So we need to manually consume it.
+        if 'filestart' not in self.__dict__:
+            self._consumemanifest()
+
         return self.filestart
 
     def url(self):
         return self._url
 
     def file(self, f):
-        if not self.bundlefilespos:
-            self.bundle.seek(self.filestart)
-            self.bundlefilespos = _getfilestarts(self.bundle)
+        if not self._cgfilespos:
+            self._cgunpacker.seek(self.filestart)
+            self._cgfilespos = _getfilestarts(self._cgunpacker)
 
-        if f in self.bundlefilespos:
-            self.bundle.seek(self.bundlefilespos[f])
+        if f in self._cgfilespos:
+            self._cgunpacker.seek(self._cgfilespos[f])
             linkmapper = self.unfiltered().changelog.rev
-            return bundlefilelog(self.svfs, f, self.bundle, linkmapper)
+            return bundlefilelog(self.svfs, f, self._cgunpacker, linkmapper)
         else:
             return filelog.filelog(self.svfs, f)
 
     def close(self):
         """Close assigned bundle file immediately."""
-        self.bundlefile.close()
+        self._bundlefile.close()
         if self.tempfile is not None:
             self.vfs.unlink(self.tempfile)
         if self._tempparent:
@@ -496,10 +541,10 @@
                       and other.capable('bundle2'))
         if canbundle2:
             kwargs = {}
-            kwargs['common'] = common
-            kwargs['heads'] = rheads
-            kwargs['bundlecaps'] = exchange.caps20to10(repo)
-            kwargs['cg'] = True
+            kwargs[r'common'] = common
+            kwargs[r'heads'] = rheads
+            kwargs[r'bundlecaps'] = exchange.caps20to10(repo)
+            kwargs[r'cg'] = True
             b2 = other.getbundle('incoming', **kwargs)
             fname = bundle = changegroup.writechunks(ui, b2._forwardchunks(),
                                                      bundlename)
--- a/mercurial/cext/parsers.c	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/cext/parsers.c	Tue Dec 19 16:27:24 2017 -0500
@@ -710,7 +710,7 @@
 void manifest_module_init(PyObject *mod);
 void revlog_module_init(PyObject *mod);
 
-static const int version = 3;
+static const int version = 4;
 
 static void module_init(PyObject *mod)
 {
--- a/mercurial/cext/revlog.c	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/cext/revlog.c	Tue Dec 19 16:27:24 2017 -0500
@@ -628,7 +628,7 @@
 {
 	PyObject *roots = Py_None;
 	PyObject *ret = NULL;
-	PyObject *phaseslist = NULL;
+	PyObject *phasessize = NULL;
 	PyObject *phaseroots = NULL;
 	PyObject *phaseset = NULL;
 	PyObject *phasessetlist = NULL;
@@ -685,12 +685,10 @@
 		}
 	}
 	/* Transform phase list to a python list */
-	phaseslist = PyList_New(len);
-	if (phaseslist == NULL)
+	phasessize = PyInt_FromLong(len);
+	if (phasessize == NULL)
 		goto release;
 	for (i = 0; i < len; i++) {
-		PyObject *phaseval;
-
 		phase = phases[i];
 		/* We only store the sets of phase for non public phase, the public phase
 		 * is computed as a difference */
@@ -702,15 +700,11 @@
 			PySet_Add(phaseset, rev);
 			Py_XDECREF(rev);
 		}
-		phaseval = PyInt_FromLong(phase);
-		if (phaseval == NULL)
-			goto release;
-		PyList_SET_ITEM(phaseslist, i, phaseval);
 	}
-	ret = PyTuple_Pack(2, phaseslist, phasessetlist);
+	ret = PyTuple_Pack(2, phasessize, phasessetlist);
 
 release:
-	Py_XDECREF(phaseslist);
+	Py_XDECREF(phasessize);
 	Py_XDECREF(phasessetlist);
 done:
 	free(phases);
--- a/mercurial/changegroup.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/changegroup.py	Tue Dec 19 16:27:24 2017 -0500
@@ -692,7 +692,7 @@
         # Callback for the manifest, used to collect linkrevs for filelog
         # revisions.
         # Returns the linkrev node (collected in lookupcl).
-        def makelookupmflinknode(dir):
+        def makelookupmflinknode(dir, nodes):
             if fastpathlinkrev:
                 assert not dir
                 return mfs.__getitem__
@@ -713,7 +713,7 @@
                 the client before you can trust the list of files and
                 treemanifests to send.
                 """
-                clnode = tmfnodes[dir][x]
+                clnode = nodes[x]
                 mdata = mfl.get(dir, x).readfast(shallow=True)
                 for p, n, fl in mdata.iterentries():
                     if fl == 't': # subdirectory manifest
@@ -733,15 +733,13 @@
 
         size = 0
         while tmfnodes:
-            dir = min(tmfnodes)
-            nodes = tmfnodes[dir]
+            dir, nodes = tmfnodes.popitem()
             prunednodes = self.prune(dirlog(dir), nodes, commonrevs)
             if not dir or prunednodes:
                 for x in self._packmanifests(dir, prunednodes,
-                                             makelookupmflinknode(dir)):
+                                             makelookupmflinknode(dir, nodes)):
                     size += len(x)
                     yield x
-            del tmfnodes[dir]
         self._verbosenote(_('%8.i (manifests)\n') % size)
         yield self._manifestsdone()
 
--- a/mercurial/changelog.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/changelog.py	Tue Dec 19 16:27:24 2017 -0500
@@ -541,5 +541,10 @@
                                                    *args, **kwargs)
         revs = transaction.changes.get('revs')
         if revs is not None:
-            revs.add(rev)
+            if revs:
+                assert revs[-1] + 1 == rev
+                revs = xrange(revs[0], rev + 1)
+            else:
+                revs = xrange(rev, rev + 1)
+            transaction.changes['revs'] = revs
         return node
--- a/mercurial/chgserver.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/chgserver.py	Tue Dec 19 16:27:24 2017 -0500
@@ -220,16 +220,7 @@
         newui._csystem = srcui._csystem
 
     # command line args
-    options = {}
-    if srcui.plain('strictflags'):
-        options.update(dispatch._earlyparseopts(args))
-    else:
-        args = args[:]
-        options['config'] = dispatch._earlygetopt(['--config'], args)
-        cwds = dispatch._earlygetopt(['--cwd'], args)
-        options['cwd'] = cwds and cwds[-1] or ''
-        rpath = dispatch._earlygetopt(["-R", "--repository", "--repo"], args)
-        options['repository'] = rpath and rpath[-1] or ''
+    options = dispatch._earlyparseopts(newui, args)
     dispatch._parseconfig(newui, options['config'])
 
     # stolen from tortoisehg.util.copydynamicconfig()
--- a/mercurial/cmdutil.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/cmdutil.py	Tue Dec 19 16:27:24 2017 -0500
@@ -181,7 +181,7 @@
 def setupwrapcolorwrite(ui):
     # wrap ui.write so diff output can be labeled/colorized
     def wrapwrite(orig, *args, **kw):
-        label = kw.pop('label', '')
+        label = kw.pop(r'label', '')
         for chunk, l in patch.difflabel(lambda: args):
             orig(chunk, label=label + l)
 
@@ -372,7 +372,7 @@
 
             # Make all of the pathnames absolute.
             newfiles = [repo.wjoin(nf) for nf in newfiles]
-            return commitfunc(ui, repo, *newfiles, **opts)
+            return commitfunc(ui, repo, *newfiles, **pycompat.strkwargs(opts))
         finally:
             # 5. finally restore backed-up files
             try:
@@ -823,9 +823,9 @@
                   total=None, seqno=None, revwidth=None, pathname=None):
     node_expander = {
         'H': lambda: hex(node),
-        'R': lambda: str(repo.changelog.rev(node)),
+        'R': lambda: '%d' % repo.changelog.rev(node),
         'h': lambda: short(node),
-        'm': lambda: re.sub('[^\w]', '_', str(desc))
+        'm': lambda: re.sub('[^\w]', '_', desc or '')
         }
     expander = {
         '%': lambda: '%',
@@ -837,13 +837,13 @@
             expander.update(node_expander)
         if node:
             expander['r'] = (lambda:
-                    str(repo.changelog.rev(node)).zfill(revwidth or 0))
+                    ('%d' % repo.changelog.rev(node)).zfill(revwidth or 0))
         if total is not None:
-            expander['N'] = lambda: str(total)
+            expander['N'] = lambda: '%d' % total
         if seqno is not None:
-            expander['n'] = lambda: str(seqno)
+            expander['n'] = lambda: '%d' % seqno
         if total is not None and seqno is not None:
-            expander['n'] = lambda: str(seqno).zfill(len(str(total)))
+            expander['n'] = (lambda: ('%d' % seqno).zfill(len('%d' % total)))
         if pathname is not None:
             expander['s'] = lambda: os.path.basename(pathname)
             expander['d'] = lambda: os.path.dirname(pathname) or '.'
@@ -1334,7 +1334,8 @@
                 if opts.get('exact'):
                     editor = None
                 else:
-                    editor = getcommiteditor(editform=editform, **opts)
+                    editor = getcommiteditor(editform=editform,
+                                             **pycompat.strkwargs(opts))
                 extra = {}
                 for idfunc in extrapreimport:
                     extrapreimportmap[idfunc](repo, extractdata, extra, opts)
@@ -1518,7 +1519,7 @@
         width = 80
         if not ui.plain():
             width = ui.termwidth()
-        chunks = patch.diff(repo, node1, node2, match, changes, diffopts,
+        chunks = patch.diff(repo, node1, node2, match, changes, opts=diffopts,
                             prefix=prefix, relroot=relroot,
                             hunksfilterfn=hunksfilterfn)
         for chunk, label in patch.diffstatui(util.iterlines(chunks),
@@ -1526,7 +1527,7 @@
             write(chunk, label=label)
     else:
         for chunk, label in patch.diffui(repo, node1, node2, match,
-                                         changes, diffopts, prefix=prefix,
+                                         changes, opts=diffopts, prefix=prefix,
                                          relroot=relroot,
                                          hunksfilterfn=hunksfilterfn):
             write(chunk, label=label)
@@ -1571,6 +1572,7 @@
         self.hunk = {}
         self.lastheader = None
         self.footer = None
+        self._columns = templatekw.getlogcolumns()
 
     def flush(self, ctx):
         rev = ctx.rev()
@@ -1610,10 +1612,8 @@
                           label='log.node')
             return
 
-        date = util.datestr(ctx.date())
-
-        # i18n: column positioning for "hg log"
-        self.ui.write(_("changeset:   %s\n") % scmutil.formatchangeid(ctx),
+        columns = self._columns
+        self.ui.write(columns['changeset'] % scmutil.formatchangeid(ctx),
                       label=_changesetlabels(ctx))
 
         # branches are shown first before any other names due to backwards
@@ -1621,9 +1621,7 @@
         branch = ctx.branch()
         # don't show the default branch name
         if branch != 'default':
-            # i18n: column positioning for "hg log"
-            self.ui.write(_("branch:      %s\n") % branch,
-                          label='log.branch')
+            self.ui.write(columns['branch'] % branch, label='log.branch')
 
         for nsname, ns in self.repo.names.iteritems():
             # branches has special logic already handled above, so here we just
@@ -1636,33 +1634,25 @@
                 self.ui.write(ns.logfmt % name,
                               label='log.%s' % ns.colorname)
         if self.ui.debugflag:
-            # i18n: column positioning for "hg log"
-            self.ui.write(_("phase:       %s\n") % ctx.phasestr(),
-                          label='log.phase')
+            self.ui.write(columns['phase'] % ctx.phasestr(), label='log.phase')
         for pctx in scmutil.meaningfulparents(self.repo, ctx):
             label = 'log.parent changeset.%s' % pctx.phasestr()
-            # i18n: column positioning for "hg log"
-            self.ui.write(_("parent:      %s\n") % scmutil.formatchangeid(pctx),
+            self.ui.write(columns['parent'] % scmutil.formatchangeid(pctx),
                           label=label)
 
         if self.ui.debugflag and rev is not None:
             mnode = ctx.manifestnode()
             mrev = self.repo.manifestlog._revlog.rev(mnode)
-            # i18n: column positioning for "hg log"
-            self.ui.write(_("manifest:    %s\n")
+            self.ui.write(columns['manifest']
                           % scmutil.formatrevnode(self.ui, mrev, mnode),
                           label='ui.debug log.manifest')
-        # i18n: column positioning for "hg log"
-        self.ui.write(_("user:        %s\n") % ctx.user(),
-                      label='log.user')
-        # i18n: column positioning for "hg log"
-        self.ui.write(_("date:        %s\n") % date,
+        self.ui.write(columns['user'] % ctx.user(), label='log.user')
+        self.ui.write(columns['date'] % util.datestr(ctx.date()),
                       label='log.date')
 
         if ctx.isunstable():
-            # i18n: column positioning for "hg log"
             instabilities = ctx.instabilities()
-            self.ui.write(_("instability: %s\n") % ', '.join(instabilities),
+            self.ui.write(columns['instability'] % ', '.join(instabilities),
                           label='log.instability')
 
         elif ctx.obsolete():
@@ -1672,31 +1662,22 @@
 
         if self.ui.debugflag:
             files = ctx.p1().status(ctx)[:3]
-            for key, value in zip([# i18n: column positioning for "hg log"
-                                   _("files:"),
-                                   # i18n: column positioning for "hg log"
-                                   _("files+:"),
-                                   # i18n: column positioning for "hg log"
-                                   _("files-:")], files):
+            for key, value in zip(['files', 'files+', 'files-'], files):
                 if value:
-                    self.ui.write("%-12s %s\n" % (key, " ".join(value)),
+                    self.ui.write(columns[key] % " ".join(value),
                                   label='ui.debug log.files')
         elif ctx.files() and self.ui.verbose:
-            # i18n: column positioning for "hg log"
-            self.ui.write(_("files:       %s\n") % " ".join(ctx.files()),
+            self.ui.write(columns['files'] % " ".join(ctx.files()),
                           label='ui.note log.files')
         if copies and self.ui.verbose:
             copies = ['%s (%s)' % c for c in copies]
-            # i18n: column positioning for "hg log"
-            self.ui.write(_("copies:      %s\n") % ' '.join(copies),
+            self.ui.write(columns['copies'] % ' '.join(copies),
                           label='ui.note log.copies')
 
         extra = ctx.extra()
         if extra and self.ui.debugflag:
             for key, value in sorted(extra.items()):
-                # i18n: column positioning for "hg log"
-                self.ui.write(_("extra:       %s=%s\n")
-                              % (key, util.escapestr(value)),
+                self.ui.write(columns['extra'] % (key, util.escapestr(value)),
                               label='ui.debug log.extra')
 
         description = ctx.description().strip()
@@ -1708,9 +1689,7 @@
                               label='ui.note log.description')
                 self.ui.write("\n\n")
             else:
-                # i18n: column positioning for "hg log"
-                self.ui.write(_("summary:     %s\n") %
-                              description.splitlines()[0],
+                self.ui.write(columns['summary'] % description.splitlines()[0],
                               label='log.summary')
         self.ui.write("\n")
 
@@ -1721,8 +1700,7 @@
 
         if obsfate:
             for obsfateline in obsfate:
-                # i18n: column positioning for "hg log"
-                self.ui.write(_("obsolete:    %s\n") % obsfateline,
+                self.ui.write(self._columns['obsolete'] % obsfateline,
                               label='log.obsfate')
 
     def _exthook(self, ctx):
@@ -1850,7 +1828,13 @@
         self.ui.write("\n }")
 
 class changeset_templater(changeset_printer):
-    '''format changeset information.'''
+    '''format changeset information.
+
+    Note: there are a variety of convenience functions to build a
+    changeset_templater for common cases. See functions such as:
+    makelogtemplater, show_changeset, buildcommittemplate, or other
+    functions that use changesest_templater.
+    '''
 
     # Arguments before "buffered" used to be positional. Consider not
     # adding/removing arguments before "buffered" to not break callers.
@@ -1972,7 +1956,8 @@
     return formatter.lookuptemplate(ui, 'changeset', tmpl)
 
 def makelogtemplater(ui, repo, tmpl, buffered=False):
-    """Create a changeset_templater from a literal template 'tmpl'"""
+    """Create a changeset_templater from a literal template 'tmpl'
+    byte-string."""
     spec = logtemplatespec(tmpl, None)
     return changeset_templater(ui, repo, spec, buffered=buffered)
 
@@ -2733,7 +2718,7 @@
         firstedge = next(edges)
         width = firstedge[2]
         displayer.show(ctx, copies=copies, matchfn=revmatchfn,
-                       _graphwidth=width, **props)
+                       _graphwidth=width, **pycompat.strkwargs(props))
         lines = displayer.hunk.pop(rev).split('\n')
         if not lines[-1]:
             del lines[-1]
@@ -2975,8 +2960,9 @@
         for f in remaining:
             count += 1
             ui.progress(_('skipping'), count, total=total, unit=_('files'))
-            warnings.append(_('not removing %s: file still exists\n')
-                    % m.rel(f))
+            if ui.verbose or (f in files):
+                warnings.append(_('not removing %s: file still exists\n')
+                                % m.rel(f))
             ret = 1
         ui.progress(_('skipping'), None)
     else:
@@ -3023,12 +3009,18 @@
 
 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts):
     err = 1
+    opts = pycompat.byteskwargs(opts)
 
     def write(path):
         filename = None
         if fntemplate:
             filename = makefilename(repo, fntemplate, ctx.node(),
                                     pathname=os.path.join(prefix, path))
+            # attempt to create the directory if it does not already exist
+            try:
+                os.makedirs(os.path.dirname(filename))
+            except OSError:
+                pass
         with formatter.maybereopen(basefm, filename, opts) as fm:
             data = ctx[path].data()
             if opts.get('decode'):
@@ -3060,7 +3052,8 @@
             submatch = matchmod.subdirmatcher(subpath, matcher)
 
             if not sub.cat(submatch, basefm, fntemplate,
-                           os.path.join(prefix, sub._path), **opts):
+                           os.path.join(prefix, sub._path),
+                           **pycompat.strkwargs(opts)):
                 err = 0
         except error.RepoLookupError:
             ui.status(_("skipping missing subrepository: %s\n")
@@ -3124,6 +3117,8 @@
         # base     o - first parent of the changeset to amend
         wctx = repo[None]
 
+        # Copy to avoid mutating input
+        extra = extra.copy()
         # Update extra dict from amended commit (e.g. to preserve graft
         # source)
         extra.update(old.extra())
@@ -3200,7 +3195,7 @@
 
                     fctx = wctx[path]
                     flags = fctx.flags()
-                    mctx = context.memfilectx(repo,
+                    mctx = context.memfilectx(repo, ctx_,
                                               fctx.path(), fctx.data(),
                                               islink='l' in flags,
                                               isexec='x' in flags,
@@ -3445,6 +3440,7 @@
     return repo.status(match=scmutil.match(repo[None], pats, opts))
 
 def revert(ui, repo, ctx, parents, *pats, **opts):
+    opts = pycompat.byteskwargs(opts)
     parent, p2 = parents
     node = ctx.node()
 
@@ -3706,7 +3702,7 @@
                                 else:
                                     util.rename(target, bakname)
                     if ui.verbose or not exact:
-                        if not isinstance(msg, basestring):
+                        if not isinstance(msg, bytes):
                             msg = msg(abs)
                         ui.status(msg % rel)
                 elif exact:
@@ -3722,7 +3718,8 @@
             # Revert the subrepos on the revert list
             for sub in targetsubs:
                 try:
-                    wctx.sub(sub).revert(ctx.substate[sub], *pats, **opts)
+                    wctx.sub(sub).revert(ctx.substate[sub], *pats,
+                                         **pycompat.strkwargs(opts))
                 except KeyError:
                     raise error.Abort("subrepository '%s' does not exist in %s!"
                                       % (sub, short(ctx.node())))
@@ -3802,9 +3799,8 @@
         operation = 'discard'
         reversehunks = True
         if node != parent:
-            operation = 'revert'
-            reversehunks = repo.ui.configbool('experimental',
-                'revertalternateinteractivemode')
+            operation = 'apply'
+            reversehunks = False
         if reversehunks:
             diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
         else:
@@ -3869,6 +3865,7 @@
             repo.dirstate.copy(copied[f], f)
 
 class command(registrar.command):
+    """deprecated: used registrar.command instead"""
     def _doregister(self, func, name, *args, **kwargs):
         func._deprecatedregistrar = True  # flag for deprecwarn in extensions.py
         return super(command, self)._doregister(func, name, *args, **kwargs)
--- a/mercurial/color.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/color.py	Tue Dec 19 16:27:24 2017 -0500
@@ -87,12 +87,14 @@
     'branches.inactive': 'none',
     'diff.changed': 'white',
     'diff.deleted': 'red',
+    'diff.deleted.highlight': 'red bold underline',
     'diff.diffline': 'bold',
     'diff.extended': 'cyan bold',
     'diff.file_a': 'red bold',
     'diff.file_b': 'green bold',
     'diff.hunk': 'magenta',
     'diff.inserted': 'green',
+    'diff.inserted.highlight': 'green bold underline',
     'diff.tab': '',
     'diff.trailingwhitespace': 'bold red_background',
     'changeset.public': '',
@@ -100,6 +102,15 @@
     'changeset.secret': '',
     'diffstat.deleted': 'red',
     'diffstat.inserted': 'green',
+    'formatvariant.name.mismatchconfig': 'red',
+    'formatvariant.name.mismatchdefault': 'yellow',
+    'formatvariant.name.uptodate': 'green',
+    'formatvariant.repo.mismatchconfig': 'red',
+    'formatvariant.repo.mismatchdefault': 'yellow',
+    'formatvariant.repo.uptodate': 'green',
+    'formatvariant.config.special': 'yellow',
+    'formatvariant.config.default': 'green',
+    'formatvariant.default': '',
     'histedit.remaining': 'red bold',
     'ui.prompt': 'yellow',
     'log.changeset': 'yellow',
@@ -181,7 +192,7 @@
         configstyles(ui)
 
 def _modesetup(ui):
-    if ui.plain():
+    if ui.plain('color'):
         return None
     config = ui.config('ui', 'color')
     if config == 'debug':
@@ -473,7 +484,7 @@
             _win32print(ui, text, writefunc, **opts)
 
     def _win32print(ui, text, writefunc, **opts):
-        label = opts.get('label', '')
+        label = opts.get(r'label', '')
         attr = origattr
 
         def mapcolor(val, attr):
--- a/mercurial/commands.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/commands.py	Tue Dec 19 16:27:24 2017 -0500
@@ -49,6 +49,7 @@
     rcutil,
     registrar,
     revsetlang,
+    rewriteutil,
     scmutil,
     server,
     sshserver,
@@ -65,6 +66,7 @@
 table.update(debugcommandsmod.command._table)
 
 command = registrar.command(table)
+readonly = registrar.command.readonly
 
 # common command options
 
@@ -102,10 +104,6 @@
      _("when to paginate (boolean, always, auto, or never)"), _('TYPE')),
 ]
 
-# options which must be pre-parsed before loading configs and extensions
-# TODO: perhaps --debugger should be included
-earlyoptflags = ("--cwd", "-R", "--repository", "--repo", "--config")
-
 dryrunopts = cmdutil.dryrunopts
 remoteopts = cmdutil.remoteopts
 walkopts = cmdutil.walkopts
@@ -857,7 +855,7 @@
                 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
                 hbisect.checkstate(state)
                 # bisect
-                nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
+                nodes, changesets, bgood = hbisect.bisect(repo, state)
                 # update to next check
                 node = nodes[0]
                 mayupdate(repo, node, show_stats=False)
@@ -870,7 +868,7 @@
     hbisect.checkstate(state)
 
     # actually bisect
-    nodes, changesets, good = hbisect.bisect(repo.changelog, state)
+    nodes, changesets, good = hbisect.bisect(repo, state)
     if extend:
         if not changesets:
             extendnode = hbisect.extendrange(repo, state, nodes, good)
@@ -1064,7 +1062,7 @@
       _('show only branches that have unmerged heads (DEPRECATED)')),
      ('c', 'closed', False, _('show normal and closed branches')),
     ] + formatteropts,
-    _('[-c]'))
+    _('[-c]'), cmdtype=readonly)
 def branches(ui, repo, active=False, closed=False, **opts):
     """list repository named branches
 
@@ -1258,7 +1256,7 @@
     ('', 'decode', None, _('apply any matching decode filter')),
     ] + walkopts + formatteropts,
     _('[OPTION]... FILE...'),
-    inferrepo=True)
+    inferrepo=True, cmdtype=readonly)
 def cat(ui, repo, file1, *pats, **opts):
     """output the current or given revision of files
 
@@ -1280,6 +1278,7 @@
 
     Returns 0 on success.
     """
+    opts = pycompat.byteskwargs(opts)
     ctx = scmutil.revsingle(repo, opts.get('rev'))
     m = scmutil.match(ctx, (file1,) + pats, opts)
     fntemplate = opts.pop('output', '')
@@ -1292,7 +1291,8 @@
         ui.pager('cat')
         fm = ui.formatter('cat', opts)
     with fm:
-        return cmdutil.cat(ui, repo, ctx, m, fm, fntemplate, '', **opts)
+        return cmdutil.cat(ui, repo, ctx, m, fm, fntemplate, '',
+                           **pycompat.strkwargs(opts))
 
 @command('^clone',
     [('U', 'noupdate', None, _('the clone will include an empty working '
@@ -1544,13 +1544,7 @@
             raise error.Abort(_('cannot amend with ui.commitsubrepos enabled'))
 
         old = repo['.']
-        if not old.mutable():
-            raise error.Abort(_('cannot amend public changesets'))
-        if len(repo[None].parents()) > 1:
-            raise error.Abort(_('cannot amend while merging'))
-        allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
-        if not allowunstable and old.children():
-            raise error.Abort(_('cannot amend changeset with children'))
+        rewriteutil.precheck(repo, [old.rev()], 'amend')
 
         # Currently histedit gets confused if an amend happens while histedit
         # is in progress. Since we have a checkunfinished command, we are
@@ -1604,7 +1598,7 @@
      ('l', 'local', None, _('edit repository config')),
      ('g', 'global', None, _('edit global config'))] + formatteropts,
     _('[-u] [NAME]...'),
-    optionalrepo=True)
+    optionalrepo=True, cmdtype=readonly)
 def config(ui, repo, *values, **opts):
     """show combined config settings from all hgrc files
 
@@ -1751,7 +1745,7 @@
 def debugcomplete(ui, cmd='', **opts):
     """returns the completion list associated with the given command"""
 
-    if opts.get('options'):
+    if opts.get(r'options'):
         options = []
         otables = [globalopts]
         if cmd:
@@ -1777,7 +1771,7 @@
     ('c', 'change', '', _('change made by revision'), _('REV'))
     ] + diffopts + diffopts2 + walkopts + subrepoopts,
     _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'),
-    inferrepo=True)
+    inferrepo=True, cmdtype=readonly)
 def diff(ui, repo, *pats, **opts):
     """diff repository (or selected files)
 
@@ -1867,7 +1861,7 @@
     ('', 'switch-parent', None, _('diff against the second parent')),
     ('r', 'rev', [], _('revisions to export'), _('REV')),
     ] + diffopts,
-    _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'))
+    _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'), cmdtype=readonly)
 def export(ui, repo, *changesets, **opts):
     """dump the header and diffs for one or more changesets
 
@@ -1948,7 +1942,7 @@
     [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
      ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
     ] + walkopts + formatteropts + subrepoopts,
-    _('[OPTION]... [FILE]...'))
+    _('[OPTION]... [FILE]...'), cmdtype=readonly)
 def files(ui, repo, *pats, **opts):
     """list tracked files
 
@@ -2321,7 +2315,7 @@
     ('d', 'date', None, _('list the date (short with -q)')),
     ] + formatteropts + walkopts,
     _('[OPTION]... PATTERN [FILE]...'),
-    inferrepo=True)
+    inferrepo=True, cmdtype=readonly)
 def grep(ui, repo, pattern, *pats, **opts):
     """search revision history for a pattern in specified files
 
@@ -2564,7 +2558,7 @@
     ('a', 'active', False, _('show active branchheads only (DEPRECATED)')),
     ('c', 'closed', False, _('show normal and closed branch heads')),
     ] + templateopts,
-    _('[-ct] [-r STARTREV] [REV]...'))
+    _('[-ct] [-r STARTREV] [REV]...'), cmdtype=readonly)
 def heads(ui, repo, *branchrevs, **opts):
     """show branch heads
 
@@ -2637,7 +2631,7 @@
      ('s', 'system', [], _('show help for specific platform(s)')),
      ],
     _('[-ecks] [TOPIC]'),
-    norepo=True)
+    norepo=True, cmdtype=readonly)
 def help_(ui, name=None, **opts):
     """show help for a given topic or a help overview
 
@@ -2679,7 +2673,7 @@
     ('B', 'bookmarks', None, _('show bookmarks')),
     ] + remoteopts + formatteropts,
     _('[-nibtB] [-r REV] [SOURCE]'),
-    optionalrepo=True)
+    optionalrepo=True, cmdtype=readonly)
 def identify(ui, repo, source=None, rev=None,
              num=None, id=None, branch=None, tags=None, bookmarks=None, **opts):
     """identify the working directory or specified revision
@@ -3253,7 +3247,7 @@
      _('do not display revision or any of its ancestors'), _('REV')),
     ] + logopts + walkopts,
     _('[OPTION]... [FILE]'),
-    inferrepo=True)
+    inferrepo=True, cmdtype=readonly)
 def log(ui, repo, *pats, **opts):
     """show revision history of entire repository or files
 
@@ -3461,7 +3455,7 @@
     [('r', 'rev', '', _('revision to display'), _('REV')),
      ('', 'all', False, _("list files from all revisions"))]
          + formatteropts,
-    _('[-r REV]'))
+    _('[-r REV]'), cmdtype=readonly)
 def manifest(ui, repo, node=None, rev=None, **opts):
     """output the current or given revision of the project manifest
 
@@ -3725,7 +3719,8 @@
             displayer.show(repo[n])
     displayer.close()
 
-@command('paths', formatteropts, _('[NAME]'), optionalrepo=True)
+@command('paths', formatteropts, _('[NAME]'), optionalrepo=True,
+    cmdtype=readonly)
 def paths(ui, repo, search=None, **opts):
     """show aliases for remote repositories
 
@@ -3922,7 +3917,7 @@
 
 @command('^pull',
     [('u', 'update', None,
-     _('update to new branch head if changesets were pulled')),
+     _('update to new branch head if new descendants were pulled')),
     ('f', 'force', None, _('run even when remote repository is unrelated')),
     ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
     ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')),
@@ -3977,12 +3972,13 @@
             # not ending up with the name of the bookmark because of a race
             # condition on the server. (See issue 4689 for details)
             remotebookmarks = other.listkeys('bookmarks')
+            remotebookmarks = bookmarks.unhexlifybookmarks(remotebookmarks)
             pullopargs['remotebookmarks'] = remotebookmarks
             for b in opts['bookmark']:
                 b = repo._bookmarks.expandname(b)
                 if b not in remotebookmarks:
                     raise error.Abort(_('remote bookmark %s not found!') % b)
-                revs.append(remotebookmarks[b])
+                revs.append(hex(remotebookmarks[b]))
 
         if revs:
             try:
@@ -4521,8 +4517,7 @@
     ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
     ('r', 'rev', '', _('revert to the specified revision'), _('REV')),
     ('C', 'no-backup', None, _('do not save backup copies of files')),
-    ('i', 'interactive', None,
-            _('interactively select the changes (EXPERIMENTAL)')),
+    ('i', 'interactive', None, _('interactively select the changes')),
     ] + walkopts + dryrunopts,
     _('[OPTION]... [-r REV] [NAME]...'))
 def revert(ui, repo, *pats, **opts):
@@ -4562,6 +4557,7 @@
     Returns 0 on success.
     """
 
+    opts = pycompat.byteskwargs(opts)
     if opts.get("date"):
         if opts.get("rev"):
             raise error.Abort(_("you can't specify a revision and a date"))
@@ -4597,7 +4593,8 @@
             hint = _("use --all to revert all files")
         raise error.Abort(msg, hint=hint)
 
-    return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts)
+    return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats,
+                          **pycompat.strkwargs(opts))
 
 @command('rollback', dryrunopts +
          [('f', 'force', False, _('ignore safety measures'))])
@@ -4652,7 +4649,7 @@
     return repo.rollback(dryrun=opts.get(r'dry_run'),
                          force=opts.get(r'force'))
 
-@command('root', [])
+@command('root', [], cmdtype=readonly)
 def root(ui, repo):
     """print the root (top) of the current working directory
 
@@ -4700,7 +4697,7 @@
 
     Please note that the server does not implement access control.
     This means that, by default, anybody can read from the server and
-    nobody can write to it by default. Set the ``web.allow_push``
+    nobody can write to it by default. Set the ``web.allow-push``
     option to ``*`` to allow everybody to push to the server. You
     should use a real web server if you need to authenticate users.
 
@@ -4746,7 +4743,7 @@
     ('', 'change', '', _('list the changed files of a revision'), _('REV')),
     ] + walkopts + subrepoopts + formatteropts,
     _('[OPTION]... [FILE]...'),
-    inferrepo=True)
+    inferrepo=True, cmdtype=readonly)
 def status(ui, repo, *pats, **opts):
     """show changed files in the working directory
 
@@ -4911,7 +4908,8 @@
     fm.end()
 
 @command('^summary|sum',
-    [('', 'remote', None, _('check for push and pull'))], '[--remote]')
+    [('', 'remote', None, _('check for push and pull'))],
+    '[--remote]', cmdtype=readonly)
 def summary(ui, repo, **opts):
     """summarize working directory state
 
@@ -5312,7 +5310,7 @@
     finally:
         release(lock, wlock)
 
-@command('tags', formatteropts, '')
+@command('tags', formatteropts, '', cmdtype=readonly)
 def tags(ui, repo, **opts):
     """list repository tags
 
@@ -5535,7 +5533,7 @@
     """
     return hg.verify(repo)
 
-@command('version', [] + formatteropts, norepo=True)
+@command('version', [] + formatteropts, norepo=True, cmdtype=readonly)
 def version_(ui, **opts):
     """output version and copyright information"""
     opts = pycompat.byteskwargs(opts)
--- a/mercurial/commandserver.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/commandserver.py	Tue Dec 19 16:27:24 2017 -0500
@@ -17,11 +17,11 @@
 import traceback
 
 from .i18n import _
+from .thirdparty import selectors2
 from . import (
     encoding,
     error,
     pycompat,
-    selectors2,
     util,
 )
 
--- a/mercurial/configitems.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/configitems.py	Tue Dec 19 16:27:24 2017 -0500
@@ -469,7 +469,7 @@
     default=None,
 )
 coreconfigitem('experimental', 'evolution.effect-flags',
-    default=False,
+    default=True,
     alias=[('experimental', 'effect-flags')]
 )
 coreconfigitem('experimental', 'evolution.exchange',
@@ -481,6 +481,9 @@
 coreconfigitem('experimental', 'evolution.track-operation',
     default=True,
 )
+coreconfigitem('experimental', 'worddiff',
+    default=False,
+)
 coreconfigitem('experimental', 'maxdeltachainspan',
     default=-1,
 )
@@ -529,15 +532,15 @@
 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
     default=False,
 )
-coreconfigitem('experimental', 'rebase.multidest',
+coreconfigitem('experimental', 'remotenames',
     default=False,
 )
-coreconfigitem('experimental', 'revertalternateinteractivemode',
-    default=True,
-)
 coreconfigitem('experimental', 'revlogv2',
     default=None,
 )
+coreconfigitem('experimental', 'single-head-per-branch',
+    default=False,
+)
 coreconfigitem('experimental', 'spacemovesdown',
     default=False,
 )
@@ -838,6 +841,9 @@
 coreconfigitem('push', 'pushvars.server',
     default=False,
 )
+coreconfigitem('server', 'bookmarks-pushkey-compat',
+    default=True,
+)
 coreconfigitem('server', 'bundle1',
     default=True,
 )
@@ -1060,6 +1066,9 @@
 coreconfigitem('ui', 'ssh',
     default='ssh',
 )
+coreconfigitem('ui', 'ssherrorhint',
+    default=None,
+)
 coreconfigitem('ui', 'statuscopies',
     default=False,
 )
@@ -1078,6 +1087,9 @@
 coreconfigitem('ui', 'timeout',
     default='600',
 )
+coreconfigitem('ui', 'timeout.warn',
+    default=0,
+)
 coreconfigitem('ui', 'traceback',
     default=False,
 )
@@ -1102,10 +1114,12 @@
 coreconfigitem('web', 'allowgz',
     default=False,
 )
-coreconfigitem('web', 'allowpull',
+coreconfigitem('web', 'allow-pull',
+    alias=[('web', 'allowpull')],
     default=True,
 )
-coreconfigitem('web', 'allow_push',
+coreconfigitem('web', 'allow-push',
+    alias=[('web', 'allow_push')],
     default=list,
 )
 coreconfigitem('web', 'allowzip',
@@ -1239,6 +1253,9 @@
 coreconfigitem('worker', 'backgroundclosethreadcount',
     default=4,
 )
+coreconfigitem('worker', 'enabled',
+    default=True,
+)
 coreconfigitem('worker', 'numcpus',
     default=None,
 )
@@ -1255,3 +1272,6 @@
 coreconfigitem('rebase', 'singletransaction',
     default=False,
 )
+coreconfigitem('rebase', 'experimental.inmemory',
+    default=False,
+)
--- a/mercurial/context.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/context.py	Tue Dec 19 16:27:24 2017 -0500
@@ -354,7 +354,7 @@
             ctx2 = self.p1()
         if ctx2 is not None:
             ctx2 = self._repo[ctx2]
-        diffopts = patch.diffopts(self._repo.ui, opts)
+        diffopts = patch.diffopts(self._repo.ui, pycompat.byteskwargs(opts))
         return patch.diff(self._repo, ctx2, self, match=match, opts=diffopts)
 
     def dirs(self):
@@ -615,10 +615,13 @@
     def closesbranch(self):
         return 'close' in self._changeset.extra
     def extra(self):
+        """Return a dict of extra information."""
         return self._changeset.extra
     def tags(self):
+        """Return a list of byte tag names"""
         return self._repo.nodetags(self._node)
     def bookmarks(self):
+        """Return a list of byte bookmark names."""
         return self._repo.nodebookmarks(self._node)
     def phase(self):
         return self._repo._phasecache.phase(self._repo, self._rev)
@@ -629,7 +632,11 @@
         return False
 
     def children(self):
-        """return contexts for each child changeset"""
+        """return list of changectx contexts for each child changeset.
+
+        This returns only the immediate child changesets. Use descendants() to
+        recursively walk children.
+        """
         c = self._repo.changelog.children(self._node)
         return [changectx(self._repo, x) for x in c]
 
@@ -638,6 +645,10 @@
             yield changectx(self._repo, a)
 
     def descendants(self):
+        """Recursively yield all children of the changeset.
+
+        For just the immediate children, use children()
+        """
         for d in self._repo.changelog.descendants([self._rev]):
             yield changectx(self._repo, d)
 
@@ -819,6 +830,10 @@
         return self._changectx.phase()
     def phasestr(self):
         return self._changectx.phasestr()
+    def obsolete(self):
+        return self._changectx.obsolete()
+    def instabilities(self):
+        return self._changectx.instabilities()
     def manifest(self):
         return self._changectx.manifest()
     def changectx(self):
@@ -931,6 +946,14 @@
             return self.linkrev()
         return self._adjustlinkrev(self.rev(), inclusive=True)
 
+    def introfilectx(self):
+        """Return filectx having identical contents, but pointing to the
+        changeset revision where this filectx was introduced"""
+        introrev = self.introrev()
+        if self.rev() == introrev:
+            return self
+        return self.filectx(self.filenode(), changeid=introrev)
+
     def _parentfilectx(self, path, fileid, filelog):
         """create parent filectx keeping ancestry info for _adjustlinkrev()"""
         fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog)
@@ -1021,19 +1044,16 @@
             return pl
 
         # use linkrev to find the first changeset where self appeared
-        base = self
-        introrev = self.introrev()
-        if self.rev() != introrev:
-            base = self.filectx(self.filenode(), changeid=introrev)
+        base = self.introfilectx()
         if getattr(base, '_ancestrycontext', None) is None:
             cl = self._repo.changelog
-            if introrev is None:
+            if base.rev() is None:
                 # wctx is not inclusive, but works because _ancestrycontext
                 # is used to test filelog revisions
                 ac = cl.ancestors([p.rev() for p in base.parents()],
                                   inclusive=True)
             else:
-                ac = cl.ancestors([introrev], inclusive=True)
+                ac = cl.ancestors([base.rev()], inclusive=True)
             base._ancestrycontext = ac
 
         # This algorithm would prefer to be recursive, but Python is a
@@ -1633,9 +1653,6 @@
                               listsubrepos=listsubrepos, badfn=badfn,
                               icasefs=icasefs)
 
-    def flushall(self):
-        pass # For overlayworkingfilectx compatibility.
-
     def _filtersuspectsymlink(self, files):
         if not files or self._repo.dirstate._checklink:
             return files
@@ -1959,25 +1976,33 @@
     def setflags(self, l, x):
         self._repo.wvfs.setflags(self._path, l, x)
 
-class overlayworkingctx(workingctx):
-    """Wraps another mutable context with a write-back cache that can be flushed
-    at a later time.
+class overlayworkingctx(committablectx):
+    """Wraps another mutable context with a write-back cache that can be
+    converted into a commit context.
 
     self._cache[path] maps to a dict with keys: {
         'exists': bool?
         'date': date?
         'data': str?
         'flags': str?
+        'copied': str? (path or None)
     }
     If `exists` is True, `flags` must be non-None and 'date' is non-None. If it
     is `False`, the file was deleted.
     """
 
-    def __init__(self, repo, wrappedctx):
+    def __init__(self, repo):
         super(overlayworkingctx, self).__init__(repo)
         self._repo = repo
+        self.clean()
+
+    def setbase(self, wrappedctx):
         self._wrappedctx = wrappedctx
-        self._clean()
+        self._parents = [wrappedctx]
+        # Drop old manifest cache as it is now out of date.
+        # This is necessary when, e.g., rebasing several nodes with one
+        # ``overlayworkingctx`` (e.g. with --collapse).
+        util.clearcachedproperty(self, '_manifest')
 
     def data(self, path):
         if self.isdirty(path):
@@ -1989,10 +2014,47 @@
                     return self._wrappedctx[path].data()
             else:
                 raise error.ProgrammingError("No such file or directory: %s" %
-                                             self._path)
+                                             path)
         else:
             return self._wrappedctx[path].data()
 
+    @propertycache
+    def _manifest(self):
+        parents = self.parents()
+        man = parents[0].manifest().copy()
+
+        flag = self._flagfunc
+        for path in self.added():
+            man[path] = addednodeid
+            man.setflag(path, flag(path))
+        for path in self.modified():
+            man[path] = modifiednodeid
+            man.setflag(path, flag(path))
+        for path in self.removed():
+            del man[path]
+        return man
+
+    @propertycache
+    def _flagfunc(self):
+        def f(path):
+            return self._cache[path]['flags']
+        return f
+
+    def files(self):
+        return sorted(self.added() + self.modified() + self.removed())
+
+    def modified(self):
+        return [f for f in self._cache.keys() if self._cache[f]['exists'] and
+                self._existsinparent(f)]
+
+    def added(self):
+        return [f for f in self._cache.keys() if self._cache[f]['exists'] and
+                not self._existsinparent(f)]
+
+    def removed(self):
+        return [f for f in self._cache.keys() if
+                not self._cache[f]['exists'] and self._existsinparent(f)]
+
     def isinmemory(self):
         return True
 
@@ -2002,6 +2064,18 @@
         else:
             return self._wrappedctx[path].date()
 
+    def markcopied(self, path, origin):
+        if self.isdirty(path):
+            self._cache[path]['copied'] = origin
+        else:
+            raise error.ProgrammingError('markcopied() called on clean context')
+
+    def copydata(self, path):
+        if self.isdirty(path):
+            return self._cache[path]['copied']
+        else:
+            raise error.ProgrammingError('copydata() called on clean context')
+
     def flags(self, path):
         if self.isdirty(path):
             if self._cache[path]['exists']:
@@ -2012,9 +2086,60 @@
         else:
             return self._wrappedctx[path].flags()
 
+    def _existsinparent(self, path):
+        try:
+            # ``commitctx` raises a ``ManifestLookupError`` if a path does not
+            # exist, unlike ``workingctx``, which returns a ``workingfilectx``
+            # with an ``exists()`` function.
+            self._wrappedctx[path]
+            return True
+        except error.ManifestLookupError:
+            return False
+
+    def _auditconflicts(self, path):
+        """Replicates conflict checks done by wvfs.write().
+
+        Since we never write to the filesystem and never call `applyupdates` in
+        IMM, we'll never check that a path is actually writable -- e.g., because
+        it adds `a/foo`, but `a` is actually a file in the other commit.
+        """
+        def fail(path, component):
+            # p1() is the base and we're receiving "writes" for p2()'s
+            # files.
+            if 'l' in self.p1()[component].flags():
+                raise error.Abort("error: %s conflicts with symlink %s "
+                                  "in %s." % (path, component,
+                                              self.p1().rev()))
+            else:
+                raise error.Abort("error: '%s' conflicts with file '%s' in "
+                                  "%s." % (path, component,
+                                           self.p1().rev()))
+
+        # Test that each new directory to be created to write this path from p2
+        # is not a file in p1.
+        components = path.split('/')
+        for i in xrange(len(components)):
+            component = "/".join(components[0:i])
+            if component in self.p1():
+                fail(path, component)
+
+        # Test the other direction -- that this path from p2 isn't a directory
+        # in p1 (test that p1 doesn't any paths matching `path/*`).
+        match = matchmod.match('/', '', [path + '/'], default=b'relpath')
+        matches = self.p1().manifest().matches(match)
+        if len(matches) > 0:
+            if len(matches) == 1 and matches.keys()[0] == path:
+                return
+            raise error.Abort("error: file '%s' cannot be written because "
+                              " '%s/' is a folder in %s (containing %d "
+                              "entries: %s)"
+                              % (path, path, self.p1(), len(matches),
+                                 ', '.join(matches.keys())))
+
     def write(self, path, data, flags=''):
         if data is None:
             raise error.ProgrammingError("data must be non-None")
+        self._auditconflicts(path)
         self._markdirty(path, exists=True, data=data, date=util.makedate(),
                         flags=flags)
 
@@ -2037,13 +2162,15 @@
                 return self.exists(self._cache[path]['data'].strip())
             else:
                 return self._cache[path]['exists']
-        return self._wrappedctx[path].exists()
+
+        return self._existsinparent(path)
 
     def lexists(self, path):
         """lexists returns True if the path exists"""
         if self.isdirty(path):
             return self._cache[path]['exists']
-        return self._wrappedctx[path].lexists()
+
+        return self._existsinparent(path)
 
     def size(self, path):
         if self.isdirty(path):
@@ -2054,48 +2181,90 @@
                                              self._path)
         return self._wrappedctx[path].size()
 
-    def flushall(self):
-        for path in self._writeorder:
-            entry = self._cache[path]
-            if entry['exists']:
-                self._wrappedctx[path].clearunknown()
-                if entry['data'] is not None:
-                    if entry['flags'] is None:
-                        raise error.ProgrammingError('data set but not flags')
-                    self._wrappedctx[path].write(
-                        entry['data'],
-                        entry['flags'])
-                else:
-                    self._wrappedctx[path].setflags(
-                        'l' in entry['flags'],
-                        'x' in entry['flags'])
+    def tomemctx(self, text, branch=None, extra=None, date=None, parents=None,
+                 user=None, editor=None):
+        """Converts this ``overlayworkingctx`` into a ``memctx`` ready to be
+        committed.
+
+        ``text`` is the commit message.
+        ``parents`` (optional) are rev numbers.
+        """
+        # Default parents to the wrapped contexts' if not passed.
+        if parents is None:
+            parents = self._wrappedctx.parents()
+            if len(parents) == 1:
+                parents = (parents[0], None)
+
+        # ``parents`` is passed as rev numbers; convert to ``commitctxs``.
+        if parents[1] is None:
+            parents = (self._repo[parents[0]], None)
+        else:
+            parents = (self._repo[parents[0]], self._repo[parents[1]])
+
+        files = self._cache.keys()
+        def getfile(repo, memctx, path):
+            if self._cache[path]['exists']:
+                return memfilectx(repo, memctx, path,
+                                  self._cache[path]['data'],
+                                  'l' in self._cache[path]['flags'],
+                                  'x' in self._cache[path]['flags'],
+                                  self._cache[path]['copied'])
             else:
-                self._wrappedctx[path].remove(path)
-        self._clean()
+                # Returning None, but including the path in `files`, is
+                # necessary for memctx to register a deletion.
+                return None
+        return memctx(self._repo, parents, text, files, getfile, date=date,
+                      extra=extra, user=user, branch=branch, editor=editor)
 
     def isdirty(self, path):
         return path in self._cache
 
-    def _clean(self):
+    def isempty(self):
+        # We need to discard any keys that are actually clean before the empty
+        # commit check.
+        self._compact()
+        return len(self._cache) == 0
+
+    def clean(self):
         self._cache = {}
-        self._writeorder = []
+
+    def _compact(self):
+        """Removes keys from the cache that are actually clean, by comparing
+        them with the underlying context.
+
+        This can occur during the merge process, e.g. by passing --tool :local
+        to resolve a conflict.
+        """
+        keys = []
+        for path in self._cache.keys():
+            cache = self._cache[path]
+            try:
+                underlying = self._wrappedctx[path]
+                if (underlying.data() == cache['data'] and
+                            underlying.flags() == cache['flags']):
+                    keys.append(path)
+            except error.ManifestLookupError:
+                # Path not in the underlying manifest (created).
+                continue
+
+        for path in keys:
+            del self._cache[path]
+        return keys
 
     def _markdirty(self, path, exists, data=None, date=None, flags=''):
-        if path not in self._cache:
-            self._writeorder.append(path)
-
         self._cache[path] = {
             'exists': exists,
             'data': data,
             'date': date,
             'flags': flags,
+            'copied': None,
         }
 
     def filectx(self, path, filelog=None):
         return overlayworkingfilectx(self._repo, path, parent=self,
                                      filelog=filelog)
 
-class overlayworkingfilectx(workingfilectx):
+class overlayworkingfilectx(committablefilectx):
     """Wrap a ``workingfilectx`` but intercepts all writes into an in-memory
     cache, which can be flushed through later by calling ``flush()``."""
 
@@ -2109,7 +2278,7 @@
     def cmp(self, fctx):
         return self.data() != fctx.data()
 
-    def ctx(self):
+    def changectx(self):
         return self._parent
 
     def data(self):
@@ -2125,16 +2294,17 @@
         return self._parent.exists(self._path)
 
     def renamed(self):
-        # Copies are currently tracked in the dirstate as before. Straight copy
-        # from workingfilectx.
-        rp = self._repo.dirstate.copied(self._path)
-        if not rp:
+        path = self._parent.copydata(self._path)
+        if not path:
             return None
-        return rp, self._changectx._parents[0]._manifest.get(rp, nullid)
+        return path, self._changectx._parents[0]._manifest.get(path, nullid)
 
     def size(self):
         return self._parent.size(self._path)
 
+    def markcopied(self, origin):
+        self._parent.markcopied(self._path, origin)
+
     def audit(self):
         pass
 
@@ -2150,6 +2320,9 @@
     def remove(self, ignoremissing=False):
         return self._parent.remove(self._path)
 
+    def clearunknown(self):
+        pass
+
 class workingcommitctx(workingctx):
     """A workingcommitctx object makes access to data related to
     the revision being committed convenient.
@@ -2215,9 +2388,9 @@
         copied = fctx.renamed()
         if copied:
             copied = copied[0]
-        return memfilectx(repo, path, fctx.data(),
+        return memfilectx(repo, memctx, path, fctx.data(),
                           islink=fctx.islink(), isexec=fctx.isexec(),
-                          copied=copied, memctx=memctx)
+                          copied=copied)
 
     return getfilectx
 
@@ -2231,9 +2404,8 @@
         if data is None:
             return None
         islink, isexec = mode
-        return memfilectx(repo, path, data, islink=islink,
-                          isexec=isexec, copied=copied,
-                          memctx=memctx)
+        return memfilectx(repo, memctx, path, data, islink=islink,
+                          isexec=isexec, copied=copied)
 
     return getfilectx
 
@@ -2365,8 +2537,8 @@
 
     See memctx and committablefilectx for more details.
     """
-    def __init__(self, repo, path, data, islink=False,
-                 isexec=False, copied=None, memctx=None):
+    def __init__(self, repo, changectx, path, data, islink=False,
+                 isexec=False, copied=None):
         """
         path is the normalized file path relative to repository root.
         data is the file content as a string.
@@ -2374,7 +2546,7 @@
         isexec is True if the file is executable.
         copied is the source file path if current file was copied in the
         revision being committed, or None."""
-        super(memfilectx, self).__init__(repo, path, None, memctx)
+        super(memfilectx, self).__init__(repo, path, None, changectx)
         self._data = data
         self._flags = (islink and 'l' or '') + (isexec and 'x' or '')
         self._copied = None
--- a/mercurial/copies.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/copies.py	Tue Dec 19 16:27:24 2017 -0500
@@ -107,7 +107,7 @@
     return min(limit, a, b)
 
 def _chain(src, dst, a, b):
-    '''chain two sets of copies a->b'''
+    """chain two sets of copies a->b"""
     t = a.copy()
     for k, v in b.iteritems():
         if v in t:
@@ -130,8 +130,8 @@
     return t
 
 def _tracefile(fctx, am, limit=-1):
-    '''return file context that is the ancestor of fctx present in ancestor
-    manifest am, stopping after the first ancestor lower than limit'''
+    """return file context that is the ancestor of fctx present in ancestor
+    manifest am, stopping after the first ancestor lower than limit"""
 
     for f in fctx.ancestors():
         if am.get(f.path(), None) == f.filenode():
@@ -139,11 +139,11 @@
         if limit >= 0 and f.linkrev() < limit and f.rev() < limit:
             return None
 
-def _dirstatecopies(d):
+def _dirstatecopies(d, match=None):
     ds = d._repo.dirstate
     c = ds.copies().copy()
     for k in list(c):
-        if ds[k] not in 'anm':
+        if ds[k] not in 'anm' or (match and not match(k)):
             del c[k]
     return c
 
@@ -156,18 +156,8 @@
     mb = b.manifest()
     return mb.filesnotin(ma, match=match)
 
-def _forwardcopies(a, b, match=None):
-    '''find {dst@b: src@a} copy mapping where a is an ancestor of b'''
-
-    # check for working copy
-    w = None
-    if b.rev() is None:
-        w = b
-        b = w.p1()
-        if a == b:
-            # short-circuit to avoid issues with merge states
-            return _dirstatecopies(w)
-
+def _committedforwardcopies(a, b, match):
+    """Like _forwardcopies(), but b.rev() cannot be None (working copy)"""
     # files might have to be traced back to the fctx parent of the last
     # one-side-only changeset, but not further back than that
     limit = _findlimit(a._repo, a.rev(), b.rev())
@@ -199,12 +189,21 @@
         ofctx = _tracefile(fctx, am, limit)
         if ofctx:
             cm[f] = ofctx.path()
+    return cm
 
-    # combine copies from dirstate if necessary
-    if w is not None:
-        cm = _chain(a, w, cm, _dirstatecopies(w))
+def _forwardcopies(a, b, match=None):
+    """find {dst@b: src@a} copy mapping where a is an ancestor of b"""
 
-    return cm
+    # check for working copy
+    if b.rev() is None:
+        if a == b.p1():
+            # short-circuit to avoid issues with merge states
+            return _dirstatecopies(b, match)
+
+        cm = _committedforwardcopies(a, b.p1(), match)
+        # combine copies from dirstate if necessary
+        return _chain(a, b, cm, _dirstatecopies(b, match))
+    return _committedforwardcopies(a, b, match)
 
 def _backwardrenames(a, b):
     if a._repo.ui.config('experimental', 'copytrace') == 'off':
@@ -223,7 +222,7 @@
     return r
 
 def pathcopies(x, y, match=None):
-    '''find {dst@y: src@x} copy mapping for directed compare'''
+    """find {dst@y: src@x} copy mapping for directed compare"""
     if x == y or not x or not y:
         return {}
     a = y.ancestor(x)
@@ -861,13 +860,13 @@
                     return
 
 def duplicatecopies(repo, wctx, rev, fromrev, skiprev=None):
-    '''reproduce copies from fromrev to rev in the dirstate
+    """reproduce copies from fromrev to rev in the dirstate
 
     If skiprev is specified, it's a revision that should be used to
     filter copy records. Any copies that occur between fromrev and
     skiprev will not be duplicated, even if they appear in the set of
     copies between fromrev and rev.
-    '''
+    """
     exclude = {}
     if (skiprev is not None and
         repo.ui.config('experimental', 'copytrace') != 'off'):
--- a/mercurial/crecord.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/crecord.py	Tue Dec 19 16:27:24 2017 -0500
@@ -555,7 +555,7 @@
     return chunkselector.opts
 
 _headermessages = { # {operation: text}
-    'revert': _('Select hunks to revert'),
+    'apply': _('Select hunks to apply'),
     'discard': _('Select hunks to discard'),
     None: _('Select hunks to record'),
 }
--- a/mercurial/dagop.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/dagop.py	Tue Dec 19 16:27:24 2017 -0500
@@ -75,6 +75,46 @@
                 if prev != node.nullrev:
                     heapq.heappush(pendingheap, (heapsign * prev, pdepth))
 
+def filectxancestors(fctxs, followfirst=False):
+    """Like filectx.ancestors(), but can walk from multiple files/revisions,
+    and includes the given fctxs themselves
+
+    Yields (rev, {fctx, ...}) pairs in descending order.
+    """
+    visit = {}
+    visitheap = []
+    def addvisit(fctx):
+        rev = fctx.rev()
+        if rev not in visit:
+            visit[rev] = set()
+            heapq.heappush(visitheap, -rev)  # max heap
+        visit[rev].add(fctx)
+
+    if followfirst:
+        cut = 1
+    else:
+        cut = None
+
+    for c in fctxs:
+        addvisit(c)
+    while visit:
+        currev = -heapq.heappop(visitheap)
+        curfctxs = visit.pop(currev)
+        yield currev, curfctxs
+        for c in curfctxs:
+            for parent in c.parents()[:cut]:
+                addvisit(parent)
+    assert not visitheap
+
+def filerevancestors(fctxs, followfirst=False):
+    """Like filectx.ancestors(), but can walk from multiple files/revisions,
+    and includes the given fctxs themselves
+
+    Returns a smartset.
+    """
+    gen = (rev for rev, _cs in filectxancestors(fctxs, followfirst))
+    return generatorset(gen, iterasc=False)
+
 def _genrevancestors(repo, revs, followfirst, startdepth, stopdepth, cutfunc):
     if followfirst:
         cut = 1
@@ -251,9 +291,7 @@
     `fromline`-`toline` range.
     """
     diffopts = patch.diffopts(fctx._repo.ui)
-    introrev = fctx.introrev()
-    if fctx.rev() != introrev:
-        fctx = fctx.filectx(fctx.filenode(), changeid=introrev)
+    fctx = fctx.introfilectx()
     visit = {(fctx.linkrev(), fctx.filenode()): (fctx, (fromline, toline))}
     while visit:
         c, linerange2 = visit.pop(max(visit))
--- a/mercurial/dagutil.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/dagutil.py	Tue Dec 19 16:27:24 2017 -0500
@@ -154,8 +154,9 @@
 class revlogdag(revlogbaseddag):
     '''dag interface to a revlog'''
 
-    def __init__(self, revlog):
+    def __init__(self, revlog, localsubset=None):
         revlogbaseddag.__init__(self, revlog, set(revlog))
+        self._heads = localsubset
 
     def _getheads(self):
         return [r for r in self._revlog.headrevs() if r != nullrev]
--- a/mercurial/debugcommands.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/debugcommands.py	Tue Dec 19 16:27:24 2017 -0500
@@ -183,7 +183,7 @@
                 id, ps = data
 
                 files = []
-                fctxs = {}
+                filecontent = {}
 
                 p2 = None
                 if mergeable_file:
@@ -204,27 +204,30 @@
                     ml[id * linesperrev] += " r%i" % id
                     mergedtext = "\n".join(ml)
                     files.append(fn)
-                    fctxs[fn] = context.memfilectx(repo, fn, mergedtext)
+                    filecontent[fn] = mergedtext
 
                 if overwritten_file:
                     fn = "of"
                     files.append(fn)
-                    fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
+                    filecontent[fn] = "r%i\n" % id
 
                 if new_file:
                     fn = "nf%i" % id
                     files.append(fn)
-                    fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id)
+                    filecontent[fn] = "r%i\n" % id
                     if len(ps) > 1:
                         if not p2:
                             p2 = repo[ps[1]]
                         for fn in p2:
                             if fn.startswith("nf"):
                                 files.append(fn)
-                                fctxs[fn] = p2[fn]
+                                filecontent[fn] = p2[fn].data()
 
                 def fctxfn(repo, cx, path):
-                    return fctxs.get(path)
+                    if path in filecontent:
+                        return context.memfilectx(repo, cx, path,
+                                                  filecontent[path])
+                    return None
 
                 if len(ps) == 0 or ps[0] < 0:
                     pars = [None, None]
@@ -296,7 +299,7 @@
         msg %= indent_string, exc.version, len(data)
         ui.write(msg)
     else:
-        msg = "%sversion: %s (%d bytes)\n"
+        msg = "%sversion: %d (%d bytes)\n"
         msg %= indent_string, version, len(data)
         ui.write(msg)
         fm = ui.formatter('debugobsolete', opts)
@@ -360,6 +363,25 @@
             return _debugbundle2(ui, gen, all=all, **opts)
         _debugchangegroup(ui, gen, all=all, **opts)
 
+@command('debugcapabilities',
+        [], _('PATH'),
+        norepo=True)
+def debugcapabilities(ui, path, **opts):
+    """lists the capabilities of a remote peer"""
+    opts = pycompat.byteskwargs(opts)
+    peer = hg.peer(ui, opts, path)
+    caps = peer.capabilities()
+    ui.write(('Main capabilities:\n'))
+    for c in sorted(caps):
+        ui.write(('  %s\n') % c)
+    b2caps = bundle2.bundle2caps(peer)
+    if b2caps:
+        ui.write(('Bundle2 capabilities:\n'))
+        for key, values in sorted(b2caps.iteritems()):
+            ui.write(('  %s\n') % key)
+            for v in values:
+                ui.write(('    %s\n') % v)
+
 @command('debugcheckstate', [], '')
 def debugcheckstate(ui, repo):
     """validate the correctness of the current dirstate"""
@@ -569,11 +591,22 @@
                     the delta chain for this revision
     :``extraratio``: extradist divided by chainsize; another representation of
                     how much unrelated data is needed to load this delta chain
+
+    If the repository is configured to use the sparse read, additional keywords
+    are available:
+
+    :``readsize``:     total size of data read from the disk for a revision
+                       (sum of the sizes of all the blocks)
+    :``largestblock``: size of the largest block of data read from the disk
+    :``readdensity``:  density of useful bytes in the data read from the disk
+
+    The sparse read can be enabled with experimental.sparse-read = True
     """
     opts = pycompat.byteskwargs(opts)
     r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
     index = r.index
     generaldelta = r.version & revlog.FLAG_GENERALDELTA
+    withsparseread = getattr(r, '_withsparseread', False)
 
     def revinfo(rev):
         e = index[rev]
@@ -609,15 +642,20 @@
 
     fm.plain('    rev  chain# chainlen     prev   delta       '
              'size    rawsize  chainsize     ratio   lindist extradist '
-             'extraratio\n')
+             'extraratio')
+    if withsparseread:
+        fm.plain('   readsize largestblk rddensity')
+    fm.plain('\n')
 
     chainbases = {}
     for rev in r:
         comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
         chainbase = chain[0]
         chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
-        basestart = r.start(chainbase)
-        revstart = r.start(rev)
+        start = r.start
+        length = r.length
+        basestart = start(chainbase)
+        revstart = start(rev)
         lineardist = revstart + comp - basestart
         extradist = lineardist - chainsize
         try:
@@ -632,7 +670,7 @@
         fm.write('rev chainid chainlen prevrev deltatype compsize '
                  'uncompsize chainsize chainratio lindist extradist '
                  'extraratio',
-                 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f\n',
+                 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
                  rev, chainid, len(chain), prevrev, deltatype, comp,
                  uncomp, chainsize, chainratio, lineardist, extradist,
                  extraratio,
@@ -641,6 +679,26 @@
                  uncompsize=uncomp, chainsize=chainsize,
                  chainratio=chainratio, lindist=lineardist,
                  extradist=extradist, extraratio=extraratio)
+        if withsparseread:
+            readsize = 0
+            largestblock = 0
+            for revschunk in revlog._slicechunk(r, chain):
+                blkend = start(revschunk[-1]) + length(revschunk[-1])
+                blksize = blkend - start(revschunk[0])
+
+                readsize += blksize
+                if largestblock < blksize:
+                    largestblock = blksize
+
+            readdensity = float(chainsize) / float(readsize)
+
+            fm.write('readsize largestblock readdensity',
+                     ' %10d %10d %9.5f',
+                     readsize, largestblock, readdensity,
+                     readsize=readsize, largestblock=largestblock,
+                     readdensity=readdensity)
+
+        fm.plain('\n')
 
     fm.end()
 
@@ -665,8 +723,9 @@
         elif nodates:
             timestr = 'set                 '
         else:
-            timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
+            timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
                                     time.localtime(ent[3]))
+            timestr = encoding.strtolocal(timestr)
         if ent[1] & 0o20000:
             mode = 'lnk'
         else:
@@ -679,24 +738,21 @@
     [('', 'old', None, _('use old-style discovery')),
     ('', 'nonheads', None,
      _('use old-style discovery with non-heads included')),
+    ('', 'rev', [], 'restrict discovery to this set of revs'),
     ] + cmdutil.remoteopts,
-    _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
+    _('[--rev REV] [OTHER]'))
 def debugdiscovery(ui, repo, remoteurl="default", **opts):
     """runs the changeset discovery protocol in isolation"""
     opts = pycompat.byteskwargs(opts)
-    remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl),
-                                      opts.get('branch'))
+    remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
     remote = hg.peer(repo, opts, remoteurl)
     ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
 
     # make sure tests are repeatable
     random.seed(12323)
 
-    def doit(localheads, remoteheads, remote=remote):
+    def doit(pushedrevs, remoteheads, remote=remote):
         if opts.get('old'):
-            if localheads:
-                raise error.Abort('cannot use localheads with old style '
-                                 'discovery')
             if not util.safehasattr(remote, 'branches'):
                 # enable in-client legacy support
                 remote = localrepo.locallegacypeer(remote.local())
@@ -710,7 +766,12 @@
                 all = dag.ancestorset(dag.internalizeall(common))
                 common = dag.externalizeall(dag.headsetofconnecteds(all))
         else:
-            common, any, hds = setdiscovery.findcommonheads(ui, repo, remote)
+            nodes = None
+            if pushedrevs:
+                revs = scmutil.revrange(repo, pushedrevs)
+                nodes = [repo[r].node() for r in revs]
+            common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
+                                                            ancestorsof=nodes)
         common = set(common)
         rheads = set(hds)
         lheads = set(repo.heads())
@@ -721,26 +782,9 @@
         elif rheads <= common:
             ui.write(("remote is subset\n"))
 
-    serverlogs = opts.get('serverlog')
-    if serverlogs:
-        for filename in serverlogs:
-            with open(filename, 'r') as logfile:
-                line = logfile.readline()
-                while line:
-                    parts = line.strip().split(';')
-                    op = parts[1]
-                    if op == 'cg':
-                        pass
-                    elif op == 'cgss':
-                        doit(parts[2].split(' '), parts[3].split(' '))
-                    elif op == 'unb':
-                        doit(parts[3].split(' '), parts[2].split(' '))
-                    line = logfile.readline()
-    else:
-        remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
-                                                 opts.get('remote_head'))
-        localrevs = opts.get('local_head')
-        doit(localrevs, remoterevs)
+    remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
+    localrevs = opts['rev']
+    doit(localrevs, remoterevs)
 
 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
 def debugextensions(ui, **opts):
@@ -801,6 +845,69 @@
     for f in ctx.getfileset(expr):
         ui.write("%s\n" % f)
 
+@command('debugformat',
+         [] + cmdutil.formatteropts,
+        _(''))
+def debugformat(ui, repo, **opts):
+    """display format information about the current repository
+
+    Use --verbose to get extra information about current config value and
+    Mercurial default."""
+    opts = pycompat.byteskwargs(opts)
+    maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
+    maxvariantlength = max(len('format-variant'), maxvariantlength)
+
+    def makeformatname(name):
+        return '%s:' + (' ' * (maxvariantlength - len(name)))
+
+    fm = ui.formatter('debugformat', opts)
+    if fm.isplain():
+        def formatvalue(value):
+            if util.safehasattr(value, 'startswith'):
+                return value
+            if value:
+                return 'yes'
+            else:
+                return 'no'
+    else:
+        formatvalue = pycompat.identity
+
+    fm.plain('format-variant')
+    fm.plain(' ' * (maxvariantlength - len('format-variant')))
+    fm.plain(' repo')
+    if ui.verbose:
+        fm.plain(' config default')
+    fm.plain('\n')
+    for fv in upgrade.allformatvariant:
+        fm.startitem()
+        repovalue = fv.fromrepo(repo)
+        configvalue = fv.fromconfig(repo)
+
+        if repovalue != configvalue:
+            namelabel = 'formatvariant.name.mismatchconfig'
+            repolabel = 'formatvariant.repo.mismatchconfig'
+        elif repovalue != fv.default:
+            namelabel = 'formatvariant.name.mismatchdefault'
+            repolabel = 'formatvariant.repo.mismatchdefault'
+        else:
+            namelabel = 'formatvariant.name.uptodate'
+            repolabel = 'formatvariant.repo.uptodate'
+
+        fm.write('name', makeformatname(fv.name), fv.name,
+                 label=namelabel)
+        fm.write('repo', ' %3s', formatvalue(repovalue),
+                 label=repolabel)
+        if fv.default != configvalue:
+            configlabel = 'formatvariant.config.special'
+        else:
+            configlabel = 'formatvariant.config.default'
+        fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
+                     label=configlabel)
+        fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
+                     label='formatvariant.default')
+        fm.plain('\n')
+    fm.end()
+
 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
 def debugfsinfo(ui, path="."):
     """show information detected about current filesystem"""
@@ -1066,6 +1173,11 @@
              fm.formatlist([e.name() for e in wirecompengines
                             if e.wireprotosupport()],
                            name='compengine', fmt='%s', sep=', '))
+    re2 = 'missing'
+    if util._re2:
+        re2 = 'available'
+    fm.plain(_('checking "re2" regexp engine (%s)\n') % re2)
+    fm.data(re2=bool(util._re2))
 
     # templates
     p = templater.templatepaths()
@@ -1155,7 +1267,10 @@
 @command('debuglocks',
          [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
           ('W', 'force-wlock', None,
-           _('free the working state lock (DANGEROUS)'))],
+           _('free the working state lock (DANGEROUS)')),
+          ('s', 'set-lock', None, _('set the store lock until stopped')),
+          ('S', 'set-wlock', None,
+           _('set the working state lock until stopped'))],
          _('[OPTION]...'))
 def debuglocks(ui, repo, **opts):
     """show or modify state of locks
@@ -1174,6 +1289,10 @@
     instance, on a shared filesystem). Removing locks may also be
     blocked by filesystem permissions.
 
+    Setting a lock will prevent other commands from changing the data.
+    The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs.
+    The set locks are removed when the command exits.
+
     Returns 0 if no locks are held.
 
     """
@@ -1182,9 +1301,27 @@
         repo.svfs.unlink('lock')
     if opts.get(r'force_wlock'):
         repo.vfs.unlink('wlock')
-    if opts.get(r'force_lock') or opts.get(r'force_lock'):
+    if opts.get(r'force_lock') or opts.get(r'force_wlock'):
         return 0
 
+    locks = []
+    try:
+        if opts.get(r'set_wlock'):
+            try:
+                locks.append(repo.wlock(False))
+            except error.LockHeld:
+                raise error.Abort(_('wlock is already held'))
+        if opts.get(r'set_lock'):
+            try:
+                locks.append(repo.lock(False))
+            except error.LockHeld:
+                raise error.Abort(_('lock is already held'))
+        if len(locks):
+            ui.promptchoice(_("ready to release the lock (y)? $$ &Yes"))
+            return 0
+    finally:
+        release(*locks)
+
     now = time.time()
     held = 0
 
@@ -2178,7 +2315,7 @@
         ctx = repo[rev]
         ui.write('%s\n'% ctx2str(ctx))
         for succsset in obsutil.successorssets(repo, ctx.node(),
-                                                closest=opts['closest'],
+                                                closest=opts[r'closest'],
                                                 cache=cache):
             if succsset:
                 ui.write('    ')
@@ -2304,6 +2441,7 @@
     for k, v in opts.iteritems():
         if v:
             args[k] = v
+    args = pycompat.strkwargs(args)
     # run twice to check that we don't mess up the stream for the next command
     res1 = repo.debugwireargs(*vals, **args)
     res2 = repo.debugwireargs(*vals, **args)
--- a/mercurial/dirstate.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/dirstate.py	Tue Dec 19 16:27:24 2017 -0500
@@ -80,6 +80,7 @@
         self._plchangecallbacks = {}
         self._origpl = None
         self._updatedfiles = set()
+        self._mapcls = dirstatemap
 
     @contextlib.contextmanager
     def parentchange(self):
@@ -127,9 +128,8 @@
 
     @propertycache
     def _map(self):
-        '''Return the dirstate contents as a map from filename to
-        (state, mode, size, time).'''
-        self._map = dirstatemap(self._ui, self._opener, self._root)
+        """Return the dirstate contents (see documentation for dirstatemap)."""
+        self._map = self._mapcls(self._ui, self._opener, self._root)
         return self._map
 
     @property
@@ -158,8 +158,8 @@
     def _pl(self):
         return self._map.parents()
 
-    def dirs(self):
-        return self._map.dirs
+    def hasdir(self, d):
+        return self._map.hastrackeddir(d)
 
     @rootcache('.hgignore')
     def _ignore(self):
@@ -387,40 +387,23 @@
     def copies(self):
         return self._map.copymap
 
-    def _droppath(self, f):
-        if self[f] not in "?r" and "dirs" in self._map.__dict__:
-            self._map.dirs.delpath(f)
-
-        if "filefoldmap" in self._map.__dict__:
-            normed = util.normcase(f)
-            if normed in self._map.filefoldmap:
-                del self._map.filefoldmap[normed]
-
-        self._updatedfiles.add(f)
-
     def _addpath(self, f, state, mode, size, mtime):
         oldstate = self[f]
         if state == 'a' or oldstate == 'r':
             scmutil.checkfilename(f)
-            if f in self._map.dirs:
+            if self._map.hastrackeddir(f):
                 raise error.Abort(_('directory %r already in dirstate') % f)
             # shadows
             for d in util.finddirs(f):
-                if d in self._map.dirs:
+                if self._map.hastrackeddir(d):
                     break
                 entry = self._map.get(d)
                 if entry is not None and entry[0] != 'r':
                     raise error.Abort(
                         _('file %r in dirstate clashes with %r') % (d, f))
-        if oldstate in "?r" and "dirs" in self._map.__dict__:
-            self._map.dirs.addpath(f)
         self._dirty = True
         self._updatedfiles.add(f)
-        self._map[f] = dirstatetuple(state, mode, size, mtime)
-        if state != 'n' or mtime == -1:
-            self._map.nonnormalset.add(f)
-        if size == -2:
-            self._map.otherparentset.add(f)
+        self._map.addfile(f, oldstate, state, mode, size, mtime)
 
     def normal(self, f):
         '''Mark a file normal and clean.'''
@@ -458,8 +441,6 @@
                     return
         self._addpath(f, 'n', 0, -1, -1)
         self._map.copymap.pop(f, None)
-        if f in self._map.nonnormalset:
-            self._map.nonnormalset.remove(f)
 
     def otherparent(self, f):
         '''Mark as coming from the other parent, always dirty.'''
@@ -482,7 +463,7 @@
     def remove(self, f):
         '''Mark a file removed.'''
         self._dirty = True
-        self._droppath(f)
+        oldstate = self[f]
         size = 0
         if self._pl[1] != nullid:
             entry = self._map.get(f)
@@ -493,8 +474,8 @@
                 elif entry[0] == 'n' and entry[2] == -2: # other parent
                     size = -2
                     self._map.otherparentset.add(f)
-        self._map[f] = dirstatetuple('r', 0, size, 0)
-        self._map.nonnormalset.add(f)
+        self._updatedfiles.add(f)
+        self._map.removefile(f, oldstate, size)
         if size == 0:
             self._map.copymap.pop(f, None)
 
@@ -506,12 +487,10 @@
 
     def drop(self, f):
         '''Drop a file from the dirstate'''
-        if f in self._map:
+        oldstate = self[f]
+        if self._map.dropfile(f, oldstate):
             self._dirty = True
-            self._droppath(f)
-            del self._map[f]
-            if f in self._map.nonnormalset:
-                self._map.nonnormalset.remove(f)
+            self._updatedfiles.add(f)
             self._map.copymap.pop(f, None)
 
     def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
@@ -635,12 +614,7 @@
 
             # emulate dropping timestamp in 'parsers.pack_dirstate'
             now = _getfsnow(self._opener)
-            dmap = self._map
-            for f in self._updatedfiles:
-                e = dmap.get(f)
-                if e is not None and e[0] == 'n' and e[3] == now:
-                    dmap[f] = dirstatetuple(e[0], e[1], e[2], -1)
-                    self._map.nonnormalset.add(f)
+            self._map.clearambiguoustimes(self._updatedfiles, now)
 
             # emulate that all 'dirstate.normal' results are written out
             self._lastnormaltime = 0
@@ -797,7 +771,6 @@
         results = dict.fromkeys(subrepos)
         results['.hg'] = None
 
-        alldirs = None
         for ff in files:
             # constructing the foldmap is expensive, so don't do it for the
             # common case where files is ['.']
@@ -828,9 +801,7 @@
                 if nf in dmap: # does it exactly match a missing file?
                     results[nf] = None
                 else: # does it match a missing directory?
-                    if alldirs is None:
-                        alldirs = util.dirs(dmap._map)
-                    if nf in alldirs:
+                    if self._map.hasdir(nf):
                         if matchedir:
                             matchedir(nf)
                         notfoundadd(nf)
@@ -1198,6 +1169,39 @@
         self._opener.unlink(backupname)
 
 class dirstatemap(object):
+    """Map encapsulating the dirstate's contents.
+
+    The dirstate contains the following state:
+
+    - `identity` is the identity of the dirstate file, which can be used to
+      detect when changes have occurred to the dirstate file.
+
+    - `parents` is a pair containing the parents of the working copy. The
+      parents are updated by calling `setparents`.
+
+    - the state map maps filenames to tuples of (state, mode, size, mtime),
+      where state is a single character representing 'normal', 'added',
+      'removed', or 'merged'. It is read by treating the dirstate as a
+      dict.  File state is updated by calling the `addfile`, `removefile` and
+      `dropfile` methods.
+
+    - `copymap` maps destination filenames to their source filename.
+
+    The dirstate also provides the following views onto the state:
+
+    - `nonnormalset` is a set of the filenames that have state other
+      than 'normal', or are normal but have an mtime of -1 ('normallookup').
+
+    - `otherparentset` is a set of the filenames that are marked as coming
+      from the second parent when the dirstate is currently being merged.
+
+    - `filefoldmap` is a dict mapping normalized filenames to the denormalized
+      form that they appear as in the dirstate.
+
+    - `dirfoldmap` is a dict mapping normalized directory names to the
+      denormalized form that they appear as in the dirstate.
+    """
+
     def __init__(self, ui, opener, root):
         self._ui = ui
         self._opener = opener
@@ -1226,6 +1230,12 @@
         self._map.clear()
         self.copymap.clear()
         self.setparents(nullid, nullid)
+        util.clearcachedproperty(self, "_dirs")
+        util.clearcachedproperty(self, "_alldirs")
+        util.clearcachedproperty(self, "filefoldmap")
+        util.clearcachedproperty(self, "dirfoldmap")
+        util.clearcachedproperty(self, "nonnormalset")
+        util.clearcachedproperty(self, "otherparentset")
 
     def iteritems(self):
         return self._map.iteritems()
@@ -1242,15 +1252,9 @@
     def __contains__(self, key):
         return key in self._map
 
-    def __setitem__(self, key, value):
-        self._map[key] = value
-
     def __getitem__(self, key):
         return self._map[key]
 
-    def __delitem__(self, key):
-        del self._map[key]
-
     def keys(self):
         return self._map.keys()
 
@@ -1258,6 +1262,60 @@
         """Loads the underlying data, if it's not already loaded"""
         self._map
 
+    def addfile(self, f, oldstate, state, mode, size, mtime):
+        """Add a tracked file to the dirstate."""
+        if oldstate in "?r" and "_dirs" in self.__dict__:
+            self._dirs.addpath(f)
+        if oldstate == "?" and "_alldirs" in self.__dict__:
+            self._alldirs.addpath(f)
+        self._map[f] = dirstatetuple(state, mode, size, mtime)
+        if state != 'n' or mtime == -1:
+            self.nonnormalset.add(f)
+        if size == -2:
+            self.otherparentset.add(f)
+
+    def removefile(self, f, oldstate, size):
+        """
+        Mark a file as removed in the dirstate.
+
+        The `size` parameter is used to store sentinel values that indicate
+        the file's previous state.  In the future, we should refactor this
+        to be more explicit about what that state is.
+        """
+        if oldstate not in "?r" and "_dirs" in self.__dict__:
+            self._dirs.delpath(f)
+        if oldstate == "?" and "_alldirs" in self.__dict__:
+            self._alldirs.addpath(f)
+        if "filefoldmap" in self.__dict__:
+            normed = util.normcase(f)
+            self.filefoldmap.pop(normed, None)
+        self._map[f] = dirstatetuple('r', 0, size, 0)
+        self.nonnormalset.add(f)
+
+    def dropfile(self, f, oldstate):
+        """
+        Remove a file from the dirstate.  Returns True if the file was
+        previously recorded.
+        """
+        exists = self._map.pop(f, None) is not None
+        if exists:
+            if oldstate != "r" and "_dirs" in self.__dict__:
+                self._dirs.delpath(f)
+            if "_alldirs" in self.__dict__:
+                self._alldirs.delpath(f)
+        if "filefoldmap" in self.__dict__:
+            normed = util.normcase(f)
+            self.filefoldmap.pop(normed, None)
+        self.nonnormalset.discard(f)
+        return exists
+
+    def clearambiguoustimes(self, files, now):
+        for f in files:
+            e = self.get(f)
+            if e is not None and e[0] == 'n' and e[3] == now:
+                self._map[f] = dirstatetuple(e[0], e[1], e[2], -1)
+                self.nonnormalset.add(f)
+
     def nonnormalentries(self):
         '''Compute the nonnormal dirstate entries from the dmap'''
         try:
@@ -1293,13 +1351,28 @@
         f['.'] = '.' # prevents useless util.fspath() invocation
         return f
 
+    def hastrackeddir(self, d):
+        """
+        Returns True if the dirstate contains a tracked (not removed) file
+        in this directory.
+        """
+        return d in self._dirs
+
+    def hasdir(self, d):
+        """
+        Returns True if the dirstate contains a file (tracked or removed)
+        in this directory.
+        """
+        return d in self._alldirs
+
     @propertycache
-    def dirs(self):
-        """Returns a set-like object containing all the directories in the
-        current dirstate.
-        """
+    def _dirs(self):
         return util.dirs(self._map, 'r')
 
+    @propertycache
+    def _alldirs(self):
+        return util.dirs(self._map)
+
     def _opendirstatefile(self):
         fp, mode = txnutil.trypending(self._root, self._opener, self._filename)
         if self._pendingmode is not None and self._pendingmode != mode:
@@ -1387,8 +1460,6 @@
         # Avoid excess attribute lookups by fast pathing certain checks
         self.__contains__ = self._map.__contains__
         self.__getitem__ = self._map.__getitem__
-        self.__setitem__ = self._map.__setitem__
-        self.__delitem__ = self._map.__delitem__
         self.get = self._map.get
 
     def write(self, st, now):
@@ -1419,6 +1490,6 @@
     def dirfoldmap(self):
         f = {}
         normcase = util.normcase
-        for name in self.dirs:
+        for name in self._dirs:
             f[normcase(name)] = name
         return f
--- a/mercurial/discovery.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/discovery.py	Tue Dec 19 16:27:24 2017 -0500
@@ -21,12 +21,13 @@
     branchmap,
     error,
     phases,
+    scmutil,
     setdiscovery,
     treediscovery,
     util,
 )
 
-def findcommonincoming(repo, remote, heads=None, force=False):
+def findcommonincoming(repo, remote, heads=None, force=False, ancestorsof=None):
     """Return a tuple (common, anyincoming, heads) used to identify the common
     subset of nodes between repo and remote.
 
@@ -37,6 +38,9 @@
       changegroupsubset. No code except for pull should be relying on this fact
       any longer.
     "heads" is either the supplied heads, or else the remote's heads.
+    "ancestorsof" if not None, restrict the discovery to a subset defined by
+      these nodes. Changeset outside of this set won't be considered (and
+      won't appears in "common")
 
     If you pass heads and they are all known locally, the response lists just
     these heads in "common" and in "heads".
@@ -59,7 +63,8 @@
             return (heads, False, heads)
 
     res = setdiscovery.findcommonheads(repo.ui, repo, remote,
-                                       abortwhenunrelated=not force)
+                                       abortwhenunrelated=not force,
+                                       ancestorsof=ancestorsof)
     common, anyinc, srvheads = res
     return (list(common), anyinc, heads or list(srvheads))
 
@@ -141,7 +146,8 @@
 
     # get common set if not provided
     if commoninc is None:
-        commoninc = findcommonincoming(repo, other, force=force)
+        commoninc = findcommonincoming(repo, other, force=force,
+                                       ancestorsof=onlyheads)
     og.commonheads, _any, _hds = commoninc
 
     # compute outgoing
@@ -365,11 +371,8 @@
             if None in unsyncedheads:
                 # old remote, no heads data
                 heads = None
-            elif len(unsyncedheads) <= 4 or repo.ui.verbose:
-                heads = ' '.join(short(h) for h in unsyncedheads)
             else:
-                heads = (' '.join(short(h) for h in unsyncedheads[:4]) +
-                         ' ' + _("and %s others") % (len(unsyncedheads) - 4))
+                heads = scmutil.nodesummaries(repo, unsyncedheads)
             if heads is None:
                 repo.ui.status(_("remote has heads that are "
                                  "not known locally\n"))
--- a/mercurial/dispatch.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/dispatch.py	Tue Dec 19 16:27:24 2017 -0500
@@ -55,7 +55,7 @@
         self.fout = fout
         self.ferr = ferr
 
-        # remember options pre-parsed by _earlyreqopt*()
+        # remember options pre-parsed by _earlyparseopts()
         self.earlyoptions = {}
 
         # reposetups which run before extensions, useful for chg to pre-fill
@@ -150,9 +150,8 @@
     try:
         if not req.ui:
             req.ui = uimod.ui.load()
-        if req.ui.plain('strictflags'):
-            req.earlyoptions.update(_earlyparseopts(req.args))
-        if _earlyreqoptbool(req, 'traceback', ['--traceback']):
+        req.earlyoptions.update(_earlyparseopts(req.ui, req.args))
+        if req.earlyoptions['traceback']:
             req.ui.setconfig('ui', 'traceback', 'on', '--traceback')
 
         # set ui streams from the request
@@ -201,7 +200,8 @@
         req.ui.flush()
         if req.ui.logblockedtimes:
             req.ui._blockedtimes['command_duration'] = duration * 1000
-            req.ui.log('uiblocked', 'ui blocked ms', **req.ui._blockedtimes)
+            req.ui.log('uiblocked', 'ui blocked ms',
+                       **pycompat.strkwargs(req.ui._blockedtimes))
         req.ui.log("commandfinish", "%s exited %d after %0.2f seconds\n",
                    msg, ret or 0, duration)
         try:
@@ -266,8 +266,7 @@
 
             # read --config before doing anything else
             # (e.g. to change trust settings for reading .hg/hgrc)
-            cfgs = _parseconfig(req.ui,
-                                _earlyreqopt(req, 'config', ['--config']))
+            cfgs = _parseconfig(req.ui, req.earlyoptions['config'])
 
             if req.repo:
                 # copy configs that were passed on the cmdline (--config) to
@@ -281,7 +280,7 @@
             if not debugger or ui.plain():
                 # if we are in HGPLAIN mode, then disable custom debugging
                 debugger = 'pdb'
-            elif _earlyreqoptbool(req, 'debugger', ['--debugger']):
+            elif req.earlyoptions['debugger']:
                 # This import can be slow for fancy debuggers, so only
                 # do it when absolutely necessary, i.e. when actual
                 # debugging has been requested
@@ -295,7 +294,7 @@
             debugmortem[debugger] = debugmod.post_mortem
 
             # enter the debugger before command execution
-            if _earlyreqoptbool(req, 'debugger', ['--debugger']):
+            if req.earlyoptions['debugger']:
                 ui.warn(_("entering debugger - "
                         "type c to continue starting hg or h for help\n"))
 
@@ -311,7 +310,7 @@
                 ui.flush()
         except: # re-raises
             # enter the debugger when we hit an exception
-            if _earlyreqoptbool(req, 'debugger', ['--debugger']):
+            if req.earlyoptions['debugger']:
                 traceback.print_exc()
                 debugmortem[debugger](sys.exc_info()[2])
             raise
@@ -410,7 +409,7 @@
     # tokenize each argument into exactly one word.
     replacemap['"$@"'] = ' '.join(util.shellquote(arg) for arg in args)
     # escape '\$' for regex
-    regex = '|'.join(replacemap.keys()).replace('$', r'\$')
+    regex = '|'.join(replacemap.keys()).replace('$', br'\$')
     r = re.compile(regex)
     return r.sub(lambda x: replacemap[x.group()], cmd)
 
@@ -455,7 +454,7 @@
                                  "of %i variable in alias '%s' definition."
                                  % (int(m.groups()[0]), self.name))
                         return ''
-                cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:])
+                cmd = re.sub(br'\$(\d+|\$)', _checkvar, self.definition[1:])
                 cmd = aliasinterpolate(self.name, args, cmd)
                 return ui.system(cmd, environ=env,
                                  blockedtag='alias_%s' % self.name)
@@ -468,16 +467,15 @@
             self.badalias = (_("error in definition for alias '%s': %s")
                              % (self.name, inst))
             return
+        earlyopts, args = _earlysplitopts(args)
+        if earlyopts:
+            self.badalias = (_("error in definition for alias '%s': %s may "
+                               "only be given on the command line")
+                             % (self.name, '/'.join(zip(*earlyopts)[0])))
+            return
         self.cmdname = cmd = args.pop(0)
         self.givenargs = args
 
-        for invalidarg in commands.earlyoptflags:
-            if _earlygetopt([invalidarg], args):
-                self.badalias = (_("error in definition for alias '%s': %s may "
-                                   "only be given on the command line")
-                                 % (self.name, invalidarg))
-                return
-
         try:
             tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
             if len(tableentry) > 2:
@@ -646,139 +644,20 @@
 
     return configs
 
-def _earlyparseopts(args):
+def _earlyparseopts(ui, args):
     options = {}
     fancyopts.fancyopts(args, commands.globalopts, options,
-                        gnu=False, early=True)
+                        gnu=not ui.plain('strictflags'), early=True,
+                        optaliases={'repository': ['repo']})
     return options
 
-def _earlygetopt(aliases, args, strip=True):
-    """Return list of values for an option (or aliases).
-
-    The values are listed in the order they appear in args.
-    The options and values are removed from args if strip=True.
-
-    >>> args = [b'x', b'--cwd', b'foo', b'y']
-    >>> _earlygetopt([b'--cwd'], args), args
-    (['foo'], ['x', 'y'])
-
-    >>> args = [b'x', b'--cwd=bar', b'y']
-    >>> _earlygetopt([b'--cwd'], args), args
-    (['bar'], ['x', 'y'])
-
-    >>> args = [b'x', b'--cwd=bar', b'y']
-    >>> _earlygetopt([b'--cwd'], args, strip=False), args
-    (['bar'], ['x', '--cwd=bar', 'y'])
-
-    >>> args = [b'x', b'-R', b'foo', b'y']
-    >>> _earlygetopt([b'-R'], args), args
-    (['foo'], ['x', 'y'])
-
-    >>> args = [b'x', b'-R', b'foo', b'y']
-    >>> _earlygetopt([b'-R'], args, strip=False), args
-    (['foo'], ['x', '-R', 'foo', 'y'])
-
-    >>> args = [b'x', b'-Rbar', b'y']
-    >>> _earlygetopt([b'-R'], args), args
-    (['bar'], ['x', 'y'])
-
-    >>> args = [b'x', b'-Rbar', b'y']
-    >>> _earlygetopt([b'-R'], args, strip=False), args
-    (['bar'], ['x', '-Rbar', 'y'])
-
-    >>> args = [b'x', b'-R=bar', b'y']
-    >>> _earlygetopt([b'-R'], args), args
-    (['=bar'], ['x', 'y'])
-
-    >>> args = [b'x', b'-R', b'--', b'y']
-    >>> _earlygetopt([b'-R'], args), args
-    ([], ['x', '-R', '--', 'y'])
-    """
-    try:
-        argcount = args.index("--")
-    except ValueError:
-        argcount = len(args)
-    shortopts = [opt for opt in aliases if len(opt) == 2]
-    values = []
-    pos = 0
-    while pos < argcount:
-        fullarg = arg = args[pos]
-        equals = -1
-        if arg.startswith('--'):
-            equals = arg.find('=')
-        if equals > -1:
-            arg = arg[:equals]
-        if arg in aliases:
-            if equals > -1:
-                values.append(fullarg[equals + 1:])
-                if strip:
-                    del args[pos]
-                    argcount -= 1
-                else:
-                    pos += 1
-            else:
-                if pos + 1 >= argcount:
-                    # ignore and let getopt report an error if there is no value
-                    break
-                values.append(args[pos + 1])
-                if strip:
-                    del args[pos:pos + 2]
-                    argcount -= 2
-                else:
-                    pos += 2
-        elif arg[:2] in shortopts:
-            # short option can have no following space, e.g. hg log -Rfoo
-            values.append(args[pos][2:])
-            if strip:
-                del args[pos]
-                argcount -= 1
-            else:
-                pos += 1
-        else:
-            pos += 1
-    return values
-
-def _earlyreqopt(req, name, aliases):
-    """Peek a list option without using a full options table"""
-    if req.ui.plain('strictflags'):
-        return req.earlyoptions[name]
-    values = _earlygetopt(aliases, req.args, strip=False)
-    req.earlyoptions[name] = values
-    return values
-
-def _earlyreqoptstr(req, name, aliases):
-    """Peek a string option without using a full options table"""
-    if req.ui.plain('strictflags'):
-        return req.earlyoptions[name]
-    value = (_earlygetopt(aliases, req.args, strip=False) or [''])[-1]
-    req.earlyoptions[name] = value
-    return value
-
-def _earlyreqoptbool(req, name, aliases):
-    """Peek a boolean option without using a full options table
-
-    >>> req = request([b'x', b'--debugger'], uimod.ui())
-    >>> _earlyreqoptbool(req, b'debugger', [b'--debugger'])
-    True
-
-    >>> req = request([b'x', b'--', b'--debugger'], uimod.ui())
-    >>> _earlyreqoptbool(req, b'debugger', [b'--debugger'])
-    """
-    if req.ui.plain('strictflags'):
-        return req.earlyoptions[name]
-    try:
-        argcount = req.args.index("--")
-    except ValueError:
-        argcount = len(req.args)
-    value = None
-    pos = 0
-    while pos < argcount:
-        arg = req.args[pos]
-        if arg in aliases:
-            value = True
-        pos += 1
-    req.earlyoptions[name] = value
-    return value
+def _earlysplitopts(args):
+    """Split args into a list of possible early options and remainder args"""
+    shortoptions = 'R:'
+    # TODO: perhaps 'debugger' should be included
+    longoptions = ['cwd=', 'repository=', 'repo=', 'config=']
+    return fancyopts.earlygetopt(args, shortoptions, longoptions,
+                                 gnu=True, keepsep=True)
 
 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
     # run pre-hook, and abort if it fails
@@ -847,8 +726,7 @@
 
     if cmd and util.safehasattr(fn, 'shell'):
         # shell alias shouldn't receive early options which are consumed by hg
-        args = args[:]
-        _earlygetopt(commands.earlyoptflags, args, strip=True)
+        _earlyopts, args = _earlysplitopts(args)
         d = lambda: fn(ui, *args[1:])
         return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d,
                                   [], {})
@@ -858,11 +736,11 @@
     ui = req.ui
 
     # check for cwd
-    cwd = _earlyreqoptstr(req, 'cwd', ['--cwd'])
+    cwd = req.earlyoptions['cwd']
     if cwd:
         os.chdir(cwd)
 
-    rpath = _earlyreqoptstr(req, 'repository', ["-R", "--repository", "--repo"])
+    rpath = req.earlyoptions['repository']
     path, lui = _getlocal(ui, rpath)
 
     uis = {ui, lui}
@@ -870,7 +748,7 @@
     if req.repo:
         uis.add(req.repo.ui)
 
-    if _earlyreqoptbool(req, 'profile', ['--profile']):
+    if req.earlyoptions['profile']:
         for ui_ in uis:
             ui_.setconfig('profiling', 'enabled', 'true', '--profile')
 
@@ -1006,10 +884,11 @@
                     if not func.optionalrepo:
                         if func.inferrepo and args and not path:
                             # try to infer -R from command args
-                            repos = map(cmdutil.findrepo, args)
+                            repos = pycompat.maplist(cmdutil.findrepo, args)
                             guess = repos[0]
                             if guess and repos.count(guess) == len(repos):
                                 req.args = ['--repository', guess] + fullargs
+                                req.earlyoptions['repository'] = guess
                                 return _dispatch(req)
                         if not path:
                             raise error.RepoError(_("no repository found in"
--- a/mercurial/error.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/error.py	Tue Dec 19 16:27:24 2017 -0500
@@ -301,3 +301,7 @@
 
 class PeerTransportError(Abort):
     """Transport-level I/O error when communicating with a peer repo."""
+
+class InMemoryMergeConflictsError(Exception):
+    """Exception raised when merge conflicts arose during an in-memory merge."""
+    __bytes__ = _tobytes
--- a/mercurial/exchange.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/exchange.py	Tue Dec 19 16:27:24 2017 -0500
@@ -13,6 +13,7 @@
 
 from .i18n import _
 from .node import (
+    bin,
     hex,
     nullid,
 )
@@ -23,6 +24,7 @@
     discovery,
     error,
     lock as lockmod,
+    logexchange,
     obsolete,
     phases,
     pushkey,
@@ -512,7 +514,11 @@
 def _pushdiscoverychangeset(pushop):
     """discover the changeset that need to be pushed"""
     fci = discovery.findcommonincoming
-    commoninc = fci(pushop.repo, pushop.remote, force=pushop.force)
+    if pushop.revs:
+        commoninc = fci(pushop.repo, pushop.remote, force=pushop.force,
+                        ancestorsof=pushop.revs)
+    else:
+        commoninc = fci(pushop.repo, pushop.remote, force=pushop.force)
     common, inc, remoteheads = commoninc
     fco = discovery.findcommonoutgoing
     outgoing = fco(pushop.repo, pushop.remote, onlyheads=pushop.revs,
@@ -742,6 +748,22 @@
                 or pushop.outobsmarkers
                 or pushop.outbookmarks)
 
+@b2partsgenerator('check-bookmarks')
+def _pushb2checkbookmarks(pushop, bundler):
+    """insert bookmark move checking"""
+    if not _pushing(pushop) or pushop.force:
+        return
+    b2caps = bundle2.bundle2caps(pushop.remote)
+    hasbookmarkcheck = 'bookmarks' in b2caps
+    if not (pushop.outbookmarks and hasbookmarkcheck):
+        return
+    data = []
+    for book, old, new in pushop.outbookmarks:
+        old = bin(old)
+        data.append((book, old))
+    checkdata = bookmod.binaryencode(data)
+    bundler.newpart('check:bookmarks', data=checkdata)
+
 @b2partsgenerator('check-phases')
 def _pushb2checkphases(pushop, bundler):
     """insert phase move checking"""
@@ -879,8 +901,46 @@
     if 'bookmarks' in pushop.stepsdone:
         return
     b2caps = bundle2.bundle2caps(pushop.remote)
-    if 'pushkey' not in b2caps:
+
+    legacy = pushop.repo.ui.configlist('devel', 'legacy.exchange')
+    legacybooks = 'bookmarks' in legacy
+
+    if not legacybooks and 'bookmarks' in b2caps:
+        return _pushb2bookmarkspart(pushop, bundler)
+    elif 'pushkey' in b2caps:
+        return _pushb2bookmarkspushkey(pushop, bundler)
+
+def _bmaction(old, new):
+    """small utility for bookmark pushing"""
+    if not old:
+        return 'export'
+    elif not new:
+        return 'delete'
+    return 'update'
+
+def _pushb2bookmarkspart(pushop, bundler):
+    pushop.stepsdone.add('bookmarks')
+    if not pushop.outbookmarks:
         return
+
+    allactions = []
+    data = []
+    for book, old, new in pushop.outbookmarks:
+        new = bin(new)
+        data.append((book, new))
+        allactions.append((book, _bmaction(old, new)))
+    checkdata = bookmod.binaryencode(data)
+    bundler.newpart('bookmarks', data=checkdata)
+
+    def handlereply(op):
+        ui = pushop.ui
+        # if success
+        for book, action in allactions:
+            ui.status(bookmsgmap[action][0] % book)
+
+    return handlereply
+
+def _pushb2bookmarkspushkey(pushop, bundler):
     pushop.stepsdone.add('bookmarks')
     part2book = []
     enc = pushkey.encode
@@ -1273,7 +1333,8 @@
     if opargs is None:
         opargs = {}
     pullop = pulloperation(repo, remote, heads, force, bookmarks=bookmarks,
-                           streamclonerequested=streamclonerequested, **opargs)
+                           streamclonerequested=streamclonerequested,
+                           **pycompat.strkwargs(opargs))
 
     peerlocal = pullop.remote.local()
     if peerlocal:
@@ -1304,6 +1365,10 @@
     finally:
         lockmod.release(pullop.trmanager, lock, wlock)
 
+    # storing remotenames
+    if repo.ui.configbool('experimental', 'remotenames'):
+        logexchange.pullremotenames(repo, remote)
+
     return pullop
 
 # list of steps to perform discovery before pull
@@ -1348,7 +1413,8 @@
         # all known bundle2 servers now support listkeys, but lets be nice with
         # new implementation.
         return
-    pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
+    books = pullop.remote.listkeys('bookmarks')
+    pullop.remotebookmarks = bookmod.unhexlifybookmarks(books)
 
 
 @pulldiscovery('changegroup')
@@ -1408,12 +1474,26 @@
         kwargs['phases'] = True
         pullop.stepsdone.add('phases')
 
+    bookmarksrequested = False
+    legacybookmark = 'bookmarks' in ui.configlist('devel', 'legacy.exchange')
+    hasbinarybook = 'bookmarks' in pullop.remotebundle2caps
+
+    if pullop.remotebookmarks is not None:
+        pullop.stepsdone.add('request-bookmarks')
+
+    if ('request-bookmarks' not in pullop.stepsdone
+        and pullop.remotebookmarks is None
+        and not legacybookmark and hasbinarybook):
+        kwargs['bookmarks'] = True
+        bookmarksrequested = True
+
     if 'listkeys' in pullop.remotebundle2caps:
         if 'phases' not in pullop.stepsdone:
             kwargs['listkeys'] = ['phases']
-        if pullop.remotebookmarks is None:
+        if 'request-bookmarks' not in pullop.stepsdone:
             # make sure to always includes bookmark data when migrating
             # `hg incoming --bundle` to using this function.
+            pullop.stepsdone.add('request-bookmarks')
             kwargs.setdefault('listkeys', []).append('bookmarks')
 
     # If this is a full pull / clone and the server supports the clone bundles
@@ -1441,7 +1521,9 @@
     _pullbundle2extraprepare(pullop, kwargs)
     bundle = pullop.remote.getbundle('pull', **pycompat.strkwargs(kwargs))
     try:
-        op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction)
+        op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction)
+        op.modes['bookmarks'] = 'records'
+        bundle2.processbundle(pullop.repo, bundle, op=op)
     except bundle2.AbortFromPart as exc:
         pullop.repo.ui.status(_('remote: abort: %s\n') % exc)
         raise error.Abort(_('pull failed on remote'), hint=exc.hint)
@@ -1457,9 +1539,15 @@
             _pullapplyphases(pullop, value)
 
     # processing bookmark update
-    for namespace, value in op.records['listkeys']:
-        if namespace == 'bookmarks':
-            pullop.remotebookmarks = value
+    if bookmarksrequested:
+        books = {}
+        for record in op.records['bookmarks']:
+            books[record['bookmark']] = record["node"]
+        pullop.remotebookmarks = books
+    else:
+        for namespace, value in op.records['listkeys']:
+            if namespace == 'bookmarks':
+                pullop.remotebookmarks = bookmod.unhexlifybookmarks(value)
 
     # bookmark data were either already there or pulled in the bundle
     if pullop.remotebookmarks is not None:
@@ -1552,7 +1640,6 @@
     pullop.stepsdone.add('bookmarks')
     repo = pullop.repo
     remotebookmarks = pullop.remotebookmarks
-    remotebookmarks = bookmod.unhexlifybookmarks(remotebookmarks)
     bookmod.updatefromremote(repo.ui, repo, remotebookmarks,
                              pullop.remote.url(),
                              pullop.gettransaction,
@@ -1671,7 +1758,7 @@
                               b2caps=None, heads=None, common=None, **kwargs):
     """add a changegroup part to the requested bundle"""
     cgstream = None
-    if kwargs.get('cg', True):
+    if kwargs.get(r'cg', True):
         # build changegroup bundle here.
         version = '01'
         cgversions = b2caps.get('changegroup')
@@ -1695,11 +1782,24 @@
         if 'treemanifest' in repo.requirements:
             part.addparam('treemanifest', '1')
 
+@getbundle2partsgenerator('bookmarks')
+def _getbundlebookmarkpart(bundler, repo, source, bundlecaps=None,
+                              b2caps=None, **kwargs):
+    """add a bookmark part to the requested bundle"""
+    if not kwargs.get(r'bookmarks', False):
+        return
+    if 'bookmarks' not in b2caps:
+        raise ValueError(_('no common bookmarks exchange method'))
+    books  = bookmod.listbinbookmarks(repo)
+    data = bookmod.binaryencode(books)
+    if data:
+        bundler.newpart('bookmarks', data=data)
+
 @getbundle2partsgenerator('listkeys')
 def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None,
                             b2caps=None, **kwargs):
     """add parts containing listkeys namespaces to the requested bundle"""
-    listkeys = kwargs.get('listkeys', ())
+    listkeys = kwargs.get(r'listkeys', ())
     for namespace in listkeys:
         part = bundler.newpart('listkeys')
         part.addparam('namespace', namespace)
@@ -1710,7 +1810,7 @@
 def _getbundleobsmarkerpart(bundler, repo, source, bundlecaps=None,
                             b2caps=None, heads=None, **kwargs):
     """add an obsolescence markers part to the requested bundle"""
-    if kwargs.get('obsmarkers', False):
+    if kwargs.get(r'obsmarkers', False):
         if heads is None:
             heads = repo.heads()
         subset = [c.node() for c in repo.set('::%ln', heads)]
@@ -1722,7 +1822,7 @@
 def _getbundlephasespart(bundler, repo, source, bundlecaps=None,
                             b2caps=None, heads=None, **kwargs):
     """add phase heads part to the requested bundle"""
-    if kwargs.get('phases', False):
+    if kwargs.get(r'phases', False):
         if not 'heads' in b2caps.get('phases'):
             raise ValueError(_('no common phases exchange method'))
         if heads is None:
@@ -1779,23 +1879,12 @@
     # Don't send unless:
     # - changeset are being exchanged,
     # - the client supports it.
-    if not (kwargs.get('cg', True) and 'hgtagsfnodes' in b2caps):
+    if not (kwargs.get(r'cg', True) and 'hgtagsfnodes' in b2caps):
         return
 
     outgoing = _computeoutgoing(repo, heads, common)
     bundle2.addparttagsfnodescache(repo, bundler, outgoing)
 
-def _getbookmarks(repo, **kwargs):
-    """Returns bookmark to node mapping.
-
-    This function is primarily used to generate `bookmarks` bundle2 part.
-    It is a separate function in order to make it easy to wrap it
-    in extensions. Passing `kwargs` to the function makes it easy to
-    add new parameters in extensions.
-    """
-
-    return dict(bookmod.listbinbookmarks(repo))
-
 def check_heads(repo, their_heads, context):
     """check if the heads of a repo have been modified
 
--- a/mercurial/fancyopts.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/fancyopts.py	Tue Dec 19 16:27:24 2017 -0500
@@ -119,7 +119,7 @@
     >>> get([b'--cwd=foo', b'x', b'y', b'-R', b'bar', b'--debugger'], gnu=False)
     ([('--cwd', 'foo')], ['x', 'y', '-R', 'bar', '--debugger'])
     >>> get([b'--unknown', b'--cwd=foo', b'--', '--debugger'], gnu=False)
-    ([], ['--unknown', '--cwd=foo', '--debugger'])
+    ([], ['--unknown', '--cwd=foo', '--', '--debugger'])
 
     stripping early options (without loosing '--'):
 
@@ -141,6 +141,13 @@
     >>> get([b'-q', b'--'])
     ([('-q', '')], [])
 
+    '--' may be a value:
+
+    >>> get([b'-R', b'--', b'x'])
+    ([('-R', '--')], ['x'])
+    >>> get([b'--cwd', b'--', b'x'])
+    ([('--cwd', '--')], ['x'])
+
     value passed to bool options:
 
     >>> get([b'--debugger=foo', b'x'])
@@ -163,20 +170,16 @@
     >>> get([b'-', b'y'])
     ([], ['-', 'y'])
     """
-    # ignoring everything just after '--' isn't correct as '--' may be an
-    # option value (e.g. ['-R', '--']), but we do that consistently.
-    try:
-        argcount = args.index('--')
-    except ValueError:
-        argcount = len(args)
-
     parsedopts = []
     parsedargs = []
     pos = 0
-    while pos < argcount:
+    while pos < len(args):
         arg = args[pos]
+        if arg == '--':
+            pos += not keepsep
+            break
         flag, hasval, val, takeval = _earlyoptarg(arg, shortlist, namelist)
-        if not hasval and takeval and pos + 1 >= argcount:
+        if not hasval and takeval and pos + 1 >= len(args):
             # missing last argument
             break
         if not flag or hasval and not takeval:
@@ -195,38 +198,10 @@
             parsedopts.append((flag, args[pos + 1]))
             pos += 2
 
-    parsedargs.extend(args[pos:argcount])
-    parsedargs.extend(args[argcount + (not keepsep):])
+    parsedargs.extend(args[pos:])
     return parsedopts, parsedargs
 
-def gnugetopt(args, options, longoptions):
-    """Parse options mostly like getopt.gnu_getopt.
-
-    This is different from getopt.gnu_getopt in that an argument of - will
-    become an argument of - instead of vanishing completely.
-    """
-    extraargs = []
-    if '--' in args:
-        stopindex = args.index('--')
-        extraargs = args[stopindex + 1:]
-        args = args[:stopindex]
-    opts, parseargs = pycompat.getoptb(args, options, longoptions)
-    args = []
-    while parseargs:
-        arg = parseargs.pop(0)
-        if arg and arg[0:1] == '-' and len(arg) > 1:
-            parseargs.insert(0, arg)
-            topts, newparseargs = pycompat.getoptb(parseargs,\
-                                            options, longoptions)
-            opts = opts + topts
-            parseargs = newparseargs
-        else:
-            args.append(arg)
-    args.extend(extraargs)
-    return opts, args
-
-
-def fancyopts(args, options, state, gnu=False, early=False):
+def fancyopts(args, options, state, gnu=False, early=False, optaliases=None):
     """
     read args, parse options, and store options in state
 
@@ -246,8 +221,15 @@
       integer - parameter strings is stored as int
       function - call function with parameter
 
+    optaliases is a mapping from a canonical option name to a list of
+    additional long options. This exists for preserving backward compatibility
+    of early options. If we want to use it extensively, please consider moving
+    the functionality to the options table (e.g separate long options by '|'.)
+
     non-option args are returned
     """
+    if optaliases is None:
+        optaliases = {}
     namelist = []
     shortlist = ''
     argmap = {}
@@ -261,10 +243,13 @@
         else:
             short, name, default, comment = option
         # convert opts to getopt format
-        oname = name
+        onames = [name]
+        onames.extend(optaliases.get(name, []))
         name = name.replace('-', '_')
 
-        argmap['-' + short] = argmap['--' + oname] = name
+        argmap['-' + short] = name
+        for n in onames:
+            argmap['--' + n] = name
         defmap[name] = default
 
         # copy defaults to state
@@ -279,30 +264,30 @@
         if not (default is None or default is True or default is False):
             if short:
                 short += ':'
-            if oname:
-                oname += '='
-        elif oname not in nevernegate:
-            if oname.startswith('no-'):
-                insert = oname[3:]
-            else:
-                insert = 'no-' + oname
-            # backout (as a practical example) has both --commit and
-            # --no-commit options, so we don't want to allow the
-            # negations of those flags.
-            if insert not in alllong:
-                assert ('--' + oname) not in negations
-                negations['--' + insert] = '--' + oname
-                namelist.append(insert)
+            onames = [n + '=' for n in onames]
+        elif name not in nevernegate:
+            for n in onames:
+                if n.startswith('no-'):
+                    insert = n[3:]
+                else:
+                    insert = 'no-' + n
+                # backout (as a practical example) has both --commit and
+                # --no-commit options, so we don't want to allow the
+                # negations of those flags.
+                if insert not in alllong:
+                    assert ('--' + n) not in negations
+                    negations['--' + insert] = '--' + n
+                    namelist.append(insert)
         if short:
             shortlist += short
         if name:
-            namelist.append(oname)
+            namelist.extend(onames)
 
     # parse arguments
     if early:
         parse = functools.partial(earlygetopt, gnu=gnu)
     elif gnu:
-        parse = gnugetopt
+        parse = pycompat.gnugetoptb
     else:
         parse = pycompat.getoptb
     opts, args = parse(args, shortlist, namelist)
--- a/mercurial/filemerge.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/filemerge.py	Tue Dec 19 16:27:24 2017 -0500
@@ -241,6 +241,12 @@
     ui = repo.ui
     fd = fcd.path()
 
+    # Avoid prompting during an in-memory merge since it doesn't support merge
+    # conflicts.
+    if fcd.changectx().isinmemory():
+        raise error.InMemoryMergeConflictsError('in-memory merge does not '
+                                                'support file conflicts')
+
     prompts = partextras(labels)
     prompts['fd'] = fd
     try:
@@ -465,11 +471,10 @@
     a = _workingpath(repo, fcd)
     fd = fcd.path()
 
-    # Run ``flushall()`` to make any missing folders the following wwrite
-    # calls might be depending on.
     from . import context
     if isinstance(fcd, context.overlayworkingfilectx):
-        fcd.ctx().flushall()
+        raise error.InMemoryMergeConflictsError('in-memory merge does not '
+                                                'support the :dump tool.')
 
     util.writefile(a + ".local", fcd.decodeddata())
     repo.wwrite(fd + ".other", fco.data(), fco.flags())
@@ -688,10 +693,10 @@
         onfailure = _("merging %s failed!\n")
         precheck = None
 
-        # If using deferred writes, must flush any deferred contents if running
-        # an external merge tool since it has arbitrary access to the working
-        # copy.
-        wctx.flushall()
+        if wctx.isinmemory():
+            raise error.InMemoryMergeConflictsError('in-memory merge does not '
+                                                    'support external merge '
+                                                    'tools')
 
     toolconf = tool, toolpath, binary, symlink
 
@@ -710,6 +715,10 @@
     if precheck and not precheck(repo, mynode, orig, fcd, fco, fca,
                                  toolconf):
         if onfailure:
+            if wctx.isinmemory():
+                raise error.InMemoryMergeConflictsError('in-memory merge does '
+                                                        'not support merge '
+                                                        'conflicts')
             ui.warn(onfailure % fd)
         return True, 1, False
 
@@ -736,6 +745,10 @@
 
         if r:
             if onfailure:
+                if wctx.isinmemory():
+                    raise error.InMemoryMergeConflictsError('in-memory merge '
+                                                            'does not support '
+                                                            'merge conflicts')
                 ui.warn(onfailure % fd)
             _onfilemergefailure(ui)
 
--- a/mercurial/hbisect.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/hbisect.py	Tue Dec 19 16:27:24 2017 -0500
@@ -21,7 +21,7 @@
     error,
 )
 
-def bisect(changelog, state):
+def bisect(repo, state):
     """find the next node (if any) for testing during a bisect search.
     returns a (nodes, number, good) tuple.
 
@@ -32,33 +32,15 @@
     if searching for a first bad one.
     """
 
+    changelog = repo.changelog
     clparents = changelog.parentrevs
     skip = set([changelog.rev(n) for n in state['skip']])
 
     def buildancestors(bad, good):
-        # only the earliest bad revision matters
         badrev = min([changelog.rev(n) for n in bad])
-        goodrevs = [changelog.rev(n) for n in good]
-        goodrev = min(goodrevs)
-        # build visit array
-        ancestors = [None] * (len(changelog) + 1) # an extra for [-1]
-
-        # set nodes descended from goodrevs
-        for rev in goodrevs:
+        ancestors = collections.defaultdict(lambda: None)
+        for rev in repo.revs("descendants(%ln) - ancestors(%ln)", good, good):
             ancestors[rev] = []
-        for rev in changelog.revs(goodrev + 1):
-            for prev in clparents(rev):
-                if ancestors[prev] == []:
-                    ancestors[rev] = []
-
-        # clear good revs from array
-        for rev in goodrevs:
-            ancestors[rev] = None
-        for rev in changelog.revs(len(changelog), goodrev):
-            if ancestors[rev] is None:
-                for prev in clparents(rev):
-                    ancestors[prev] = None
-
         if ancestors[badrev] is None:
             return badrev, None
         return badrev, ancestors
--- a/mercurial/help.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/help.py	Tue Dec 19 16:27:24 2017 -0500
@@ -226,6 +226,7 @@
     (['color'], _("Colorizing Outputs"), loaddoc('color')),
     (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
     (["dates"], _("Date Formats"), loaddoc('dates')),
+    (["flags"], _("Command-line flags"), loaddoc('flags')),
     (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
     (['environment', 'env'], _('Environment Variables'),
      loaddoc('environment')),
@@ -452,7 +453,7 @@
                 rst.append(' :%s: %s\n' % (f, h[f]))
 
         ex = opts.get
-        anyopts = (ex('keyword') or not (ex('command') or ex('extension')))
+        anyopts = (ex(r'keyword') or not (ex(r'command') or ex(r'extension')))
         if not name and anyopts:
             exts = listexts(_('enabled extensions:'), extensions.enabled())
             if exts:
--- a/mercurial/help/config.txt	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/help/config.txt	Tue Dec 19 16:27:24 2017 -0500
@@ -1723,6 +1723,14 @@
 
 Controls generic server settings.
 
+``bookmarks-pushkey-compat``
+    Trigger pushkey hook when being pushed bookmark updates. This config exist
+    for compatibility purpose (default to True)
+
+    If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
+    movement we recommend you migrate them to ``txnclose-bookmark`` and
+    ``pretxnclose-bookmark``.
+
 ``compressionengines``
     List of compression engines and their relative priority to advertise
     to clients.
@@ -2176,6 +2184,8 @@
     (default: True)
 
 ``slash``
+    (Deprecated. Use ``slashpath`` template filter instead.)
+
     Display paths using a slash (``/``) as the path separator. This
     only makes a difference on systems where the default path
     separator is not the slash character (e.g. Windows uses the
@@ -2188,6 +2198,10 @@
 ``ssh``
     Command to use for SSH connections. (default: ``ssh``)
 
+``ssherrorhint``
+    A hint shown to the user in the case of SSH error (e.g.
+    ``Please see http://company/internalwiki/ssh.html``)
+
 ``strict``
     Require exact command names, instead of allowing unambiguous
     abbreviations. (default: False)
@@ -2211,6 +2225,10 @@
     The timeout used when a lock is held (in seconds), a negative value
     means no timeout. (default: 600)
 
+``timeout.warn``
+    Time (in seconds) before a warning is printed about held lock. A negative
+    value means no warning. (default: 0)
+
 ``traceback``
     Mercurial always prints a traceback when an unknown exception
     occurs. Setting this to True will make Mercurial print a traceback
@@ -2260,7 +2278,7 @@
 you want it to accept pushes from anybody, you can use the following
 command line::
 
-    $ hg --config web.allow_push=* --config web.push_ssl=False serve
+    $ hg --config web.allow-push=* --config web.push_ssl=False serve
 
 Note that this will allow anybody to push anything to the server and
 that this should not be used for public servers.
@@ -2287,16 +2305,16 @@
     revisions.
     (default: False)
 
-``allowpull``
+``allow-pull``
     Whether to allow pulling from the repository. (default: True)
 
-``allow_push``
+``allow-push``
     Whether to allow pushing to the repository. If empty or not set,
     pushing is not allowed. If the special value ``*``, any remote
     user can push, including unauthenticated users. Otherwise, the
     remote user must have been authenticated, and the authenticated
     user name must be present in this list. The contents of the
-    allow_push list are examined after the deny_push list.
+    allow-push list are examined after the deny_push list.
 
 ``allow_read``
     If the user has not already been denied repository access due to
@@ -2390,7 +2408,7 @@
     push is not denied. If the special value ``*``, all remote users are
     denied push. Otherwise, unauthenticated users are all denied, and
     any authenticated user name present in this list is also denied. The
-    contents of the deny_push list are examined before the allow_push list.
+    contents of the deny_push list are examined before the allow-push list.
 
 ``deny_read``
     Whether to deny reading/viewing of the repository. If this list is
@@ -2547,6 +2565,10 @@
 directory updates in parallel on Unix-like systems, which greatly
 helps performance.
 
+``enabled``
+    Whether to enable workers code to be used.
+    (default: true)
+
 ``numcpus``
     Number of CPUs to use for parallel operations. A zero or
     negative value is treated as ``use the default``.
--- a/mercurial/help/environment.txt	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/help/environment.txt	Tue Dec 19 16:27:24 2017 -0500
@@ -73,6 +73,8 @@
 
     ``alias``
         Don't remove aliases.
+    ``color``
+        Don't disable colored output.
     ``i18n``
         Preserve internationalization.
     ``revsetalias``
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/help/flags.txt	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,104 @@
+Most Mercurial commands accept various flags.
+
+Flag names
+==========
+
+Flags for each command are listed in :hg:`help` for that command.
+Additionally, some flags, such as --repository, are global and can be used with
+any command - those are seen in :hg:`help -v`, and can be specified before or
+after the command.
+
+Every flag has at least a long name, such as --repository. Some flags may also
+have a short one-letter name, such as the equivalent -R. Using the short or long
+name is equivalent and has the same effect.
+
+Flags that have a short name can also be bundled together - for instance, to
+specify both --edit (short -e) and --interactive (short -i), one could use::
+
+    hg commit -ei
+
+If any of the bundled flags takes a value (i.e. is not a boolean), it must be
+last, followed by the value::
+
+    hg commit -im 'Message'
+
+Flag types
+==========
+
+Mercurial command-line flags can be strings, numbers, booleans, or lists of
+strings.
+
+Specifying flag values
+======================
+
+The following syntaxes are allowed, assuming a flag 'flagname' with short name
+'f'::
+
+    --flagname=foo
+    --flagname foo
+    -f foo
+    -ffoo
+
+This syntax applies to all non-boolean flags (strings, numbers or lists).
+
+Specifying boolean flags
+========================
+
+Boolean flags do not take a value parameter. To specify a boolean, use the flag
+name to set it to true, or the same name prefixed with 'no-' to set it to
+false::
+
+    hg commit --interactive
+    hg commit --no-interactive
+
+Specifying list flags
+=====================
+
+List flags take multiple values. To specify them, pass the flag multiple times::
+
+    hg files --include mercurial --include tests
+
+Setting flag defaults
+=====================
+
+In order to set a default value for a flag in an hgrc file, it is recommended to
+use aliases::
+
+    [alias]
+    commit = commit --interactive
+
+For more information on hgrc files, see :hg:`help config`.
+
+Overriding flags on the command line
+====================================
+
+If the same non-list flag is specified multiple times on the command line, the
+latest specification is used::
+
+    hg commit -m "Ignored value" -m "Used value"
+
+This includes the use of aliases - e.g., if one has::
+
+    [alias]
+    committemp = commit -m "Ignored value"
+
+then the following command will override that -m::
+
+    hg committemp -m "Used value"
+
+Overriding flag defaults
+========================
+
+Every flag has a default value, and you may also set your own defaults in hgrc
+as described above.
+Except for list flags, defaults can be overridden on the command line simply by
+specifying the flag in that location.
+
+Hidden flags
+============
+
+Some flags are not shown in a command's help by default - specifically, those
+that are deemed to be experimental, deprecated or advanced. To show all flags,
+add the --verbose flag for the help command::
+
+    hg help --verbose commit
--- a/mercurial/help/internals/wireprotocol.txt	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/help/internals/wireprotocol.txt	Tue Dec 19 16:27:24 2017 -0500
@@ -731,6 +731,8 @@
 cbattempted
    Boolean indicating whether the client attempted to use the *clone bundles*
    feature before performing this request.
+bookmarks
+   Boolean indicating whether bookmark data is requested.
 phases
    Boolean indicating whether phases data is requested.
 
--- a/mercurial/hg.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/hg.py	Tue Dec 19 16:27:24 2017 -0500
@@ -28,6 +28,7 @@
     httppeer,
     localrepo,
     lock,
+    logexchange,
     merge as mergemod,
     node,
     phases,
@@ -689,6 +690,9 @@
 
             destrepo.ui.setconfig('paths', 'default', defaulturl, 'clone')
 
+            if ui.configbool('experimental', 'remotenames'):
+                logexchange.pullremotenames(destrepo, srcpeer)
+
             if update:
                 if update is not True:
                     checkout = srcpeer.lookup(update)
@@ -912,8 +916,13 @@
     return _incoming(display, subreporecurse, ui, repo, source, opts)
 
 def _outgoing(ui, repo, dest, opts):
-    dest = ui.expandpath(dest or 'default-push', dest or 'default')
-    dest, branches = parseurl(dest, opts.get('branch'))
+    path = ui.paths.getpath(dest, default=('default-push', 'default'))
+    if not path:
+        raise error.Abort(_('default repository not configured!'),
+                hint=_("see 'hg help config.paths'"))
+    dest = path.pushloc or path.loc
+    branches = path.branch, opts.get('branch') or []
+
     ui.status(_('comparing with %s\n') % util.hidepassword(dest))
     revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev'))
     if revs:
--- a/mercurial/hgweb/common.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/hgweb/common.py	Tue Dec 19 16:27:24 2017 -0500
@@ -75,7 +75,7 @@
     if deny and (not user or ismember(hgweb.repo.ui, user, deny)):
         raise ErrorResponse(HTTP_UNAUTHORIZED, 'push not authorized')
 
-    allow = hgweb.configlist('web', 'allow_push')
+    allow = hgweb.configlist('web', 'allow-push')
     if not (allow and ismember(hgweb.repo.ui, user, allow)):
         raise ErrorResponse(HTTP_UNAUTHORIZED, 'push not authorized')
 
--- a/mercurial/hgweb/hgweb_mod.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/hgweb/hgweb_mod.py	Tue Dec 19 16:27:24 2017 -0500
@@ -114,7 +114,7 @@
         self.stripecount = self.configint('web', 'stripes')
         self.maxshortchanges = self.configint('web', 'maxshortchanges')
         self.maxfiles = self.configint('web', 'maxfiles')
-        self.allowpull = self.configbool('web', 'allowpull')
+        self.allowpull = self.configbool('web', 'allow-pull')
 
         # we use untrusted=False to prevent a repo owner from using
         # web.templates in .hg/hgrc to get access to any file readable
--- a/mercurial/hgweb/webcommands.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/hgweb/webcommands.py	Tue Dec 19 16:27:24 2017 -0500
@@ -36,9 +36,7 @@
     revsetlang,
     scmutil,
     smartset,
-    templatefilters,
     templater,
-    url,
     util,
 )
 
@@ -415,7 +413,7 @@
     else:
         nextentry = []
 
-    return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav,
+    return tmpl('shortlog' if shortlog else 'changelog', changenav=changenav,
                 node=ctx.hex(), rev=pos, symrev=symrev, changesets=count,
                 entries=entries,
                 latestentry=latestentry, nextentry=nextentry,
@@ -1178,11 +1176,16 @@
     Information rendered by this handler can be used to create visual
     representations of repository topology.
 
-    The ``revision`` URL parameter controls the starting changeset.
+    The ``revision`` URL parameter controls the starting changeset. If it's
+    absent, the default is ``tip``.
 
     The ``revcount`` query string argument can define the number of changesets
     to show information for.
 
+    The ``graphtop`` query string argument can specify the starting changeset
+    for producing ``jsdata`` variable that is used for rendering graph in
+    JavaScript. By default it has the same value as ``revision``.
+
     This handler will render the ``graph`` template.
     """
 
@@ -1209,6 +1212,10 @@
     morevars = copy.copy(tmpl.defaults['sessionvars'])
     morevars['revcount'] = revcount * 2
 
+    graphtop = req.form.get('graphtop', [ctx.hex()])[0]
+    graphvars = copy.copy(tmpl.defaults['sessionvars'])
+    graphvars['graphtop'] = graphtop
+
     count = len(web.repo)
     pos = rev
 
@@ -1217,94 +1224,76 @@
     changenav = webutil.revnav(web.repo).gen(pos, revcount, count)
 
     tree = []
+    nextentry = []
+    lastrev = 0
     if pos != -1:
         allrevs = web.repo.changelog.revs(pos, 0)
         revs = []
         for i in allrevs:
             revs.append(i)
-            if len(revs) >= revcount:
+            if len(revs) >= revcount + 1:
                 break
 
+        if len(revs) > revcount:
+            nextentry = [webutil.commonentry(web.repo, web.repo[revs[-1]])]
+            revs = revs[:-1]
+
+        lastrev = revs[-1]
+
         # We have to feed a baseset to dagwalker as it is expecting smartset
         # object. This does not have a big impact on hgweb performance itself
         # since hgweb graphing code is not itself lazy yet.
         dag = graphmod.dagwalker(web.repo, smartset.baseset(revs))
         # As we said one line above... not lazy.
-        tree = list(graphmod.colored(dag, web.repo))
-
-    def getcolumns(tree):
-        cols = 0
-        for (id, type, ctx, vtx, edges) in tree:
-            if type != graphmod.CHANGESET:
-                continue
-            cols = max(cols, max([edge[0] for edge in edges] or [0]),
-                             max([edge[1] for edge in edges] or [0]))
-        return cols
-
-    def graphdata(usetuples, encodestr):
-        data = []
+        tree = list(item for item in graphmod.colored(dag, web.repo)
+                    if item[1] == graphmod.CHANGESET)
 
-        row = 0
-        for (id, type, ctx, vtx, edges) in tree:
-            if type != graphmod.CHANGESET:
-                continue
-            node = pycompat.bytestr(ctx)
-            age = encodestr(templatefilters.age(ctx.date()))
-            desc = templatefilters.firstline(encodestr(ctx.description()))
-            desc = url.escape(templatefilters.nonempty(desc))
-            user = url.escape(templatefilters.person(encodestr(ctx.user())))
-            branch = url.escape(encodestr(ctx.branch()))
-            try:
-                branchnode = web.repo.branchtip(branch)
-            except error.RepoLookupError:
-                branchnode = None
-            branch = branch, branchnode == ctx.node()
+    def fulltree():
+        pos = web.repo[graphtop].rev()
+        tree = []
+        if pos != -1:
+            revs = web.repo.changelog.revs(pos, lastrev)
+            dag = graphmod.dagwalker(web.repo, smartset.baseset(revs))
+            tree = list(item for item in graphmod.colored(dag, web.repo)
+                        if item[1] == graphmod.CHANGESET)
+        return tree
+
+    def jsdata():
+        return [{'node': pycompat.bytestr(ctx),
+                 'vertex': vtx,
+                 'edges': edges}
+                for (id, type, ctx, vtx, edges) in fulltree()]
 
-            if usetuples:
-                data.append((node, vtx, edges, desc, user, age, branch,
-                             [url.escape(encodestr(x)) for x in ctx.tags()],
-                             [url.escape(encodestr(x))
-                              for x in ctx.bookmarks()]))
-            else:
-                edgedata = [{'col': edge[0], 'nextcol': edge[1],
-                             'color': (edge[2] - 1) % 6 + 1,
-                             'width': edge[3], 'bcolor': edge[4]}
-                            for edge in edges]
+    def nodes():
+        for row, (id, type, ctx, vtx, edges) in enumerate(tree):
+            entry = webutil.commonentry(web.repo, ctx)
+            edgedata = [{'col': edge[0],
+                         'nextcol': edge[1],
+                         'color': (edge[2] - 1) % 6 + 1,
+                         'width': edge[3],
+                         'bcolor': edge[4]}
+                        for edge in edges]
 
-                data.append(
-                    {'node': node,
-                     'col': vtx[0],
-                     'color': (vtx[1] - 1) % 6 + 1,
-                     'edges': edgedata,
-                     'row': row,
-                     'nextrow': row + 1,
-                     'desc': desc,
-                     'user': user,
-                     'age': age,
-                     'bookmarks': webutil.nodebookmarksdict(
-                         web.repo, ctx.node()),
-                     'branches': webutil.nodebranchdict(web.repo, ctx),
-                     'inbranch': webutil.nodeinbranch(web.repo, ctx),
-                     'tags': webutil.nodetagsdict(web.repo, ctx.node())})
+            entry.update({'col': vtx[0],
+                          'color': (vtx[1] - 1) % 6 + 1,
+                          'edges': edgedata,
+                          'row': row,
+                          'nextrow': row + 1})
 
-            row += 1
-
-        return data
+            yield entry
 
-    cols = getcolumns(tree)
     rows = len(tree)
-    canvasheight = (rows + 1) * bg_height - 27
 
     return tmpl('graph', rev=rev, symrev=symrev, revcount=revcount,
                 uprev=uprev,
                 lessvars=lessvars, morevars=morevars, downrev=downrev,
-                cols=cols, rows=rows,
-                canvaswidth=(cols + 1) * bg_height,
-                truecanvasheight=rows * bg_height,
-                canvasheight=canvasheight, bg_height=bg_height,
-                # {jsdata} will be passed to |json, so it must be in utf-8
-                jsdata=lambda **x: graphdata(True, encoding.fromlocal),
-                nodes=lambda **x: graphdata(False, pycompat.bytestr),
+                graphvars=graphvars,
+                rows=rows,
+                bg_height=bg_height,
+                changesets=count,
+                nextentry=nextentry,
+                jsdata=lambda **x: jsdata(),
+                nodes=lambda **x: nodes(),
                 node=ctx.hex(), changenav=changenav)
 
 def _getdoc(e):
--- a/mercurial/hgweb/webutil.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/hgweb/webutil.py	Tue Dec 19 16:27:24 2017 -0500
@@ -361,6 +361,8 @@
         'date': ctx.date(),
         'extra': ctx.extra(),
         'phase': ctx.phasestr(),
+        'obsolete': ctx.obsolete(),
+        'instabilities': [{"instability": i} for i in ctx.instabilities()],
         'branch': nodebranchnodefault(ctx),
         'inbranch': nodeinbranch(repo, ctx),
         'branches': nodebranchdict(repo, ctx),
@@ -409,7 +411,7 @@
     files = []
     parity = paritygen(web.stripecount)
     for blockno, f in enumerate(ctx.files()):
-        template = f in ctx and 'filenodelink' or 'filenolink'
+        template = 'filenodelink' if f in ctx else 'filenolink'
         files.append(tmpl(template,
                           node=ctx.hex(), file=f, blockno=blockno + 1,
                           parity=next(parity)))
@@ -571,7 +573,7 @@
 
     fileno = 0
     for filename, adds, removes, isbinary in stats:
-        template = filename in files and 'diffstatlink' or 'diffstatnolink'
+        template = 'diffstatlink' if filename in files else 'diffstatnolink'
         total = adds + removes
         fileno += 1
         yield tmpl(template, node=ctx.hex(), file=filename, fileno=fileno,
--- a/mercurial/hook.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/hook.py	Tue Dec 19 16:27:24 2017 -0500
@@ -91,7 +91,7 @@
     starttime = util.timer()
 
     try:
-        r = obj(ui=ui, repo=repo, hooktype=htype, **args)
+        r = obj(ui=ui, repo=repo, hooktype=htype, **pycompat.strkwargs(args))
     except Exception as exc:
         if isinstance(exc, error.Abort):
             ui.warn(_('error: %s hook failed: %s\n') %
--- a/mercurial/httpconnection.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/httpconnection.py	Tue Dec 19 16:27:24 2017 -0500
@@ -248,7 +248,7 @@
             return self.https_open(req)
         def makehttpcon(*args, **kwargs):
             k2 = dict(kwargs)
-            k2['use_ssl'] = False
+            k2[r'use_ssl'] = False
             return HTTPConnection(*args, **k2)
         return self.do_open(makehttpcon, req, False)
 
@@ -288,8 +288,8 @@
             if '[' in host:
                 host = host[1:-1]
 
-        kwargs['keyfile'] = keyfile
-        kwargs['certfile'] = certfile
+        kwargs[r'keyfile'] = keyfile
+        kwargs[r'certfile'] = certfile
 
         con = HTTPConnection(host, port, use_ssl=True,
                              ssl_wrap_socket=sslutil.wrapsocket,
--- a/mercurial/httppeer.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/httppeer.py	Tue Dec 19 16:27:24 2017 -0500
@@ -204,6 +204,7 @@
         self._caps = set(self._call('capabilities').split())
 
     def _callstream(self, cmd, _compressible=False, **args):
+        args = pycompat.byteskwargs(args)
         if cmd == 'pushkey':
             args['data'] = ''
         data = args.pop('data', None)
@@ -222,7 +223,7 @@
             if not data:
                 data = strargs
             else:
-                if isinstance(data, basestring):
+                if isinstance(data, bytes):
                     i = io.BytesIO(data)
                     i.length = len(data)
                     data = i
--- a/mercurial/keepalive.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/keepalive.py	Tue Dec 19 16:27:24 2017 -0500
@@ -322,7 +322,7 @@
                 data = urllibcompat.getdata(req)
                 h.putrequest(
                     req.get_method(), urllibcompat.getselector(req),
-                    **skipheaders)
+                    **pycompat.strkwargs(skipheaders))
                 if 'content-type' not in headers:
                     h.putheader('Content-type',
                                 'application/x-www-form-urlencoded')
@@ -331,7 +331,7 @@
             else:
                 h.putrequest(
                     req.get_method(), urllibcompat.getselector(req),
-                    **skipheaders)
+                    **pycompat.strkwargs(skipheaders))
         except socket.error as err:
             raise urlerr.urlerror(err)
         for k, v in headers.items():
@@ -366,8 +366,8 @@
     def __init__(self, sock, debuglevel=0, strict=0, method=None):
         extrakw = {}
         if not pycompat.ispy3:
-            extrakw['strict'] = True
-            extrakw['buffering'] = True
+            extrakw[r'strict'] = True
+            extrakw[r'buffering'] = True
         httplib.HTTPResponse.__init__(self, sock, debuglevel=debuglevel,
                                       method=method, **extrakw)
         self.fileno = sock.fileno
--- a/mercurial/localrepo.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/localrepo.py	Tue Dec 19 16:27:24 2017 -0500
@@ -364,11 +364,14 @@
         self.root = self.wvfs.base
         self.path = self.wvfs.join(".hg")
         self.origroot = path
-        # These auditor are not used by the vfs,
-        # only used when writing this comment: basectx.match
-        self.auditor = pathutil.pathauditor(self.root, self._checknested)
-        self.nofsauditor = pathutil.pathauditor(self.root, self._checknested,
-                                                realfs=False, cached=True)
+        # This is only used by context.workingctx.match in order to
+        # detect files in subrepos.
+        self.auditor = pathutil.pathauditor(
+            self.root, callback=self._checknested)
+        # This is only used by context.basectx.match in order to detect
+        # files in subrepos.
+        self.nofsauditor = pathutil.pathauditor(
+            self.root, callback=self._checknested, realfs=False, cached=True)
         self.baseui = baseui
         self.ui = baseui.copy()
         self.ui.copy = baseui.copy # prevent copying repo configuration
@@ -499,9 +502,6 @@
         # post-dirstate-status hooks
         self._postdsstatus = []
 
-        # Cache of types representing filtered repos.
-        self._filteredrepotypes = weakref.WeakKeyDictionary()
-
         # generic mapping between names and nodes
         self.names = namespaces.namespaces()
 
@@ -677,21 +677,8 @@
 
     def filtered(self, name):
         """Return a filtered version of a repository"""
-        # Python <3.4 easily leaks types via __mro__. See
-        # https://bugs.python.org/issue17950. We cache dynamically
-        # created types so this method doesn't leak on every
-        # invocation.
-
-        key = self.unfiltered().__class__
-        if key not in self._filteredrepotypes:
-            # Build a new type with the repoview mixin and the base
-            # class of this repo. Give it a name containing the
-            # filter name to aid debugging.
-            bases = (repoview.repoview, key)
-            cls = type(r'%sfilteredrepo' % name, bases, {})
-            self._filteredrepotypes[key] = cls
-
-        return self._filteredrepotypes[key](self, name)
+        cls = repoview.newtype(self.unfiltered().__class__)
+        return cls(self, name)
 
     @repofilecache('bookmarks', 'bookmarks.current')
     def _bookmarks(self):
@@ -701,8 +688,8 @@
     def _activebookmark(self):
         return self._bookmarks.active
 
-    # _phaserevs and _phasesets depend on changelog. what we need is to
-    # call _phasecache.invalidate() if '00changelog.i' was changed, but it
+    # _phasesets depend on changelog. what we need is to call
+    # _phasecache.invalidate() if '00changelog.i' was changed, but it
     # can't be easily expressed in filecache mechanism.
     @storecache('phaseroots', '00changelog.i')
     def _phasecache(self):
@@ -1244,6 +1231,8 @@
             # gating.
             tracktags(tr2)
             repo = reporef()
+            if repo.ui.configbool('experimental', 'single-head-per-branch'):
+                scmutil.enforcesinglehead(repo, tr2, desc)
             if hook.hashook(repo.ui, 'pretxnclose-bookmark'):
                 for name, (old, new) in sorted(tr.changes['bookmarks'].items()):
                     args = tr.hookargs.copy()
@@ -1286,7 +1275,7 @@
                                      validator=validate,
                                      releasefn=releasefn,
                                      checkambigfiles=_cachedfiles)
-        tr.changes['revs'] = set()
+        tr.changes['revs'] = xrange(0, 0)
         tr.changes['obsmarkers'] = set()
         tr.changes['phases'] = {}
         tr.changes['bookmarks'] = {}
@@ -1587,29 +1576,18 @@
         # determine whether it can be inherited
         if parentenvvar is not None:
             parentlock = encoding.environ.get(parentenvvar)
-        try:
-            l = lockmod.lock(vfs, lockname, 0, releasefn=releasefn,
-                             acquirefn=acquirefn, desc=desc,
-                             inheritchecker=inheritchecker,
-                             parentlock=parentlock)
-        except error.LockHeld as inst:
-            if not wait:
-                raise
-            # show more details for new-style locks
-            if ':' in inst.locker:
-                host, pid = inst.locker.split(":", 1)
-                self.ui.warn(
-                    _("waiting for lock on %s held by process %r "
-                      "on host %r\n") % (desc, pid, host))
-            else:
-                self.ui.warn(_("waiting for lock on %s held by %r\n") %
-                             (desc, inst.locker))
-            # default to 600 seconds timeout
-            l = lockmod.lock(vfs, lockname,
-                             int(self.ui.config("ui", "timeout")),
-                             releasefn=releasefn, acquirefn=acquirefn,
-                             desc=desc)
-            self.ui.warn(_("got lock after %s seconds\n") % l.delay)
+
+        timeout = 0
+        warntimeout = 0
+        if wait:
+            timeout = self.ui.configint("ui", "timeout")
+            warntimeout = self.ui.configint("ui", "timeout.warn")
+
+        l = lockmod.trylock(self.ui, vfs, lockname, timeout, warntimeout,
+                            releasefn=releasefn,
+                            acquirefn=acquirefn, desc=desc,
+                            inheritchecker=inheritchecker,
+                            parentlock=parentlock)
         return l
 
     def _afterlock(self, callback):
--- a/mercurial/lock.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/lock.py	Tue Dec 19 16:27:24 2017 -0500
@@ -14,6 +14,8 @@
 import time
 import warnings
 
+from .i18n import _
+
 from . import (
     encoding,
     error,
@@ -39,6 +41,58 @@
                 raise
     return result
 
+def trylock(ui, vfs, lockname, timeout, warntimeout, *args, **kwargs):
+    """return an acquired lock or raise an a LockHeld exception
+
+    This function is responsible to issue warnings and or debug messages about
+    the held lock while trying to acquires it."""
+
+    def printwarning(printer, locker):
+        """issue the usual "waiting on lock" message through any channel"""
+        # show more details for new-style locks
+        if ':' in locker:
+            host, pid = locker.split(":", 1)
+            msg = _("waiting for lock on %s held by process %r "
+                    "on host %r\n") % (l.desc, pid, host)
+        else:
+            msg = _("waiting for lock on %s held by %r\n") % (l.desc, locker)
+        printer(msg)
+
+    l = lock(vfs, lockname, 0, *args, dolock=False, **kwargs)
+
+    debugidx = 0 if (warntimeout and timeout) else -1
+    warningidx = 0
+    if not timeout:
+        warningidx = -1
+    elif warntimeout:
+        warningidx = warntimeout
+
+    delay = 0
+    while True:
+        try:
+            l._trylock()
+            break
+        except error.LockHeld as inst:
+            if delay == debugidx:
+                printwarning(ui.debug, inst.locker)
+            if delay == warningidx:
+                printwarning(ui.warn, inst.locker)
+            if timeout <= delay:
+                raise error.LockHeld(errno.ETIMEDOUT, inst.filename,
+                                     l.desc, inst.locker)
+            time.sleep(1)
+            delay += 1
+
+    l.delay = delay
+    if l.delay:
+        if 0 <= warningidx <= l.delay:
+            ui.warn(_("got lock after %s seconds\n") % l.delay)
+        else:
+            ui.debug("got lock after %s seconds\n" % l.delay)
+    if l.acquirefn:
+        l.acquirefn()
+    return l
+
 class lock(object):
     '''An advisory lock held by one process to control access to a set
     of files.  Non-cooperating processes or incorrectly written scripts
@@ -60,7 +114,8 @@
     _host = None
 
     def __init__(self, vfs, file, timeout=-1, releasefn=None, acquirefn=None,
-                 desc=None, inheritchecker=None, parentlock=None):
+                 desc=None, inheritchecker=None, parentlock=None,
+                 dolock=True):
         self.vfs = vfs
         self.f = file
         self.held = 0
@@ -74,9 +129,10 @@
         self._inherited = False
         self.postrelease  = []
         self.pid = self._getpid()
-        self.delay = self.lock()
-        if self.acquirefn:
-            self.acquirefn()
+        if dolock:
+            self.delay = self.lock()
+            if self.acquirefn:
+                self.acquirefn()
 
     def __enter__(self):
         return self
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/logexchange.py	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,118 @@
+# logexchange.py
+#
+# Copyright 2017 Augie Fackler <raf@durin42.com>
+# Copyright 2017 Sean Farley <sean@farley.io>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from __future__ import absolute_import
+
+from .node import hex
+
+from . import (
+    vfs as vfsmod,
+)
+
+# directory name in .hg/ in which remotenames files will be present
+remotenamedir = 'logexchange'
+
+def readremotenamefile(repo, filename):
+    """
+    reads a file from .hg/logexchange/ directory and yields it's content
+    filename: the file to be read
+    yield a tuple (node, remotepath, name)
+    """
+
+    vfs = vfsmod.vfs(repo.vfs.join(remotenamedir))
+    if not vfs.exists(filename):
+        return
+    f = vfs(filename)
+    lineno = 0
+    for line in f:
+        line = line.strip()
+        if not line:
+            continue
+        # contains the version number
+        if lineno == 0:
+            lineno += 1
+        try:
+            node, remote, rname = line.split('\0')
+            yield node, remote, rname
+        except ValueError:
+            pass
+
+    f.close()
+
+def readremotenames(repo):
+    """
+    read the details about the remotenames stored in .hg/logexchange/ and
+    yields a tuple (node, remotepath, name). It does not yields information
+    about whether an entry yielded is branch or bookmark. To get that
+    information, call the respective functions.
+    """
+
+    for bmentry in readremotenamefile(repo, 'bookmarks'):
+        yield bmentry
+    for branchentry in readremotenamefile(repo, 'branches'):
+        yield branchentry
+
+def writeremotenamefile(repo, remotepath, names, nametype):
+    vfs = vfsmod.vfs(repo.vfs.join(remotenamedir))
+    f = vfs(nametype, 'w', atomictemp=True)
+    # write the storage version info on top of file
+    # version '0' represents the very initial version of the storage format
+    f.write('0\n\n')
+
+    olddata = set(readremotenamefile(repo, nametype))
+    # re-save the data from a different remote than this one.
+    for node, oldpath, rname in sorted(olddata):
+        if oldpath != remotepath:
+            f.write('%s\0%s\0%s\n' % (node, oldpath, rname))
+
+    for name, node in sorted(names.iteritems()):
+        if nametype == "branches":
+            for n in node:
+                f.write('%s\0%s\0%s\n' % (n, remotepath, name))
+        elif nametype == "bookmarks":
+            if node:
+                f.write('%s\0%s\0%s\n' % (node, remotepath, name))
+
+    f.close()
+
+def saveremotenames(repo, remotepath, branches=None, bookmarks=None):
+    """
+    save remotenames i.e. remotebookmarks and remotebranches in their
+    respective files under ".hg/logexchange/" directory.
+    """
+    wlock = repo.wlock()
+    try:
+        if bookmarks:
+            writeremotenamefile(repo, remotepath, bookmarks, 'bookmarks')
+        if branches:
+            writeremotenamefile(repo, remotepath, branches, 'branches')
+    finally:
+        wlock.release()
+
+def pullremotenames(localrepo, remoterepo):
+    """
+    pulls bookmarks and branches information of the remote repo during a
+    pull or clone operation.
+    localrepo is our local repository
+    remoterepo is the peer instance
+    """
+    remotepath = remoterepo.url()
+    bookmarks = remoterepo.listkeys('bookmarks')
+    # on a push, we don't want to keep obsolete heads since
+    # they won't show up as heads on the next pull, so we
+    # remove them here otherwise we would require the user
+    # to issue a pull to refresh the storage
+    bmap = {}
+    repo = localrepo.unfiltered()
+    for branch, nodes in remoterepo.branchmap().iteritems():
+        bmap[branch] = []
+        for node in nodes:
+            if node in repo and not repo[node].obsolete():
+                bmap[branch].append(hex(node))
+
+    saveremotenames(localrepo, remotepath, bmap, bookmarks)
--- a/mercurial/mail.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/mail.py	Tue Dec 19 16:27:24 2017 -0500
@@ -152,7 +152,7 @@
     fp = open(mbox, 'ab+')
     # Should be time.asctime(), but Windows prints 2-characters day
     # of month instead of one. Make them print the same thing.
-    date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime())
+    date = time.strftime(r'%a %b %d %H:%M:%S %Y', time.localtime())
     fp.write('From %s %s\n' % (sender, date))
     fp.write(msg)
     fp.write('\n\n')
--- a/mercurial/match.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/match.py	Tue Dec 19 16:27:24 2017 -0500
@@ -305,9 +305,6 @@
         Returns the string 'all' if the given directory and all subdirectories
         should be visited. Otherwise returns True or False indicating whether
         the given directory should be visited.
-
-        This function's behavior is undefined if it has returned False for
-        one of the dir's parent directories.
         '''
         return True
 
--- a/mercurial/mdiff.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/mdiff.py	Tue Dec 19 16:27:24 2017 -0500
@@ -67,6 +67,7 @@
         'ignoreblanklines': False,
         'upgrade': False,
         'showsimilarity': False,
+        'worddiff': False,
         }
 
     def __init__(self, **opts):
--- a/mercurial/merge.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/merge.py	Tue Dec 19 16:27:24 2017 -0500
@@ -646,6 +646,14 @@
     return config
 
 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
+    if wctx.isinmemory():
+        # Nothing to do in IMM because nothing in the "working copy" can be an
+        # unknown file.
+        #
+        # Note that we should bail out here, not in ``_checkunknownfiles()``,
+        # because that function does other useful work.
+        return False
+
     if f2 is None:
         f2 = f
     return (repo.wvfs.audit.check(f)
@@ -674,7 +682,11 @@
         # updated with any new dirs that are checked and found to be absent.
         self._missingdircache = set()
 
-    def __call__(self, repo, f):
+    def __call__(self, repo, wctx, f):
+        if wctx.isinmemory():
+            # Nothing to do in IMM for the same reason as ``_checkunknownfile``.
+            return False
+
         # Check for path prefixes that exist as unknown files.
         for p in reversed(list(util.finddirs(f))):
             if p in self._missingdircache:
@@ -726,7 +738,7 @@
                 if _checkunknownfile(repo, wctx, mctx, f):
                     fileconflicts.add(f)
                 elif pathconfig and f not in wctx:
-                    path = checkunknowndirs(repo, f)
+                    path = checkunknowndirs(repo, wctx, f)
                     if path is not None:
                         pathconflicts.add(path)
             elif m == 'dg':
@@ -1333,10 +1345,6 @@
         repo.ui.warn(_("current directory was removed\n"
                        "(consider changing to repo root: %s)\n") % repo.root)
 
-    # It's necessary to flush here in case we're inside a worker fork and will
-    # quit after this function.
-    wctx.flushall()
-
 def batchget(repo, mctx, wctx, actions):
     """apply gets to the working directory
 
@@ -1376,9 +1384,6 @@
     if i > 0:
         yield i, f
 
-    # It's necessary to flush here in case we're inside a worker fork and will
-    # quit after this function.
-    wctx.flushall()
 
 def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None):
     """apply the merge action list to the working directory
@@ -1479,10 +1484,6 @@
         z += 1
         progress(_updating, z, item=f, total=numupdates, unit=_files)
 
-    # We should flush before forking into worker processes, since those workers
-    # flush when they complete, and we don't want to duplicate work.
-    wctx.flushall()
-
     # get in parallel
     prog = worker.worker(repo.ui, cost, batchget, (repo, mctx, wctx),
                          actions['g'])
@@ -1850,8 +1851,9 @@
             if not force and (wc.files() or wc.deleted()):
                 raise error.Abort(_("uncommitted changes"),
                                  hint=_("use 'hg status' to list changes"))
-            for s in sorted(wc.substate):
-                wc.sub(s).bailifchanged()
+            if not wc.isinmemory():
+                for s in sorted(wc.substate):
+                    wc.sub(s).bailifchanged()
 
         elif not overwrite:
             if p1 == p2: # no-op update
@@ -1966,7 +1968,7 @@
         ### apply phase
         if not branchmerge: # just jump to the new rev
             fp1, fp2, xp1, xp2 = fp2, nullid, xp2, ''
-        if not partial:
+        if not partial and not wc.isinmemory():
             repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
             # note that we're in the middle of an update
             repo.vfs.write('updatestate', p2.hex())
@@ -2004,9 +2006,8 @@
                   'see "hg help -e fsmonitor")\n'))
 
         stats = applyupdates(repo, actions, wc, p2, overwrite, labels=labels)
-        wc.flushall()
 
-        if not partial:
+        if not partial and not wc.isinmemory():
             with repo.dirstate.parentchange():
                 repo.setparents(fp1, fp2)
                 recordupdates(repo, actions, branchmerge)
--- a/mercurial/namespaces.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/namespaces.py	Tue Dec 19 16:27:24 2017 -0500
@@ -25,6 +25,7 @@
 
     def __init__(self):
         self._names = util.sortdict()
+        columns = templatekw.getlogcolumns()
 
         # we need current mercurial named objects (bookmarks, tags, and
         # branches) to be initialized somewhere, so that place is here
@@ -32,8 +33,7 @@
         bmknamemap = lambda repo, name: tolist(repo._bookmarks.get(name))
         bmknodemap = lambda repo, node: repo.nodebookmarks(node)
         n = namespace("bookmarks", templatename="bookmark",
-                      # i18n: column positioning for "hg log"
-                      logfmt=_("bookmark:    %s\n"),
+                      logfmt=columns['bookmark'],
                       listnames=bmknames,
                       namemap=bmknamemap, nodemap=bmknodemap,
                       builtin=True)
@@ -43,8 +43,7 @@
         tagnamemap = lambda repo, name: tolist(repo._tagscache.tags.get(name))
         tagnodemap = lambda repo, node: repo.nodetags(node)
         n = namespace("tags", templatename="tag",
-                      # i18n: column positioning for "hg log"
-                      logfmt=_("tag:         %s\n"),
+                      logfmt=columns['tag'],
                       listnames=tagnames,
                       namemap=tagnamemap, nodemap=tagnodemap,
                       deprecated={'tip'},
@@ -55,8 +54,7 @@
         bnamemap = lambda repo, name: tolist(repo.branchtip(name, True))
         bnodemap = lambda repo, node: [repo[node].branch()]
         n = namespace("branches", templatename="branch",
-                      # i18n: column positioning for "hg log"
-                      logfmt=_("branch:      %s\n"),
+                      logfmt=columns['branch'],
                       listnames=bnames,
                       namemap=bnamemap, nodemap=bnodemap,
                       builtin=True)
--- a/mercurial/obsolete.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/obsolete.py	Tue Dec 19 16:27:24 2017 -0500
@@ -776,7 +776,7 @@
     # rely on obsstore class default when possible.
     kwargs = {}
     if defaultformat is not None:
-        kwargs['defaultformat'] = defaultformat
+        kwargs[r'defaultformat'] = defaultformat
     readonly = not isenabled(repo, createmarkersopt)
     store = obsstore(repo.svfs, readonly=readonly, **kwargs)
     if store and readonly:
@@ -994,10 +994,10 @@
     public = phases.public
     cl = repo.changelog
     torev = cl.nodemap.get
-    for ctx in repo.set('(not public()) and (not obsolete())'):
-        rev = ctx.rev()
+    tonode = cl.node
+    for rev in repo.revs('(not public()) and (not obsolete())'):
         # We only evaluate mutable, non-obsolete revision
-        node = ctx.node()
+        node = tonode(rev)
         # (future) A cache of predecessors may worth if split is very common
         for pnode in obsutil.allpredecessors(repo.obsstore, [node],
                                    ignoreflags=bumpedfix):
@@ -1023,8 +1023,10 @@
     divergent = set()
     obsstore = repo.obsstore
     newermap = {}
-    for ctx in repo.set('(not public()) - obsolete()'):
-        mark = obsstore.predecessors.get(ctx.node(), ())
+    tonode = repo.changelog.node
+    for rev in repo.revs('(not public()) - obsolete()'):
+        node = tonode(rev)
+        mark = obsstore.predecessors.get(node, ())
         toprocess = set(mark)
         seen = set()
         while toprocess:
@@ -1036,7 +1038,7 @@
                 obsutil.successorssets(repo, prec, cache=newermap)
             newer = [n for n in newermap[prec] if n]
             if len(newer) > 1:
-                divergent.add(ctx.rev())
+                divergent.add(rev)
                 break
             toprocess.update(obsstore.predecessors.get(prec, ()))
     return divergent
--- a/mercurial/obsutil.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/obsutil.py	Tue Dec 19 16:27:24 2017 -0500
@@ -441,12 +441,12 @@
     public = phases.public
     addedmarkers = tr.changes.get('obsmarkers')
     addedrevs = tr.changes.get('revs')
-    seenrevs = set(addedrevs)
+    seenrevs = set()
     obsoleted = set()
     for mark in addedmarkers:
         node = mark[0]
         rev = torev(node)
-        if rev is None or rev in seenrevs:
+        if rev is None or rev in seenrevs or rev in addedrevs:
             continue
         seenrevs.add(rev)
         if phase(repo, rev) == public:
@@ -751,8 +751,9 @@
 
     return values
 
-def successorsetverb(successorset):
-    """ Return the verb summarizing the successorset
+def obsfateverb(successorset, markers):
+    """ Return the verb summarizing the successorset and potentially using
+    information from the markers
     """
     if not successorset:
         verb = 'pruned'
@@ -795,7 +796,7 @@
     line = []
 
     # Verb
-    line.append(successorsetverb(successors))
+    line.append(obsfateverb(successors, markers))
 
     # Operations
     operations = markersoperations(markers)
--- a/mercurial/patch.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/patch.py	Tue Dec 19 16:27:24 2017 -0500
@@ -10,6 +10,7 @@
 
 import collections
 import copy
+import difflib
 import email
 import errno
 import hashlib
@@ -45,6 +46,7 @@
 
 gitre = re.compile(br'diff --git a/(.*) b/(.*)')
 tabsplitter = re.compile(br'(\t+|[^\t]+)')
+_nonwordre = re.compile(br'([^a-zA-Z0-9_\x80-\xff])')
 
 PatchError = error.PatchError
 
@@ -149,6 +151,8 @@
                 raise StopIteration
             return l
 
+        __next__ = next
+
     inheader = False
     cur = []
 
@@ -203,7 +207,7 @@
 
     # attempt to detect the start of a patch
     # (this heuristic is borrowed from quilt)
-    diffre = re.compile(br'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
+    diffre = re.compile(br'^(?:Index:[ \t]|diff[ \t]-|RCS file: |'
                         br'retrieving revision [0-9]+(\.[0-9]+)*$|'
                         br'---[ \t].*?^\+\+\+[ \t]|'
                         br'\*\*\*[ \t].*?^---[ \t])',
@@ -997,16 +1001,26 @@
 def getmessages():
     return {
         'multiple': {
+            'apply': _("apply change %d/%d to '%s'?"),
             'discard': _("discard change %d/%d to '%s'?"),
             'record': _("record change %d/%d to '%s'?"),
-            'revert': _("revert change %d/%d to '%s'?"),
         },
         'single': {
+            'apply': _("apply this change to '%s'?"),
             'discard': _("discard this change to '%s'?"),
             'record': _("record this change to '%s'?"),
-            'revert': _("revert this change to '%s'?"),
         },
         'help': {
+            'apply': _('[Ynesfdaq?]'
+                         '$$ &Yes, apply this change'
+                         '$$ &No, skip this change'
+                         '$$ &Edit this change manually'
+                         '$$ &Skip remaining changes to this file'
+                         '$$ Apply remaining changes to this &file'
+                         '$$ &Done, skip remaining changes and files'
+                         '$$ Apply &all changes to all remaining files'
+                         '$$ &Quit, applying no changes'
+                         '$$ &? (display help)'),
             'discard': _('[Ynesfdaq?]'
                          '$$ &Yes, discard this change'
                          '$$ &No, skip this change'
@@ -1027,16 +1041,6 @@
                         '$$ Record &all changes to all remaining files'
                         '$$ &Quit, recording no changes'
                         '$$ &? (display help)'),
-            'revert': _('[Ynesfdaq?]'
-                        '$$ &Yes, revert this change'
-                        '$$ &No, skip this change'
-                        '$$ &Edit this change manually'
-                        '$$ &Skip remaining changes to this file'
-                        '$$ Revert remaining changes to this &file'
-                        '$$ &Done, skip remaining changes and files'
-                        '$$ Revert &all changes to all remaining files'
-                        '$$ &Quit, reverting no changes'
-                        '$$ &? (display help)')
         }
     }
 
@@ -1990,14 +1994,16 @@
     return _applydiff(ui, fp, patchfile, backend, store, strip=strip,
                       prefix=prefix, eolmode=eolmode)
 
+def _canonprefix(repo, prefix):
+    if prefix:
+        prefix = pathutil.canonpath(repo.root, repo.getcwd(), prefix)
+        if prefix != '':
+            prefix += '/'
+    return prefix
+
 def _applydiff(ui, fp, patcher, backend, store, strip=1, prefix='',
                eolmode='strict'):
-
-    if prefix:
-        prefix = pathutil.canonpath(backend.repo.root, backend.repo.getcwd(),
-                                    prefix)
-        if prefix != '':
-            prefix += '/'
+    prefix = _canonprefix(backend.repo, prefix)
     def pstrip(p):
         return pathtransform(p, strip - 1, prefix)[1]
 
@@ -2183,20 +2189,22 @@
     return internalpatch(ui, repo, patchname, strip, prefix, files, eolmode,
                          similarity)
 
-def changedfiles(ui, repo, patchpath, strip=1):
+def changedfiles(ui, repo, patchpath, strip=1, prefix=''):
     backend = fsbackend(ui, repo.root)
+    prefix = _canonprefix(repo, prefix)
     with open(patchpath, 'rb') as fp:
         changed = set()
         for state, values in iterhunks(fp):
             if state == 'file':
                 afile, bfile, first_hunk, gp = values
                 if gp:
-                    gp.path = pathtransform(gp.path, strip - 1, '')[1]
+                    gp.path = pathtransform(gp.path, strip - 1, prefix)[1]
                     if gp.oldpath:
-                        gp.oldpath = pathtransform(gp.oldpath, strip - 1, '')[1]
+                        gp.oldpath = pathtransform(gp.oldpath, strip - 1,
+                                                   prefix)[1]
                 else:
                     gp = makepatchmeta(backend, afile, bfile, first_hunk, strip,
-                                       '')
+                                       prefix)
                 changed.add(gp.path)
                 if gp.op == 'RENAME':
                     changed.add(gp.oldpath)
@@ -2246,6 +2254,7 @@
         'showfunc': get('show_function', 'showfunc'),
         'context': get('unified', getter=ui.config),
     }
+    buildopts['worddiff'] = ui.configbool('experimental', 'worddiff')
 
     if git:
         buildopts['git'] = get('git')
@@ -2457,6 +2466,9 @@
 
 def difflabel(func, *args, **kw):
     '''yields 2-tuples of (output, label) based on the output of func()'''
+    inlinecolor = False
+    if kw.get(r'opts'):
+        inlinecolor = kw[r'opts'].worddiff
     headprefixes = [('diff', 'diff.diffline'),
                     ('copy', 'diff.extended'),
                     ('rename', 'diff.extended'),
@@ -2473,6 +2485,9 @@
     head = False
     for chunk in func(*args, **kw):
         lines = chunk.split('\n')
+        matches = {}
+        if inlinecolor:
+            matches = _findmatches(lines)
         for i, line in enumerate(lines):
             if i != 0:
                 yield ('\n', '')
@@ -2496,11 +2511,17 @@
             for prefix, label in prefixes:
                 if stripline.startswith(prefix):
                     if diffline:
-                        for token in tabsplitter.findall(stripline):
-                            if '\t' == token[0]:
-                                yield (token, 'diff.tab')
-                            else:
-                                yield (token, label)
+                        if i in matches:
+                            for t, l in _inlinediff(lines[i].rstrip(),
+                                                    lines[matches[i]].rstrip(),
+                                                    label):
+                                yield (t, l)
+                        else:
+                            for token in tabsplitter.findall(stripline):
+                                if '\t' == token[0]:
+                                    yield (token, 'diff.tab')
+                                else:
+                                    yield (token, label)
                     else:
                         yield (stripline, label)
                     break
@@ -2509,6 +2530,75 @@
             if line != stripline:
                 yield (line[len(stripline):], 'diff.trailingwhitespace')
 
+def _findmatches(slist):
+    '''Look for insertion matches to deletion and returns a dict of
+    correspondences.
+    '''
+    lastmatch = 0
+    matches = {}
+    for i, line in enumerate(slist):
+        if line == '':
+            continue
+        if line[0] == '-':
+            lastmatch = max(lastmatch, i)
+            newgroup = False
+            for j, newline in enumerate(slist[lastmatch + 1:]):
+                if newline == '':
+                    continue
+                if newline[0] == '-' and newgroup: # too far, no match
+                    break
+                if newline[0] == '+': # potential match
+                    newgroup = True
+                    sim = difflib.SequenceMatcher(None, line, newline).ratio()
+                    if sim > 0.7:
+                        lastmatch = lastmatch + 1 + j
+                        matches[i] = lastmatch
+                        matches[lastmatch] = i
+                        break
+    return matches
+
+def _inlinediff(s1, s2, operation):
+    '''Perform string diff to highlight specific changes.'''
+    operation_skip = '+?' if operation == 'diff.deleted' else '-?'
+    if operation == 'diff.deleted':
+        s2, s1 = s1, s2
+
+    buff = []
+    # we never want to higlight the leading +-
+    if operation == 'diff.deleted' and s2.startswith('-'):
+        label = operation
+        token = '-'
+        s2 = s2[1:]
+        s1 = s1[1:]
+    elif operation == 'diff.inserted' and s1.startswith('+'):
+        label = operation
+        token = '+'
+        s2 = s2[1:]
+        s1 = s1[1:]
+    else:
+        raise error.ProgrammingError("Case not expected, operation = %s" %
+                                     operation)
+
+    s = difflib.ndiff(_nonwordre.split(s2), _nonwordre.split(s1))
+    for part in s:
+        if part[0] in operation_skip or len(part) == 2:
+            continue
+        l = operation + '.highlight'
+        if part[0] in ' ':
+            l = operation
+        if part[2:] == '\t':
+            l = 'diff.tab'
+        if l == label: # contiguous token with same label
+            token += part[2:]
+            continue
+        else:
+            buff.append((token, label))
+            label = l
+            token = part[2:]
+    buff.append((token, label))
+
+    return buff
+
 def diffui(*args, **kw):
     '''like diff(), but yields 2-tuples of (output, label) for ui.write()'''
     return difflabel(diff, *args, **kw)
--- a/mercurial/phases.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/phases.py	Tue Dec 19 16:27:24 2017 -0500
@@ -115,6 +115,7 @@
 )
 from . import (
     error,
+    pycompat,
     smartset,
     txnutil,
     util,
@@ -202,31 +203,43 @@
         if _load:
             # Cheap trick to allow shallow-copy without copy module
             self.phaseroots, self.dirty = _readroots(repo, phasedefaults)
-            self._phaserevs = None
+            self._loadedrevslen = 0
             self._phasesets = None
             self.filterunknown(repo)
             self.opener = repo.svfs
 
-    def getrevset(self, repo, phases):
+    def getrevset(self, repo, phases, subset=None):
         """return a smartset for the given phases"""
         self.loadphaserevs(repo) # ensure phase's sets are loaded
-
-        if self._phasesets and all(self._phasesets[p] is not None
-                                   for p in phases):
-            # fast path - use _phasesets
-            revs = self._phasesets[phases[0]]
-            if len(phases) > 1:
-                revs = revs.copy() # only copy when needed
-                for p in phases[1:]:
-                    revs.update(self._phasesets[p])
+        phases = set(phases)
+        if public not in phases:
+            # fast path: _phasesets contains the interesting sets,
+            # might only need a union and post-filtering.
+            if len(phases) == 1:
+                [p] = phases
+                revs = self._phasesets[p]
+            else:
+                revs = set.union(*[self._phasesets[p] for p in phases])
             if repo.changelog.filteredrevs:
                 revs = revs - repo.changelog.filteredrevs
-            return smartset.baseset(revs)
+            if subset is None:
+                return smartset.baseset(revs)
+            else:
+                return subset & smartset.baseset(revs)
         else:
-            # slow path - enumerate all revisions
-            phase = self.phase
-            revs = (r for r in repo if phase(repo, r) in phases)
-            return smartset.generatorset(revs, iterasc=True)
+            phases = set(allphases).difference(phases)
+            if not phases:
+                return smartset.fullreposet(repo)
+            if len(phases) == 1:
+                [p] = phases
+                revs = self._phasesets[p]
+            else:
+                revs = set.union(*[self._phasesets[p] for p in phases])
+            if subset is None:
+                subset = smartset.fullreposet(repo)
+            if not revs:
+                return subset
+            return subset.filter(lambda r: r not in revs)
 
     def copy(self):
         # Shallow copy meant to ensure isolation in
@@ -235,13 +248,14 @@
         ph.phaseroots = self.phaseroots[:]
         ph.dirty = self.dirty
         ph.opener = self.opener
-        ph._phaserevs = self._phaserevs
+        ph._loadedrevslen = self._loadedrevslen
         ph._phasesets = self._phasesets
         return ph
 
     def replace(self, phcache):
         """replace all values in 'self' with content of phcache"""
-        for a in ('phaseroots', 'dirty', 'opener', '_phaserevs', '_phasesets'):
+        for a in ('phaseroots', 'dirty', 'opener', '_loadedrevslen',
+                  '_phasesets'):
             setattr(self, a, getattr(phcache, a))
 
     def _getphaserevsnative(self, repo):
@@ -253,42 +267,38 @@
 
     def _computephaserevspure(self, repo):
         repo = repo.unfiltered()
-        revs = [public] * len(repo.changelog)
-        self._phaserevs = revs
-        self._populatephaseroots(repo)
-        for phase in trackedphases:
-            roots = list(map(repo.changelog.rev, self.phaseroots[phase]))
-            if roots:
-                for rev in roots:
-                    revs[rev] = phase
-                for rev in repo.changelog.descendants(roots):
-                    revs[rev] = phase
+        cl = repo.changelog
+        self._phasesets = [set() for phase in allphases]
+        roots = pycompat.maplist(cl.rev, self.phaseroots[secret])
+        if roots:
+            ps = set(cl.descendants(roots))
+            for root in roots:
+                ps.add(root)
+            self._phasesets[secret] = ps
+        roots = pycompat.maplist(cl.rev, self.phaseroots[draft])
+        if roots:
+            ps = set(cl.descendants(roots))
+            for root in roots:
+                ps.add(root)
+            ps.difference_update(self._phasesets[secret])
+            self._phasesets[draft] = ps
+        self._loadedrevslen = len(cl)
 
     def loadphaserevs(self, repo):
         """ensure phase information is loaded in the object"""
-        if self._phaserevs is None:
+        if self._phasesets is None:
             try:
                 res = self._getphaserevsnative(repo)
-                self._phaserevs, self._phasesets = res
+                self._loadedrevslen, self._phasesets = res
             except AttributeError:
                 self._computephaserevspure(repo)
 
     def invalidate(self):
-        self._phaserevs = None
+        self._loadedrevslen = 0
         self._phasesets = None
 
-    def _populatephaseroots(self, repo):
-        """Fills the _phaserevs cache with phases for the roots.
-        """
-        cl = repo.changelog
-        phaserevs = self._phaserevs
-        for phase in trackedphases:
-            roots = map(cl.rev, self.phaseroots[phase])
-            for root in roots:
-                phaserevs[root] = phase
-
     def phase(self, repo, rev):
-        # We need a repo argument here to be able to build _phaserevs
+        # We need a repo argument here to be able to build _phasesets
         # if necessary. The repository instance is not stored in
         # phasecache to avoid reference cycles. The changelog instance
         # is not stored because it is a filecache() property and can
@@ -297,10 +307,13 @@
             return public
         if rev < nullrev:
             raise ValueError(_('cannot lookup negative revision'))
-        if self._phaserevs is None or rev >= len(self._phaserevs):
+        if rev >= self._loadedrevslen:
             self.invalidate()
             self.loadphaserevs(repo)
-        return self._phaserevs[rev]
+        for phase in trackedphases:
+            if rev in self._phasesets[phase]:
+                return phase
+        return public
 
     def write(self):
         if not self.dirty:
@@ -455,10 +468,10 @@
         if filtered:
             self.dirty = True
         # filterunknown is called by repo.destroyed, we may have no changes in
-        # root but phaserevs contents is certainly invalid (or at least we
+        # root but _phasesets contents is certainly invalid (or at least we
         # have not proper way to check that). related to issue 3858.
         #
-        # The other caller is __init__ that have no _phaserevs initialized
+        # The other caller is __init__ that have no _phasesets initialized
         # anyway. If this change we should consider adding a dedicated
         # "destroyed" function to phasecache or a proper cache key mechanism
         # (see branchmap one)
--- a/mercurial/policy.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/policy.py	Tue Dec 19 16:27:24 2017 -0500
@@ -75,7 +75,7 @@
     (r'cext', r'diffhelpers'): 1,
     (r'cext', r'mpatch'): 1,
     (r'cext', r'osutil'): 1,
-    (r'cext', r'parsers'): 3,
+    (r'cext', r'parsers'): 4,
 }
 
 # map import request to other package or module
--- a/mercurial/pycompat.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/pycompat.py	Tue Dec 19 16:27:24 2017 -0500
@@ -63,6 +63,7 @@
         sysexecutable = os.fsencode(sysexecutable)
     stringio = io.BytesIO
     maplist = lambda *args: list(map(*args))
+    ziplist = lambda *args: list(zip(*args))
     rawinput = input
 
     # TODO: .buffer might not exist if std streams were replaced; we'll need
@@ -214,7 +215,7 @@
     def open(name, mode='r', buffering=-1):
         return builtins.open(name, sysstr(mode), buffering)
 
-    def getoptb(args, shortlist, namelist):
+    def _getoptbwrapper(orig, args, shortlist, namelist):
         """
         Takes bytes arguments, converts them to unicode, pass them to
         getopt.getopt(), convert the returned values back to bytes and then
@@ -224,7 +225,7 @@
         args = [a.decode('latin-1') for a in args]
         shortlist = shortlist.decode('latin-1')
         namelist = [a.decode('latin-1') for a in namelist]
-        opts, args = getopt.getopt(args, shortlist, namelist)
+        opts, args = orig(args, shortlist, namelist)
         opts = [(a[0].encode('latin-1'), a[1].encode('latin-1'))
                 for a in opts]
         args = [a.encode('latin-1') for a in args]
@@ -291,8 +292,8 @@
     def getdoc(obj):
         return getattr(obj, '__doc__', None)
 
-    def getoptb(args, shortlist, namelist):
-        return getopt.getopt(args, shortlist, namelist)
+    def _getoptbwrapper(orig, args, shortlist, namelist):
+        return orig(args, shortlist, namelist)
 
     strkwargs = identity
     byteskwargs = identity
@@ -313,6 +314,7 @@
     shlexsplit = shlex.split
     stringio = cStringIO.StringIO
     maplist = map
+    ziplist = zip
     rawinput = raw_input
 
 isjython = sysplatform.startswith('java')
@@ -320,3 +322,9 @@
 isdarwin = sysplatform == 'darwin'
 isposix = osname == 'posix'
 iswindows = osname == 'nt'
+
+def getoptb(args, shortlist, namelist):
+    return _getoptbwrapper(getopt.getopt, args, shortlist, namelist)
+
+def gnugetoptb(args, shortlist, namelist):
+    return _getoptbwrapper(getopt.gnu_getopt, args, shortlist, namelist)
--- a/mercurial/registrar.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/registrar.py	Tue Dec 19 16:27:24 2017 -0500
@@ -112,35 +112,53 @@
     The created object can be used as a decorator for adding commands to
     that command table. This accepts multiple arguments to define a command.
 
-    The first argument is the command name.
+    The first argument is the command name (as bytes).
 
-    The options argument is an iterable of tuples defining command arguments.
-    See ``mercurial.fancyopts.fancyopts()`` for the format of each tuple.
+    The `options` keyword argument is an iterable of tuples defining command
+    arguments. See ``mercurial.fancyopts.fancyopts()`` for the format of each
+    tuple.
 
-    The synopsis argument defines a short, one line summary of how to use the
+    The `synopsis` argument defines a short, one line summary of how to use the
     command. This shows up in the help output.
 
-    The norepo argument defines whether the command does not require a
+    There are three arguments that control what repository (if any) is found
+    and passed to the decorated function: `norepo`, `optionalrepo`, and
+    `inferrepo`.
+
+    The `norepo` argument defines whether the command does not require a
     local repository. Most commands operate against a repository, thus the
-    default is False.
+    default is False. When True, no repository will be passed.
 
-    The optionalrepo argument defines whether the command optionally requires
-    a local repository.
+    The `optionalrepo` argument defines whether the command optionally requires
+    a local repository. If no repository can be found, None will be passed
+    to the decorated function.
 
-    The inferrepo argument defines whether to try to find a repository from the
-    command line arguments. If True, arguments will be examined for potential
-    repository locations. See ``findrepo()``. If a repository is found, it
-    will be used.
+    The `inferrepo` argument defines whether to try to find a repository from
+    the command line arguments. If True, arguments will be examined for
+    potential repository locations. See ``findrepo()``. If a repository is
+    found, it will be used and passed to the decorated function.
 
     There are three constants in the class which tells what type of the command
     that is. That information will be helpful at various places. It will be also
     be used to decide what level of access the command has on hidden commits.
     The constants are:
 
-    unrecoverablewrite is for those write commands which can't be recovered like
-    push.
-    recoverablewrite is for write commands which can be recovered like commit.
-    readonly is for commands which are read only.
+    `unrecoverablewrite` is for those write commands which can't be recovered
+    like push.
+    `recoverablewrite` is for write commands which can be recovered like commit.
+    `readonly` is for commands which are read only.
+
+    The signature of the decorated function looks like this:
+        def cmd(ui[, repo] [, <args>] [, <options>])
+
+      `repo` is required if `norepo` is False.
+      `<args>` are positional args (or `*args`) arguments, of non-option
+      arguments from the command line.
+      `<options>` are keyword arguments (or `**options`) of option arguments
+      from the command line.
+
+    See the WritingExtensions and MercurialApi documentation for more exhaustive
+    descriptions and examples.
     """
 
     unrecoverablewrite = "unrecoverable"
--- a/mercurial/repoview.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/repoview.py	Tue Dec 19 16:27:24 2017 -0500
@@ -9,11 +9,13 @@
 from __future__ import absolute_import
 
 import copy
+import weakref
 
 from .node import nullrev
 from . import (
     obsolete,
     phases,
+    pycompat,
     tags as tagsmod,
 )
 
@@ -231,6 +233,11 @@
             return self
         return self.unfiltered().filtered(name)
 
+    def __repr__(self):
+        return r'<%s:%s %r>' % (self.__class__.__name__,
+                                pycompat.sysstr(self.filtername),
+                                self.unfiltered())
+
     # everything access are forwarded to the proxied repo
     def __getattr__(self, attr):
         return getattr(self._unfilteredrepo, attr)
@@ -240,3 +247,16 @@
 
     def __delattr__(self, attr):
         return delattr(self._unfilteredrepo, attr)
+
+# Python <3.4 easily leaks types via __mro__. See
+# https://bugs.python.org/issue17950. We cache dynamically created types
+# so they won't be leaked on every invocation of repo.filtered().
+_filteredrepotypes = weakref.WeakKeyDictionary()
+
+def newtype(base):
+    """Create a new type with the repoview mixin and the given base class"""
+    if base not in _filteredrepotypes:
+        class filteredrepo(repoview, base):
+            pass
+        _filteredrepotypes[base] = filteredrepo
+    return _filteredrepotypes[base]
--- a/mercurial/revlog.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/revlog.py	Tue Dec 19 16:27:24 2017 -0500
@@ -2264,7 +2264,9 @@
     DELTAREUSESAMEREVS = 'samerevs'
     DELTAREUSENEVER = 'never'
 
-    DELTAREUSEALL = {'always', 'samerevs', 'never'}
+    DELTAREUSEFULLADD = 'fulladd'
+
+    DELTAREUSEALL = {'always', 'samerevs', 'never', 'fulladd'}
 
     def clone(self, tr, destrevlog, addrevisioncb=None,
               deltareuse=DELTAREUSESAMEREVS, aggressivemergedeltas=None):
@@ -2355,18 +2357,24 @@
                 if not cachedelta:
                     rawtext = self.revision(rev, raw=True)
 
-                ifh = destrevlog.opener(destrevlog.indexfile, 'a+',
-                                        checkambig=False)
-                dfh = None
-                if not destrevlog._inline:
-                    dfh = destrevlog.opener(destrevlog.datafile, 'a+')
-                try:
-                    destrevlog._addrevision(node, rawtext, tr, linkrev, p1, p2,
-                                            flags, cachedelta, ifh, dfh)
-                finally:
-                    if dfh:
-                        dfh.close()
-                    ifh.close()
+
+                if deltareuse == self.DELTAREUSEFULLADD:
+                    destrevlog.addrevision(rawtext, tr, linkrev, p1, p2,
+                                           cachedelta=cachedelta,
+                                           node=node, flags=flags)
+                else:
+                    ifh = destrevlog.opener(destrevlog.indexfile, 'a+',
+                                            checkambig=False)
+                    dfh = None
+                    if not destrevlog._inline:
+                        dfh = destrevlog.opener(destrevlog.datafile, 'a+')
+                    try:
+                        destrevlog._addrevision(node, rawtext, tr, linkrev, p1,
+                                                p2, flags, cachedelta, ifh, dfh)
+                    finally:
+                        if dfh:
+                            dfh.close()
+                        ifh.close()
 
                 if addrevisioncb:
                     addrevisioncb(self, rev, node)
--- a/mercurial/revset.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/revset.py	Tue Dec 19 16:27:24 2017 -0500
@@ -22,6 +22,7 @@
     obsutil,
     pathutil,
     phases,
+    pycompat,
     registrar,
     repoview,
     revsetlang,
@@ -266,7 +267,8 @@
 def _destupdate(repo, subset, x):
     # experimental revset for update destination
     args = getargsdict(x, 'limit', 'clean')
-    return subset & baseset([destutil.destupdate(repo, **args)[0]])
+    return subset & baseset([destutil.destupdate(repo,
+                            **pycompat.strkwargs(args))[0]])
 
 @predicate('_destmerge')
 def _destmerge(repo, subset, x):
@@ -909,48 +911,43 @@
     return limit(repo, subset, x, order)
 
 def _follow(repo, subset, x, name, followfirst=False):
-    l = getargs(x, 0, 2, _("%s takes no arguments or a pattern "
-                           "and an optional revset") % name)
-    c = repo['.']
-    if l:
-        x = getstring(l[0], _("%s expected a pattern") % name)
-        rev = None
-        if len(l) >= 2:
-            revs = getset(repo, fullreposet(repo), l[1])
-            if len(revs) != 1:
-                raise error.RepoLookupError(
-                        _("%s expected one starting revision") % name)
-            rev = revs.last()
-            c = repo[rev]
-        matcher = matchmod.match(repo.root, repo.getcwd(), [x],
-                                 ctx=repo[rev], default='path')
-
-        files = c.manifest().walk(matcher)
-
-        s = set()
-        for fname in files:
-            fctx = c[fname]
-            s = s.union(set(c.rev() for c in fctx.ancestors(followfirst)))
-            # include the revision responsible for the most recent version
-            s.add(fctx.introrev())
+    args = getargsdict(x, name, 'file startrev')
+    revs = None
+    if 'startrev' in args:
+        revs = getset(repo, fullreposet(repo), args['startrev'])
+    if 'file' in args:
+        x = getstring(args['file'], _("%s expected a pattern") % name)
+        if revs is None:
+            revs = [None]
+        fctxs = []
+        for r in revs:
+            ctx = mctx = repo[r]
+            if r is None:
+                ctx = repo['.']
+            m = matchmod.match(repo.root, repo.getcwd(), [x],
+                               ctx=mctx, default='path')
+            fctxs.extend(ctx[f].introfilectx() for f in ctx.manifest().walk(m))
+        s = dagop.filerevancestors(fctxs, followfirst)
     else:
-        s = dagop.revancestors(repo, baseset([c.rev()]), followfirst)
+        if revs is None:
+            revs = baseset([repo['.'].rev()])
+        s = dagop.revancestors(repo, revs, followfirst)
 
     return subset & s
 
-@predicate('follow([pattern[, startrev]])', safe=True)
+@predicate('follow([file[, startrev]])', safe=True)
 def follow(repo, subset, x):
     """
     An alias for ``::.`` (ancestors of the working directory's first parent).
-    If pattern is specified, the histories of files matching given
+    If file pattern is specified, the histories of files matching given
     pattern in the revision given by startrev are followed, including copies.
     """
     return _follow(repo, subset, x, 'follow')
 
 @predicate('_followfirst', safe=True)
 def _followfirst(repo, subset, x):
-    # ``followfirst([pattern[, startrev]])``
-    # Like ``follow([pattern[, startrev]])`` but follows only the first parent
+    # ``followfirst([file[, startrev]])``
+    # Like ``follow([file[, startrev]])`` but follows only the first parent
     # of every revisions or files revisions.
     return _follow(repo, subset, x, '_followfirst', followfirst=True)
 
@@ -1421,8 +1418,16 @@
     l = getargs(x, 0, 1, _("outgoing takes one or no arguments"))
     # i18n: "outgoing" is a keyword
     dest = l and getstring(l[0], _("outgoing requires a repository path")) or ''
-    dest = repo.ui.expandpath(dest or 'default-push', dest or 'default')
-    dest, branches = hg.parseurl(dest)
+    if not dest:
+        # ui.paths.getpath() explicitly tests for None, not just a boolean
+        dest = None
+    path = repo.ui.paths.getpath(dest, default=('default-push', 'default'))
+    if not path:
+        raise error.Abort(_('default repository not configured!'),
+                hint=_("see 'hg help config.paths'"))
+    dest = path.pushloc or path.loc
+    branches = path.branch, []
+
     revs, checkout = hg.addbranchrevs(repo, repo, branches, [])
     if revs:
         revs = [repo.lookup(rev) for rev in revs]
@@ -1509,8 +1514,7 @@
 
 def _phase(repo, subset, *targets):
     """helper to select all rev in <targets> phases"""
-    s = repo._phasecache.getrevset(repo, targets)
-    return subset & s
+    return repo._phasecache.getrevset(repo, targets, subset)
 
 @predicate('draft()', safe=True)
 def draft(repo, subset, x):
@@ -1617,11 +1621,7 @@
     """Changeset in public phase."""
     # i18n: "public" is a keyword
     getargs(x, 0, 0, _("public takes no arguments"))
-    phase = repo._phasecache.phase
-    target = phases.public
-    condition = lambda r: phase(repo, r) == target
-    return subset.filter(condition, condrepr=('<phase %r>', target),
-                         cache=False)
+    return _phase(repo, subset, phases.public)
 
 @predicate('remote([id [,path]])', safe=False)
 def remote(repo, subset, x):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/rewriteutil.py	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,53 @@
+# rewriteutil.py - utility functions for rewriting changesets
+#
+# Copyright 2017 Octobus <contact@octobus.net>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from __future__ import absolute_import
+
+from .i18n import _
+
+from . import (
+    error,
+    node,
+    obsolete,
+    revset,
+)
+
+def precheck(repo, revs, action='rewrite'):
+    """check if revs can be rewritten
+    action is used to control the error message.
+
+    Make sure this function is called after taking the lock.
+    """
+    if node.nullrev in revs:
+        msg = _("cannot %s null changeset") % (action)
+        hint = _("no changeset checked out")
+        raise error.Abort(msg, hint=hint)
+
+    publicrevs = repo.revs('%ld and public()', revs)
+    if len(repo[None].parents()) > 1:
+        raise error.Abort(_("cannot %s while merging") % action)
+
+    if publicrevs:
+        msg = _("cannot %s public changesets") % (action)
+        hint = _("see 'hg help phases' for details")
+        raise error.Abort(msg, hint=hint)
+
+    newunstable = disallowednewunstable(repo, revs)
+    if newunstable:
+        raise error.Abort(_("cannot %s changeset with children") % action)
+
+def disallowednewunstable(repo, revs):
+    """Checks whether editing the revs will create new unstable changesets and
+    are we allowed to create them.
+
+    To allow new unstable changesets, set the config:
+        `experimental.evolution.allowunstable=True`
+    """
+    allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
+    if allowunstable:
+        return revset.baseset()
+    return repo.revs("(%ld::) - %ld", revs, revs)
--- a/mercurial/scmutil.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/scmutil.py	Tue Dec 19 16:27:24 2017 -0500
@@ -1100,12 +1100,11 @@
     finally:
         if proc:
             proc.communicate()
-            if proc.returncode != 0:
-                # not an error so 'cmd | grep' can be empty
-                repo.ui.debug("extdata command '%s' %s\n"
-                              % (cmd, util.explainexit(proc.returncode)[0]))
         if src:
             src.close()
+    if proc and proc.returncode != 0:
+        raise error.Abort(_("extdata command '%s' failed: %s")
+                          % (cmd, util.explainexit(proc.returncode)[0]))
 
     return data
 
@@ -1262,7 +1261,7 @@
         @reportsummary
         def reportnewcs(repo, tr):
             """Report the range of new revisions pulled/unbundled."""
-            newrevs = list(tr.changes.get('revs', set()))
+            newrevs = tr.changes.get('revs', xrange(0, 0))
             if not newrevs:
                 return
 
@@ -1279,3 +1278,30 @@
             else:
                 revrange = '%s:%s' % (minrev, maxrev)
             repo.ui.status(_('new changesets %s\n') % revrange)
+
+def nodesummaries(repo, nodes, maxnumnodes=4):
+    if len(nodes) <= maxnumnodes or repo.ui.verbose:
+        return ' '.join(short(h) for h in nodes)
+    first = ' '.join(short(h) for h in nodes[:maxnumnodes])
+    return _("%s and %d others") % (first, len(nodes) - maxnumnodes)
+
+def enforcesinglehead(repo, tr, desc):
+    """check that no named branch has multiple heads"""
+    if desc in ('strip', 'repair'):
+        # skip the logic during strip
+        return
+    visible = repo.filtered('visible')
+    # possible improvement: we could restrict the check to affected branch
+    for name, heads in visible.branchmap().iteritems():
+        if len(heads) > 1:
+            msg = _('rejecting multiple heads on branch "%s"')
+            msg %= name
+            hint = _('%d heads: %s')
+            hint %= (len(heads), nodesummaries(repo, heads))
+            raise error.Abort(msg, hint=hint)
+
+def wrapconvertsink(sink):
+    """Allow extensions to wrap the sink returned by convcmd.convertsink()
+    before it is used, whether or not the convert extension was formally loaded.
+    """
+    return sink
--- a/mercurial/selectors2.py	Sun Dec 17 18:43:05 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,745 +0,0 @@
-""" Back-ported, durable, and portable selectors """
-
-# MIT License
-#
-# Copyright (c) 2017 Seth Michael Larson
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in all
-# copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-# no-check-code
-
-from __future__ import absolute_import
-
-import collections
-import errno
-import math
-import select
-import socket
-import sys
-import time
-
-from . import pycompat
-
-namedtuple = collections.namedtuple
-Mapping = collections.Mapping
-
-try:
-    monotonic = time.monotonic
-except AttributeError:
-    monotonic = time.time
-
-__author__ = 'Seth Michael Larson'
-__email__ = 'sethmichaellarson@protonmail.com'
-__version__ = '2.0.0'
-__license__ = 'MIT'
-__url__ = 'https://www.github.com/SethMichaelLarson/selectors2'
-
-__all__ = ['EVENT_READ',
-           'EVENT_WRITE',
-           'SelectorKey',
-           'DefaultSelector',
-           'BaseSelector']
-
-EVENT_READ = (1 << 0)
-EVENT_WRITE = (1 << 1)
-_DEFAULT_SELECTOR = None
-_SYSCALL_SENTINEL = object()  # Sentinel in case a system call returns None.
-_ERROR_TYPES = (OSError, IOError, socket.error)
-
-
-SelectorKey = namedtuple('SelectorKey', ['fileobj', 'fd', 'events', 'data'])
-
-
-class _SelectorMapping(Mapping):
-    """ Mapping of file objects to selector keys """
-
-    def __init__(self, selector):
-        self._selector = selector
-
-    def __len__(self):
-        return len(self._selector._fd_to_key)
-
-    def __getitem__(self, fileobj):
-        try:
-            fd = self._selector._fileobj_lookup(fileobj)
-            return self._selector._fd_to_key[fd]
-        except KeyError:
-            raise KeyError("{0!r} is not registered.".format(fileobj))
-
-    def __iter__(self):
-        return iter(self._selector._fd_to_key)
-
-
-def _fileobj_to_fd(fileobj):
-    """ Return a file descriptor from a file object. If
-    given an integer will simply return that integer back. """
-    if isinstance(fileobj, int):
-        fd = fileobj
-    else:
-        try:
-            fd = int(fileobj.fileno())
-        except (AttributeError, TypeError, ValueError):
-            raise ValueError("Invalid file object: {0!r}".format(fileobj))
-    if fd < 0:
-        raise ValueError("Invalid file descriptor: {0}".format(fd))
-    return fd
-
-
-class BaseSelector(object):
-    """ Abstract Selector class
-
-    A selector supports registering file objects to be monitored
-    for specific I/O events.
-
-    A file object is a file descriptor or any object with a
-    `fileno()` method. An arbitrary object can be attached to the
-    file object which can be used for example to store context info,
-    a callback, etc.
-
-    A selector can use various implementations (select(), poll(), epoll(),
-    and kqueue()) depending on the platform. The 'DefaultSelector' class uses
-    the most efficient implementation for the current platform.
-    """
-    def __init__(self):
-        # Maps file descriptors to keys.
-        self._fd_to_key = {}
-
-        # Read-only mapping returned by get_map()
-        self._map = _SelectorMapping(self)
-
-    def _fileobj_lookup(self, fileobj):
-        """ Return a file descriptor from a file object.
-        This wraps _fileobj_to_fd() to do an exhaustive
-        search in case the object is invalid but we still
-        have it in our map. Used by unregister() so we can
-        unregister an object that was previously registered
-        even if it is closed. It is also used by _SelectorMapping
-        """
-        try:
-            return _fileobj_to_fd(fileobj)
-        except ValueError:
-
-            # Search through all our mapped keys.
-            for key in self._fd_to_key.values():
-                if key.fileobj is fileobj:
-                    return key.fd
-
-            # Raise ValueError after all.
-            raise
-
-    def register(self, fileobj, events, data=None):
-        """ Register a file object for a set of events to monitor. """
-        if (not events) or (events & ~(EVENT_READ | EVENT_WRITE)):
-            raise ValueError("Invalid events: {0!r}".format(events))
-
-        key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
-
-        if key.fd in self._fd_to_key:
-            raise KeyError("{0!r} (FD {1}) is already registered"
-                           .format(fileobj, key.fd))
-
-        self._fd_to_key[key.fd] = key
-        return key
-
-    def unregister(self, fileobj):
-        """ Unregister a file object from being monitored. """
-        try:
-            key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))
-        except KeyError:
-            raise KeyError("{0!r} is not registered".format(fileobj))
-
-        # Getting the fileno of a closed socket on Windows errors with EBADF.
-        except socket.error as err:
-            if err.errno != errno.EBADF:
-                raise
-            else:
-                for key in self._fd_to_key.values():
-                    if key.fileobj is fileobj:
-                        self._fd_to_key.pop(key.fd)
-                        break
-                else:
-                    raise KeyError("{0!r} is not registered".format(fileobj))
-        return key
-
-    def modify(self, fileobj, events, data=None):
-        """ Change a registered file object monitored events and data. """
-        # NOTE: Some subclasses optimize this operation even further.
-        try:
-            key = self._fd_to_key[self._fileobj_lookup(fileobj)]
-        except KeyError:
-            raise KeyError("{0!r} is not registered".format(fileobj))
-
-        if events != key.events:
-            self.unregister(fileobj)
-            key = self.register(fileobj, events, data)
-
-        elif data != key.data:
-            # Use a shortcut to update the data.
-            key = key._replace(data=data)
-            self._fd_to_key[key.fd] = key
-
-        return key
-
-    def select(self, timeout=None):
-        """ Perform the actual selection until some monitored file objects
-        are ready or the timeout expires. """
-        raise NotImplementedError()
-
-    def close(self):
-        """ Close the selector. This must be called to ensure that all
-        underlying resources are freed. """
-        self._fd_to_key.clear()
-        self._map = None
-
-    def get_key(self, fileobj):
-        """ Return the key associated with a registered file object. """
-        mapping = self.get_map()
-        if mapping is None:
-            raise RuntimeError("Selector is closed")
-        try:
-            return mapping[fileobj]
-        except KeyError:
-            raise KeyError("{0!r} is not registered".format(fileobj))
-
-    def get_map(self):
-        """ Return a mapping of file objects to selector keys """
-        return self._map
-
-    def _key_from_fd(self, fd):
-        """ Return the key associated to a given file descriptor
-         Return None if it is not found. """
-        try:
-            return self._fd_to_key[fd]
-        except KeyError:
-            return None
-
-    def __enter__(self):
-        return self
-
-    def __exit__(self, *_):
-        self.close()
-
-
-# Almost all platforms have select.select()
-if hasattr(select, "select"):
-    class SelectSelector(BaseSelector):
-        """ Select-based selector. """
-        def __init__(self):
-            super(SelectSelector, self).__init__()
-            self._readers = set()
-            self._writers = set()
-
-        def register(self, fileobj, events, data=None):
-            key = super(SelectSelector, self).register(fileobj, events, data)
-            if events & EVENT_READ:
-                self._readers.add(key.fd)
-            if events & EVENT_WRITE:
-                self._writers.add(key.fd)
-            return key
-
-        def unregister(self, fileobj):
-            key = super(SelectSelector, self).unregister(fileobj)
-            self._readers.discard(key.fd)
-            self._writers.discard(key.fd)
-            return key
-
-        def select(self, timeout=None):
-            # Selecting on empty lists on Windows errors out.
-            if not len(self._readers) and not len(self._writers):
-                return []
-
-            timeout = None if timeout is None else max(timeout, 0.0)
-            ready = []
-            r, w, _ = _syscall_wrapper(self._wrap_select, True, self._readers,
-                                       self._writers, timeout)
-            r = set(r)
-            w = set(w)
-            for fd in r | w:
-                events = 0
-                if fd in r:
-                    events |= EVENT_READ
-                if fd in w:
-                    events |= EVENT_WRITE
-
-                key = self._key_from_fd(fd)
-                if key:
-                    ready.append((key, events & key.events))
-            return ready
-
-        def _wrap_select(self, r, w, timeout=None):
-            """ Wrapper for select.select because timeout is a positional arg """
-            return select.select(r, w, [], timeout)
-
-    __all__.append('SelectSelector')
-
-    # Jython has a different implementation of .fileno() for socket objects.
-    if pycompat.isjython:
-        class _JythonSelectorMapping(object):
-            """ This is an implementation of _SelectorMapping that is built
-            for use specifically with Jython, which does not provide a hashable
-            value from socket.socket.fileno(). """
-
-            def __init__(self, selector):
-                assert isinstance(selector, JythonSelectSelector)
-                self._selector = selector
-
-            def __len__(self):
-                return len(self._selector._sockets)
-
-            def __getitem__(self, fileobj):
-                for sock, key in self._selector._sockets:
-                    if sock is fileobj:
-                        return key
-                else:
-                    raise KeyError("{0!r} is not registered.".format(fileobj))
-
-        class JythonSelectSelector(SelectSelector):
-            """ This is an implementation of SelectSelector that is for Jython
-            which works around that Jython's socket.socket.fileno() does not
-            return an integer fd value. All SelectorKey.fd will be equal to -1
-            and should not be used. This instead uses object id to compare fileobj
-            and will only use select.select as it's the only selector that allows
-            directly passing in socket objects rather than registering fds.
-            See: http://bugs.jython.org/issue1678
-                 https://wiki.python.org/jython/NewSocketModule#socket.fileno.28.29_does_not_return_an_integer
-            """
-
-            def __init__(self):
-                super(JythonSelectSelector, self).__init__()
-
-                self._sockets = []  # Uses a list of tuples instead of dictionary.
-                self._map = _JythonSelectorMapping(self)
-                self._readers = []
-                self._writers = []
-
-                # Jython has a select.cpython_compatible_select function in older versions.
-                self._select_func = getattr(select, 'cpython_compatible_select', select.select)
-
-            def register(self, fileobj, events, data=None):
-                for sock, _ in self._sockets:
-                    if sock is fileobj:
-                        raise KeyError("{0!r} is already registered"
-                                       .format(fileobj, sock))
-
-                key = SelectorKey(fileobj, -1, events, data)
-                self._sockets.append((fileobj, key))
-
-                if events & EVENT_READ:
-                    self._readers.append(fileobj)
-                if events & EVENT_WRITE:
-                    self._writers.append(fileobj)
-                return key
-
-            def unregister(self, fileobj):
-                for i, (sock, key) in enumerate(self._sockets):
-                    if sock is fileobj:
-                        break
-                else:
-                    raise KeyError("{0!r} is not registered.".format(fileobj))
-
-                if key.events & EVENT_READ:
-                    self._readers.remove(fileobj)
-                if key.events & EVENT_WRITE:
-                    self._writers.remove(fileobj)
-
-                del self._sockets[i]
-                return key
-
-            def _wrap_select(self, r, w, timeout=None):
-                """ Wrapper for select.select because timeout is a positional arg """
-                return self._select_func(r, w, [], timeout)
-
-        __all__.append('JythonSelectSelector')
-        SelectSelector = JythonSelectSelector  # Override so the wrong selector isn't used.
-
-
-if hasattr(select, "poll"):
-    class PollSelector(BaseSelector):
-        """ Poll-based selector """
-        def __init__(self):
-            super(PollSelector, self).__init__()
-            self._poll = select.poll()
-
-        def register(self, fileobj, events, data=None):
-            key = super(PollSelector, self).register(fileobj, events, data)
-            event_mask = 0
-            if events & EVENT_READ:
-                event_mask |= select.POLLIN
-            if events & EVENT_WRITE:
-                event_mask |= select.POLLOUT
-            self._poll.register(key.fd, event_mask)
-            return key
-
-        def unregister(self, fileobj):
-            key = super(PollSelector, self).unregister(fileobj)
-            self._poll.unregister(key.fd)
-            return key
-
-        def _wrap_poll(self, timeout=None):
-            """ Wrapper function for select.poll.poll() so that
-            _syscall_wrapper can work with only seconds. """
-            if timeout is not None:
-                if timeout <= 0:
-                    timeout = 0
-                else:
-                    # select.poll.poll() has a resolution of 1 millisecond,
-                    # round away from zero to wait *at least* timeout seconds.
-                    timeout = math.ceil(timeout * 1000)
-
-            result = self._poll.poll(timeout)
-            return result
-
-        def select(self, timeout=None):
-            ready = []
-            fd_events = _syscall_wrapper(self._wrap_poll, True, timeout=timeout)
-            for fd, event_mask in fd_events:
-                events = 0
-                if event_mask & ~select.POLLIN:
-                    events |= EVENT_WRITE
-                if event_mask & ~select.POLLOUT:
-                    events |= EVENT_READ
-
-                key = self._key_from_fd(fd)
-                if key:
-                    ready.append((key, events & key.events))
-
-            return ready
-
-    __all__.append('PollSelector')
-
-if hasattr(select, "epoll"):
-    class EpollSelector(BaseSelector):
-        """ Epoll-based selector """
-        def __init__(self):
-            super(EpollSelector, self).__init__()
-            self._epoll = select.epoll()
-
-        def fileno(self):
-            return self._epoll.fileno()
-
-        def register(self, fileobj, events, data=None):
-            key = super(EpollSelector, self).register(fileobj, events, data)
-            events_mask = 0
-            if events & EVENT_READ:
-                events_mask |= select.EPOLLIN
-            if events & EVENT_WRITE:
-                events_mask |= select.EPOLLOUT
-            _syscall_wrapper(self._epoll.register, False, key.fd, events_mask)
-            return key
-
-        def unregister(self, fileobj):
-            key = super(EpollSelector, self).unregister(fileobj)
-            try:
-                _syscall_wrapper(self._epoll.unregister, False, key.fd)
-            except _ERROR_TYPES:
-                # This can occur when the fd was closed since registry.
-                pass
-            return key
-
-        def select(self, timeout=None):
-            if timeout is not None:
-                if timeout <= 0:
-                    timeout = 0.0
-                else:
-                    # select.epoll.poll() has a resolution of 1 millisecond
-                    # but luckily takes seconds so we don't need a wrapper
-                    # like PollSelector. Just for better rounding.
-                    timeout = math.ceil(timeout * 1000) * 0.001
-                timeout = float(timeout)
-            else:
-                timeout = -1.0  # epoll.poll() must have a float.
-
-            # We always want at least 1 to ensure that select can be called
-            # with no file descriptors registered. Otherwise will fail.
-            max_events = max(len(self._fd_to_key), 1)
-
-            ready = []
-            fd_events = _syscall_wrapper(self._epoll.poll, True,
-                                         timeout=timeout,
-                                         maxevents=max_events)
-            for fd, event_mask in fd_events:
-                events = 0
-                if event_mask & ~select.EPOLLIN:
-                    events |= EVENT_WRITE
-                if event_mask & ~select.EPOLLOUT:
-                    events |= EVENT_READ
-
-                key = self._key_from_fd(fd)
-                if key:
-                    ready.append((key, events & key.events))
-            return ready
-
-        def close(self):
-            self._epoll.close()
-            super(EpollSelector, self).close()
-
-    __all__.append('EpollSelector')
-
-
-if hasattr(select, "devpoll"):
-    class DevpollSelector(BaseSelector):
-        """Solaris /dev/poll selector."""
-
-        def __init__(self):
-            super(DevpollSelector, self).__init__()
-            self._devpoll = select.devpoll()
-
-        def fileno(self):
-            return self._devpoll.fileno()
-
-        def register(self, fileobj, events, data=None):
-            key = super(DevpollSelector, self).register(fileobj, events, data)
-            poll_events = 0
-            if events & EVENT_READ:
-                poll_events |= select.POLLIN
-            if events & EVENT_WRITE:
-                poll_events |= select.POLLOUT
-            self._devpoll.register(key.fd, poll_events)
-            return key
-
-        def unregister(self, fileobj):
-            key = super(DevpollSelector, self).unregister(fileobj)
-            self._devpoll.unregister(key.fd)
-            return key
-
-        def _wrap_poll(self, timeout=None):
-            """ Wrapper function for select.poll.poll() so that
-            _syscall_wrapper can work with only seconds. """
-            if timeout is not None:
-                if timeout <= 0:
-                    timeout = 0
-                else:
-                    # select.devpoll.poll() has a resolution of 1 millisecond,
-                    # round away from zero to wait *at least* timeout seconds.
-                    timeout = math.ceil(timeout * 1000)
-
-            result = self._devpoll.poll(timeout)
-            return result
-
-        def select(self, timeout=None):
-            ready = []
-            fd_events = _syscall_wrapper(self._wrap_poll, True, timeout=timeout)
-            for fd, event_mask in fd_events:
-                events = 0
-                if event_mask & ~select.POLLIN:
-                    events |= EVENT_WRITE
-                if event_mask & ~select.POLLOUT:
-                    events |= EVENT_READ
-
-                key = self._key_from_fd(fd)
-                if key:
-                    ready.append((key, events & key.events))
-
-            return ready
-
-        def close(self):
-            self._devpoll.close()
-            super(DevpollSelector, self).close()
-
-    __all__.append('DevpollSelector')
-
-
-if hasattr(select, "kqueue"):
-    class KqueueSelector(BaseSelector):
-        """ Kqueue / Kevent-based selector """
-        def __init__(self):
-            super(KqueueSelector, self).__init__()
-            self._kqueue = select.kqueue()
-
-        def fileno(self):
-            return self._kqueue.fileno()
-
-        def register(self, fileobj, events, data=None):
-            key = super(KqueueSelector, self).register(fileobj, events, data)
-            if events & EVENT_READ:
-                kevent = select.kevent(key.fd,
-                                       select.KQ_FILTER_READ,
-                                       select.KQ_EV_ADD)
-
-                _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
-
-            if events & EVENT_WRITE:
-                kevent = select.kevent(key.fd,
-                                       select.KQ_FILTER_WRITE,
-                                       select.KQ_EV_ADD)
-
-                _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
-
-            return key
-
-        def unregister(self, fileobj):
-            key = super(KqueueSelector, self).unregister(fileobj)
-            if key.events & EVENT_READ:
-                kevent = select.kevent(key.fd,
-                                       select.KQ_FILTER_READ,
-                                       select.KQ_EV_DELETE)
-                try:
-                    _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
-                except _ERROR_TYPES:
-                    pass
-            if key.events & EVENT_WRITE:
-                kevent = select.kevent(key.fd,
-                                       select.KQ_FILTER_WRITE,
-                                       select.KQ_EV_DELETE)
-                try:
-                    _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
-                except _ERROR_TYPES:
-                    pass
-
-            return key
-
-        def select(self, timeout=None):
-            if timeout is not None:
-                timeout = max(timeout, 0)
-
-            max_events = len(self._fd_to_key) * 2
-            ready_fds = {}
-
-            kevent_list = _syscall_wrapper(self._kqueue.control, True,
-                                           None, max_events, timeout)
-
-            for kevent in kevent_list:
-                fd = kevent.ident
-                event_mask = kevent.filter
-                events = 0
-                if event_mask == select.KQ_FILTER_READ:
-                    events |= EVENT_READ
-                if event_mask == select.KQ_FILTER_WRITE:
-                    events |= EVENT_WRITE
-
-                key = self._key_from_fd(fd)
-                if key:
-                    if key.fd not in ready_fds:
-                        ready_fds[key.fd] = (key, events & key.events)
-                    else:
-                        old_events = ready_fds[key.fd][1]
-                        ready_fds[key.fd] = (key, (events | old_events) & key.events)
-
-            return list(ready_fds.values())
-
-        def close(self):
-            self._kqueue.close()
-            super(KqueueSelector, self).close()
-
-    __all__.append('KqueueSelector')
-
-
-def _can_allocate(struct):
-    """ Checks that select structs can be allocated by the underlying
-    operating system, not just advertised by the select module. We don't
-    check select() because we'll be hopeful that most platforms that
-    don't have it available will not advertise it. (ie: GAE) """
-    try:
-        # select.poll() objects won't fail until used.
-        if struct == 'poll':
-            p = select.poll()
-            p.poll(0)
-
-        # All others will fail on allocation.
-        else:
-            getattr(select, struct)().close()
-        return True
-    except (OSError, AttributeError):
-        return False
-
-
-# Python 3.5 uses a more direct route to wrap system calls to increase speed.
-if sys.version_info >= (3, 5):
-    def _syscall_wrapper(func, _, *args, **kwargs):
-        """ This is the short-circuit version of the below logic
-        because in Python 3.5+ all selectors restart system calls. """
-        return func(*args, **kwargs)
-else:
-    def _syscall_wrapper(func, recalc_timeout, *args, **kwargs):
-        """ Wrapper function for syscalls that could fail due to EINTR.
-        All functions should be retried if there is time left in the timeout
-        in accordance with PEP 475. """
-        timeout = kwargs.get("timeout", None)
-        if timeout is None:
-            expires = None
-            recalc_timeout = False
-        else:
-            timeout = float(timeout)
-            if timeout < 0.0:  # Timeout less than 0 treated as no timeout.
-                expires = None
-            else:
-                expires = monotonic() + timeout
-
-        args = list(args)
-        if recalc_timeout and "timeout" not in kwargs:
-            raise ValueError(
-                "Timeout must be in args or kwargs to be recalculated")
-
-        result = _SYSCALL_SENTINEL
-        while result is _SYSCALL_SENTINEL:
-            try:
-                result = func(*args, **kwargs)
-            # OSError is thrown by select.select
-            # IOError is thrown by select.epoll.poll
-            # select.error is thrown by select.poll.poll
-            # Aren't we thankful for Python 3.x rework for exceptions?
-            except (OSError, IOError, select.error) as e:
-                # select.error wasn't a subclass of OSError in the past.
-                errcode = None
-                if hasattr(e, "errno"):
-                    errcode = e.errno
-                elif hasattr(e, "args"):
-                    errcode = e.args[0]
-
-                # Also test for the Windows equivalent of EINTR.
-                is_interrupt = (errcode == errno.EINTR or (hasattr(errno, "WSAEINTR") and
-                                                           errcode == errno.WSAEINTR))
-
-                if is_interrupt:
-                    if expires is not None:
-                        current_time = monotonic()
-                        if current_time > expires:
-                            raise OSError(errno=errno.ETIMEDOUT)
-                        if recalc_timeout:
-                            if "timeout" in kwargs:
-                                kwargs["timeout"] = expires - current_time
-                    continue
-                raise
-        return result
-
-
-# Choose the best implementation, roughly:
-# kqueue == devpoll == epoll > poll > select
-# select() also can't accept a FD > FD_SETSIZE (usually around 1024)
-def DefaultSelector():
-    """ This function serves as a first call for DefaultSelector to
-    detect if the select module is being monkey-patched incorrectly
-    by eventlet, greenlet, and preserve proper behavior. """
-    global _DEFAULT_SELECTOR
-    if _DEFAULT_SELECTOR is None:
-        if pycompat.isjython:
-            _DEFAULT_SELECTOR = JythonSelectSelector
-        elif _can_allocate('kqueue'):
-            _DEFAULT_SELECTOR = KqueueSelector
-        elif _can_allocate('devpoll'):
-            _DEFAULT_SELECTOR = DevpollSelector
-        elif _can_allocate('epoll'):
-            _DEFAULT_SELECTOR = EpollSelector
-        elif _can_allocate('poll'):
-            _DEFAULT_SELECTOR = PollSelector
-        elif hasattr(select, 'select'):
-            _DEFAULT_SELECTOR = SelectSelector
-        else:  # Platform-specific: AppEngine
-            raise RuntimeError('Platform does not have a selector.')
-    return _DEFAULT_SELECTOR()
--- a/mercurial/setdiscovery.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/setdiscovery.py	Tue Dec 19 16:27:24 2017 -0500
@@ -133,7 +133,8 @@
 def findcommonheads(ui, local, remote,
                     initialsamplesize=100,
                     fullsamplesize=200,
-                    abortwhenunrelated=True):
+                    abortwhenunrelated=True,
+                    ancestorsof=None):
     '''Return a tuple (common, anyincoming, remoteheads) used to identify
     missing nodes from or in remote.
     '''
@@ -141,7 +142,11 @@
 
     roundtrips = 0
     cl = local.changelog
-    dag = dagutil.revlogdag(cl)
+    localsubset = None
+    if ancestorsof is not None:
+        rev = local.changelog.rev
+        localsubset = [rev(n) for n in ancestorsof]
+    dag = dagutil.revlogdag(cl, localsubset=localsubset)
 
     # early exit if we know all the specified remote heads already
     ui.debug("query 1; heads\n")
--- a/mercurial/simplemerge.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/simplemerge.py	Tue Dec 19 16:27:24 2017 -0500
@@ -418,6 +418,8 @@
 
     The merged result is written into `localctx`.
     """
+    opts = pycompat.byteskwargs(opts)
+
     def readctx(ctx):
         # Merges were always run in the working copy before, which means
         # they used decoded data, if the user defined any repository
--- a/mercurial/sshpeer.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/sshpeer.py	Tue Dec 19 16:27:24 2017 -0500
@@ -136,6 +136,8 @@
 
         sshcmd = self.ui.config("ui", "ssh")
         remotecmd = self.ui.config("ui", "remotecmd")
+        sshaddenv = dict(self.ui.configitems("sshenv"))
+        sshenv = util.shellenviron(sshaddenv)
 
         args = util.sshargs(sshcmd, self._host, self._user, self._port)
 
@@ -144,11 +146,11 @@
                 util.shellquote("%s init %s" %
                     (_serverquote(remotecmd), _serverquote(self._path))))
             ui.debug('running %s\n' % cmd)
-            res = ui.system(cmd, blockedtag='sshpeer')
+            res = ui.system(cmd, blockedtag='sshpeer', environ=sshenv)
             if res != 0:
                 self._abort(error.RepoError(_("could not create remote repo")))
 
-        self._validaterepo(sshcmd, args, remotecmd)
+        self._validaterepo(sshcmd, args, remotecmd, sshenv)
 
     # Begin of _basepeer interface.
 
@@ -180,7 +182,7 @@
 
     # End of _basewirecommands interface.
 
-    def _validaterepo(self, sshcmd, args, remotecmd):
+    def _validaterepo(self, sshcmd, args, remotecmd, sshenv=None):
         # cleanup up previous run
         self._cleanup()
 
@@ -196,7 +198,7 @@
         # no buffer allow the use of 'select'
         # feel free to remove buffering and select usage when we ultimately
         # move to threading.
-        sub = util.popen4(cmd, bufsize=0)
+        sub = util.popen4(cmd, bufsize=0, env=sshenv)
         self._pipeo, self._pipei, self._pipee, self._subprocess = sub
 
         self._pipei = util.bufferedinputpipe(self._pipei)
@@ -204,8 +206,9 @@
         self._pipeo = doublepipe(self.ui, self._pipeo, self._pipee)
 
         def badresponse():
-            self._abort(error.RepoError(_('no suitable response from '
-                                          'remote hg')))
+            msg = _("no suitable response from remote hg")
+            hint = self.ui.config("ui", "ssherrorhint")
+            self._abort(error.RepoError(msg, hint=hint))
 
         try:
             # skip any noise generated by remote shell
--- a/mercurial/sslutil.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/sslutil.py	Tue Dec 19 16:27:24 2017 -0500
@@ -96,13 +96,13 @@
             # in this legacy code since we don't support SNI.
 
             args = {
-                'keyfile': self._keyfile,
-                'certfile': self._certfile,
-                'server_side': server_side,
-                'cert_reqs': self.verify_mode,
-                'ssl_version': self.protocol,
-                'ca_certs': self._cacerts,
-                'ciphers': self._ciphers,
+                r'keyfile': self._keyfile,
+                r'certfile': self._certfile,
+                r'server_side': server_side,
+                r'cert_reqs': self.verify_mode,
+                r'ssl_version': self.protocol,
+                r'ca_certs': self._cacerts,
+                r'ciphers': self._ciphers,
             }
 
             return ssl.wrap_socket(socket, **args)
--- a/mercurial/statichttprepo.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/statichttprepo.py	Tue Dec 19 16:27:24 2017 -0500
@@ -166,8 +166,6 @@
         self.encodepats = None
         self.decodepats = None
         self._transref = None
-        # Cache of types representing filtered repos.
-        self._filteredrepotypes = {}
 
     def _restrictcapabilities(self, caps):
         caps = super(statichttprepository, self)._restrictcapabilities(caps)
--- a/mercurial/statprof.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/statprof.py	Tue Dec 19 16:27:24 2017 -0500
@@ -815,7 +815,6 @@
         tos = sample.stack[0]
         name = tos.function
         path = simplifypath(tos.path)
-        category = '%s:%d' % (path, tos.lineno)
         stack = tuple((('%s:%d' % (simplifypath(frame.path), frame.lineno),
                         frame.function) for frame in sample.stack))
         qstack = collections.deque(stack)
@@ -922,7 +921,7 @@
 
     load_data(path=path)
 
-    display(**displayargs)
+    display(**pycompat.strkwargs(displayargs))
 
     return 0
 
--- a/mercurial/subrepo.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/subrepo.py	Tue Dec 19 16:27:24 2017 -0500
@@ -60,8 +60,8 @@
 class SubrepoAbort(error.Abort):
     """Exception class used to avoid handling a subrepo error more than once"""
     def __init__(self, *args, **kw):
-        self.subrepo = kw.pop('subrepo', None)
-        self.cause = kw.pop('cause', None)
+        self.subrepo = kw.pop(r'subrepo', None)
+        self.cause = kw.pop(r'cause', None)
         error.Abort.__init__(self, *args, **kw)
 
 def annotatesubrepoerror(func):
@@ -1154,24 +1154,24 @@
         # 2. update the subrepo to the revision specified in
         #    the corresponding substate dictionary
         self.ui.status(_('reverting subrepo %s\n') % substate[0])
-        if not opts.get('no_backup'):
+        if not opts.get(r'no_backup'):
             # Revert all files on the subrepo, creating backups
             # Note that this will not recursively revert subrepos
             # We could do it if there was a set:subrepos() predicate
             opts = opts.copy()
-            opts['date'] = None
-            opts['rev'] = substate[1]
+            opts[r'date'] = None
+            opts[r'rev'] = substate[1]
 
             self.filerevert(*pats, **opts)
 
         # Update the repo to the revision specified in the given substate
-        if not opts.get('dry_run'):
+        if not opts.get(r'dry_run'):
             self.get(substate, overwrite=True)
 
     def filerevert(self, *pats, **opts):
-        ctx = self._repo[opts['rev']]
+        ctx = self._repo[opts[r'rev']]
         parents = self._repo.dirstate.parents()
-        if opts.get('all'):
+        if opts.get(r'all'):
             pats = ['set:modified()']
         else:
             pats = []
@@ -1244,7 +1244,7 @@
         if not self.ui.interactive():
             # Making stdin be a pipe should prevent svn from behaving
             # interactively even if we can't pass --non-interactive.
-            extrakw['stdin'] = subprocess.PIPE
+            extrakw[r'stdin'] = subprocess.PIPE
             # Starting in svn 1.5 --non-interactive is a global flag
             # instead of being per-command, but we need to support 1.4 so
             # we have to be intelligent about what commands take
--- a/mercurial/templatefilters.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templatefilters.py	Tue Dec 19 16:27:24 2017 -0500
@@ -349,6 +349,11 @@
     """Date. Returns a date like "2006-09-18"."""
     return util.shortdate(text)
 
+@templatefilter('slashpath')
+def slashpath(path):
+    """Any text. Replaces the native path separator with slash."""
+    return util.pconvert(path)
+
 @templatefilter('splitlines')
 def splitlines(text):
     """Any text. Split text into a list of lines."""
--- a/mercurial/templatekw.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templatekw.py	Tue Dec 19 16:27:24 2017 -0500
@@ -17,6 +17,7 @@
     encoding,
     error,
     hbisect,
+    i18n,
     obsutil,
     patch,
     pycompat,
@@ -301,6 +302,30 @@
 
     return getrenamed
 
+def getlogcolumns():
+    """Return a dict of log column labels"""
+    _ = pycompat.identity  # temporarily disable gettext
+    # i18n: column positioning for "hg log"
+    columns = _('bookmark:    %s\n'
+                'branch:      %s\n'
+                'changeset:   %s\n'
+                'copies:      %s\n'
+                'date:        %s\n'
+                'extra:       %s=%s\n'
+                'files+:      %s\n'
+                'files-:      %s\n'
+                'files:       %s\n'
+                'instability: %s\n'
+                'manifest:    %s\n'
+                'obsolete:    %s\n'
+                'parent:      %s\n'
+                'phase:       %s\n'
+                'summary:     %s\n'
+                'tag:         %s\n'
+                'user:        %s\n')
+    return dict(zip([s.split(':', 1)[0] for s in columns.splitlines()],
+                    i18n._(columns).splitlines(True)))
+
 # default templates internally used for rendering of lists
 defaulttempl = {
     'parent': '{rev}:{node|formatnode} ',
@@ -608,6 +633,7 @@
     # the verbosity templatekw available.
     succsandmarkers = showsuccsandmarkers(**args)
 
+    args = pycompat.byteskwargs(args)
     ui = args['ui']
 
     values = []
@@ -816,7 +842,7 @@
 
 @templatekeyword('phaseidx')
 def showphaseidx(repo, ctx, templ, **args):
-    """Integer. The changeset phase index."""
+    """Integer. The changeset phase index. (ADVANCED)"""
     return ctx.phase()
 
 @templatekeyword('rev')
@@ -860,12 +886,6 @@
     """List of strings. Any tags associated with the changeset."""
     return shownames('tags', **args)
 
-def loadkeyword(ui, extname, registrarobj):
-    """Load template keyword from specified registrarobj
-    """
-    for name, func in registrarobj._table.iteritems():
-        keywords[name] = func
-
 @templatekeyword('termwidth')
 def showtermwidth(repo, ctx, templ, **args):
     """Integer. The width of the current terminal."""
@@ -891,5 +911,24 @@
     return showlist('instability', args['ctx'].instabilities(), args,
                     plural='instabilities')
 
+@templatekeyword('verbosity')
+def showverbosity(ui, **args):
+    """String. The current output verbosity in 'debug', 'quiet', 'verbose',
+    or ''."""
+    # see cmdutil.changeset_templater for priority of these flags
+    if ui.debugflag:
+        return 'debug'
+    elif ui.quiet:
+        return 'quiet'
+    elif ui.verbose:
+        return 'verbose'
+    return ''
+
+def loadkeyword(ui, extname, registrarobj):
+    """Load template keyword from specified registrarobj
+    """
+    for name, func in registrarobj._table.iteritems():
+        keywords[name] = func
+
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = keywords.values()
--- a/mercurial/templater.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templater.py	Tue Dec 19 16:27:24 2017 -0500
@@ -880,7 +880,7 @@
     if len(args) == 1:
         pattern = evalstring(context, mapping, args[0])
 
-    return templatekw.showlatesttags(pattern, **mapping)
+    return templatekw.showlatesttags(pattern, **pycompat.strkwargs(mapping))
 
 @templatefunc('localdate(date[, tz])')
 def localdate(context, mapping, args):
@@ -1005,17 +1005,18 @@
                 "obsmakers")
         raise error.ParseError(msg)
 
-@templatefunc('obsfateverb(successors)')
+@templatefunc('obsfateverb(successors, markers)')
 def obsfateverb(context, mapping, args):
     """Compute obsfate related information based on successors (EXPERIMENTAL)"""
-    if len(args) != 1:
+    if len(args) != 2:
         # i18n: "obsfateverb" is a keyword
-        raise error.ParseError(_("obsfateverb expects one arguments"))
+        raise error.ParseError(_("obsfateverb expects two arguments"))
 
     successors = evalfuncarg(context, mapping, args[0])
+    markers = evalfuncarg(context, mapping, args[1])
 
     try:
-        return obsutil.successorsetverb(successors)
+        return obsutil.obsfateverb(successors, markers)
     except TypeError:
         # i18n: "obsfateverb" is a keyword
         errmsg = _("obsfateverb first argument should be countable")
@@ -1062,7 +1063,8 @@
             revs = list(revs)
             revsetcache[raw] = revs
 
-    return templatekw.showrevslist("revision", revs, **mapping)
+    return templatekw.showrevslist("revision", revs,
+                                   **pycompat.strkwargs(mapping))
 
 @templatefunc('rstdoc(text, style)')
 def rstdoc(context, mapping, args):
--- a/mercurial/templates/gitweb/changelogentry.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/gitweb/changelogentry.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -1,5 +1,9 @@
 <div>
-<a class="title" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}"><span class="age">{date|rfc822date}</span>{desc|strip|firstline|escape|nonempty}<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></a>
+ <a class="title" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
+  <span class="age">{date|rfc822date}</span>
+  {desc|strip|firstline|escape|nonempty}
+  {alltags}
+ </a>
 </div>
 <div class="title_text">
 <div class="log_link">
--- a/mercurial/templates/gitweb/changeset.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/gitweb/changeset.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -30,7 +30,10 @@
 </div>
 
 <div>
-<a class="title" href="{url|urlescape}raw-rev/{node|short}">{desc|strip|escape|firstline|nonempty} <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></a>
+ <a class="title" href="{url|urlescape}raw-rev/{node|short}">
+  {desc|strip|escape|firstline|nonempty}
+  {alltags}
+ </a>
 </div>
 <div class="title_text">
 <table cellspacing="0">
--- a/mercurial/templates/gitweb/filelog.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/gitweb/filelog.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -36,7 +36,7 @@
 
 <div class="title" >
   {file|urlescape}{if(linerange,
-' (following lines {linerange}{if(descend, ', descending')} <a href="{url|urlescape}log/{symrev}/{file|urlescape}{sessionvars%urlparameter}">back to filelog</a>)')}
+' (following lines {linerange}{if(descend, ', descending')} <a href="{url|urlescape}log/{symrev}/{file|urlescape}{sessionvars%urlparameter}">all revisions for this file</a>)')}
 </div>
 
 <table>
--- a/mercurial/templates/gitweb/graph.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/gitweb/graph.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -38,65 +38,21 @@
 
 <div id="wrapper">
 <ul id="nodebgs"></ul>
-<canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
-<ul id="graphnodes"></ul>
+<canvas id="graph"></canvas>
+<ul id="graphnodes">{nodes%graphentry}</ul>
 </div>
 
 <script{if(nonce, ' nonce="{nonce}"')}>
-<!-- hide script content
-
 var data = {jsdata|json};
 var graph = new Graph();
 graph.scale({bg_height});
 
-graph.vertex = function(x, y, color, parity, cur) \{
-	
-	this.ctx.beginPath();
-	color = this.setColor(color, 0.25, 0.75);
-	this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
-	this.ctx.fill();
-	
-	var bg = '<li class="bg parity' + parity + '"></li>';
-	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
-	var nstyle = 'padding-left: ' + left + 'px;';
-	
-	var tagspan = '';
-	if (cur[7].length || cur[8].length || (cur[6][0] != 'default' || cur[6][1])) \{
-		tagspan = '<span class="logtags">';
-		if (cur[6][1]) \{
-			tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
-			tagspan += cur[6][0] + '</span> ';
-		} else if (!cur[6][1] && cur[6][0] != 'default') \{
-			tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
-			tagspan += cur[6][0] + '</span> ';
-		}
-		if (cur[7].length) \{
-			for (var t in cur[7]) \{
-				var tag = cur[7][t];
-				tagspan += '<span class="tagtag">' + tag + '</span> ';
-			}
-		}
-		if (cur[8].length) \{
-			for (var t in cur[8]) \{
-				var bookmark = cur[8][t];
-				tagspan += '<span class="bookmarktag">' + bookmark + '</span> ';
-			}
-		}
-		tagspan += '</span>';
-	}
-	
-	var item = '<li style="' + nstyle + '"><span class="desc">';
-	item += '<a class="list" href="{url|urlescape}rev/' + cur[0] + '{sessionvars%urlparameter}" title="' + cur[0] + '"><b>' + cur[3] + '</b></a>';
-	item += '</span> ' + tagspan + '';
-	item += '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
-
-	return [bg, item];
-	
+graph.vertex = function(x, y, radius, color, parity, cur) \{
+	Graph.prototype.vertex.apply(this, arguments);
+	return ['<li class="bg parity' + parity + '"></li>', ''];
 }
 
 graph.render(data);
-
-// stop hiding script -->
 </script>
 
 <div class="extra_nav">
@@ -107,9 +63,12 @@
 
 <script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
     ajaxScrollInit(
-            '{url|urlescape}graph/{rev}?revcount=%next%&style={style}',
-            {revcount}+60,
-            function (htmlText, previousVal) \{ return previousVal + 60; },
+            '{url|urlescape}graph/%next%{graphvars%urlparameter}',
+            '{nextentry%"{node}"}', <!-- NEXTHASH
+            function (htmlText, previousVal) \{
+                var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/);
+                return m ? m[1] : null;
+            },
             '#wrapper',
             '<div class="%class%" style="text-align: center;">%text%</div>',
             'graph'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/templates/gitweb/graphentry.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,7 @@
+<li data-node="{node|short}">
+ <span class="desc">
+  <a class="list" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}"><b>{desc|strip|firstline|escape|nonempty}</b></a>
+ </span>
+ {alltags}
+ <span class="info">{date|age}, by {author|person}</span>
+</li>
--- a/mercurial/templates/gitweb/manifest.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/gitweb/manifest.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -28,7 +28,7 @@
 {searchform}
 </div>
 
-<div class="title">{path|escape} <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></div>
+<div class="title">{path|escape} {alltags}</div>
 <table cellspacing="0">
 <tr class="parity{upparity}">
 <td style="font-family:monospace">drwxr-xr-x</td>
--- a/mercurial/templates/gitweb/map	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/gitweb/map	Tue Dec 19 16:27:24 2017 -0500
@@ -262,10 +262,15 @@
   </tr>'
 shortlog = shortlog.tmpl
 graph = graph.tmpl
+graphentry = graphentry.tmpl
+phasetag = '{ifeq(phase, 'public', '', '<span class="phasetag" title="{phase|escape}">{phase|escape}</span> ')}'
+obsoletetag = '{if(obsolete, '<span class="obsoletetag" title="obsolete">obsolete</span> ')}'
+instabilitytag = '<span class="instabilitytag" title="{instability|escape}">{instability|escape}</span> '
 tagtag = '<span class="tagtag" title="{name|escape}">{name|escape}</span> '
 branchtag = '<span class="branchtag" title="{name|escape}">{name|escape}</span> '
 inbranchtag = '<span class="inbranchtag" title="{name|escape}">{name|escape}</span> '
 bookmarktag = '<span class="bookmarktag" title="{name|escape}">{name|escape}</span> '
+alltags = '<span class="logtags">{phasetag}{obsoletetag}{instabilities%instabilitytag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
 shortlogentry = '
   <tr class="parity{parity}">
     <td class="age"><i class="age">{date|rfc822date}</i></td>
@@ -273,7 +278,7 @@
     <td>
       <a class="list" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
         <b>{desc|strip|firstline|escape|nonempty}</b>
-        <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+        {alltags}
       </a>
     </td>
     <td class="link" nowrap>
@@ -288,7 +293,7 @@
     <td>
       <a class="list" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
         <b>{desc|strip|firstline|escape|nonempty}</b>
-        <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+        {alltags}
       </a>
     </td>
     <td class="link">
--- a/mercurial/templates/gitweb/summary.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/gitweb/summary.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -31,7 +31,7 @@
 <table cellspacing="0">
 <tr><td>description</td><td>{desc}</td></tr>
 <tr><td>owner</td><td>{owner|obfuscate}</td></tr>
-<tr><td>last change</td><td>{lastchange|rfc822date}</td></tr>
+<tr><td>last change</td><td class="date age">{lastchange|rfc822date}</td></tr>
 </table>
 
 <div><a  class="title" href="{url|urlescape}shortlog{sessionvars%urlparameter}">changes</a></div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/templates/json/graph.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,5 @@
+\{
+  "node": {node|json},
+  "changeset_count": {changesets|json},
+  "changesets": [{join(nodes%graphentry, ", ")}]
+}
--- a/mercurial/templates/json/map	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/json/map	Tue Dec 19 16:27:24 2017 -0500
@@ -25,6 +25,7 @@
 # number of entries.
 changelog = changelist.tmpl
 shortlog = changelist.tmpl
+graph = graph.tmpl
 changelistentry = '\{
   "node": {node|json},
   "date": {date|json},
@@ -37,6 +38,22 @@
   "parents": [{if(allparents, join(allparents%changesetparent, ", "),
                   join(parent%changesetparent, ", "))}]
   }'
+graphentry = '\{
+  "node": {node|json},
+  "date": {date|json},
+  "desc": {desc|utf8|json},
+  "branch": {if(branch, branch%changesetbranch, "default"|json)},
+  "bookmarks": [{join(bookmarks%changelistentryname, ", ")}],
+  "tags": [{join(tags%changelistentryname, ", ")}],
+  "user": {author|utf8|json},
+  "phase": {phase|json},
+  "col": {col|json},
+  "row": {row|json},
+  "color": {color|json},
+  "edges": {edges|json},
+  "parents": [{if(allparents, join(allparents%changesetparent, ", "),
+                  join(parent%changesetparent, ", "))}]
+  }'
 changelistentryname = '{name|utf8|json}'
 changeset = '\{
   "node": {node|json},
@@ -198,7 +215,6 @@
 filelog = '\{
   "entries": [{join(entries%changelistentry, ", ")}]
   }'
-graph = '"not yet implemented"'
 helptopics = '\{
   "topics": [{join(topics%helptopicentry, ", ")}],
   "earlycommands": [{join(earlycommands%helptopicentry, ", ")}],
--- a/mercurial/templates/monoblue/changelogentry.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/monoblue/changelogentry.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -1,4 +1,9 @@
-<h3 class="changelog"><a class="title" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></a></h3>
+<h3 class="changelog">
+    <a class="title" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
+        {desc|strip|firstline|escape|nonempty}
+        {alltags}
+    </a>
+</h3>
 <ul class="changelog-entry">
     <li class="age">{date|rfc822date}</li>
     <li>by <span class="name">{author|obfuscate}</span> <span class="revdate">[{date|rfc822date}] rev {rev}</span></li>
--- a/mercurial/templates/monoblue/changeset.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/monoblue/changeset.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -32,14 +32,19 @@
 
     <h2 class="no-link no-border">changeset</h2>
 
-    <h3 class="changeset"><a href="{url|urlescape}raw-rev/{node|short}">{desc|strip|escape|firstline|nonempty} <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></a></h3>
+    <h3 class="changeset">
+        <a href="{url|urlescape}raw-rev/{node|short}">
+            {desc|strip|escape|firstline|nonempty}
+            {alltags}
+        </a>
+    </h3>
     <p class="changeset-age"><span class="age">{date|rfc822date}</span></p>
 
     <dl class="overview">
         <dt>author</dt>
         <dd>{author|obfuscate}</dd>
         <dt>date</dt>
-        <dd>{date|rfc822date}</dd>
+        <dd class="date age">{date|rfc822date}</dd>
         {branch%changesetbranch}
         <dt>changeset {rev}</dt>
         <dd><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></dd>
--- a/mercurial/templates/monoblue/fileannotate.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/monoblue/fileannotate.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -42,7 +42,7 @@
         <dt>author</dt>
         <dd>{author|obfuscate}</dd>
         <dt>date</dt>
-        <dd>{date|rfc822date}</dd>
+        <dd class="date age">{date|rfc822date}</dd>
         {branch%filerevbranch}
         <dt>changeset {rev}</dt>
         <dd><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></dd>
--- a/mercurial/templates/monoblue/filerevision.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/monoblue/filerevision.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -42,7 +42,7 @@
         <dt>author</dt>
         <dd>{author|obfuscate}</dd>
         <dt>date</dt>
-        <dd>{date|rfc822date}</dd>
+        <dd class="date age">{date|rfc822date}</dd>
         {branch%filerevbranch}
         <dt>changeset {rev}</dt>
         <dd><a class="list" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></dd>
--- a/mercurial/templates/monoblue/graph.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/monoblue/graph.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -30,66 +30,23 @@
     <div id="noscript">The revision graph only works with JavaScript-enabled browsers.</div>
     <div id="wrapper">
         <ul id="nodebgs"></ul>
-        <canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
-        <ul id="graphnodes"></ul>
+        <canvas id="graph"></canvas>
+        <ul id="graphnodes">{nodes%graphentry}</ul>
     </div>
 
     <script{if(nonce, ' nonce="{nonce}"')}>
-    <!-- hide script content
-
     document.getElementById('noscript').style.display = 'none';
 
     var data = {jsdata|json};
     var graph = new Graph();
     graph.scale({bg_height});
 
-    graph.vertex = function(x, y, color, parity, cur) \{
-
-        this.ctx.beginPath();
-        color = this.setColor(color, 0.25, 0.75);
-        this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
-        this.ctx.fill();
-
-        var bg = '<li class="bg parity' + parity + '"></li>';
-        var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
-        var nstyle = 'padding-left: ' + left + 'px;';
-
-        var tagspan = '';
-        if (cur[7].length || cur[8].length || (cur[6][0] != 'default' || cur[6][1])) \{
-            tagspan = '<span class="logtags">';
-            if (cur[6][1]) \{
-                tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
-                tagspan += cur[6][0] + '</span> ';
-            } else if (!cur[6][1] && cur[6][0] != 'default') \{
-                tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
-                tagspan += cur[6][0] + '</span> ';
-            }
-            if (cur[7].length) \{
-                for (var t in cur[7]) \{
-                    var tag = cur[7][t];
-                    tagspan += '<span class="tagtag">' + tag + '</span> ';
-                }
-            }
-            if (cur[8].length) \{
-                for (var t in cur[8]) \{
-                    var bookmark = cur[8][t];
-                    tagspan += '<span class="bookmarktag">' + bookmark + '</span> ';
-                }
-            }
-            tagspan += '</span>';
-        }
-
-        var item = '<li style="' + nstyle + '"><span class="desc">';
-        item += '<a href="{url|urlescape}rev/' + cur[0] + '{sessionvars%urlparameter}" title="' + cur[0] + '">' + cur[3] + '</a>';
-        item += '</span>' + tagspan + '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
-
-        return [bg, item];
-
+    graph.vertex = function(x, y, radius, color, parity, cur) \{
+        Graph.prototype.vertex.apply(this, arguments);
+        return ['<li class="bg parity' + parity + '"></li>', ''];
     }
 
     graph.render(data);
-
-    // stop hiding script -->
     </script>
 
     <div class="page-path">
@@ -100,9 +57,12 @@
 
     <script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
     ajaxScrollInit(
-            '{url|urlescape}graph/{rev}?revcount=%next%&style={style}',
-            {revcount}+60,
-            function (htmlText, previousVal) \{ return previousVal + 60; },
+            '{url|urlescape}graph/%next%{graphvars%urlparameter}',
+            '{nextentry%"{node}"}', <!-- NEXTHASH
+            function (htmlText, previousVal) \{
+                var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/);
+                return m ? m[1] : null;
+            },
             '#wrapper',
             '<div class="%class%" style="text-align: center;">%text%</div>',
             'graph'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/templates/monoblue/graphentry.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,7 @@
+<li data-node="{node|short}">
+    <span class="desc">
+        <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>
+    </span>
+    {alltags}
+    <span class="info"><span class="age">{date|rfc822date}</span>, by {author|person}</span>
+</li>
--- a/mercurial/templates/monoblue/manifest.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/monoblue/manifest.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -30,7 +30,7 @@
     </ul>
 
     <h2 class="no-link no-border">files</h2>
-    <p class="files">{path|escape} <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></p>
+    <p class="files">{path|escape} {alltags}</p>
 
     <table>
         <tr class="parity{upparity}">
--- a/mercurial/templates/monoblue/map	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/monoblue/map	Tue Dec 19 16:27:24 2017 -0500
@@ -221,10 +221,14 @@
   <dt>child {rev}</dt>
   <dd><a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></dd>'
 shortlog = shortlog.tmpl
+phasetag = '{ifeq(phase, 'public', '', '<span class="phasetag" title="{phase|escape}">{phase|escape}</span> ')}'
+obsoletetag = '{if(obsolete, '<span class="obsoletetag" title="obsolete">obsolete</span> ')}'
+instabilitytag = '<span class="instabilitytag" title="{instability|escape}">{instability|escape}</span> '
 tagtag = '<span class="tagtag" title="{name|escape}">{name|escape}</span> '
 branchtag = '<span class="branchtag" title="{name|escape}">{name|escape}</span> '
 inbranchtag = '<span class="inbranchtag" title="{name|escape}">{name|escape}</span> '
 bookmarktag = '<span class="bookmarktag" title="{name|escape}">{name|escape}</span> '
+alltags = '<span class="logtags">{phasetag}{obsoletetag}{instabilities%instabilitytag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
 shortlogentry = '
   <tr class="parity{parity}">
     <td class="nowrap age">{date|rfc822date}</td>
@@ -232,7 +236,7 @@
     <td>
       <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
         {desc|strip|firstline|escape|nonempty}
-        <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+        {alltags}
       </a>
     </td>
     <td class="nowrap">
@@ -247,7 +251,7 @@
     <td>
       <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
         {desc|strip|firstline|escape|nonempty}
-        <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>
+        {alltags}
       </a>
     </td>
     <td class="nowrap">
@@ -278,6 +282,7 @@
 urlparameter = '{separator}{name}={value|urlescape}'
 hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
 graph = graph.tmpl
+graphentry = graphentry.tmpl
 breadcrumb = '&gt; <a href="{url|urlescape}">{name|escape}</a> '
 
 searchform = '
--- a/mercurial/templates/monoblue/summary.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/monoblue/summary.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -34,7 +34,7 @@
         <dt>owner</dt>
         <dd>{owner|obfuscate}</dd>
         <dt>last change</dt>
-        <dd>{lastchange|rfc822date}</dd>
+        <dd class="date age">{lastchange|rfc822date}</dd>
     </dl>
 
     <h2><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">Changes</a></h2>
--- a/mercurial/templates/paper/changeset.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/paper/changeset.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -33,7 +33,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  changeset {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {changesetbranch%changelogbranchname}{changesettag}{changesetbookmark}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/fileannotate.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/paper/fileannotate.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -39,7 +39,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  annotate {file|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/filecomparison.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/paper/filecomparison.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -38,7 +38,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  comparison {file|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/filediff.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/paper/filediff.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -38,7 +38,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  diff {file|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/filelog.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/paper/filelog.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -46,9 +46,9 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  log {file|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
  {if(linerange,
-' (following lines {linerange}{if(descend, ', descending')} <a href="{url|urlescape}log/{symrev}/{file|urlescape}{sessionvars%urlparameter}">back to filelog</a>)')}
+' (following lines {linerange}{if(descend, ', descending')} <a href="{url|urlescape}log/{symrev}/{file|urlescape}{sessionvars%urlparameter}">all revisions for this file</a>)')}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/filelogentry.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/paper/filelogentry.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -3,7 +3,7 @@
   <td class="author">{author|person}</td>
   <td class="description">
    <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>
-   {inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}{rename%filelogrename}
+   {alltags}{rename%filelogrename}
   </td>
  </tr>
  {if(patch, '<tr><td colspan="3">{diff}</td></tr>')}
--- a/mercurial/templates/paper/filerevision.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/paper/filerevision.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -38,7 +38,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  view {file|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/graph.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/paper/graph.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -51,64 +51,21 @@
 
 <div id="wrapper">
 <ul id="nodebgs" class="stripes2"></ul>
-<canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
-<ul id="graphnodes"></ul>
+<canvas id="graph"></canvas>
+<ul id="graphnodes">{nodes%graphentry}</ul>
 </div>
 
 <script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
-<!-- hide script content
-
 var data = {jsdata|json};
 var graph = new Graph();
 graph.scale({bg_height});
 
-graph.vertex = function(x, y, color, parity, cur) \{
-	
-	this.ctx.beginPath();
-	color = this.setColor(color, 0.25, 0.75);
-	this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
-	this.ctx.fill();
-	
-	var bg = '<li class="bg"></li>';
-	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
-	var nstyle = 'padding-left: ' + left + 'px;';
-
-	var tagspan = '';
-	if (cur[7].length || cur[8].length || (cur[6][0] != 'default' || cur[6][1])) \{
-		tagspan = '<span class="logtags">';
-		if (cur[6][1]) \{
-			tagspan += '<span class="branchhead" title="' + cur[6][0] + '">';
-			tagspan += cur[6][0] + '</span> ';
-		} else if (!cur[6][1] && cur[6][0] != 'default') \{
-			tagspan += '<span class="branchname" title="' + cur[6][0] + '">';
-			tagspan += cur[6][0] + '</span> ';
-		}
-		if (cur[7].length) \{
-			for (var t in cur[7]) \{
-				var tag = cur[7][t];
-				tagspan += '<span class="tag">' + tag + '</span> ';
-			}
-		}
-		if (cur[8].length) \{
-			for (var b in cur[8]) \{
-				var bookmark = cur[8][b];
-				tagspan += '<span class="tag">' + bookmark + '</span> ';
-			}
-		}
-		tagspan += '</span>';
-	}
-
-	var item = '<li style="' + nstyle + '"><span class="desc">';
-	item += '<a href="{url|urlescape}rev/' + cur[0] + '{sessionvars%urlparameter}" title="' + cur[0] + '">' + cur[3] + '</a>';
-	item += '</span>' + tagspan + '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
-	
-	return [bg, item];
-	
+graph.vertex = function(x, y, radius, color, parity, cur) \{
+	Graph.prototype.vertex.apply(this, arguments);
+	return ['<li class="bg"></li>', ''];
 }
 
 graph.render(data);
-
-// stop hiding script -->
 </script>
 
 <div class="navigate">
@@ -119,9 +76,12 @@
 
 <script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
     ajaxScrollInit(
-            '{url|urlescape}graph/{rev}?revcount=%next%&style={style}',
-            {revcount}+60,
-            function (htmlText, previousVal) \{ return previousVal + 60; },
+            '{url|urlescape}graph/%next%{graphvars%urlparameter}',
+            '{nextentry%"{node}"}', <!-- NEXTHASH
+            function (htmlText, previousVal) \{
+                var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/);
+                return m ? m[1] : null;
+            },
             '#wrapper',
             '<div class="%class%" style="text-align: center;">%text%</div>',
             'graph'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/templates/paper/graphentry.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,7 @@
+<li data-node="{node|short}">
+ <span class="desc">
+  <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>
+ </span>
+ {alltags}
+ <span class="info"><span class="age">{date|rfc822date}</span>, by {author|person}</span>
+</li>
--- a/mercurial/templates/paper/manifest.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/paper/manifest.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -32,7 +32,7 @@
 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
 <h3>
  directory {path|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
- {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
+ {alltags}
 </h3>
 
 {searchform}
--- a/mercurial/templates/paper/map	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/paper/map	Tue Dec 19 16:27:24 2017 -0500
@@ -9,6 +9,7 @@
 shortlog = shortlog.tmpl
 shortlogentry = shortlogentry.tmpl
 graph = graph.tmpl
+graphentry = graphentry.tmpl
 help = help.tmpl
 helptopics = helptopics.tmpl
 
@@ -198,11 +199,15 @@
       </a>
     </td>
   </tr>'
+phasetag = '{ifeq(phase, 'public', '', '<span class="phase">{phase|escape}</span> ')}'
+obsoletetag = '{if(obsolete, '<span class="obsolete">obsolete</span> ')}'
+instabilitytag = '<span class="instability">{instability|escape}</span> '
 changelogtag = '<span class="tag">{name|escape}</span> '
 changesettag = '<span class="tag">{tag|escape}</span> '
 changesetbookmark = '<span class="tag">{bookmark|escape}</span> '
 changelogbranchhead = '<span class="branchhead">{name|escape}</span> '
 changelogbranchname = '<span class="branchname">{name|escape}</span> '
+alltags = '{phasetag}{obsoletetag}{instabilities%instabilitytag}{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
 
 filediffparent = '
   <tr>
--- a/mercurial/templates/paper/shortlogentry.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/paper/shortlogentry.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -3,6 +3,6 @@
   <td class="author">{author|person}</td>
   <td class="description">
    <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>
-   {inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}
+   {alltags}
   </td>
  </tr>
--- a/mercurial/templates/raw/graphnode.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/raw/graphnode.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -1,7 +1,7 @@
-changeset:   {node}
-user:        {user}
-date:        {age}
-summary:     {desc}
+changeset:   {node|short}
+user:        {author|person}
+date:        {date|age}
+summary:     {desc|firstline|nonempty}
 {branches%branchname}{tags%tagname}{bookmarks%bookmarkname}
 node:        ({col}, {row}) (color {color})
 {edges%graphedge}
--- a/mercurial/templates/spartan/changelogentry.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/spartan/changelogentry.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -18,6 +18,18 @@
   <th class="date">date:</th>
   <td class="date">{date|rfc822date}</td>
  </tr>
+ {ifeq(phase, 'public', '', '<tr>
+  <th class="phase">phase:</th>
+  <td class="phase">{phase|escape}</td>
+ </tr>')}
+ {if(obsolete, '<tr>
+  <th class="obsolete">obsolete:</th>
+  <td class="obsolete">yes</td>
+ </tr>')}
+ {ifeq(count(instabilities), '0', '', '<tr>
+  <th class="instabilities">instabilities:</th>
+  <td class="instabilities">{instabilities%"{instability} "|escape}</td>
+ </tr>')}
  <tr>
   <th class="files"><a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a>:</th>
   <td class="files">{files}</td>
--- a/mercurial/templates/spartan/changeset.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/spartan/changeset.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -33,6 +33,18 @@
  <th class="date">date:</th>
  <td class="date age">{date|rfc822date}</td>
 </tr>
+{ifeq(phase, 'public', '', '<tr>
+ <th class="phase">phase:</th>
+ <td class="phase">{phase|escape}</td>
+</tr>')}
+{if(obsolete, '<tr>
+ <th class="obsolete">obsolete:</th>
+ <td class="obsolete">yes</td>
+</tr>')}
+{ifeq(count(instabilities), '0', '', '<tr>
+ <th class="instabilities">instabilities:</th>
+ <td class="instabilities">{instabilities%"{instability} "|escape}</td>
+</tr>')}
 <tr>
  <th class="files">files:</th>
  <td class="files">{files}</td>
--- a/mercurial/templates/spartan/graph.tmpl	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/spartan/graph.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -32,38 +32,21 @@
 
 <div id="wrapper">
 <ul id="nodebgs"></ul>
-<canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
-<ul id="graphnodes"></ul>
+<canvas id="graph"></canvas>
+<ul id="graphnodes">{nodes%graphentry}</ul>
 </div>
 
 <script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
-<!-- hide script content
-
 var data = {jsdata|json};
 var graph = new Graph();
 graph.scale({bg_height});
 
-graph.vertex = function(x, y, color, parity, cur) \{
-	
-	this.ctx.beginPath();
-	color = this.setColor(color, 0.25, 0.75);
-	this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
-	this.ctx.fill();
-	
-	var bg = '<li class="bg parity' + parity + '"></li>';
-	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
-	var nstyle = 'padding-left: ' + left + 'px;';
-	var item = '<li style="' + nstyle + '"><span class="desc">';
-	item += '<a href="{url|urlescape}rev/' + cur[0] + '{sessionvars%urlparameter}" title="' + cur[0] + '">' + cur[3] + '</a>';
-	item += '</span><span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
-
-	return [bg, item];
-	
+graph.vertex = function(x, y, radius, color, parity, cur) \{
+	Graph.prototype.vertex.apply(this, arguments);
+	return ['<li class="bg parity' + parity + '"></li>', ''];
 }
 
 graph.render(data);
-
-// stop hiding script -->
 </script>
 
 <form action="{url|urlescape}log">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/templates/spartan/graphentry.tmpl	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,6 @@
+<li data-node="{node|short}">
+ <span class="desc">
+  <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>
+ </span>
+ <span class="info"><span class="age">{date|rfc822date}</span>, by {author|person}</span>
+</li>
--- a/mercurial/templates/spartan/map	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/spartan/map	Tue Dec 19 16:27:24 2017 -0500
@@ -7,6 +7,7 @@
 shortlog = shortlog.tmpl
 shortlogentry = shortlogentry.tmpl
 graph = graph.tmpl
+graphentry = graphentry.tmpl
 naventry = '<a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navshortentry = '<a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navgraphentry = '<a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
--- a/mercurial/templates/static/followlines.js	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/static/followlines.js	Tue Dec 19 16:27:24 2017 -0500
@@ -13,7 +13,7 @@
     }
     // URL to complement with "linerange" query parameter
     var targetUri = sourcelines.dataset.logurl;
-    if (typeof targetUri === 'undefined') {
+    if (typeof targetUri === 'undefined') {
         return;
     }
 
@@ -38,7 +38,7 @@
     // element
     var selectableElements = Array.prototype.filter.call(
         sourcelines.children,
-        function(x) { return x.tagName === selectableTag });
+        function(x) { return x.tagName === selectableTag; });
 
     var btnTitleStart = 'start following lines history from here';
     var btnTitleEnd = 'terminate line block selection here';
@@ -62,7 +62,7 @@
     }
 
     // extend DOM with CSS class for selection highlight and action buttons
-    var followlinesButtons = []
+    var followlinesButtons = [];
     for (var i = 0; i < selectableElements.length; i++) {
         selectableElements[i].classList.add('followlines-select');
         var btn = createButton();
@@ -114,7 +114,7 @@
         if (parent === null) {
             return null;
         }
-        if (element.tagName == selectableTag && parent.isSameNode(sourcelines)) {
+        if (element.tagName === selectableTag && parent.isSameNode(sourcelines)) {
             return element;
         }
         return selectableParent(parent);
@@ -182,7 +182,7 @@
 
             // compute line range (startId, endId)
             var endId = parseInt(endElement.id.slice(1));
-            if (endId == startId) {
+            if (endId === startId) {
                 // clicked twice the same line, cancel and reset initial state
                 // (CSS, event listener for selection start)
                 removeSelectedCSSClass();
--- a/mercurial/templates/static/mercurial.js	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/static/mercurial.js	Tue Dec 19 16:27:24 2017 -0500
@@ -29,28 +29,27 @@
 	this.ctx = this.canvas.getContext('2d');
 	this.ctx.strokeStyle = 'rgb(0, 0, 0)';
 	this.ctx.fillStyle = 'rgb(0, 0, 0)';
-	this.cur = [0, 0];
-	this.line_width = 3;
 	this.bg = [0, 4];
 	this.cell = [2, 0];
 	this.columns = 0;
-	this.revlink = '';
+
+}
 
-	this.reset = function() {
+Graph.prototype = {
+	reset: function() {
 		this.bg = [0, 4];
 		this.cell = [2, 0];
 		this.columns = 0;
 		document.getElementById('nodebgs').innerHTML = '';
-		document.getElementById('graphnodes').innerHTML = '';
-	}
+	},
 
-	this.scale = function(height) {
+	scale: function(height) {
 		this.bg_height = height;
 		this.box_size = Math.floor(this.bg_height / 1.2);
 		this.cell_height = this.box_size;
-	}
+	},
 
-	this.setColor = function(color, bg, fg) {
+	setColor: function(color, bg, fg) {
 
 		// Set the colour.
 		//
@@ -62,9 +61,9 @@
 		// provides the multiplier that should be applied to
 		// the foreground colours.
 		var s;
-		if(typeof color == "string") {
+		if(typeof color === "string") {
 			s = "#" + color;
-		} else { //typeof color == "number"
+		} else { //typeof color === "number"
 			color %= colors.length;
 			var red = (colors[color][0] * fg) || bg;
 			var green = (colors[color][1] * fg) || bg;
@@ -78,9 +77,9 @@
 		this.ctx.fillStyle = s;
 		return s;
 
-	}
+	},
 
-	this.edge = function(x0, y0, x1, y1, color, width) {
+	edge: function(x0, y0, x1, y1, color, width) {
 
 		this.setColor(color, 0.0, 0.65);
 		if(width >= 0)
@@ -90,28 +89,53 @@
 		this.ctx.lineTo(x1, y1);
 		this.ctx.stroke();
 
-	}
+	},
+
+	vertex: function(x, y, radius, color, parity, cur) {
+		this.ctx.beginPath();
+		this.setColor(color, 0.25, 0.75);
+		this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
+		this.ctx.fill();
 
-	this.render = function(data) {
+		var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
+		var item = document.querySelector('[data-node="' + cur.node + '"]');
+		if (item) {
+			item.style.paddingLeft = left + 'px';
+		}
+
+		return ['', ''];
+	},
+
+	render: function(data) {
 
 		var backgrounds = '';
 		var nodedata = '';
+		var i, j, cur, line, start, end, color, x, y, x0, y0, x1, y1, column, radius;
 
-		for (var i in data) {
+		var cols = 0;
+		for (i = 0; i < data.length; i++) {
+			cur = data[i];
+			for (j = 0; j < cur.edges.length; j++) {
+				line = cur.edges[j];
+				cols = Math.max(cols, line[0], line[1]);
+			}
+		}
+		this.canvas.width = (cols + 1) * this.bg_height;
+		this.canvas.height = (data.length + 1) * this.bg_height - 27;
+
+		for (i = 0; i < data.length; i++) {
 
 			var parity = i % 2;
 			this.cell[1] += this.bg_height;
 			this.bg[1] += this.bg_height;
 
-			var cur = data[i];
-			var node = cur[1];
-			var edges = cur[2];
+			cur = data[i];
 			var fold = false;
 
 			var prevWidth = this.ctx.lineWidth;
-			for (var j in edges) {
+			for (j = 0; j < cur.edges.length; j++) {
 
-				line = edges[j];
+				line = cur.edges[j];
 				start = line[0];
 				end = line[1];
 				color = line[2];
@@ -126,8 +150,8 @@
 					this.columns += 1;
 				}
 
-				if (start == this.columns && start > end) {
-					var fold = true;
+				if (start === this.columns && start > end) {
+					fold = true;
 				}
 
 				x0 = this.cell[0] + this.box_size * start + this.box_size / 2;
@@ -142,13 +166,13 @@
 
 			// Draw the revision node in the right column
 
-			column = node[0]
-			color = node[1]
+			column = cur.vertex[0];
+			color = cur.vertex[1];
 
 			radius = this.box_size / 8;
 			x = this.cell[0] + this.box_size * column + this.box_size / 2;
 			y = this.bg[1] - this.bg_height / 2;
-			var add = this.vertex(x, y, color, parity, cur);
+			var add = this.vertex(x, y, radius, color, parity, cur);
 			backgrounds += add[0];
 			nodedata += add[1];
 
@@ -161,7 +185,7 @@
 
 	}
 
-}
+};
 
 
 function process_dates(parentSelector){
@@ -228,10 +252,11 @@
 			return shortdate(once);
 		}
 
-		for (unit in scales){
+		for (var unit in scales){
+			if (!scales.hasOwnProperty(unit)) { continue; }
 			var s = scales[unit];
 			var n = Math.floor(delta / s);
-			if ((n >= 2) || (s == 1)){
+			if ((n >= 2) || (s === 1)){
 				if (future){
 					return format(n, unit) + ' from now';
 				} else {
@@ -259,7 +284,7 @@
 
 function toggleDiffstat() {
     var curdetails = document.getElementById('diffstatdetails').style.display;
-    var curexpand = curdetails == 'none' ? 'inline' : 'none';
+    var curexpand = curdetails === 'none' ? 'inline' : 'none';
     document.getElementById('diffstatdetails').style.display = curexpand;
     document.getElementById('diffstatexpand').style.display = curdetails;
 }
@@ -273,7 +298,8 @@
 
     function setLinewrap(enable) {
         var nodes = document.getElementsByClassName('sourcelines');
-        for (var i = 0; i < nodes.length; i++) {
+        var i;
+        for (i = 0; i < nodes.length; i++) {
             if (enable) {
                 nodes[i].classList.add('wrap');
             } else {
@@ -282,7 +308,7 @@
         }
 
         var links = document.getElementsByClassName('linewraplink');
-        for (var i = 0; i < links.length; i++) {
+        for (i = 0; i < links.length; i++) {
             links[i].innerHTML = enable ? 'on' : 'off';
         }
     }
@@ -297,12 +323,12 @@
 }
 
 function makeRequest(url, method, onstart, onsuccess, onerror, oncomplete) {
-    xfr = new XMLHttpRequest();
-    xfr.onreadystatechange = function() {
-        if (xfr.readyState === 4) {
+    var xhr = new XMLHttpRequest();
+    xhr.onreadystatechange = function() {
+        if (xhr.readyState === 4) {
             try {
-                if (xfr.status === 200) {
-                    onsuccess(xfr.responseText);
+                if (xhr.status === 200) {
+                    onsuccess(xhr.responseText);
                 } else {
                     throw 'server error';
                 }
@@ -314,11 +340,11 @@
         }
     };
 
-    xfr.open(method, url);
-    xfr.overrideMimeType("text/xhtml; charset=" + document.characterSet.toLowerCase());
-    xfr.send();
+    xhr.open(method, url);
+    xhr.overrideMimeType("text/xhtml; charset=" + document.characterSet.toLowerCase());
+    xhr.send();
     onstart();
-    return xfr;
+    return xhr;
 }
 
 function removeByClassName(className) {
@@ -338,14 +364,26 @@
     element.insertAdjacentHTML('beforeend', format(formatStr, replacements));
 }
 
+function adoptChildren(from, to) {
+    var nodes = from.children;
+    var curClass = 'c' + Date.now();
+    while (nodes.length) {
+        var node = nodes[0];
+        node = document.adoptNode(node);
+        node.classList.add(curClass);
+        to.appendChild(node);
+    }
+    process_dates('.' + curClass);
+}
+
 function ajaxScrollInit(urlFormat,
                         nextPageVar,
                         nextPageVarGet,
                         containerSelector,
                         messageFormat,
                         mode) {
-    updateInitiated = false;
-    container = document.querySelector(containerSelector);
+    var updateInitiated = false;
+    var container = document.querySelector(containerSelector);
 
     function scrollHandler() {
         if (updateInitiated) {
@@ -354,8 +392,7 @@
 
         var scrollHeight = document.documentElement.scrollHeight;
         var clientHeight = document.documentElement.clientHeight;
-        var scrollTop = document.body.scrollTop
-            || document.documentElement.scrollTop;
+        var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
 
         if (scrollHeight - (scrollTop + clientHeight) < 50) {
             updateInitiated = true;
@@ -382,33 +419,20 @@
                     appendFormatHTML(container, messageFormat, message);
                 },
                 function onsuccess(htmlText) {
-                    if (mode == 'graph') {
-                        var sizes = htmlText.match(/^\s*<canvas id="graph" width="(\d+)" height="(\d+)"><\/canvas>$/m);
-                        var addWidth = sizes[1];
-                        var addHeight = sizes[2];
-                        addWidth = parseInt(addWidth);
-                        addHeight = parseInt(addHeight);
-                        graph.canvas.width = addWidth;
-                        graph.canvas.height = addHeight;
+                    var doc = docFromHTML(htmlText);
 
+                    if (mode === 'graph') {
+                        var graph = window.graph;
                         var dataStr = htmlText.match(/^\s*var data = (.*);$/m)[1];
                         var data = JSON.parse(dataStr);
                         if (data.length < nextPageVar) {
                             nextPageVar = undefined;
                         }
                         graph.reset();
+                        adoptChildren(doc.querySelector('#graphnodes'), container.querySelector('#graphnodes'));
                         graph.render(data);
                     } else {
-                        var doc = docFromHTML(htmlText);
-                        var nodes = doc.querySelector(containerSelector).children;
-                        var curClass = 'c' + Date.now();
-                        while (nodes.length) {
-                            var node = nodes[0];
-                            node = document.adoptNode(node);
-                            node.classList.add(curClass);
-                            container.appendChild(node);
-                        }
-                        process_dates('.' + curClass);
+                        adoptChildren(doc.querySelector(containerSelector), container);
                     }
 
                     nextPageVar = nextPageVarGet(htmlText, nextPageVar);
@@ -450,7 +474,7 @@
         "ignoreblanklines",
     ];
 
-    var urlParams = new URLSearchParams(window.location.search);
+    var urlParams = new window.URLSearchParams(window.location.search);
 
     function updateAndRefresh(e) {
         var checkbox = e.target;
@@ -459,7 +483,7 @@
         window.location.search = urlParams.toString();
     }
 
-    var allChecked = form.getAttribute("data-ignorews") == "1";
+    var allChecked = form.getAttribute("data-ignorews") === "1";
 
     for (var i = 0; i < KEYS.length; i++) {
         var key = KEYS[i];
@@ -469,11 +493,11 @@
             continue;
         }
 
-        currentValue = form.getAttribute("data-" + key);
-        checkbox.checked = currentValue != "0";
+        var currentValue = form.getAttribute("data-" + key);
+        checkbox.checked = currentValue !== "0";
 
         // ignorews implies ignorewsamount and ignorewseol.
-        if (allChecked && (key == "ignorewsamount" || key == "ignorewseol")) {
+        if (allChecked && (key === "ignorewsamount" || key === "ignorewseol")) {
             checkbox.checked = true;
             checkbox.disabled = true;
         }
--- a/mercurial/templates/static/style-gitweb.css	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/static/style-gitweb.css	Tue Dec 19 16:27:24 2017 -0500
@@ -61,8 +61,6 @@
 }
 td.indexlinks a:hover { background-color: #6666aa; }
 div.pre { font-family:monospace; font-size:12px; white-space:pre; }
-div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; }
-div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; }
 
 .search {
     margin-right: 8px;
@@ -122,6 +120,18 @@
 	background-color: #ffaaff;
 	border-color: #ffccff #ff00ee #ff00ee #ffccff;
 }
+span.logtags span.phasetag {
+	background-color: #dfafff;
+	border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
+}
+span.logtags span.obsoletetag {
+	background-color: #dddddd;
+	border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
+}
+span.logtags span.instabilitytag {
+	background-color: #ffb1c0;
+	border-color: #ffbbc8 #ff4476 #ff4476 #ffbbc8;
+}
 span.logtags span.tagtag {
 	background-color: #ffffaa;
 	border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
@@ -191,10 +201,9 @@
 }
 
 div#followlines {
-  background-color: #B7B7B7;
-  border: 1px solid #CCC;
-  border-radius: 5px;
-  padding: 4px;
+  background-color: #FFF;
+  border: 1px solid #d9d8d1;
+  padding: 5px;
   position: fixed;
 }
 
@@ -315,8 +324,6 @@
 ul#graphnodes li .info {
 	display: block;
 	font-size: 100%;
-	position: relative;
-	top: -3px;
 	font-style: italic;
 }
 
--- a/mercurial/templates/static/style-monoblue.css	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/static/style-monoblue.css	Tue Dec 19 16:27:24 2017 -0500
@@ -233,6 +233,18 @@
   background-color: #ffaaff;
   border-color: #ffccff #ff00ee #ff00ee #ffccff;
 }
+span.logtags span.phasetag {
+  background-color: #dfafff;
+  border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
+}
+span.logtags span.obsoletetag {
+  background-color: #dddddd;
+  border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
+}
+span.logtags span.instabilitytag {
+  background-color: #ffb1c0;
+  border-color: #ffbbc8 #ff4476 #ff4476 #ffbbc8;
+}
 span.logtags span.tagtag {
   background-color: #ffffaa;
   border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
@@ -309,6 +321,7 @@
 pre.sourcelines.stripes > :nth-child(4n+1):hover + :nth-child(4n+2),
 pre.sourcelines.stripes > :nth-child(4n+3):hover + :nth-child(4n+4) { background-color: #D5E1E6; }
 
+tr:target td,
 pre.sourcelines > span:target,
 pre.sourcelines.stripes > span:target {
     background-color: #bfdfff;
@@ -490,7 +503,6 @@
 
 ul#graphnodes li .info {
 	display: block;
-	position: relative;
 }
 /** end of canvas **/
 
--- a/mercurial/templates/static/style-paper.css	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/static/style-paper.css	Tue Dec 19 16:27:24 2017 -0500
@@ -137,6 +137,33 @@
   margin: 1em 0;
 }
 
+.phase {
+  color: #999;
+  font-size: 70%;
+  border-bottom: 1px dotted #999;
+  font-weight: normal;
+  margin-left: .5em;
+  vertical-align: baseline;
+}
+
+.obsolete {
+  color: #999;
+  font-size: 70%;
+  border-bottom: 1px dashed #999;
+  font-weight: normal;
+  margin-left: .5em;
+  vertical-align: baseline;
+}
+
+.instability {
+  color: #000;
+  font-size: 70%;
+  border-bottom: 1px solid #000;
+  font-weight: normal;
+  margin-left: .5em;
+  vertical-align: baseline;
+}
+
 .tag {
   color: #999;
   font-size: 70%;
@@ -165,10 +192,6 @@
   vertical-align: baseline;
 }
 
-h3 .branchname {
-  font-size: 80%;
-}
-
 /* Common */
 pre { margin: 0; }
 
@@ -295,10 +318,9 @@
 }
 
 div#followlines {
-  background-color: #B7B7B7;
-  border: 1px solid #CCC;
-  border-radius: 5px;
-  padding: 4px;
+  background-color: #FFF;
+  border: 1px solid #999;
+  padding: 5px;
   position: fixed;
 }
 
@@ -459,8 +481,6 @@
 ul#graphnodes li .info {
 	display: block;
 	font-size: 70%;
-	position: relative;
-	top: -3px;
 }
 
 /* Comparison */
--- a/mercurial/templates/static/style.css	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/templates/static/style.css	Tue Dec 19 16:27:24 2017 -0500
@@ -117,6 +117,4 @@
 ul#graphnodes li .info {
 	display: block;
 	font-size: 70%;
-	position: relative;
-	top: -1px;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/thirdparty/selectors2.py	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,743 @@
+""" Back-ported, durable, and portable selectors """
+
+# MIT License
+#
+# Copyright (c) 2017 Seth Michael Larson
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+from __future__ import absolute_import
+
+import collections
+import errno
+import math
+import select
+import socket
+import sys
+import time
+
+from .. import pycompat
+
+namedtuple = collections.namedtuple
+Mapping = collections.Mapping
+
+try:
+    monotonic = time.monotonic
+except AttributeError:
+    monotonic = time.time
+
+__author__ = 'Seth Michael Larson'
+__email__ = 'sethmichaellarson@protonmail.com'
+__version__ = '2.0.0'
+__license__ = 'MIT'
+__url__ = 'https://www.github.com/SethMichaelLarson/selectors2'
+
+__all__ = ['EVENT_READ',
+           'EVENT_WRITE',
+           'SelectorKey',
+           'DefaultSelector',
+           'BaseSelector']
+
+EVENT_READ = (1 << 0)
+EVENT_WRITE = (1 << 1)
+_DEFAULT_SELECTOR = None
+_SYSCALL_SENTINEL = object()  # Sentinel in case a system call returns None.
+_ERROR_TYPES = (OSError, IOError, socket.error)
+
+
+SelectorKey = namedtuple('SelectorKey', ['fileobj', 'fd', 'events', 'data'])
+
+
+class _SelectorMapping(Mapping):
+    """ Mapping of file objects to selector keys """
+
+    def __init__(self, selector):
+        self._selector = selector
+
+    def __len__(self):
+        return len(self._selector._fd_to_key)
+
+    def __getitem__(self, fileobj):
+        try:
+            fd = self._selector._fileobj_lookup(fileobj)
+            return self._selector._fd_to_key[fd]
+        except KeyError:
+            raise KeyError("{0!r} is not registered.".format(fileobj))
+
+    def __iter__(self):
+        return iter(self._selector._fd_to_key)
+
+
+def _fileobj_to_fd(fileobj):
+    """ Return a file descriptor from a file object. If
+    given an integer will simply return that integer back. """
+    if isinstance(fileobj, int):
+        fd = fileobj
+    else:
+        try:
+            fd = int(fileobj.fileno())
+        except (AttributeError, TypeError, ValueError):
+            raise ValueError("Invalid file object: {0!r}".format(fileobj))
+    if fd < 0:
+        raise ValueError("Invalid file descriptor: {0}".format(fd))
+    return fd
+
+
+class BaseSelector(object):
+    """ Abstract Selector class
+
+    A selector supports registering file objects to be monitored
+    for specific I/O events.
+
+    A file object is a file descriptor or any object with a
+    `fileno()` method. An arbitrary object can be attached to the
+    file object which can be used for example to store context info,
+    a callback, etc.
+
+    A selector can use various implementations (select(), poll(), epoll(),
+    and kqueue()) depending on the platform. The 'DefaultSelector' class uses
+    the most efficient implementation for the current platform.
+    """
+    def __init__(self):
+        # Maps file descriptors to keys.
+        self._fd_to_key = {}
+
+        # Read-only mapping returned by get_map()
+        self._map = _SelectorMapping(self)
+
+    def _fileobj_lookup(self, fileobj):
+        """ Return a file descriptor from a file object.
+        This wraps _fileobj_to_fd() to do an exhaustive
+        search in case the object is invalid but we still
+        have it in our map. Used by unregister() so we can
+        unregister an object that was previously registered
+        even if it is closed. It is also used by _SelectorMapping
+        """
+        try:
+            return _fileobj_to_fd(fileobj)
+        except ValueError:
+
+            # Search through all our mapped keys.
+            for key in self._fd_to_key.values():
+                if key.fileobj is fileobj:
+                    return key.fd
+
+            # Raise ValueError after all.
+            raise
+
+    def register(self, fileobj, events, data=None):
+        """ Register a file object for a set of events to monitor. """
+        if (not events) or (events & ~(EVENT_READ | EVENT_WRITE)):
+            raise ValueError("Invalid events: {0!r}".format(events))
+
+        key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
+
+        if key.fd in self._fd_to_key:
+            raise KeyError("{0!r} (FD {1}) is already registered"
+                           .format(fileobj, key.fd))
+
+        self._fd_to_key[key.fd] = key
+        return key
+
+    def unregister(self, fileobj):
+        """ Unregister a file object from being monitored. """
+        try:
+            key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))
+        except KeyError:
+            raise KeyError("{0!r} is not registered".format(fileobj))
+
+        # Getting the fileno of a closed socket on Windows errors with EBADF.
+        except socket.error as err:
+            if err.errno != errno.EBADF:
+                raise
+            else:
+                for key in self._fd_to_key.values():
+                    if key.fileobj is fileobj:
+                        self._fd_to_key.pop(key.fd)
+                        break
+                else:
+                    raise KeyError("{0!r} is not registered".format(fileobj))
+        return key
+
+    def modify(self, fileobj, events, data=None):
+        """ Change a registered file object monitored events and data. """
+        # NOTE: Some subclasses optimize this operation even further.
+        try:
+            key = self._fd_to_key[self._fileobj_lookup(fileobj)]
+        except KeyError:
+            raise KeyError("{0!r} is not registered".format(fileobj))
+
+        if events != key.events:
+            self.unregister(fileobj)
+            key = self.register(fileobj, events, data)
+
+        elif data != key.data:
+            # Use a shortcut to update the data.
+            key = key._replace(data=data)
+            self._fd_to_key[key.fd] = key
+
+        return key
+
+    def select(self, timeout=None):
+        """ Perform the actual selection until some monitored file objects
+        are ready or the timeout expires. """
+        raise NotImplementedError()
+
+    def close(self):
+        """ Close the selector. This must be called to ensure that all
+        underlying resources are freed. """
+        self._fd_to_key.clear()
+        self._map = None
+
+    def get_key(self, fileobj):
+        """ Return the key associated with a registered file object. """
+        mapping = self.get_map()
+        if mapping is None:
+            raise RuntimeError("Selector is closed")
+        try:
+            return mapping[fileobj]
+        except KeyError:
+            raise KeyError("{0!r} is not registered".format(fileobj))
+
+    def get_map(self):
+        """ Return a mapping of file objects to selector keys """
+        return self._map
+
+    def _key_from_fd(self, fd):
+        """ Return the key associated to a given file descriptor
+         Return None if it is not found. """
+        try:
+            return self._fd_to_key[fd]
+        except KeyError:
+            return None
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, *_):
+        self.close()
+
+
+# Almost all platforms have select.select()
+if hasattr(select, "select"):
+    class SelectSelector(BaseSelector):
+        """ Select-based selector. """
+        def __init__(self):
+            super(SelectSelector, self).__init__()
+            self._readers = set()
+            self._writers = set()
+
+        def register(self, fileobj, events, data=None):
+            key = super(SelectSelector, self).register(fileobj, events, data)
+            if events & EVENT_READ:
+                self._readers.add(key.fd)
+            if events & EVENT_WRITE:
+                self._writers.add(key.fd)
+            return key
+
+        def unregister(self, fileobj):
+            key = super(SelectSelector, self).unregister(fileobj)
+            self._readers.discard(key.fd)
+            self._writers.discard(key.fd)
+            return key
+
+        def select(self, timeout=None):
+            # Selecting on empty lists on Windows errors out.
+            if not len(self._readers) and not len(self._writers):
+                return []
+
+            timeout = None if timeout is None else max(timeout, 0.0)
+            ready = []
+            r, w, _ = _syscall_wrapper(self._wrap_select, True, self._readers,
+                                       self._writers, timeout)
+            r = set(r)
+            w = set(w)
+            for fd in r | w:
+                events = 0
+                if fd in r:
+                    events |= EVENT_READ
+                if fd in w:
+                    events |= EVENT_WRITE
+
+                key = self._key_from_fd(fd)
+                if key:
+                    ready.append((key, events & key.events))
+            return ready
+
+        def _wrap_select(self, r, w, timeout=None):
+            """ Wrapper for select.select because timeout is a positional arg """
+            return select.select(r, w, [], timeout)
+
+    __all__.append('SelectSelector')
+
+    # Jython has a different implementation of .fileno() for socket objects.
+    if pycompat.isjython:
+        class _JythonSelectorMapping(object):
+            """ This is an implementation of _SelectorMapping that is built
+            for use specifically with Jython, which does not provide a hashable
+            value from socket.socket.fileno(). """
+
+            def __init__(self, selector):
+                assert isinstance(selector, JythonSelectSelector)
+                self._selector = selector
+
+            def __len__(self):
+                return len(self._selector._sockets)
+
+            def __getitem__(self, fileobj):
+                for sock, key in self._selector._sockets:
+                    if sock is fileobj:
+                        return key
+                else:
+                    raise KeyError("{0!r} is not registered.".format(fileobj))
+
+        class JythonSelectSelector(SelectSelector):
+            """ This is an implementation of SelectSelector that is for Jython
+            which works around that Jython's socket.socket.fileno() does not
+            return an integer fd value. All SelectorKey.fd will be equal to -1
+            and should not be used. This instead uses object id to compare fileobj
+            and will only use select.select as it's the only selector that allows
+            directly passing in socket objects rather than registering fds.
+            See: http://bugs.jython.org/issue1678
+                 https://wiki.python.org/jython/NewSocketModule#socket.fileno.28.29_does_not_return_an_integer
+            """
+
+            def __init__(self):
+                super(JythonSelectSelector, self).__init__()
+
+                self._sockets = []  # Uses a list of tuples instead of dictionary.
+                self._map = _JythonSelectorMapping(self)
+                self._readers = []
+                self._writers = []
+
+                # Jython has a select.cpython_compatible_select function in older versions.
+                self._select_func = getattr(select, 'cpython_compatible_select', select.select)
+
+            def register(self, fileobj, events, data=None):
+                for sock, _ in self._sockets:
+                    if sock is fileobj:
+                        raise KeyError("{0!r} is already registered"
+                                       .format(fileobj, sock))
+
+                key = SelectorKey(fileobj, -1, events, data)
+                self._sockets.append((fileobj, key))
+
+                if events & EVENT_READ:
+                    self._readers.append(fileobj)
+                if events & EVENT_WRITE:
+                    self._writers.append(fileobj)
+                return key
+
+            def unregister(self, fileobj):
+                for i, (sock, key) in enumerate(self._sockets):
+                    if sock is fileobj:
+                        break
+                else:
+                    raise KeyError("{0!r} is not registered.".format(fileobj))
+
+                if key.events & EVENT_READ:
+                    self._readers.remove(fileobj)
+                if key.events & EVENT_WRITE:
+                    self._writers.remove(fileobj)
+
+                del self._sockets[i]
+                return key
+
+            def _wrap_select(self, r, w, timeout=None):
+                """ Wrapper for select.select because timeout is a positional arg """
+                return self._select_func(r, w, [], timeout)
+
+        __all__.append('JythonSelectSelector')
+        SelectSelector = JythonSelectSelector  # Override so the wrong selector isn't used.
+
+
+if hasattr(select, "poll"):
+    class PollSelector(BaseSelector):
+        """ Poll-based selector """
+        def __init__(self):
+            super(PollSelector, self).__init__()
+            self._poll = select.poll()
+
+        def register(self, fileobj, events, data=None):
+            key = super(PollSelector, self).register(fileobj, events, data)
+            event_mask = 0
+            if events & EVENT_READ:
+                event_mask |= select.POLLIN
+            if events & EVENT_WRITE:
+                event_mask |= select.POLLOUT
+            self._poll.register(key.fd, event_mask)
+            return key
+
+        def unregister(self, fileobj):
+            key = super(PollSelector, self).unregister(fileobj)
+            self._poll.unregister(key.fd)
+            return key
+
+        def _wrap_poll(self, timeout=None):
+            """ Wrapper function for select.poll.poll() so that
+            _syscall_wrapper can work with only seconds. """
+            if timeout is not None:
+                if timeout <= 0:
+                    timeout = 0
+                else:
+                    # select.poll.poll() has a resolution of 1 millisecond,
+                    # round away from zero to wait *at least* timeout seconds.
+                    timeout = math.ceil(timeout * 1000)
+
+            result = self._poll.poll(timeout)
+            return result
+
+        def select(self, timeout=None):
+            ready = []
+            fd_events = _syscall_wrapper(self._wrap_poll, True, timeout=timeout)
+            for fd, event_mask in fd_events:
+                events = 0
+                if event_mask & ~select.POLLIN:
+                    events |= EVENT_WRITE
+                if event_mask & ~select.POLLOUT:
+                    events |= EVENT_READ
+
+                key = self._key_from_fd(fd)
+                if key:
+                    ready.append((key, events & key.events))
+
+            return ready
+
+    __all__.append('PollSelector')
+
+if hasattr(select, "epoll"):
+    class EpollSelector(BaseSelector):
+        """ Epoll-based selector """
+        def __init__(self):
+            super(EpollSelector, self).__init__()
+            self._epoll = select.epoll()
+
+        def fileno(self):
+            return self._epoll.fileno()
+
+        def register(self, fileobj, events, data=None):
+            key = super(EpollSelector, self).register(fileobj, events, data)
+            events_mask = 0
+            if events & EVENT_READ:
+                events_mask |= select.EPOLLIN
+            if events & EVENT_WRITE:
+                events_mask |= select.EPOLLOUT
+            _syscall_wrapper(self._epoll.register, False, key.fd, events_mask)
+            return key
+
+        def unregister(self, fileobj):
+            key = super(EpollSelector, self).unregister(fileobj)
+            try:
+                _syscall_wrapper(self._epoll.unregister, False, key.fd)
+            except _ERROR_TYPES:
+                # This can occur when the fd was closed since registry.
+                pass
+            return key
+
+        def select(self, timeout=None):
+            if timeout is not None:
+                if timeout <= 0:
+                    timeout = 0.0
+                else:
+                    # select.epoll.poll() has a resolution of 1 millisecond
+                    # but luckily takes seconds so we don't need a wrapper
+                    # like PollSelector. Just for better rounding.
+                    timeout = math.ceil(timeout * 1000) * 0.001
+                timeout = float(timeout)
+            else:
+                timeout = -1.0  # epoll.poll() must have a float.
+
+            # We always want at least 1 to ensure that select can be called
+            # with no file descriptors registered. Otherwise will fail.
+            max_events = max(len(self._fd_to_key), 1)
+
+            ready = []
+            fd_events = _syscall_wrapper(self._epoll.poll, True,
+                                         timeout=timeout,
+                                         maxevents=max_events)
+            for fd, event_mask in fd_events:
+                events = 0
+                if event_mask & ~select.EPOLLIN:
+                    events |= EVENT_WRITE
+                if event_mask & ~select.EPOLLOUT:
+                    events |= EVENT_READ
+
+                key = self._key_from_fd(fd)
+                if key:
+                    ready.append((key, events & key.events))
+            return ready
+
+        def close(self):
+            self._epoll.close()
+            super(EpollSelector, self).close()
+
+    __all__.append('EpollSelector')
+
+
+if hasattr(select, "devpoll"):
+    class DevpollSelector(BaseSelector):
+        """Solaris /dev/poll selector."""
+
+        def __init__(self):
+            super(DevpollSelector, self).__init__()
+            self._devpoll = select.devpoll()
+
+        def fileno(self):
+            return self._devpoll.fileno()
+
+        def register(self, fileobj, events, data=None):
+            key = super(DevpollSelector, self).register(fileobj, events, data)
+            poll_events = 0
+            if events & EVENT_READ:
+                poll_events |= select.POLLIN
+            if events & EVENT_WRITE:
+                poll_events |= select.POLLOUT
+            self._devpoll.register(key.fd, poll_events)
+            return key
+
+        def unregister(self, fileobj):
+            key = super(DevpollSelector, self).unregister(fileobj)
+            self._devpoll.unregister(key.fd)
+            return key
+
+        def _wrap_poll(self, timeout=None):
+            """ Wrapper function for select.poll.poll() so that
+            _syscall_wrapper can work with only seconds. """
+            if timeout is not None:
+                if timeout <= 0:
+                    timeout = 0
+                else:
+                    # select.devpoll.poll() has a resolution of 1 millisecond,
+                    # round away from zero to wait *at least* timeout seconds.
+                    timeout = math.ceil(timeout * 1000)
+
+            result = self._devpoll.poll(timeout)
+            return result
+
+        def select(self, timeout=None):
+            ready = []
+            fd_events = _syscall_wrapper(self._wrap_poll, True, timeout=timeout)
+            for fd, event_mask in fd_events:
+                events = 0
+                if event_mask & ~select.POLLIN:
+                    events |= EVENT_WRITE
+                if event_mask & ~select.POLLOUT:
+                    events |= EVENT_READ
+
+                key = self._key_from_fd(fd)
+                if key:
+                    ready.append((key, events & key.events))
+
+            return ready
+
+        def close(self):
+            self._devpoll.close()
+            super(DevpollSelector, self).close()
+
+    __all__.append('DevpollSelector')
+
+
+if hasattr(select, "kqueue"):
+    class KqueueSelector(BaseSelector):
+        """ Kqueue / Kevent-based selector """
+        def __init__(self):
+            super(KqueueSelector, self).__init__()
+            self._kqueue = select.kqueue()
+
+        def fileno(self):
+            return self._kqueue.fileno()
+
+        def register(self, fileobj, events, data=None):
+            key = super(KqueueSelector, self).register(fileobj, events, data)
+            if events & EVENT_READ:
+                kevent = select.kevent(key.fd,
+                                       select.KQ_FILTER_READ,
+                                       select.KQ_EV_ADD)
+
+                _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
+
+            if events & EVENT_WRITE:
+                kevent = select.kevent(key.fd,
+                                       select.KQ_FILTER_WRITE,
+                                       select.KQ_EV_ADD)
+
+                _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
+
+            return key
+
+        def unregister(self, fileobj):
+            key = super(KqueueSelector, self).unregister(fileobj)
+            if key.events & EVENT_READ:
+                kevent = select.kevent(key.fd,
+                                       select.KQ_FILTER_READ,
+                                       select.KQ_EV_DELETE)
+                try:
+                    _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
+                except _ERROR_TYPES:
+                    pass
+            if key.events & EVENT_WRITE:
+                kevent = select.kevent(key.fd,
+                                       select.KQ_FILTER_WRITE,
+                                       select.KQ_EV_DELETE)
+                try:
+                    _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
+                except _ERROR_TYPES:
+                    pass
+
+            return key
+
+        def select(self, timeout=None):
+            if timeout is not None:
+                timeout = max(timeout, 0)
+
+            max_events = len(self._fd_to_key) * 2
+            ready_fds = {}
+
+            kevent_list = _syscall_wrapper(self._kqueue.control, True,
+                                           None, max_events, timeout)
+
+            for kevent in kevent_list:
+                fd = kevent.ident
+                event_mask = kevent.filter
+                events = 0
+                if event_mask == select.KQ_FILTER_READ:
+                    events |= EVENT_READ
+                if event_mask == select.KQ_FILTER_WRITE:
+                    events |= EVENT_WRITE
+
+                key = self._key_from_fd(fd)
+                if key:
+                    if key.fd not in ready_fds:
+                        ready_fds[key.fd] = (key, events & key.events)
+                    else:
+                        old_events = ready_fds[key.fd][1]
+                        ready_fds[key.fd] = (key, (events | old_events) & key.events)
+
+            return list(ready_fds.values())
+
+        def close(self):
+            self._kqueue.close()
+            super(KqueueSelector, self).close()
+
+    __all__.append('KqueueSelector')
+
+
+def _can_allocate(struct):
+    """ Checks that select structs can be allocated by the underlying
+    operating system, not just advertised by the select module. We don't
+    check select() because we'll be hopeful that most platforms that
+    don't have it available will not advertise it. (ie: GAE) """
+    try:
+        # select.poll() objects won't fail until used.
+        if struct == 'poll':
+            p = select.poll()
+            p.poll(0)
+
+        # All others will fail on allocation.
+        else:
+            getattr(select, struct)().close()
+        return True
+    except (OSError, AttributeError):
+        return False
+
+
+# Python 3.5 uses a more direct route to wrap system calls to increase speed.
+if sys.version_info >= (3, 5):
+    def _syscall_wrapper(func, _, *args, **kwargs):
+        """ This is the short-circuit version of the below logic
+        because in Python 3.5+ all selectors restart system calls. """
+        return func(*args, **kwargs)
+else:
+    def _syscall_wrapper(func, recalc_timeout, *args, **kwargs):
+        """ Wrapper function for syscalls that could fail due to EINTR.
+        All functions should be retried if there is time left in the timeout
+        in accordance with PEP 475. """
+        timeout = kwargs.get("timeout", None)
+        if timeout is None:
+            expires = None
+            recalc_timeout = False
+        else:
+            timeout = float(timeout)
+            if timeout < 0.0:  # Timeout less than 0 treated as no timeout.
+                expires = None
+            else:
+                expires = monotonic() + timeout
+
+        args = list(args)
+        if recalc_timeout and "timeout" not in kwargs:
+            raise ValueError(
+                "Timeout must be in args or kwargs to be recalculated")
+
+        result = _SYSCALL_SENTINEL
+        while result is _SYSCALL_SENTINEL:
+            try:
+                result = func(*args, **kwargs)
+            # OSError is thrown by select.select
+            # IOError is thrown by select.epoll.poll
+            # select.error is thrown by select.poll.poll
+            # Aren't we thankful for Python 3.x rework for exceptions?
+            except (OSError, IOError, select.error) as e:
+                # select.error wasn't a subclass of OSError in the past.
+                errcode = None
+                if hasattr(e, "errno"):
+                    errcode = e.errno
+                elif hasattr(e, "args"):
+                    errcode = e.args[0]
+
+                # Also test for the Windows equivalent of EINTR.
+                is_interrupt = (errcode == errno.EINTR or (hasattr(errno, "WSAEINTR") and
+                                                           errcode == errno.WSAEINTR))
+
+                if is_interrupt:
+                    if expires is not None:
+                        current_time = monotonic()
+                        if current_time > expires:
+                            raise OSError(errno=errno.ETIMEDOUT)
+                        if recalc_timeout:
+                            if "timeout" in kwargs:
+                                kwargs["timeout"] = expires - current_time
+                    continue
+                raise
+        return result
+
+
+# Choose the best implementation, roughly:
+# kqueue == devpoll == epoll > poll > select
+# select() also can't accept a FD > FD_SETSIZE (usually around 1024)
+def DefaultSelector():
+    """ This function serves as a first call for DefaultSelector to
+    detect if the select module is being monkey-patched incorrectly
+    by eventlet, greenlet, and preserve proper behavior. """
+    global _DEFAULT_SELECTOR
+    if _DEFAULT_SELECTOR is None:
+        if pycompat.isjython:
+            _DEFAULT_SELECTOR = JythonSelectSelector
+        elif _can_allocate('kqueue'):
+            _DEFAULT_SELECTOR = KqueueSelector
+        elif _can_allocate('devpoll'):
+            _DEFAULT_SELECTOR = DevpollSelector
+        elif _can_allocate('epoll'):
+            _DEFAULT_SELECTOR = EpollSelector
+        elif _can_allocate('poll'):
+            _DEFAULT_SELECTOR = PollSelector
+        elif hasattr(select, 'select'):
+            _DEFAULT_SELECTOR = SelectSelector
+        else:  # Platform-specific: AppEngine
+            raise RuntimeError('Platform does not have a selector.')
+    return _DEFAULT_SELECTOR()
--- a/mercurial/ui.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/ui.py	Tue Dec 19 16:27:24 2017 -0500
@@ -49,6 +49,10 @@
 [ui]
 # The rollback command is dangerous. As a rule, don't use it.
 rollback = False
+# Make `hg status` report copy information
+statuscopies = yes
+# Prefer curses UIs when available. Revert to plain-text with `text`.
+interface = curses
 
 [commands]
 # Make `hg status` emit cwd-relative paths by default.
@@ -58,6 +62,7 @@
 
 [diff]
 git = 1
+showfunc = 1
 """
 
 samplehgrcs = {
@@ -695,6 +700,9 @@
         >>> u.setconfig(s, b'list1', b'this,is "a small" ,test')
         >>> u.configlist(s, b'list1')
         ['this', 'is', 'a small', 'test']
+        >>> u.setconfig(s, b'list2', b'this, is "a small" , test ')
+        >>> u.configlist(s, b'list2')
+        ['this', 'is', 'a small', 'test']
         """
         # default is not always a list
         v = self.configwith(config.parselist, section, name, default,
@@ -886,9 +894,9 @@
         "cmdname.type" is recommended. For example, status issues
         a label of "status.modified" for modified files.
         '''
-        if self._buffers and not opts.get('prompt', False):
+        if self._buffers and not opts.get(r'prompt', False):
             if self._bufferapplylabels:
-                label = opts.get('label', '')
+                label = opts.get(r'label', '')
                 self._buffers[-1].extend(self.label(a, label) for a in args)
             else:
                 self._buffers[-1].extend(args)
@@ -899,7 +907,7 @@
         else:
             msgs = args
             if self._colormode is not None:
-                label = opts.get('label', '')
+                label = opts.get(r'label', '')
                 msgs = [self.label(a, label) for a in args]
             self._write(*msgs, **opts)
 
@@ -927,7 +935,7 @@
         else:
             msgs = args
             if self._colormode is not None:
-                label = opts.get('label', '')
+                label = opts.get(r'label', '')
                 msgs = [self.label(a, label) for a in args]
             self._write_err(*msgs, **opts)
 
@@ -1602,7 +1610,7 @@
         stack.
         """
         if not self.configbool('devel', 'all-warnings'):
-            if config is not None and not self.configbool('devel', config):
+            if config is None or not self.configbool('devel', config):
                 return
         msg = 'devel-warn: ' + msg
         stacklevel += 1 # get in develwarn
--- a/mercurial/upgrade.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/upgrade.py	Tue Dec 19 16:27:24 2017 -0500
@@ -14,6 +14,8 @@
 from . import (
     changelog,
     error,
+    filelog,
+    hg,
     localrepo,
     manifest,
     revlog,
@@ -94,6 +96,9 @@
         'generaldelta',
     }
 
+def preservedrequirements(repo):
+    return set()
+
 deficiency = 'deficiency'
 optimisation = 'optimization'
 
@@ -256,7 +261,7 @@
 
 @registerformatvariant
 class removecldeltachain(formatvariant):
-    name = 'removecldeltachain'
+    name = 'plain-cl-delta'
 
     default = True
 
@@ -281,6 +286,28 @@
     def fromconfig(repo):
         return True
 
+@registerformatvariant
+class compressionengine(formatvariant):
+    name = 'compression'
+    default = 'zlib'
+
+    description = _('Compresion algorithm used to compress data. '
+                    'Some engine are faster than other')
+
+    upgrademessage = _('revlog content will be recompressed with the new '
+                       'algorithm.')
+
+    @classmethod
+    def fromrepo(cls, repo):
+        for req in repo.requirements:
+            if req.startswith('exp-compression-'):
+                return req.split('-', 2)[2]
+        return 'zlib'
+
+    @classmethod
+    def fromconfig(cls, repo):
+        return repo.ui.config('experimental', 'format.compression')
+
 def finddeficiencies(repo):
     """returns a list of deficiencies that the repo suffer from"""
     deficiencies = []
@@ -342,6 +369,19 @@
                          'recomputed; this will likely drastically slow down '
                          'execution time')))
 
+    optimizations.append(improvement(
+        name='redeltafulladd',
+        type=optimisation,
+        description=_('every revision will be re-added as if it was new '
+                      'content. It will go through the full storage '
+                      'mechanism giving extensions a chance to process it '
+                      '(eg. lfs). This is similar to "redeltaall" but even '
+                      'slower since more logic is involved.'),
+        upgrademessage=_('each revision will be added as new content to the '
+                         'internal storage; this will likely drastically slow '
+                         'down execution time, but some extensions might need '
+                         'it')))
+
     return optimizations
 
 def determineactions(repo, deficiencies, sourcereqs, destreqs):
@@ -387,9 +427,8 @@
         mandir = path[:-len('00manifest.i')]
         return manifest.manifestrevlog(repo.svfs, dir=mandir)
     else:
-        # Filelogs don't do anything special with settings. So we can use a
-        # vanilla revlog.
-        return revlog.revlog(repo.svfs, path)
+        #reverse of "/".join(("data", path + ".i"))
+        return filelog.filelog(repo.svfs, path[5:-2])
 
 def _copyrevlogs(ui, srcrepo, dstrepo, tr, deltareuse, aggressivemergedeltas):
     """Copy revlogs between 2 repos."""
@@ -592,6 +631,8 @@
         deltareuse = revlog.revlog.DELTAREUSESAMEREVS
     elif 'redeltamultibase' in actions:
         deltareuse = revlog.revlog.DELTAREUSESAMEREVS
+    if 'redeltafulladd' in actions:
+        deltareuse = revlog.revlog.DELTAREUSEFULLADD
     else:
         deltareuse = revlog.revlog.DELTAREUSEALWAYS
 
@@ -679,6 +720,7 @@
     # FUTURE there is potentially a need to control the wanted requirements via
     # command arguments or via an extension hook point.
     newreqs = localrepo.newreporequirements(repo)
+    newreqs.update(preservedrequirements(repo))
 
     noremovereqs = (repo.requirements - newreqs -
                    supportremovedrequirements(repo))
@@ -804,9 +846,10 @@
         try:
             ui.write(_('creating temporary repository to stage migrated '
                        'data: %s\n') % tmppath)
-            dstrepo = localrepo.localrepository(repo.baseui,
-                                                path=tmppath,
-                                                create=True)
+
+            # clone ui without using ui.copy because repo.ui is protected
+            repoui = repo.ui.__class__(repo.ui)
+            dstrepo = hg.repository(repoui, path=tmppath, create=True)
 
             with dstrepo.wlock(), dstrepo.lock():
                 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,
--- a/mercurial/url.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/url.py	Tue Dec 19 16:27:24 2017 -0500
@@ -466,7 +466,7 @@
 
 handlerfuncs = []
 
-def opener(ui, authinfo=None):
+def opener(ui, authinfo=None, useragent=None):
     '''
     construct an opener suitable for urllib2
     authinfo will be added to the password manager
@@ -512,8 +512,14 @@
     # own distribution name. Since servers should not be using the user
     # agent string for anything, clients should be able to define whatever
     # user agent they deem appropriate.
-    agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version()
-    opener.addheaders = [(r'User-agent', pycompat.sysstr(agent))]
+    #
+    # The custom user agent is for lfs, because unfortunately some servers
+    # do look at this value.
+    if not useragent:
+        agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version()
+        opener.addheaders = [(r'User-agent', pycompat.sysstr(agent))]
+    else:
+        opener.addheaders = [(r'User-agent', pycompat.sysstr(useragent))]
 
     # This header should only be needed by wire protocol requests. But it has
     # been sent on all requests since forever. We keep sending it for backwards
--- a/mercurial/util.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/util.py	Tue Dec 19 16:27:24 2017 -0500
@@ -931,6 +931,11 @@
         # __dict__ assignment required to bypass __setattr__ (eg: repoview)
         obj.__dict__[self.name] = value
 
+def clearcachedproperty(obj, prop):
+    '''clear a cached property value, if one has been set'''
+    if prop in obj.__dict__:
+        del obj.__dict__[prop]
+
 def pipefilter(s, cmd):
     '''filter string S through command CMD, returning its output'''
     p = subprocess.Popen(cmd, shell=True, close_fds=closefds,
@@ -2662,7 +2667,7 @@
         else:
             prefix_char = prefix
         mapping[prefix_char] = prefix_char
-    r = remod.compile(r'%s(%s)' % (prefix, patterns))
+    r = remod.compile(br'%s(%s)' % (prefix, patterns))
     return r.sub(lambda x: fn(mapping[x.group()[1:]]), s)
 
 def getport(port):
--- a/mercurial/vfs.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/vfs.py	Tue Dec 19 16:27:24 2017 -0500
@@ -277,8 +277,12 @@
         to ``__call__``/``open`` to result in the file possibly being closed
         asynchronously, on a background thread.
         """
-        # This is an arbitrary restriction and could be changed if we ever
-        # have a use case.
+        # Sharing backgroundfilecloser between threads is complex and using
+        # multiple instances puts us at risk of running out of file descriptors
+        # only allow to use backgroundfilecloser when in main thread.
+        if not isinstance(threading.currentThread(), threading._MainThread):
+            yield
+            return
         vfs = getattr(self, 'vfs', self)
         if getattr(vfs, '_backgroundfilecloser', None):
             raise error.Abort(
@@ -413,7 +417,8 @@
                                     ' valid for checkambig=True') % mode)
             fp = checkambigatclosing(fp)
 
-        if backgroundclose:
+        if (backgroundclose and
+                isinstance(threading.currentThread(), threading._MainThread)):
             if not self._backgroundfilecloser:
                 raise error.Abort(_('backgroundclose can only be used when a '
                                   'backgroundclosing context manager is active')
--- a/mercurial/wireproto.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/wireproto.py	Tue Dec 19 16:27:24 2017 -0500
@@ -205,6 +205,7 @@
 # :scsv:  list of comma-separated values return as set
 # :plain: string with no transformation needed.
 gboptsmap = {'heads':  'nodes',
+             'bookmarks': 'boolean',
              'common': 'nodes',
              'obsmarkers': 'boolean',
              'phases': 'boolean',
@@ -451,9 +452,9 @@
         # don't pass optional arguments left at their default value
         opts = {}
         if three is not None:
-            opts['three'] = three
+            opts[r'three'] = three
         if four is not None:
-            opts['four'] = four
+            opts[r'four'] = four
         return self._call('debugwireargs', one=one, two=two, **opts)
 
     def _call(self, cmd, **args):
@@ -816,7 +817,7 @@
 def debugwireargs(repo, proto, one, two, others):
     # only accept optional args from the known set
     opts = options('debugwireargs', ['three', 'four'], others)
-    return repo.debugwireargs(one, two, **opts)
+    return repo.debugwireargs(one, two, **pycompat.strkwargs(opts))
 
 @wireprotocommand('getbundle', '*')
 def getbundle(repo, proto, others):
--- a/mercurial/worker.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/mercurial/worker.py	Tue Dec 19 16:27:24 2017 -0500
@@ -11,6 +11,8 @@
 import os
 import signal
 import sys
+import threading
+import time
 
 from .i18n import _
 from . import (
@@ -53,7 +55,7 @@
             raise error.Abort(_('number of cpus must be an integer'))
     return min(max(countcpus(), 4), 32)
 
-if pycompat.isposix:
+if pycompat.isposix or pycompat.iswindows:
     _startupcost = 0.01
 else:
     _startupcost = 1e30
@@ -81,7 +83,8 @@
     args - arguments to split into chunks, to pass to individual
     workers
     '''
-    if worthwhile(ui, costperarg, len(args)):
+    enabled = ui.configbool('worker', 'enabled')
+    if enabled and worthwhile(ui, costperarg, len(args)):
         return _platformworker(ui, func, staticargs, args)
     return func(*staticargs + (args,))
 
@@ -203,7 +206,91 @@
     elif os.WIFSIGNALED(code):
         return -os.WTERMSIG(code)
 
-if not pycompat.iswindows:
+def _windowsworker(ui, func, staticargs, args):
+    class Worker(threading.Thread):
+        def __init__(self, taskqueue, resultqueue, func, staticargs,
+                     group=None, target=None, name=None, verbose=None):
+            threading.Thread.__init__(self, group=group, target=target,
+                                      name=name, verbose=verbose)
+            self._taskqueue = taskqueue
+            self._resultqueue = resultqueue
+            self._func = func
+            self._staticargs = staticargs
+            self._interrupted = False
+            self.daemon = True
+            self.exception = None
+
+        def interrupt(self):
+            self._interrupted = True
+
+        def run(self):
+            try:
+                while not self._taskqueue.empty():
+                    try:
+                        args = self._taskqueue.get_nowait()
+                        for res in self._func(*self._staticargs + (args,)):
+                            self._resultqueue.put(res)
+                            # threading doesn't provide a native way to
+                            # interrupt execution. handle it manually at every
+                            # iteration.
+                            if self._interrupted:
+                                return
+                    except util.empty:
+                        break
+            except Exception as e:
+                # store the exception such that the main thread can resurface
+                # it as if the func was running without workers.
+                self.exception = e
+                raise
+
+    threads = []
+    def trykillworkers():
+        # Allow up to 1 second to clean worker threads nicely
+        cleanupend = time.time() + 1
+        for t in threads:
+            t.interrupt()
+        for t in threads:
+            remainingtime = cleanupend - time.time()
+            t.join(remainingtime)
+            if t.is_alive():
+                # pass over the workers joining failure. it is more
+                # important to surface the inital exception than the
+                # fact that one of workers may be processing a large
+                # task and does not get to handle the interruption.
+                ui.warn(_("failed to kill worker threads while "
+                          "handling an exception\n"))
+                return
+
+    workers = _numworkers(ui)
+    resultqueue = util.queue()
+    taskqueue = util.queue()
+    # partition work to more pieces than workers to minimize the chance
+    # of uneven distribution of large tasks between the workers
+    for pargs in partition(args, workers * 20):
+        taskqueue.put(pargs)
+    for _i in range(workers):
+        t = Worker(taskqueue, resultqueue, func, staticargs)
+        threads.append(t)
+        t.start()
+    try:
+        while len(threads) > 0:
+            while not resultqueue.empty():
+                yield resultqueue.get()
+            threads[0].join(0.05)
+            finishedthreads = [_t for _t in threads if not _t.is_alive()]
+            for t in finishedthreads:
+                if t.exception is not None:
+                    raise t.exception
+                threads.remove(t)
+    except (Exception, KeyboardInterrupt): # re-raises
+        trykillworkers()
+        raise
+    while not resultqueue.empty():
+        yield resultqueue.get()
+
+if pycompat.iswindows:
+    _platformworker = _windowsworker
+else:
     _platformworker = _posixworker
     _exitstatus = _posixexitstatus
 
--- a/setup.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/setup.py	Tue Dec 19 16:27:24 2017 -0500
@@ -29,12 +29,16 @@
 if sys.version_info[0] >= 3:
     printf = eval('print')
     libdir_escape = 'unicode_escape'
+    def sysstr(s):
+        return s.decode('latin-1')
 else:
     libdir_escape = 'string_escape'
     def printf(*args, **kwargs):
         f = kwargs.get('file', sys.stdout)
         end = kwargs.get('end', '\n')
         f.write(b' '.join(args) + end)
+    def sysstr(s):
+        return s
 
 # Attempt to guide users to a modern pip - this means that 2.6 users
 # should have a chance of getting a 4.2 release, and when we ratchet
@@ -136,6 +140,18 @@
 from distutils.sysconfig import get_python_inc, get_config_var
 from distutils.version import StrictVersion
 
+def write_if_changed(path, content):
+    """Write content to a file iff the content hasn't changed."""
+    if os.path.exists(path):
+        with open(path, 'rb') as fh:
+            current = fh.read()
+    else:
+        current = b''
+
+    if current != content:
+        with open(path, 'wb') as fh:
+            fh.write(content)
+
 scripts = ['hg']
 if os.name == 'nt':
     # We remove hg.bat if we are able to build hg.exe.
@@ -283,8 +299,8 @@
 if os.path.isdir('.hg'):
     hg = findhg()
     cmd = ['log', '-r', '.', '--template', '{tags}\n']
-    numerictags = [t for t in hg.run(cmd).split() if t[0:1].isdigit()]
-    hgid = hg.run(['id', '-i']).strip()
+    numerictags = [t for t in sysstr(hg.run(cmd)).split() if t[0:1].isdigit()]
+    hgid = sysstr(hg.run(['id', '-i'])).strip()
     if not hgid:
         # Bail out if hg is having problems interacting with this repository,
         # rather than falling through and producing a bogus version number.
@@ -297,7 +313,7 @@
             version += '+'
     else: # no tag found
         ltagcmd = ['parents', '--template', '{latesttag}']
-        ltag = hg.run(ltagcmd)
+        ltag = sysstr(hg.run(ltagcmd))
         changessincecmd = ['log', '-T', 'x\n', '-r', "only(.,'%s')" % ltag]
         changessince = len(hg.run(changessincecmd).splitlines())
         version = '%s+%s-%s' % (ltag, changessince, hgid)
@@ -317,9 +333,14 @@
         version = kw.get('node', '')[:12]
 
 if version:
-    with open("mercurial/__version__.py", "w") as f:
-        f.write('# this file is autogenerated by setup.py\n')
-        f.write('version = "%s"\n' % version)
+    versionb = version
+    if not isinstance(versionb, bytes):
+        versionb = versionb.encode('ascii')
+
+    write_if_changed('mercurial/__version__.py', b''.join([
+        b'# this file is autogenerated by setup.py\n'
+        b'version = "%s"\n' % versionb,
+    ]))
 
 try:
     oldpolicy = os.environ.get('HGMODULEPOLICY', None)
@@ -478,9 +499,13 @@
             modulepolicy = 'allow'
         else:
             modulepolicy = 'c'
-        with open(os.path.join(basepath, '__modulepolicy__.py'), "w") as f:
-            f.write('# this file is autogenerated by setup.py\n')
-            f.write('modulepolicy = b"%s"\n' % modulepolicy)
+
+        content = b''.join([
+            b'# this file is autogenerated by setup.py\n',
+            b'modulepolicy = b"%s"\n' % modulepolicy.encode('ascii'),
+        ])
+        write_if_changed(os.path.join(basepath, '__modulepolicy__.py'),
+                         content)
 
         build_py.run(self)
 
@@ -767,7 +792,7 @@
             'mercurial.thirdparty.attr',
             'hgext', 'hgext.convert', 'hgext.fsmonitor',
             'hgext.fsmonitor.pywatchman', 'hgext.highlight',
-            'hgext.largefiles', 'hgext.zeroconf', 'hgext3rd',
+            'hgext.largefiles', 'hgext.lfs', 'hgext.zeroconf', 'hgext3rd',
             'hgdemandimport']
 
 common_depends = ['mercurial/bitmanipulation.h',
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/common-pattern.py	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,132 @@
+# common patterns in test at can safely be replaced
+from __future__ import absolute_import
+
+import os
+
+substitutions = [
+    # list of possible compressions
+    (br'(zstd,)?zlib,none,bzip2',
+     br'$USUAL_COMPRESSIONS$'
+    ),
+    # capabilities sent through http
+    (br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
+     br'bookmarks%250A'
+     br'changegroup%253D01%252C02%250A'
+     br'digests%253Dmd5%252Csha1%252Csha512%250A'
+     br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
+     br'hgtagsfnodes%250A'
+     br'listkeys%250A'
+     br'phases%253Dheads%250A'
+     br'pushkey%250A'
+     br'remote-changegroup%253Dhttp%252Chttps',
+     # (the replacement patterns)
+     br'$USUAL_BUNDLE_CAPS$'
+    ),
+    # bundle2 capabilities sent through ssh
+    (br'bundle2=HG20%0A'
+     br'bookmarks%0A'
+     br'changegroup%3D01%2C02%0A'
+     br'digests%3Dmd5%2Csha1%2Csha512%0A'
+     br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
+     br'hgtagsfnodes%0A'
+     br'listkeys%0A'
+     br'phases%3Dheads%0A'
+     br'pushkey%0A'
+     br'remote-changegroup%3Dhttp%2Chttps',
+     # (replacement patterns)
+     br'$USUAL_BUNDLE2_CAPS$'
+    ),
+    # HTTP log dates
+    (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "GET',
+     br' - - [$LOGDATE$] "GET'
+    ),
+    # Windows has an extra '/' in the following lines that get globbed away:
+    #   pushing to file:/*/$TESTTMP/r2 (glob)
+    #   comparing with file:/*/$TESTTMP/r2 (glob)
+    #   sub/maybelarge.dat: largefile 34..9c not available from
+    #       file:/*/$TESTTMP/largefiles-repo (glob)
+    (br'(.*file:/)/?(/\$TESTTMP.*)',
+     lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)'
+    ),
+]
+
+# Various platform error strings, keyed on a common replacement string
+_errors = {
+    br'$ENOENT$': (
+        # strerror()
+        br'No such file or directory',
+
+        # FormatMessage(ERROR_FILE_NOT_FOUND)
+        br'The system cannot find the file specified',
+    ),
+    br'$ENOTDIR$': (
+        # strerror()
+        br'Not a directory',
+
+        # FormatMessage(ERROR_PATH_NOT_FOUND)
+        br'The system cannot find the path specified',
+    ),
+    br'$ECONNRESET$': (
+        # strerror()
+        br'Connection reset by peer',
+
+        # FormatMessage(WSAECONNRESET)
+        br'An existing connection was forcibly closed by the remote host',
+    ),
+    br'$EADDRINUSE$': (
+        # strerror()
+        br'Address already in use',
+
+        # FormatMessage(WSAEADDRINUSE)
+        br'Only one usage of each socket address'
+        br' \(protocol/network address/port\) is normally permitted',
+    ),
+}
+
+for replace, msgs in _errors.items():
+    substitutions.extend((m, replace) for m in msgs)
+
+# Output lines on Windows that can be autocorrected for '\' vs '/' path
+# differences.
+_winpathfixes = [
+    # cloning subrepo s\ss from $TESTTMP/t/s/ss
+    # cloning subrepo foo\bar from http://localhost:$HGPORT/foo/bar
+    br'(?m)^cloning subrepo \S+\\.*',
+
+    # pulling from $TESTTMP\issue1852a
+    br'(?m)^pulling from \$TESTTMP\\.*',
+
+    # pushing to $TESTTMP\a
+    br'(?m)^pushing to \$TESTTMP\\.*',
+
+    # pushing subrepo s\ss to $TESTTMP/t/s/ss
+    br'(?m)^pushing subrepo \S+\\\S+ to.*',
+
+    # moving d1\d11\a1 to d3/d11/a1
+    br'(?m)^moving \S+\\.*',
+
+    # d1\a: not recording move - dummy does not exist
+    br'\S+\\\S+: not recording move .+',
+
+    # reverting s\a
+    br'(?m)^reverting (?!subrepo ).*\\.*',
+
+    # saved backup bundle to
+    #     $TESTTMP\test\.hg\strip-backup/443431ffac4f-2fc5398a-backup.hg
+    br'(?m)^saved backup bundle to \$TESTTMP.*\.hg',
+
+    # no changes made to subrepo s\ss since last push to ../tcc/s/ss
+    br'(?m)^no changes made to subrepo \S+\\\S+ since.*',
+
+    # changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing
+    #     $TESTTMP\largefiles-repo-hg\.hg\largefiles\76..38
+    br'(?m)^changeset .* references (corrupted|missing) \$TESTTMP\\.*',
+
+    # stuff/maybelarge.dat: largefile 76..38 not available from
+    #     file:/*/$TESTTMP\largefiles-repo (glob)
+    br'.*: largefile \S+ not available from file:/\*/.+',
+]
+
+if os.name == 'nt':
+    substitutions.extend([(s, lambda match: match.group().replace(b'\\', b'/'))
+                          for s in _winpathfixes])
--- a/tests/hghave.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/hghave.py	Tue Dec 19 16:27:24 2017 -0500
@@ -284,6 +284,17 @@
         return (0, 0)
     return (int(m.group(1)), int(m.group(2)))
 
+# https://github.com/git-lfs/lfs-test-server
+@check("lfs-test-server", "git-lfs test server")
+def has_lfsserver():
+    exe = 'lfs-test-server'
+    if has_windows():
+        exe = 'lfs-test-server.exe'
+    return any(
+        os.access(os.path.join(path, exe), os.X_OK)
+        for path in os.environ["PATH"].split(os.pathsep)
+    )
+
 @checkvers("git", "git client (with ext::sh support) version >= %s", (1.9,))
 def has_git_range(v):
     major, minor = v.split('.')[0:2]
@@ -444,6 +455,10 @@
     return matchoutput("clang-format --help",
                        br"^OVERVIEW: A tool to format C/C\+\+[^ ]+ code.")
 
+@check("jshint", "JSHint static code analysis tool")
+def has_jshint():
+    return matchoutput("jshint --version 2>&1", br"jshint v")
+
 @check("pygments", "Pygments source highlighting library")
 def has_pygments():
     try:
--- a/tests/list-tree.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/list-tree.py	Tue Dec 19 16:27:24 2017 -0500
@@ -24,4 +24,4 @@
         else:
             yield p
 
-print('\n'.join(sorted(gather())))
+print('\n'.join(sorted(gather(), key=lambda x: x.replace(os.path.sep, '/'))))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/logexceptions.py	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,73 @@
+# logexceptions.py - Write files containing info about Mercurial exceptions
+#
+# Copyright 2017 Matt Mackall <mpm@selenic.com>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from __future__ import absolute_import
+
+import inspect
+import os
+import sys
+import traceback
+import uuid
+
+from mercurial import (
+    dispatch,
+    extensions,
+)
+
+def handleexception(orig, ui):
+    res = orig(ui)
+
+    if not ui.environ.get(b'HGEXCEPTIONSDIR'):
+        return res
+
+    dest = os.path.join(ui.environ[b'HGEXCEPTIONSDIR'],
+                        str(uuid.uuid4()).encode('ascii'))
+
+    exc_type, exc_value, exc_tb = sys.exc_info()
+
+    stack = []
+    tb = exc_tb
+    while tb:
+        stack.append(tb)
+        tb = tb.tb_next
+    stack.reverse()
+
+    hgframe = 'unknown'
+    hgline = 'unknown'
+
+    # Find the first Mercurial frame in the stack.
+    for tb in stack:
+        mod = inspect.getmodule(tb)
+        if not mod.__name__.startswith(('hg', 'mercurial')):
+            continue
+
+        frame = tb.tb_frame
+
+        try:
+            with open(inspect.getsourcefile(tb), 'r') as fh:
+                hgline = fh.readlines()[frame.f_lineno - 1].strip()
+        except (IndexError, OSError):
+            pass
+
+        hgframe = '%s:%d' % (frame.f_code.co_filename, frame.f_lineno)
+        break
+
+    primary = traceback.extract_tb(exc_tb)[-1]
+    primaryframe = '%s:%d' % (primary.filename, primary.lineno)
+
+    with open(dest, 'wb') as fh:
+        parts = [
+            str(exc_value),
+            primaryframe,
+            hgframe,
+            hgline,
+        ]
+        fh.write(b'\0'.join(p.encode('utf-8', 'replace') for p in parts))
+
+def extsetup(ui):
+    extensions.wrapfunction(dispatch, 'handlecommandexception',
+                            handleexception)
--- a/tests/run-tests.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/run-tests.py	Tue Dec 19 16:27:24 2017 -0500
@@ -45,11 +45,12 @@
 
 from __future__ import absolute_import, print_function
 
+import argparse
+import collections
 import difflib
 import distutils.version as version
 import errno
 import json
-import optparse
 import os
 import random
 import re
@@ -296,122 +297,132 @@
 
 def getparser():
     """Obtain the OptionParser used by the CLI."""
-    parser = optparse.OptionParser("%prog [options] [tests]")
-
-    # keep these sorted
-    parser.add_option("--blacklist", action="append",
+    parser = argparse.ArgumentParser(usage='%(prog)s [options] [tests]')
+
+    selection = parser.add_argument_group('Test Selection')
+    selection.add_argument('--allow-slow-tests', action='store_true',
+        help='allow extremely slow tests')
+    selection.add_argument("--blacklist", action="append",
         help="skip tests listed in the specified blacklist file")
-    parser.add_option("--whitelist", action="append",
+    selection.add_argument("--changed",
+        help="run tests that are changed in parent rev or working directory")
+    selection.add_argument("-k", "--keywords",
+        help="run tests matching keywords")
+    selection.add_argument("-r", "--retest", action="store_true",
+        help = "retest failed tests")
+    selection.add_argument("--test-list", action="append",
+        help="read tests to run from the specified file")
+    selection.add_argument("--whitelist", action="append",
         help="always run tests listed in the specified whitelist file")
-    parser.add_option("--test-list", action="append",
-                      help="read tests to run from the specified file")
-    parser.add_option("--changed", type="string",
-        help="run tests that are changed in parent rev or working directory")
-    parser.add_option("-C", "--annotate", action="store_true",
-        help="output files annotated with coverage")
-    parser.add_option("-c", "--cover", action="store_true",
-        help="print a test coverage report")
-    parser.add_option("--color", choices=["always", "auto", "never"],
-                      default=os.environ.get('HGRUNTESTSCOLOR', 'auto'),
-                      help="colorisation: always|auto|never (default: auto)")
-    parser.add_option("-d", "--debug", action="store_true",
+    selection.add_argument('tests', metavar='TESTS', nargs='*',
+                        help='Tests to run')
+
+    harness = parser.add_argument_group('Test Harness Behavior')
+    harness.add_argument('--bisect-repo',
+                        metavar='bisect_repo',
+                        help=("Path of a repo to bisect. Use together with "
+                              "--known-good-rev"))
+    harness.add_argument("-d", "--debug", action="store_true",
         help="debug mode: write output of test scripts to console"
              " rather than capturing and diffing it (disables timeout)")
-    parser.add_option("-f", "--first", action="store_true",
+    harness.add_argument("-f", "--first", action="store_true",
         help="exit on the first test failure")
-    parser.add_option("-H", "--htmlcov", action="store_true",
-        help="create an HTML report of the coverage of the files")
-    parser.add_option("-i", "--interactive", action="store_true",
+    harness.add_argument("-i", "--interactive", action="store_true",
         help="prompt to accept changed output")
-    parser.add_option("-j", "--jobs", type="int",
+    harness.add_argument("-j", "--jobs", type=int,
         help="number of jobs to run in parallel"
              " (default: $%s or %d)" % defaults['jobs'])
-    parser.add_option("--keep-tmpdir", action="store_true",
+    harness.add_argument("--keep-tmpdir", action="store_true",
         help="keep temporary directory after running tests")
-    parser.add_option("-k", "--keywords",
-        help="run tests matching keywords")
-    parser.add_option("--list-tests", action="store_true",
+    harness.add_argument('--known-good-rev',
+                        metavar="known_good_rev",
+                        help=("Automatically bisect any failures using this "
+                              "revision as a known-good revision."))
+    harness.add_argument("--list-tests", action="store_true",
         help="list tests instead of running them")
-    parser.add_option("-l", "--local", action="store_true",
+    harness.add_argument("--loop", action="store_true",
+        help="loop tests repeatedly")
+    harness.add_argument('--random', action="store_true",
+        help='run tests in random order')
+    harness.add_argument("-p", "--port", type=int,
+        help="port on which servers should listen"
+             " (default: $%s or %d)" % defaults['port'])
+    harness.add_argument('--profile-runner', action='store_true',
+                        help='run statprof on run-tests')
+    harness.add_argument("-R", "--restart", action="store_true",
+        help="restart at last error")
+    harness.add_argument("--runs-per-test", type=int, dest="runs_per_test",
+        help="run each test N times (default=1)", default=1)
+    harness.add_argument("--shell",
+        help="shell to use (default: $%s or %s)" % defaults['shell'])
+    harness.add_argument('--showchannels', action='store_true',
+                        help='show scheduling channels')
+    harness.add_argument("--slowtimeout", type=int,
+        help="kill errant slow tests after SLOWTIMEOUT seconds"
+             " (default: $%s or %d)" % defaults['slowtimeout'])
+    harness.add_argument("-t", "--timeout", type=int,
+        help="kill errant tests after TIMEOUT seconds"
+             " (default: $%s or %d)" % defaults['timeout'])
+    harness.add_argument("--tmpdir",
+        help="run tests in the given temporary directory"
+             " (implies --keep-tmpdir)")
+    harness.add_argument("-v", "--verbose", action="store_true",
+        help="output verbose messages")
+
+    hgconf = parser.add_argument_group('Mercurial Configuration')
+    hgconf.add_argument("--chg", action="store_true",
+        help="install and use chg wrapper in place of hg")
+    hgconf.add_argument("--compiler",
+        help="compiler to build with")
+    hgconf.add_argument('--extra-config-opt', action="append", default=[],
+        help='set the given config opt in the test hgrc')
+    hgconf.add_argument("-l", "--local", action="store_true",
         help="shortcut for --with-hg=<testdir>/../hg, "
              "and --with-chg=<testdir>/../contrib/chg/chg if --chg is set")
-    parser.add_option("--loop", action="store_true",
-        help="loop tests repeatedly")
-    parser.add_option("--runs-per-test", type="int", dest="runs_per_test",
-        help="run each test N times (default=1)", default=1)
-    parser.add_option("-n", "--nodiff", action="store_true",
-        help="skip showing test changes")
-    parser.add_option("--outputdir", type="string",
-        help="directory to write error logs to (default=test directory)")
-    parser.add_option("-p", "--port", type="int",
-        help="port on which servers should listen"
-             " (default: $%s or %d)" % defaults['port'])
-    parser.add_option("--compiler", type="string",
-        help="compiler to build with")
-    parser.add_option("--pure", action="store_true",
+    hgconf.add_argument("--ipv6", action="store_true",
+        help="prefer IPv6 to IPv4 for network related tests")
+    hgconf.add_argument("--pure", action="store_true",
         help="use pure Python code instead of C extensions")
-    parser.add_option("-R", "--restart", action="store_true",
-        help="restart at last error")
-    parser.add_option("-r", "--retest", action="store_true",
-        help="retest failed tests")
-    parser.add_option("-S", "--noskips", action="store_true",
-        help="don't report skip tests verbosely")
-    parser.add_option("--shell", type="string",
-        help="shell to use (default: $%s or %s)" % defaults['shell'])
-    parser.add_option("-t", "--timeout", type="int",
-        help="kill errant tests after TIMEOUT seconds"
-             " (default: $%s or %d)" % defaults['timeout'])
-    parser.add_option("--slowtimeout", type="int",
-        help="kill errant slow tests after SLOWTIMEOUT seconds"
-             " (default: $%s or %d)" % defaults['slowtimeout'])
-    parser.add_option("--time", action="store_true",
-        help="time how long each test takes")
-    parser.add_option("--json", action="store_true",
-                      help="store test result data in 'report.json' file")
-    parser.add_option("--tmpdir", type="string",
-        help="run tests in the given temporary directory"
-             " (implies --keep-tmpdir)")
-    parser.add_option("-v", "--verbose", action="store_true",
-        help="output verbose messages")
-    parser.add_option("--xunit", type="string",
-                      help="record xunit results at specified path")
-    parser.add_option("--view", type="string",
-        help="external diff viewer")
-    parser.add_option("--with-hg", type="string",
+    hgconf.add_argument("-3", "--py3k-warnings", action="store_true",
+        help="enable Py3k warnings on Python 2.7+")
+    hgconf.add_argument("--with-chg", metavar="CHG",
+        help="use specified chg wrapper in place of hg")
+    hgconf.add_argument("--with-hg",
         metavar="HG",
         help="test using specified hg script rather than a "
              "temporary installation")
-    parser.add_option("--chg", action="store_true",
-                      help="install and use chg wrapper in place of hg")
-    parser.add_option("--with-chg", metavar="CHG",
-                      help="use specified chg wrapper in place of hg")
-    parser.add_option("--ipv6", action="store_true",
-                      help="prefer IPv6 to IPv4 for network related tests")
-    parser.add_option("-3", "--py3k-warnings", action="store_true",
-        help="enable Py3k warnings on Python 2.7+")
     # This option should be deleted once test-check-py3-compat.t and other
     # Python 3 tests run with Python 3.
-    parser.add_option("--with-python3", metavar="PYTHON3",
-                      help="Python 3 interpreter (if running under Python 2)"
-                           " (TEMPORARY)")
-    parser.add_option('--extra-config-opt', action="append",
-                      help='set the given config opt in the test hgrc')
-    parser.add_option('--random', action="store_true",
-                      help='run tests in random order')
-    parser.add_option('--profile-runner', action='store_true',
-                      help='run statprof on run-tests')
-    parser.add_option('--allow-slow-tests', action='store_true',
-                      help='allow extremely slow tests')
-    parser.add_option('--showchannels', action='store_true',
-                      help='show scheduling channels')
-    parser.add_option('--known-good-rev', type="string",
-                      metavar="known_good_rev",
-                      help=("Automatically bisect any failures using this "
-                            "revision as a known-good revision."))
-    parser.add_option('--bisect-repo', type="string",
-                      metavar='bisect_repo',
-                      help=("Path of a repo to bisect. Use together with "
-                            "--known-good-rev"))
+    hgconf.add_argument("--with-python3", metavar="PYTHON3",
+        help="Python 3 interpreter (if running under Python 2)"
+             " (TEMPORARY)")
+
+    reporting = parser.add_argument_group('Results Reporting')
+    reporting.add_argument("-C", "--annotate", action="store_true",
+        help="output files annotated with coverage")
+    reporting.add_argument("--color", choices=["always", "auto", "never"],
+        default=os.environ.get('HGRUNTESTSCOLOR', 'auto'),
+        help="colorisation: always|auto|never (default: auto)")
+    reporting.add_argument("-c", "--cover", action="store_true",
+        help="print a test coverage report")
+    reporting.add_argument('--exceptions', action='store_true',
+        help='log all exceptions and generate an exception report')
+    reporting.add_argument("-H", "--htmlcov", action="store_true",
+        help="create an HTML report of the coverage of the files")
+    reporting.add_argument("--json", action="store_true",
+        help="store test result data in 'report.json' file")
+    reporting.add_argument("--outputdir",
+        help="directory to write error logs to (default=test directory)")
+    reporting.add_argument("-n", "--nodiff", action="store_true",
+        help="skip showing test changes")
+    reporting.add_argument("-S", "--noskips", action="store_true",
+        help="don't report skip tests verbosely")
+    reporting.add_argument("--time", action="store_true",
+        help="time how long each test takes")
+    reporting.add_argument("--view",
+        help="external diff viewer")
+    reporting.add_argument("--xunit",
+        help="record xunit results at specified path")
 
     for option, (envvar, default) in defaults.items():
         defaults[option] = type(default)(os.environ.get(envvar, default))
@@ -421,7 +432,7 @@
 
 def parseargs(args, parser):
     """Parse arguments with our OptionParser and validate results."""
-    (options, args) = parser.parse_args(args)
+    options = parser.parse_args(args)
 
     # jython is always pure
     if 'java' in sys.platform or '__pypy__' in sys.modules:
@@ -550,7 +561,7 @@
     if options.showchannels:
         options.nodiff = True
 
-    return (options, args)
+    return options
 
 def rename(src, dst):
     """Like os.rename(), trade atomicity and opened files friendliness
@@ -890,10 +901,9 @@
             # Diff generation may rely on written .err file.
             if (ret != 0 or out != self._refout) and not self._skipped \
                 and not self._debug:
-                f = open(self.errpath, 'wb')
-                for line in out:
-                    f.write(line)
-                f.close()
+                with open(self.errpath, 'wb') as f:
+                    for line in out:
+                        f.write(line)
 
             # The result object handles diff calculation for us.
             if self._result.addOutputMismatch(self, ret, out, self._refout):
@@ -930,10 +940,9 @@
 
         if (self._ret != 0 or self._out != self._refout) and not self._skipped \
             and not self._debug and self._out:
-            f = open(self.errpath, 'wb')
-            for line in self._out:
-                f.write(line)
-            f.close()
+            with open(self.errpath, 'wb') as f:
+                for line in self._out:
+                    f.write(line)
 
         vlog("# Ret was:", self._ret, '(%s)' % self.name)
 
@@ -961,13 +970,20 @@
             self._portmap(0),
             self._portmap(1),
             self._portmap(2),
-            (br'(?m)^(saved backup bundle to .*\.hg)( \(glob\))?$',
-             br'\1 (glob)'),
             (br'([^0-9])%s' % re.escape(self._localip()), br'\1$LOCALIP'),
             (br'\bHG_TXNID=TXN:[a-f0-9]{40}\b', br'HG_TXNID=TXN:$ID$'),
             ]
         r.append((self._escapepath(self._testtmp), b'$TESTTMP'))
 
+        replacementfile = os.path.join(self._testdir, b'common-pattern.py')
+
+        if os.path.exists(replacementfile):
+            data = {}
+            with open(replacementfile, mode='rb') as source:
+                # the intermediate 'compile' step help with debugging
+                code = compile(source.read(), replacementfile, 'exec')
+                exec(code, data)
+                r.extend(data.get('substitutions', ()))
         return r
 
     def _escapepath(self, p):
@@ -1069,29 +1085,31 @@
 
     def _createhgrc(self, path):
         """Create an hgrc file for this test."""
-        hgrc = open(path, 'wb')
-        hgrc.write(b'[ui]\n')
-        hgrc.write(b'slash = True\n')
-        hgrc.write(b'interactive = False\n')
-        hgrc.write(b'mergemarkers = detailed\n')
-        hgrc.write(b'promptecho = True\n')
-        hgrc.write(b'[defaults]\n')
-        hgrc.write(b'[devel]\n')
-        hgrc.write(b'all-warnings = true\n')
-        hgrc.write(b'default-date = 0 0\n')
-        hgrc.write(b'[largefiles]\n')
-        hgrc.write(b'usercache = %s\n' %
-                   (os.path.join(self._testtmp, b'.cache/largefiles')))
-        hgrc.write(b'[web]\n')
-        hgrc.write(b'address = localhost\n')
-        hgrc.write(b'ipv6 = %s\n' % str(self._useipv6).encode('ascii'))
-
-        for opt in self._extraconfigopts:
-            section, key = opt.split('.', 1)
-            assert '=' in key, ('extra config opt %s must '
-                                'have an = for assignment' % opt)
-            hgrc.write(b'[%s]\n%s\n' % (section, key))
-        hgrc.close()
+        with open(path, 'wb') as hgrc:
+            hgrc.write(b'[ui]\n')
+            hgrc.write(b'slash = True\n')
+            hgrc.write(b'interactive = False\n')
+            hgrc.write(b'mergemarkers = detailed\n')
+            hgrc.write(b'promptecho = True\n')
+            hgrc.write(b'[defaults]\n')
+            hgrc.write(b'[devel]\n')
+            hgrc.write(b'all-warnings = true\n')
+            hgrc.write(b'default-date = 0 0\n')
+            hgrc.write(b'[largefiles]\n')
+            hgrc.write(b'usercache = %s\n' %
+                       (os.path.join(self._testtmp, b'.cache/largefiles')))
+            hgrc.write(b'[lfs]\n')
+            hgrc.write(b'usercache = %s\n' %
+                       (os.path.join(self._testtmp, b'.cache/lfs')))
+            hgrc.write(b'[web]\n')
+            hgrc.write(b'address = localhost\n')
+            hgrc.write(b'ipv6 = %s\n' % str(self._useipv6).encode('ascii'))
+
+            for opt in self._extraconfigopts:
+                section, key = opt.encode('utf-8').split(b'.', 1)
+                assert b'=' in key, ('extra config opt %s must '
+                                     'have an = for assignment' % opt)
+                hgrc.write(b'[%s]\n%s\n' % (section, key))
 
     def fail(self, msg):
         # unittest differentiates between errored and failed.
@@ -1197,9 +1215,7 @@
 
     def __init__(self, path, *args, **kwds):
         # accept an extra "case" parameter
-        case = None
-        if 'case' in kwds:
-            case = kwds.pop('case')
+        case = kwds.pop('case', None)
         self._case = case
         self._allcases = parsettestcases(path)
         super(TTest, self).__init__(path, *args, **kwds)
@@ -1213,9 +1229,8 @@
         return os.path.join(self._testdir, self.bname)
 
     def _run(self, env):
-        f = open(self.path, 'rb')
-        lines = f.readlines()
-        f.close()
+        with open(self.path, 'rb') as f:
+            lines = f.readlines()
 
         # .t file is both reference output and the test input, keep reference
         # output updated with the the test input. This avoids some race
@@ -1227,10 +1242,9 @@
 
         # Write out the generated script.
         fname = b'%s.sh' % self._testtmp
-        f = open(fname, 'wb')
-        for l in script:
-            f.write(l)
-        f.close()
+        with open(fname, 'wb') as f:
+            for l in script:
+                f.write(l)
 
         cmd = b'%s "%s"' % (self._shell, fname)
         vlog("# Running", cmd)
@@ -1430,10 +1444,7 @@
 
                     r = self.linematch(el, lout)
                     if isinstance(r, str):
-                        if r == '+glob':
-                            lout = el[:-1] + ' (glob)\n'
-                            r = '' # Warn only this line.
-                        elif r == '-glob':
+                        if r == '-glob':
                             lout = ''.join(el.rsplit(' (glob)', 1))
                             r = '' # Warn only this line.
                         elif r == "retry":
@@ -1517,6 +1528,7 @@
     @staticmethod
     def rematch(el, l):
         try:
+            el = b'(?:' + el + b')'
             # use \Z to ensure that the regex matches to the end of the string
             if os.name == 'nt':
                 return re.match(el + br'\r?\n\Z', l)
@@ -1588,8 +1600,10 @@
                 if l.endswith(b" (glob)\n"):
                     l = l[:-8] + b"\n"
                 return TTest.globmatch(el[:-8], l) or retry
-            if os.altsep and l.replace(b'\\', b'/') == el:
-                return b'+glob'
+            if os.altsep:
+                _l = l.replace(b'\\', b'/')
+                if el == _l or os.name == 'nt' and el[:-1] + b'\r\n' == _l:
+                    return True
         return retry
 
     @staticmethod
@@ -1865,9 +1879,8 @@
                     continue
 
                 if self._keywords:
-                    f = open(test.path, 'rb')
-                    t = f.read().lower() + test.bname.lower()
-                    f.close()
+                    with open(test.path, 'rb') as f:
+                        t = f.read().lower() + test.bname.lower()
                     ignored = False
                     for k in self._keywords.lower().split():
                         if k not in t:
@@ -2096,6 +2109,18 @@
                     os.environ['PYTHONHASHSEED'])
             if self._runner.options.time:
                 self.printtimes(result.times)
+
+            if self._runner.options.exceptions:
+                exceptions = aggregateexceptions(
+                    os.path.join(self._runner._outputdir, b'exceptions'))
+                total = sum(exceptions.values())
+
+                self.stream.writeln('Exceptions Report:')
+                self.stream.writeln('%d total from %d frames' %
+                                    (total, len(exceptions)))
+                for (frame, line, exc), count in exceptions.most_common():
+                    self.stream.writeln('%d\t%s: %s' % (count, frame, exc))
+
             self.stream.flush()
 
         return result
@@ -2287,18 +2312,16 @@
         oldmask = os.umask(0o22)
         try:
             parser = parser or getparser()
-            options, args = parseargs(args, parser)
-            # positional arguments are paths to test files to run, so
-            # we make sure they're all bytestrings
-            args = [_bytespath(a) for a in args]
+            options = parseargs(args, parser)
+            tests = [_bytespath(a) for a in options.tests]
             if options.test_list is not None:
                 for listfile in options.test_list:
                     with open(listfile, 'rb') as f:
-                        args.extend(t for t in f.read().splitlines() if t)
+                        tests.extend(t for t in f.read().splitlines() if t)
             self.options = options
 
             self._checktools()
-            testdescs = self.findtests(args)
+            testdescs = self.findtests(tests)
             if options.profile_runner:
                 import statprof
                 statprof.start()
@@ -2353,10 +2376,18 @@
 
         self._testdir = osenvironb[b'TESTDIR'] = getattr(
             os, 'getcwdb', os.getcwd)()
+        # assume all tests in same folder for now
+        if testdescs:
+            pathname = os.path.dirname(testdescs[0]['path'])
+            if pathname:
+                osenvironb[b'TESTDIR'] = os.path.join(osenvironb[b'TESTDIR'],
+                                                      pathname)
         if self.options.outputdir:
             self._outputdir = canonpath(_bytespath(self.options.outputdir))
         else:
             self._outputdir = self._testdir
+            if testdescs and pathname:
+                self._outputdir = os.path.join(self._outputdir, pathname)
 
         if 'PYTHONHASHSEED' not in os.environ:
             # use a random python hash seed all the time
@@ -2476,6 +2507,23 @@
 
         self._coveragefile = os.path.join(self._testdir, b'.coverage')
 
+        if self.options.exceptions:
+            exceptionsdir = os.path.join(self._outputdir, b'exceptions')
+            try:
+                os.makedirs(exceptionsdir)
+            except OSError as e:
+                if e.errno != errno.EEXIST:
+                    raise
+
+            # Remove all existing exception reports.
+            for f in os.listdir(exceptionsdir):
+                os.unlink(os.path.join(exceptionsdir, f))
+
+            osenvironb[b'HGEXCEPTIONSDIR'] = exceptionsdir
+            logexceptions = os.path.join(self._testdir, b'logexceptions.py')
+            self.options.extra_config_opt.append(
+                'extensions.logexceptions=%s' % logexceptions.decode('utf-8'))
+
         vlog("# Using TESTDIR", self._testdir)
         vlog("# Using RUNTESTDIR", osenvironb[b'RUNTESTDIR'])
         vlog("# Using HGTMP", self._hgtmp)
@@ -2504,6 +2552,16 @@
             else:
                 args = os.listdir(b'.')
 
+        expanded_args = []
+        for arg in args:
+            if os.path.isdir(arg):
+                if not arg.endswith(b'/'):
+                    arg += b'/'
+                expanded_args.extend([arg + a for a in os.listdir(arg)])
+            else:
+                expanded_args.append(arg)
+        args = expanded_args
+
         tests = []
         for t in args:
             if not (os.path.basename(t).startswith(b'test-')
@@ -2758,13 +2816,12 @@
                     if e.errno != errno.ENOENT:
                         raise
         else:
-            f = open(installerrs, 'rb')
-            for line in f:
-                if PYTHON3:
-                    sys.stdout.buffer.write(line)
-                else:
-                    sys.stdout.write(line)
-            f.close()
+            with open(installerrs, 'rb') as f:
+                for line in f:
+                    if PYTHON3:
+                        sys.stdout.buffer.write(line)
+                    else:
+                        sys.stdout.write(line)
             sys.exit(1)
         os.chdir(self._testdir)
 
@@ -2772,28 +2829,24 @@
 
         if self.options.py3k_warnings and not self.options.anycoverage:
             vlog("# Updating hg command to enable Py3k Warnings switch")
-            f = open(os.path.join(self._bindir, 'hg'), 'rb')
-            lines = [line.rstrip() for line in f]
-            lines[0] += ' -3'
-            f.close()
-            f = open(os.path.join(self._bindir, 'hg'), 'wb')
-            for line in lines:
-                f.write(line + '\n')
-            f.close()
+            with open(os.path.join(self._bindir, 'hg'), 'rb') as f:
+                lines = [line.rstrip() for line in f]
+                lines[0] += ' -3'
+            with open(os.path.join(self._bindir, 'hg'), 'wb') as f:
+                for line in lines:
+                    f.write(line + '\n')
 
         hgbat = os.path.join(self._bindir, b'hg.bat')
         if os.path.isfile(hgbat):
             # hg.bat expects to be put in bin/scripts while run-tests.py
             # installation layout put it in bin/ directly. Fix it
-            f = open(hgbat, 'rb')
-            data = f.read()
-            f.close()
+            with open(hgbat, 'rb') as f:
+                data = f.read()
             if b'"%~dp0..\python" "%~dp0hg" %*' in data:
                 data = data.replace(b'"%~dp0..\python" "%~dp0hg" %*',
                                     b'"%~dp0python" "%~dp0hg" %*')
-                f = open(hgbat, 'wb')
-                f.write(data)
-                f.close()
+                with open(hgbat, 'wb') as f:
+                    f.write(data)
             else:
                 print('WARNING: cannot fix hg.bat reference to python.exe')
 
@@ -2918,6 +2971,24 @@
                 print("WARNING: Did not find prerequisite tool: %s " %
                       p.decode("utf-8"))
 
+def aggregateexceptions(path):
+    exceptions = collections.Counter()
+
+    for f in os.listdir(path):
+        with open(os.path.join(path, f), 'rb') as fh:
+            data = fh.read().split(b'\0')
+            if len(data) != 4:
+                continue
+
+            exc, mainframe, hgframe, hgline = data
+            exc = exc.decode('utf-8')
+            mainframe = mainframe.decode('utf-8')
+            hgframe = hgframe.decode('utf-8')
+            hgline = hgline.decode('utf-8')
+            exceptions[(hgframe, hgline, exc)] += 1
+
+    return exceptions
+
 if __name__ == '__main__':
     runner = TestRunner()
 
--- a/tests/seq.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/seq.py	Tue Dec 19 16:27:24 2017 -0500
@@ -10,6 +10,9 @@
 from __future__ import absolute_import, print_function
 import sys
 
+if sys.version_info[0] >= 3:
+    xrange = range
+
 start = 1
 if len(sys.argv) > 2:
     start = int(sys.argv[1])
--- a/tests/test-acl.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-acl.t	Tue Dec 19 16:27:24 2017 -0500
@@ -93,14 +93,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -156,14 +156,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -222,14 +222,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -298,14 +298,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -366,14 +366,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -439,14 +439,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -509,14 +509,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -584,14 +584,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -656,14 +656,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -730,14 +730,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -813,14 +813,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -894,14 +894,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -925,7 +925,7 @@
   bundle2-input-bundle: 4 parts total
   transaction abort!
   rollback completed
-  abort: No such file or directory: ../acl.config
+  abort: $ENOENT$: ../acl.config
   no rollback information available
   0:6675d58eff77
   
@@ -970,14 +970,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -1057,14 +1057,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -1143,14 +1143,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -1225,14 +1225,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -1304,14 +1304,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -1387,14 +1387,14 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -1507,14 +1507,14 @@
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 48 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 48 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 48
   bundle2-input-part: "check:heads" supported
@@ -1591,14 +1591,14 @@
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 48 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 48 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 48
   bundle2-input-part: "check:heads" supported
@@ -1668,14 +1668,14 @@
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 48 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 48 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 48
   bundle2-input-part: "check:heads" supported
@@ -1741,14 +1741,14 @@
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 48 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 48 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 48
   bundle2-input-part: "check:heads" supported
@@ -1808,14 +1808,14 @@
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 48 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 48 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 48
   bundle2-input-part: "check:heads" supported
@@ -1897,14 +1897,14 @@
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 48 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 48 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 48
   bundle2-input-part: "check:heads" supported
@@ -1985,14 +1985,14 @@
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 48 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 48 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 48
   bundle2-input-part: "check:heads" supported
@@ -2057,14 +2057,14 @@
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 48 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 48 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 48
   bundle2-input-part: "check:heads" supported
@@ -2139,14 +2139,14 @@
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 48 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 48 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 48
   bundle2-input-part: "check:heads" supported
--- a/tests/test-add.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-add.t	Tue Dec 19 16:27:24 2017 -0500
@@ -197,17 +197,17 @@
   $ echo def > CapsDir1/CapsDir/SubDir/Def.txt
 
   $ hg add capsdir1/capsdir
-  adding CapsDir1/CapsDir/AbC.txt (glob)
-  adding CapsDir1/CapsDir/SubDir/Def.txt (glob)
+  adding CapsDir1/CapsDir/AbC.txt
+  adding CapsDir1/CapsDir/SubDir/Def.txt
 
   $ hg forget capsdir1/capsdir/abc.txt
 
   $ hg forget capsdir1/capsdir
-  removing CapsDir1/CapsDir/SubDir/Def.txt (glob)
+  removing CapsDir1/CapsDir/SubDir/Def.txt
 
   $ hg add capsdir1
-  adding CapsDir1/CapsDir/AbC.txt (glob)
-  adding CapsDir1/CapsDir/SubDir/Def.txt (glob)
+  adding CapsDir1/CapsDir/AbC.txt
+  adding CapsDir1/CapsDir/SubDir/Def.txt
 
   $ hg ci -m "AbCDef" capsdir1/capsdir
 
@@ -216,14 +216,14 @@
   C CapsDir1/CapsDir/SubDir/Def.txt
 
   $ hg files capsdir1/capsdir
-  CapsDir1/CapsDir/AbC.txt (glob)
-  CapsDir1/CapsDir/SubDir/Def.txt (glob)
+  CapsDir1/CapsDir/AbC.txt
+  CapsDir1/CapsDir/SubDir/Def.txt
 
   $ echo xyz > CapsDir1/CapsDir/SubDir/Def.txt
   $ hg ci -m xyz capsdir1/capsdir/subdir/def.txt
 
   $ hg revert -r '.^' capsdir1/capsdir
-  reverting CapsDir1/CapsDir/SubDir/Def.txt (glob)
+  reverting CapsDir1/CapsDir/SubDir/Def.txt
 
 The conditional tests above mean the hash on the diff line differs on Windows
 and OS X
@@ -244,8 +244,8 @@
 
   $ hg remove -f 'glob:**.txt' -X capsdir1/capsdir
   $ hg remove -f 'glob:**.txt' -I capsdir1/capsdir
-  removing CapsDir1/CapsDir/ABC.txt (glob)
-  removing CapsDir1/CapsDir/SubDir/Def.txt (glob)
+  removing CapsDir1/CapsDir/ABC.txt
+  removing CapsDir1/CapsDir/SubDir/Def.txt
 #endif
 
   $ cd ..
--- a/tests/test-addremove-similar.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-addremove-similar.t	Tue Dec 19 16:27:24 2017 -0500
@@ -153,7 +153,7 @@
   $ hg addremove -s80
   removing d/a
   adding d/b
-  recording removal of d/a as rename to d/b (100% similar) (glob)
+  recording removal of d/a as rename to d/b (100% similar)
   $ hg debugstate
   r   0          0 1970-01-01 00:00:00 d/a
   a   0         -1 unset               d/b
@@ -163,12 +163,12 @@
 no copies found here (since the target isn't in d
 
   $ hg addremove -s80 d
-  removing d/b (glob)
+  removing d/b
 
 copies here
 
   $ hg addremove -s80
   adding c
-  recording removal of d/a as rename to c (100% similar) (glob)
+  recording removal of d/a as rename to c (100% similar)
 
   $ cd ..
--- a/tests/test-addremove.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-addremove.t	Tue Dec 19 16:27:24 2017 -0500
@@ -31,8 +31,7 @@
   $ hg forget foo
 
   $ hg -v addremove nonexistent
-  nonexistent: The system cannot find the file specified (windows !)
-  nonexistent: No such file or directory (no-windows !)
+  nonexistent: $ENOENT$
   [1]
 
   $ cd ..
@@ -86,8 +85,7 @@
   $ rm c
 
   $ hg ci -A -m "c" nonexistent
-  nonexistent: The system cannot find the file specified (windows !)
-  nonexistent: No such file or directory (no-windows !)
+  nonexistent: $ENOENT$
   abort: failed to mark all new/missing files as added/removed
   [255]
 
--- a/tests/test-alias.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-alias.t	Tue Dec 19 16:27:24 2017 -0500
@@ -119,6 +119,12 @@
   $ hg help noclosing
   error in definition for alias 'noclosingquotation': No closing quotation
 
+"--" in alias definition should be preserved
+
+  $ hg --config alias.dash='cat --' -R alias dash -r0
+  abort: -r0 not under root '$TESTTMP/alias'
+  (consider using '--cwd alias')
+  [255]
 
 invalid options
 
@@ -148,6 +154,12 @@
   $ hg no--config
   abort: error in definition for alias 'no--config': --config may only be given on the command line
   [255]
+  $ hg no --config alias.no='--repo elsewhere --cwd elsewhere status'
+  abort: error in definition for alias 'no': --repo/--cwd may only be given on the command line
+  [255]
+  $ hg no --config alias.no='--repo elsewhere'
+  abort: error in definition for alias 'no': --repo may only be given on the command line
+  [255]
 
 optional repository
 
@@ -351,6 +363,10 @@
   $ hg echoall --cwd ..
   
 
+"--" passed to shell alias should be preserved
+
+  $ hg --config alias.printf='!printf "$@"' printf '%s %s %s\n' -- --cwd ..
+  -- --cwd ..
 
 repo specific shell aliases
 
--- a/tests/test-amend-subrepo.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-amend-subrepo.t	Tue Dec 19 16:27:24 2017 -0500
@@ -58,7 +58,7 @@
 
   $ echo a >> s/a
   $ hg add -R s
-  adding s/a (glob)
+  adding s/a
   $ hg amend
   abort: uncommitted changes in subrepository "s"
   (use --subrepos for recursive commit)
--- a/tests/test-amend.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-amend.t	Tue Dec 19 16:27:24 2017 -0500
@@ -29,7 +29,7 @@
   $ echo 2 >> B
 
   $ hg amend
-  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (glob) (obsstore-off !)
+  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (obsstore-off !)
 #if obsstore-off
   $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n'
   @  1 be169c7e8dbe B
@@ -99,13 +99,13 @@
   $ echo 4 > D
   $ hg add C D
   $ hg amend -m NEWMESSAGE -I C
-  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (glob) (obsstore-off !)
+  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (obsstore-off !)
   $ hg log -r . -T '{node|short} {desc} {files}\n'
   c7ba14d9075b NEWMESSAGE B C
   $ echo 5 > E
   $ rm C
   $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D
-  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (glob) (obsstore-off !)
+  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (obsstore-off !)
   $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n'
   14f6c4bcc865 NEWMESSAGE B D Foo <foo@example.com> 2000.01000
 
@@ -119,11 +119,11 @@
   $ chmod +x $TESTTMP/prefix.sh
 
   $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit
-  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (glob) (obsstore-off !)
+  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (obsstore-off !)
   $ hg log -r . -T '{node|short} {desc}\n'
   298f085230c3 EDITED: NEWMESSAGE
   $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG
-  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (glob) (obsstore-off !)
+  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (obsstore-off !)
   $ hg log -r . -T '{node|short} {desc}\n'
   974f07f28537 EDITED: MSG
 
@@ -132,7 +132,7 @@
   abort: options --message and --logfile are mutually exclusive
   [255]
   $ hg amend -l $TESTTMP/msg
-  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (glob) (obsstore-off !)
+  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (obsstore-off !)
   $ hg log -r . -T '{node|short} {desc}\n'
   507be9bdac71 FOO
 
@@ -152,7 +152,7 @@
   new file mode 100644
   examine changes to 'G'? [Ynesfdaq?] n
   
-  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (glob) (obsstore-off !)
+  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (obsstore-off !)
   $ hg log -r . -T '{files}\n'
   B D F
 
@@ -203,8 +203,8 @@
   [255]
   $ hg amend --note "adding bar"
   $ hg debugobsolete -r .
-  112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'note': 'adding bar', 'operation': 'amend', 'user': 'test'}
+  112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
+  be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'note': 'adding bar', 'operation': 'amend', 'user': 'test'}
 #endif
 
 Cannot amend public changeset
@@ -213,6 +213,7 @@
   $ hg update -C -q A
   $ hg amend -m AMEND
   abort: cannot amend public changesets
+  (see 'hg help phases' for details)
   [255]
 
 Amend a merge changeset
@@ -226,7 +227,7 @@
   > EOS
   $ hg update -q C
   $ hg amend -m FOO
-  saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (glob) (obsstore-off !)
+  saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (obsstore-off !)
   $ rm .hg/localtags
   $ hg log -G -T '{desc}\n'
   @    FOO
--- a/tests/test-annotate.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-annotate.t	Tue Dec 19 16:27:24 2017 -0500
@@ -556,8 +556,8 @@
   $ rm baz
 
   $ hg annotate -ncr "wdir()" baz
-  abort: $TESTTMP\repo\baz: The system cannot find the file specified (windows !)
-  abort: No such file or directory: $TESTTMP/repo/baz (no-windows !)
+  abort: $TESTTMP\repo\baz: $ENOENT$ (windows !)
+  abort: $ENOENT$: $TESTTMP/repo/baz (no-windows !)
   [255]
 
 annotate removed file
@@ -565,8 +565,8 @@
   $ hg rm baz
 
   $ hg annotate -ncr "wdir()" baz
-  abort: $TESTTMP\repo\baz: The system cannot find the file specified (windows !)
-  abort: No such file or directory: $TESTTMP/repo/baz (no-windows !)
+  abort: $TESTTMP\repo\baz: $ENOENT$ (windows !)
+  abort: $ENOENT$: $TESTTMP/repo/baz (no-windows !)
   [255]
 
   $ hg revert --all --no-backup --quiet
--- a/tests/test-archive.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-archive.t	Tue Dec 19 16:27:24 2017 -0500
@@ -32,7 +32,7 @@
   sharing subrepo subrepo from $TESTTMP/test/subrepo
   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat shared1/subrepo/.hg/sharedpath
-  $TESTTMP/test/subrepo/.hg (no-eol) (glob)
+  $TESTTMP/test/subrepo/.hg (no-eol)
 
 hg subrepos are shared into existence on demand if the parent was shared
 
@@ -45,7 +45,7 @@
   sharing subrepo subrepo from $TESTTMP/test/subrepo
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat share2/subrepo/.hg/sharedpath
-  $TESTTMP/test/subrepo/.hg (no-eol) (glob)
+  $TESTTMP/test/subrepo/.hg (no-eol)
   $ echo 'mod' > share2/subrepo/sub
   $ hg -R share2 ci -Sqm 'subrepo mod'
   $ hg -R clone1 update -C tip
@@ -79,7 +79,7 @@
   $ hg -R shared3 archive --config ui.archivemeta=False -r tip -S archive
   sharing subrepo subrepo from $TESTTMP/test/subrepo
   $ cat shared3/subrepo/.hg/sharedpath
-  $TESTTMP/test/subrepo/.hg (no-eol) (glob)
+  $TESTTMP/test/subrepo/.hg (no-eol)
   $ diff -r archive test
   Only in test: .hg
   Common subdirectories: archive/baz and test/baz (?)
--- a/tests/test-audit-path.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-audit-path.t	Tue Dec 19 16:27:24 2017 -0500
@@ -3,7 +3,7 @@
 audit of .hg
 
   $ hg add .hg/00changelog.i
-  abort: path contains illegal component: .hg/00changelog.i (glob)
+  abort: path contains illegal component: .hg/00changelog.i
   [255]
 
 #if symlink
@@ -17,14 +17,14 @@
   $ ln -s a b
   $ echo b > a/b
   $ hg add b/b
-  abort: path 'b/b' traverses symbolic link 'b' (glob)
+  abort: path 'b/b' traverses symbolic link 'b'
   [255]
   $ hg add b
 
 should still fail - maybe
 
   $ hg add b/b
-  abort: path 'b/b' traverses symbolic link 'b' (glob)
+  abort: path 'b/b' traverses symbolic link 'b'
   [255]
 
   $ hg commit -m 'add symlink b'
@@ -86,7 +86,7 @@
   $ hg manifest -r0
   .hg/test
   $ hg update -Cr0
-  abort: path contains illegal component: .hg/test (glob)
+  abort: path contains illegal component: .hg/test
   [255]
 
 attack foo/.hg/test
@@ -94,7 +94,7 @@
   $ hg manifest -r1
   foo/.hg/test
   $ hg update -Cr1
-  abort: path 'foo/.hg/test' is inside nested repo 'foo' (glob)
+  abort: path 'foo/.hg/test' is inside nested repo 'foo'
   [255]
 
 attack back/test where back symlinks to ..
@@ -121,7 +121,7 @@
   $ mkdir ../test
   $ echo data > ../test/file
   $ hg update -Cr3
-  abort: path contains illegal component: ../test (glob)
+  abort: path contains illegal component: ../test
   [255]
   $ cat ../test/file
   data
@@ -131,7 +131,7 @@
   $ hg manifest -r4
   /tmp/test
   $ hg update -Cr4
-  abort: path contains illegal component: /tmp/test (glob)
+  abort: path contains illegal component: /tmp/test
   [255]
 
   $ cd ..
--- a/tests/test-audit-subrepo.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-audit-subrepo.t	Tue Dec 19 16:27:24 2017 -0500
@@ -9,7 +9,7 @@
   $ hg init sub/.hg
   $ echo 'sub/.hg = sub/.hg' >> .hgsub
   $ hg ci -qAm 'add subrepo "sub/.hg"'
-  abort: path 'sub/.hg' is inside nested repo 'sub' (glob)
+  abort: path 'sub/.hg' is inside nested repo 'sub'
   [255]
 
 prepare tampered repo (including the commit above):
@@ -33,7 +33,7 @@
 on clone (and update):
 
   $ hg clone -q hgname hgname2
-  abort: path 'sub/.hg' is inside nested repo 'sub' (glob)
+  abort: path 'sub/.hg' is inside nested repo 'sub'
   [255]
 
 Test direct symlink traversal
--- a/tests/test-basic.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-basic.t	Tue Dec 19 16:27:24 2017 -0500
@@ -4,7 +4,8 @@
   devel.all-warnings=true
   devel.default-date=0 0
   extensions.fsmonitor= (fsmonitor !)
-  largefiles.usercache=$TESTTMP/.cache/largefiles (glob)
+  largefiles.usercache=$TESTTMP/.cache/largefiles
+  lfs.usercache=$TESTTMP/.cache/lfs
   ui.slash=True
   ui.interactive=False
   ui.mergemarkers=detailed
--- a/tests/test-blackbox.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-blackbox.t	Tue Dec 19 16:27:24 2017 -0500
@@ -60,7 +60,7 @@
   adding c
   $ cd ../blackboxtest2
   $ hg pull
-  pulling from $TESTTMP/blackboxtest (glob)
+  pulling from $TESTTMP/blackboxtest
   searching for changes
   adding changesets
   adding manifests
@@ -85,7 +85,7 @@
   $ mkdir .hg/blackbox.log
   $ hg --debug incoming
   warning: cannot write to blackbox.log: * (glob)
-  comparing with $TESTTMP/blackboxtest (glob)
+  comparing with $TESTTMP/blackboxtest
   query 1; heads
   searching for changes
   all local heads known remotely
@@ -104,7 +104,7 @@
   
   
   $ hg pull
-  pulling from $TESTTMP/blackboxtest (glob)
+  pulling from $TESTTMP/blackboxtest
   searching for changes
   adding changesets
   adding manifests
@@ -133,7 +133,7 @@
   saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
   $ hg blackbox -l 6
   1970/01/01 00:00:00 bob @73f6ee326b27d820b0472f1a825e3a50f3dc489b (5000)> strip tip
-  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg (glob)
+  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg
   1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated base branch cache in * seconds (glob)
   1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote base branch cache with 1 labels and 2 nodes
   1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> strip tip exited 0 after * seconds (glob)
--- a/tests/test-bookmarks-pushpull.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-bookmarks-pushpull.t	Tue Dec 19 16:27:24 2017 -0500
@@ -1,3 +1,12 @@
+#testcases b2-pushkey b2-binary
+
+#if b2-pushkey
+  $ cat << EOF >> $HGRCPATH
+  > [devel]
+  > legacy.exchange=bookmarks
+  > EOF
+#endif
+
 #require serve
 
   $ cat << EOF >> $HGRCPATH
@@ -103,14 +112,222 @@
 delete a remote bookmark
 
   $ hg book -d W
-  $ hg push -B W ../a --config "$TESTHOOK"
+
+#if b2-pushkey
+
+  $ hg push -B W ../a --config "$TESTHOOK" --debug --config devel.bundle2.debug=yes
   pushing to ../a
+  query 1; heads
   searching for changes
+  all remote heads known locally
+  listing keys for "phases"
+  checking for updated bookmarks
+  listing keys for "bookmarks"
   no changes found
+  bundle2-output-bundle: "HG20", 4 parts total
+  bundle2-output: start emission of HG20 stream
+  bundle2-output: bundle parameter: 
+  bundle2-output: start of parts
+  bundle2-output: bundle part: "replycaps"
+  bundle2-output-part: "replycaps" 195 bytes payload
+  bundle2-output: part 0: "REPLYCAPS"
+  bundle2-output: header chunk size: 16
+  bundle2-output: payload chunk size: 195
+  bundle2-output: closing payload chunk
+  bundle2-output: bundle part: "check:bookmarks"
+  bundle2-output-part: "check:bookmarks" 23 bytes payload
+  bundle2-output: part 1: "CHECK:BOOKMARKS"
+  bundle2-output: header chunk size: 22
+  bundle2-output: payload chunk size: 23
+  bundle2-output: closing payload chunk
+  bundle2-output: bundle part: "check:phases"
+  bundle2-output-part: "check:phases" 48 bytes payload
+  bundle2-output: part 2: "CHECK:PHASES"
+  bundle2-output: header chunk size: 19
+  bundle2-output: payload chunk size: 48
+  bundle2-output: closing payload chunk
+  bundle2-output: bundle part: "pushkey"
+  bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload
+  bundle2-output: part 3: "PUSHKEY"
+  bundle2-output: header chunk size: 90
+  bundle2-output: closing payload chunk
+  bundle2-output: end of bundle
+  bundle2-input: start processing of HG20 stream
+  bundle2-input: reading bundle2 stream parameters
+  bundle2-input-bundle: with-transaction
+  bundle2-input: start extraction of bundle2 parts
+  bundle2-input: part header size: 16
+  bundle2-input: part type: "REPLYCAPS"
+  bundle2-input: part id: "0"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part replycaps
+  bundle2-input-part: "replycaps" supported
+  bundle2-input: payload chunk size: 195
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 195
+  bundle2-input: part header size: 22
+  bundle2-input: part type: "CHECK:BOOKMARKS"
+  bundle2-input: part id: "1"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part check:bookmarks
+  bundle2-input-part: "check:bookmarks" supported
+  bundle2-input: payload chunk size: 23
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 23
+  bundle2-input: part header size: 19
+  bundle2-input: part type: "CHECK:PHASES"
+  bundle2-input: part id: "2"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part check:phases
+  bundle2-input-part: "check:phases" supported
+  bundle2-input: payload chunk size: 48
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 48
+  bundle2-input: part header size: 90
+  bundle2-input: part type: "PUSHKEY"
+  bundle2-input: part id: "3"
+  bundle2-input: part parameters: 4
+  bundle2-input: found a handler for part pushkey
+  bundle2-input-part: "pushkey" (params: 4 mandatory) supported
+  pushing key for "bookmarks:W"
+  bundle2-input: payload chunk size: 0
+  bundle2-input: part header size: 0
+  bundle2-input: end of bundle2 stream
+  bundle2-input-bundle: 3 parts total
+  running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
   test-hook-bookmark: W:  0000000000000000000000000000000000000000 -> 
+  bundle2-output-bundle: "HG20", 1 parts total
+  bundle2-output: start emission of HG20 stream
+  bundle2-output: bundle parameter: 
+  bundle2-output: start of parts
+  bundle2-output: bundle part: "reply:pushkey"
+  bundle2-output-part: "reply:pushkey" (params: 0 advisory) empty payload
+  bundle2-output: part 0: "REPLY:PUSHKEY"
+  bundle2-output: header chunk size: 43
+  bundle2-output: closing payload chunk
+  bundle2-output: end of bundle
+  bundle2-input: start processing of HG20 stream
+  bundle2-input: reading bundle2 stream parameters
+  bundle2-input-bundle: no-transaction
+  bundle2-input: start extraction of bundle2 parts
+  bundle2-input: part header size: 43
+  bundle2-input: part type: "REPLY:PUSHKEY"
+  bundle2-input: part id: "0"
+  bundle2-input: part parameters: 2
+  bundle2-input: found a handler for part reply:pushkey
+  bundle2-input-part: "reply:pushkey" (params: 0 advisory) supported
+  bundle2-input: payload chunk size: 0
+  bundle2-input: part header size: 0
+  bundle2-input: end of bundle2 stream
+  bundle2-input-bundle: 0 parts total
   deleting remote bookmark W
+  listing keys for "phases"
   [1]
 
+#endif
+#if b2-binary
+
+  $ hg push -B W ../a --config "$TESTHOOK" --debug --config devel.bundle2.debug=yes
+  pushing to ../a
+  query 1; heads
+  searching for changes
+  all remote heads known locally
+  listing keys for "phases"
+  checking for updated bookmarks
+  listing keys for "bookmarks"
+  no changes found
+  bundle2-output-bundle: "HG20", 4 parts total
+  bundle2-output: start emission of HG20 stream
+  bundle2-output: bundle parameter: 
+  bundle2-output: start of parts
+  bundle2-output: bundle part: "replycaps"
+  bundle2-output-part: "replycaps" 195 bytes payload
+  bundle2-output: part 0: "REPLYCAPS"
+  bundle2-output: header chunk size: 16
+  bundle2-output: payload chunk size: 195
+  bundle2-output: closing payload chunk
+  bundle2-output: bundle part: "check:bookmarks"
+  bundle2-output-part: "check:bookmarks" 23 bytes payload
+  bundle2-output: part 1: "CHECK:BOOKMARKS"
+  bundle2-output: header chunk size: 22
+  bundle2-output: payload chunk size: 23
+  bundle2-output: closing payload chunk
+  bundle2-output: bundle part: "check:phases"
+  bundle2-output-part: "check:phases" 48 bytes payload
+  bundle2-output: part 2: "CHECK:PHASES"
+  bundle2-output: header chunk size: 19
+  bundle2-output: payload chunk size: 48
+  bundle2-output: closing payload chunk
+  bundle2-output: bundle part: "bookmarks"
+  bundle2-output-part: "bookmarks" 23 bytes payload
+  bundle2-output: part 3: "BOOKMARKS"
+  bundle2-output: header chunk size: 16
+  bundle2-output: payload chunk size: 23
+  bundle2-output: closing payload chunk
+  bundle2-output: end of bundle
+  bundle2-input: start processing of HG20 stream
+  bundle2-input: reading bundle2 stream parameters
+  bundle2-input-bundle: with-transaction
+  bundle2-input: start extraction of bundle2 parts
+  bundle2-input: part header size: 16
+  bundle2-input: part type: "REPLYCAPS"
+  bundle2-input: part id: "0"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part replycaps
+  bundle2-input-part: "replycaps" supported
+  bundle2-input: payload chunk size: 195
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 195
+  bundle2-input: part header size: 22
+  bundle2-input: part type: "CHECK:BOOKMARKS"
+  bundle2-input: part id: "1"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part check:bookmarks
+  bundle2-input-part: "check:bookmarks" supported
+  bundle2-input: payload chunk size: 23
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 23
+  bundle2-input: part header size: 19
+  bundle2-input: part type: "CHECK:PHASES"
+  bundle2-input: part id: "2"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part check:phases
+  bundle2-input-part: "check:phases" supported
+  bundle2-input: payload chunk size: 48
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 48
+  bundle2-input: part header size: 16
+  bundle2-input: part type: "BOOKMARKS"
+  bundle2-input: part id: "3"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part bookmarks
+  bundle2-input-part: "bookmarks" supported
+  bundle2-input: payload chunk size: 23
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 23
+  bundle2-input: part header size: 0
+  bundle2-input: end of bundle2 stream
+  bundle2-input-bundle: 3 parts total
+  running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
+  test-hook-bookmark: W:  0000000000000000000000000000000000000000 -> 
+  bundle2-output-bundle: "HG20", 0 parts total
+  bundle2-output: start emission of HG20 stream
+  bundle2-output: bundle parameter: 
+  bundle2-output: start of parts
+  bundle2-output: end of bundle
+  bundle2-input: start processing of HG20 stream
+  bundle2-input: reading bundle2 stream parameters
+  bundle2-input-bundle: no-transaction
+  bundle2-input: start extraction of bundle2 parts
+  bundle2-input: part header size: 0
+  bundle2-input: end of bundle2 stream
+  bundle2-input-bundle: 0 parts total
+  deleting remote bookmark W
+  listing keys for "phases"
+  [1]
+
+#endif
+
 export the active bookmark
 
   $ hg bookmark V
@@ -192,7 +409,7 @@
    * foobar                    1:9b140be10808
 
   $ hg pull --config paths.foo=../a foo --config "$TESTHOOK"
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
@@ -268,7 +485,7 @@
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark X)
   $ hg pull --config paths.foo=../a foo -B . --config "$TESTHOOK"
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   no changes found
   divergent bookmark @ stored as @foo
   importing bookmark X
@@ -623,12 +840,12 @@
 be exchanged)
 
   $ hg -R repo1 incoming -B
-  comparing with $TESTTMP/bmcomparison/source (glob)
+  comparing with $TESTTMP/bmcomparison/source
   searching for changed bookmarks
   no changed bookmarks found
   [1]
   $ hg -R repo1 outgoing -B
-  comparing with $TESTTMP/bmcomparison/source (glob)
+  comparing with $TESTTMP/bmcomparison/source
   searching for changed bookmarks
   no changed bookmarks found
   [1]
@@ -772,7 +989,7 @@
   $ echo 2 > f2
   $ hg ci -qAmr
   $ hg push -B X
-  pushing to $TESTTMP/addmarks (glob)
+  pushing to $TESTTMP/addmarks
   searching for changes
   remote has heads on branch 'default' that are not known locally: a2a606d9ff1b
   abort: push creates new remote head 54694f811df9 with bookmark 'X'!
@@ -852,19 +1069,36 @@
 Local push
 ----------
 
+#if b2-pushkey
+
   $ hg push -B @ local
-  pushing to $TESTTMP/issue4455-dest (glob)
+  pushing to $TESTTMP/issue4455-dest
   searching for changes
   no changes found
   pushkey-abort: prepushkey hook exited with status 1
   abort: exporting bookmark @ failed!
   [255]
+
+#endif
+#if b2-binary
+
+  $ hg push -B @ local
+  pushing to $TESTTMP/issue4455-dest
+  searching for changes
+  no changes found
+  abort: prepushkey hook exited with status 1
+  [255]
+
+#endif
+
   $ hg -R ../issue4455-dest/ bookmarks
   no bookmarks set
 
 Using ssh
 ---------
 
+#if b2-pushkey
+
   $ hg push -B @ ssh # bundle2+
   pushing to ssh://user@dummy/issue4455-dest
   searching for changes
@@ -872,6 +1106,7 @@
   remote: pushkey-abort: prepushkey hook exited with status 1
   abort: exporting bookmark @ failed!
   [255]
+
   $ hg -R ../issue4455-dest/ bookmarks
   no bookmarks set
 
@@ -882,12 +1117,27 @@
   remote: pushkey-abort: prepushkey hook exited with status 1
   exporting bookmark @ failed!
   [1]
+
+#endif
+#if b2-binary
+
+  $ hg push -B @ ssh # bundle2+
+  pushing to ssh://user@dummy/issue4455-dest
+  searching for changes
+  no changes found
+  remote: prepushkey hook exited with status 1
+  abort: push failed on remote
+  [255]
+
+#endif
+
   $ hg -R ../issue4455-dest/ bookmarks
   no bookmarks set
 
 Using http
 ----------
 
+#if b2-pushkey
   $ hg push -B @ http # bundle2+
   pushing to http://localhost:$HGPORT/
   searching for changes
@@ -895,6 +1145,7 @@
   remote: pushkey-abort: prepushkey hook exited with status 1
   abort: exporting bookmark @ failed!
   [255]
+
   $ hg -R ../issue4455-dest/ bookmarks
   no bookmarks set
 
@@ -905,5 +1156,20 @@
   remote: pushkey-abort: prepushkey hook exited with status 1
   exporting bookmark @ failed!
   [1]
+
+#endif
+
+#if b2-binary
+
+  $ hg push -B @ ssh # bundle2+
+  pushing to ssh://user@dummy/issue4455-dest
+  searching for changes
+  no changes found
+  remote: prepushkey hook exited with status 1
+  abort: push failed on remote
+  [255]
+
+#endif
+
   $ hg -R ../issue4455-dest/ bookmarks
   no bookmarks set
--- a/tests/test-bookmarks-rebase.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-bookmarks-rebase.t	Tue Dec 19 16:27:24 2017 -0500
@@ -38,7 +38,7 @@
 
   $ hg rebase -s two -d one
   rebasing 3:2ae46b1d99a7 "3" (two tip)
-  saved backup bundle to $TESTTMP/.hg/strip-backup/2ae46b1d99a7-e6b057bc-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/2ae46b1d99a7-e6b057bc-rebase.hg
 
   $ hg log
   changeset:   3:42e5ed2cdcf4
--- a/tests/test-bookmarks.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-bookmarks.t	Tue Dec 19 16:27:24 2017 -0500
@@ -736,7 +736,7 @@
      Z                         2:db815d6d32e6
      x  y                      2:db815d6d32e6
   $ hg -R ../cloned-bookmarks-manual-update-with-divergence pull
-  pulling from $TESTTMP/repo (glob)
+  pulling from $TESTTMP/repo
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-bugzilla.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-bugzilla.t	Tue Dec 19 16:27:24 2017 -0500
@@ -61,7 +61,7 @@
   $ cat bzmock.log && rm bzmock.log
   update bugid=123, newstate={}, committer='test'
   ----
-  changeset 7875a8342c6f in repo $TESTTMP/mockremote refers to bug 123. (glob)
+  changeset 7875a8342c6f in repo $TESTTMP/mockremote refers to bug 123.
   details:
   	Fixes bug 123
   ----
--- a/tests/test-bundle.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-bundle.t	Tue Dec 19 16:27:24 2017 -0500
@@ -856,7 +856,7 @@
   $ hg bundle --base 1 -r 3 ../update2bundled.hg
   1 changesets found
   $ hg strip -r 3
-  saved backup bundle to $TESTTMP/update2bundled/.hg/strip-backup/8bd3e1f196af-017e56d8-backup.hg (glob)
+  saved backup bundle to $TESTTMP/update2bundled/.hg/strip-backup/8bd3e1f196af-017e56d8-backup.hg
   $ hg merge -R ../update2bundled.hg -r 3
   setting parent to node 8bd3e1f196af289b2b121be08031e76d7ae92098 that only exists in the bundle
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-bundle2-exchange.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-bundle2-exchange.t	Tue Dec 19 16:27:24 2017 -0500
@@ -106,7 +106,7 @@
   postclose-tip:02de42196ebe draft 
   txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
   $ hg -R other pull -r 24b6387c8c8c
-  pulling from $TESTTMP/main (glob)
+  pulling from $TESTTMP/main
   searching for changes
   adding changesets
   adding manifests
@@ -137,7 +137,7 @@
   postclose-tip:02de42196ebe draft 
   txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
   $ hg -R other pull -r 24b6387c8c8c
-  pulling from $TESTTMP/main (glob)
+  pulling from $TESTTMP/main
   no changes found
   pre-close-tip:24b6387c8c8c public 
   postclose-tip:24b6387c8c8c public 
@@ -157,7 +157,7 @@
 pull empty
 
   $ hg -R other pull -r 24b6387c8c8c
-  pulling from $TESTTMP/main (glob)
+  pulling from $TESTTMP/main
   no changes found
   pre-close-tip:24b6387c8c8c public 
   postclose-tip:24b6387c8c8c public 
@@ -253,9 +253,6 @@
   remote: added 1 changesets with 0 changes to 0 files (-1 heads)
   remote: 1 new obsolescence markers
   remote: pre-close-tip:eea13746799a public book_eea1
-  remote: pushkey: lock state after "bookmarks"
-  remote: lock:  free
-  remote: wlock: free
   remote: postclose-tip:eea13746799a public book_eea1
   remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_NODE_LAST=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/other
   updating bookmark book_eea1
@@ -339,9 +336,6 @@
   remote: added 1 changesets with 1 changes to 1 files
   remote: 1 new obsolescence markers
   remote: pre-close-tip:5fddd98957c8 draft book_5fdd
-  remote: pushkey: lock state after "bookmarks"
-  remote: lock:  free
-  remote: wlock: free
   remote: postclose-tip:5fddd98957c8 draft book_5fdd
   remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_NODE_LAST=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_TXNNAME=serve HG_URL=remote:ssh:$LOCALIP
   updating bookmark book_5fdd
@@ -390,9 +384,6 @@
   remote: added 1 changesets with 1 changes to 1 files
   remote: 1 new obsolescence markers
   remote: pre-close-tip:32af7686d403 public book_32af
-  remote: pushkey: lock state after "bookmarks"
-  remote: lock:  free
-  remote: wlock: free
   remote: postclose-tip:32af7686d403 public book_32af
   remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=32af7686d403cf45b5d95f2d70cebea587ac806a HG_NODE_LAST=32af7686d403cf45b5d95f2d70cebea587ac806a HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_TXNNAME=serve HG_URL=remote:http:$LOCALIP: (glob)
   updating bookmark book_32af
--- a/tests/test-bundle2-multiple-changegroups.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-bundle2-multiple-changegroups.t	Tue Dec 19 16:27:24 2017 -0500
@@ -74,7 +74,7 @@
 Pull the new commits in the clone
 
   $ hg pull
-  pulling from $TESTTMP/repo (glob)
+  pulling from $TESTTMP/repo
   searching for changes
   remote: changegroup1
   adding changesets
@@ -145,7 +145,7 @@
 
   $ cd ../clone
   $ hg pull
-  pulling from $TESTTMP/repo (glob)
+  pulling from $TESTTMP/repo
   searching for changes
   remote: changegroup1
   adding changesets
@@ -219,7 +219,7 @@
 
   $ cd ../clone
   $ hg pull
-  pulling from $TESTTMP/repo (glob)
+  pulling from $TESTTMP/repo
   searching for changes
   remote: changegroup1
   adding changesets
--- a/tests/test-casefolding.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-casefolding.t	Tue Dec 19 16:27:24 2017 -0500
@@ -178,8 +178,8 @@
   $ echo 'foo' > a/B/c/D/E
   $ hg ci -m 'e content change'
   $ hg revert --all -r 0
-  removing a/B/c/D/E (glob)
-  adding a/B/c/D/e (glob)
+  removing a/B/c/D/E
+  adding a/B/c/D/e
   $ find * | sort
   a
   a/B
--- a/tests/test-cat.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-cat.t	Tue Dec 19 16:27:24 2017 -0500
@@ -66,9 +66,9 @@
 Test template output
 
   $ hg --cwd tmp cat ../b ../c -T '== {path} ({abspath}) ==\n{data}'
-  == ../b (b) == (glob)
+  == ../b (b) ==
   1
-  == ../c (c) == (glob)
+  == ../c (c) ==
   3
 
   $ hg cat b c -Tjson --output -
@@ -119,3 +119,13 @@
   $ PATTERN='t4' hg log -r '.' -T "{envvars % '{key} -> {value}\n'}" \
   >                 --config "experimental.exportableenviron=PATTERN"
   PATTERN -> t4
+
+Test behavior of output when directory structure does not already exist
+
+  $ mkdir foo
+  $ echo a > foo/a
+  $ hg add foo/a
+  $ hg commit -qm "add foo/a"
+  $ hg cat --output "output/%p" foo/a
+  $ cat output/foo/a
+  a
--- a/tests/test-censor.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-censor.t	Tue Dec 19 16:27:24 2017 -0500
@@ -353,7 +353,7 @@
   checking files
   2 files, 1 changesets, 2 total revisions
   $ hg pull -r $H1 -r $H2
-  pulling from $TESTTMP/r (glob)
+  pulling from $TESTTMP/r
   searching for changes
   adding changesets
   adding manifests
@@ -398,7 +398,7 @@
   $ hg cat -r $CLEANREV target
   Re-sanitized; nothing to see here
   $ hg push -f -r $H2
-  pushing to $TESTTMP/r (glob)
+  pushing to $TESTTMP/r
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-check-code.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-check-code.t	Tue Dec 19 16:27:24 2017 -0500
@@ -15,7 +15,6 @@
   Skipping i18n/polib.py it has no-che?k-code (glob)
   Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
   Skipping mercurial/httpclient/_readers.py it has no-che?k-code (glob)
-  Skipping mercurial/selectors2.py it has no-che?k-code (glob)
   Skipping mercurial/statprof.py it has no-che?k-code (glob)
   Skipping tests/badserverext.py it has no-che?k-code (glob)
 
@@ -44,6 +43,7 @@
   .hgignore
   .hgsigs
   .hgtags
+  .jshintrc
   CONTRIBUTING
   CONTRIBUTORS
   COPYING
--- a/tests/test-check-config.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-check-config.t	Tue Dec 19 16:27:24 2017 -0500
@@ -33,7 +33,7 @@
   $ $PYTHON contrib/check-config.py < $TESTTMP/files
   foo = ui.configint('ui', 'intdefault', default=42)
   conflict on ui.intdefault: ('int', '42') != ('int', '1')
-  at $TESTTMP/testfile.py:12: (glob)
+  at $TESTTMP/testfile.py:12:
   undocumented: ui.doesnotexist (str)
   undocumented: ui.intdefault (int) [42]
   undocumented: ui.intdefault2 (int) [42]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-check-jshint.t	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,12 @@
+#require test-repo jshint hg10
+
+  $ . "$TESTDIR/helpers-testrepo.sh"
+
+run jshint on all tracked files ending in .js except vendored dependencies
+
+  $ cd "`dirname "$TESTDIR"`"
+
+  $ testrepohg locate 'set:**.js' \
+  > -X mercurial/templates/static/excanvas.js \
+  > 2>/dev/null \
+  > | xargs jshint
--- a/tests/test-clone.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-clone.t	Tue Dec 19 16:27:24 2017 -0500
@@ -138,7 +138,7 @@
 
   $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
   $ hg -R f showconfig paths.default
-  $TESTTMP/a#0 (glob)
+  $TESTTMP/a#0
 
 Use --pull:
 
@@ -808,7 +808,7 @@
 The destination should point to it
 
   $ cat share-dest1a/.hg/sharedpath; echo
-  $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg (glob)
+  $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
 
 The destination should have bookmarks
 
@@ -818,7 +818,7 @@
 The default path should be the remote, not the share
 
   $ hg -R share-dest1a config paths.default
-  $TESTTMP/source1a (glob)
+  $TESTTMP/source1a
 
 Clone with existing share dir should result in pull + share
 
@@ -839,7 +839,7 @@
   b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
 
   $ cat share-dest1b/.hg/sharedpath; echo
-  $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg (glob)
+  $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
 
 We only get bookmarks from the remote, not everything in the share
 
@@ -850,7 +850,7 @@
 Default path should be source, not share.
 
   $ hg -R share-dest1b config paths.default
-  $TESTTMP/source1b (glob)
+  $TESTTMP/source1b
 
 Checked out revision should be head of default branch
 
--- a/tests/test-clonebundles.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-clonebundles.t	Tue Dec 19 16:27:24 2017 -0500
@@ -32,8 +32,8 @@
 
   $ cat server/access.log
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
 
 Empty manifest file results in retrieval
 (the extension only checks if the manifest file exists)
--- a/tests/test-command-template.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-command-template.t	Tue Dec 19 16:27:24 2017 -0500
@@ -2876,6 +2876,17 @@
   @@ -0,0 +1,1 @@
   +second
 
+ui verbosity:
+
+  $ hg log -l1 -T '{verbosity}\n'
+  
+  $ hg log -l1 -T '{verbosity}\n' --debug
+  debug
+  $ hg log -l1 -T '{verbosity}\n' --quiet
+  quiet
+  $ hg log -l1 -T '{verbosity}\n' --verbose
+  verbose
+
   $ cd ..
 
 
--- a/tests/test-commandserver.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-commandserver.t	Tue Dec 19 16:27:24 2017 -0500
@@ -207,6 +207,7 @@
   devel.default-date=0 0
   extensions.fsmonitor= (fsmonitor !)
   largefiles.usercache=$TESTTMP/.cache/largefiles
+  lfs.usercache=$TESTTMP/.cache/lfs
   ui.slash=True
   ui.interactive=False
   ui.mergemarkers=detailed
--- a/tests/test-commit-amend.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-commit-amend.t	Tue Dec 19 16:27:24 2017 -0500
@@ -16,6 +16,7 @@
   $ hg phase -r . -p
   $ hg ci --amend
   abort: cannot amend public changesets
+  (see 'hg help phases' for details)
   [255]
   $ hg phase -r . -f -d
 
@@ -40,7 +41,7 @@
   $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
   pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
   43f1ba15f28a tip
-  saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
   $ echo 'pretxncommit.foo = ' >> $HGRCPATH
   $ hg diff -c .
   diff -r ad120869acf0 -r 43f1ba15f28a a
@@ -98,7 +99,7 @@
 
 Add new file along with modified existing file:
   $ hg ci --amend -m 'amend base1 new file'
-  saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
 
 Remove file that was added in amended commit:
 (and test logfile option)
@@ -107,7 +108,7 @@
   $ hg rm b
   $ echo 'amend base1 remove new file' > ../logfile
   $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
-  saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
 
   $ hg cat b
   b: no such file in rev 47343646fa3d
@@ -127,7 +128,7 @@
        254 (changelog)
        163 (manifests)
        131  a
-  saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
   1 changesets found
   uncompressed size of bundle content:
        250 (changelog)
@@ -174,10 +175,10 @@
   > EOF
   $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
   HGEDITFORM=commit.amend.normal
-  saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
   $ echo a >> a
   $ hg ci --amend -u foo -d '1 0'
-  saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
   $ hg log -r .
   changeset:   1:a9a13940fc03
   tag:         tip
@@ -271,7 +272,7 @@
        249 (changelog)
        163 (manifests)
        133  a
-  saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
   1 changesets found
   uncompressed size of bundle content:
        257 (changelog)
@@ -307,7 +308,7 @@
        257 (changelog)
        163 (manifests)
        133  a
-  saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
   1 changesets found
   uncompressed size of bundle content:
        257 (changelog)
@@ -334,13 +335,13 @@
   $ hg book book1
   $ hg book book2
   $ hg ci --amend -m 'move bookmarks'
-  saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
   $ hg book
      book1                     1:8311f17e2616
    * book2                     1:8311f17e2616
   $ echo a >> a
   $ hg ci --amend -m 'move bookmarks'
-  saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
   $ hg book
      book1                     1:a3b65065808c
    * book2                     1:a3b65065808c
@@ -374,7 +375,7 @@
   $ hg branch default -f
   marked working directory as branch default
   $ hg ci --amend -m 'back to default'
-  saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
   $ hg branches
   default                        2:9c07515f2650
 
@@ -390,7 +391,7 @@
   $ echo b >> b
   $ hg ci -mb
   $ hg ci --amend --close-branch -m 'closing branch foo'
-  saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
 
 Same thing, different code path:
 
@@ -399,7 +400,7 @@
   reopening closed branch head 4
   $ echo b >> b
   $ hg ci --amend --close-branch
-  saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg
   $ hg branches
   default                        2:9c07515f2650
 
@@ -420,7 +421,7 @@
   $ hg ci -m 'b -> c'
   $ hg mv c d
   $ hg ci --amend -m 'b -> d'
-  saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
   $ hg st --rev '.^' --copies d
   A d
     b
@@ -428,7 +429,7 @@
   $ hg ci -m 'e = d'
   $ hg cp e f
   $ hg ci --amend -m 'f = d'
-  saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
   $ hg st --rev '.^' --copies f
   A f
     d
@@ -439,7 +440,7 @@
   $ hg cp a f
   $ mv f.orig f
   $ hg ci --amend -m replacef
-  saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
   $ hg st --change . --copies
   $ hg log -r . --template "{file_copies}\n"
   
@@ -451,7 +452,7 @@
   adding g
   $ hg mv g h
   $ hg ci --amend
-  saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
   $ hg st --change . --copies h
   A h
   $ hg log -r . --template "{file_copies}\n"
@@ -471,11 +472,11 @@
   $ echo a >> a
   $ hg ci -ma
   $ hg ci --amend -m "a'"
-  saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
   $ hg log -r . --template "{branch}\n"
   a
   $ hg ci --amend -m "a''"
-  saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
   $ hg log -r . --template "{branch}\n"
   a
 
@@ -492,7 +493,7 @@
   $ hg graft 12
   grafting 12:2647734878ef "fork" (tip)
   $ hg ci --amend -m 'graft amend'
-  saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
   $ hg log -r . --debug | grep extra
   extra:       amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
   extra:       branch=a
@@ -1111,7 +1112,7 @@
   marked working directory as branch newdirname
   (branches are permanent and global, did you want a bookmark?)
   $ hg mv olddirname newdirname
-  moving olddirname/commonfile.py to newdirname/commonfile.py (glob)
+  moving olddirname/commonfile.py to newdirname/commonfile.py
   $ hg ci -m rename
 
   $ hg update default
@@ -1129,7 +1130,7 @@
   $ hg ci -m add
   $ 
   $ hg debugrename newdirname/newfile.py
-  newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
+  newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
   $ hg status -C --change .
   A newdirname/newfile.py
   $ hg status -C --rev 1
@@ -1148,7 +1149,7 @@
   $ echo a >> newdirname/commonfile.py
   $ hg ci --amend -m bug
   $ hg debugrename newdirname/newfile.py
-  newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
+  newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
   $ hg debugindex newdirname/newfile.py
      rev    offset  length  delta linkrev nodeid       p1           p2
        0         0      89     -1       3 34a4d536c0c0 000000000000 000000000000
--- a/tests/test-commit-interactive-curses.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-commit-interactive-curses.t	Tue Dec 19 16:27:24 2017 -0500
@@ -206,7 +206,7 @@
   > X
   > EOF
   $ hg commit -i  -m "newly added file" -d "0 0"
-  saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-3cf0bc8c-amend.hg (glob)
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-3cf0bc8c-amend.hg
   $ hg diff -c .
   diff -r a6735021574d -r c1d239d165ae x
   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
--- a/tests/test-commit.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-commit.t	Tue Dec 19 16:27:24 2017 -0500
@@ -61,7 +61,7 @@
   $ mkdir dir
   $ echo boo > dir/file
   $ hg add
-  adding dir/file (glob)
+  adding dir/file
   $ hg -v commit -m commit-9 dir
   committing files:
   dir/file
@@ -180,8 +180,8 @@
   $ mkdir bar
   $ echo bar > bar/bar
   $ hg add
-  adding bar/bar (glob)
-  adding foo/foo (glob)
+  adding bar/bar
+  adding foo/foo
   $ HGEDITOR=cat hg ci -e -m commit-subdir-1 foo
   commit-subdir-1
   
@@ -648,7 +648,8 @@
   > u = uimod.ui.load()
   > r = hg.repository(u, '.')
   > def filectxfn(repo, memctx, path):
-  >     return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned')
+  >     return context.memfilectx(repo, memctx, path,
+  >         '[hooks]\nupdate = echo owned')
   > c = context.memctx(r, [r['tip'].node(), node.nullid],
   >                    'evil', [notrc], filectxfn, 0)
   > r.commitctx(c)
@@ -673,14 +674,15 @@
   > u = uimod.ui.load()
   > r = hg.repository(u, '.')
   > def filectxfn(repo, memctx, path):
-  >     return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned')
+  >     return context.memfilectx(repo, memctx, path,
+  >         '[hooks]\nupdate = echo owned')
   > c = context.memctx(r, [r['tip'].node(), node.nullid],
   >                    'evil', [notrc], filectxfn, 0)
   > r.commitctx(c)
   > EOF
   $ $PYTHON evil-commit.py
   $ hg co --clean tip
-  abort: path contains illegal component: HG~1/hgrc (glob)
+  abort: path contains illegal component: HG~1/hgrc
   [255]
 
   $ hg rollback -f
@@ -692,14 +694,15 @@
   > u = uimod.ui.load()
   > r = hg.repository(u, '.')
   > def filectxfn(repo, memctx, path):
-  >     return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned')
+  >     return context.memfilectx(repo, memctx, path,
+  >         '[hooks]\nupdate = echo owned')
   > c = context.memctx(r, [r['tip'].node(), node.nullid],
   >                    'evil', [notrc], filectxfn, 0)
   > r.commitctx(c)
   > EOF
   $ $PYTHON evil-commit.py
   $ hg co --clean tip
-  abort: path contains illegal component: HG8B6C~2/hgrc (glob)
+  abort: path contains illegal component: HG8B6C~2/hgrc
   [255]
 
 # test that an unmodified commit template message aborts
--- a/tests/test-completion.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-completion.t	Tue Dec 19 16:27:24 2017 -0500
@@ -72,6 +72,7 @@
   debugapplystreamclonebundle
   debugbuilddag
   debugbundle
+  debugcapabilities
   debugcheckstate
   debugcolor
   debugcommands
@@ -86,6 +87,7 @@
   debugdiscovery
   debugextensions
   debugfileset
+  debugformat
   debugfsinfo
   debuggetbundle
   debugignore
@@ -249,6 +251,7 @@
   debugapplystreamclonebundle: 
   debugbuilddag: mergeable-file, overwritten-file, new-file
   debugbundle: all, part-type, spec
+  debugcapabilities: 
   debugcheckstate: 
   debugcolor: style
   debugcommands: 
@@ -259,9 +262,10 @@
   debugdate: extended
   debugdeltachain: changelog, manifest, dir, template
   debugdirstate: nodates, datesort
-  debugdiscovery: old, nonheads, ssh, remotecmd, insecure
+  debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
   debugextensions: template
   debugfileset: rev
+  debugformat: template
   debugfsinfo: 
   debuggetbundle: head, common, type
   debugignore: 
@@ -270,7 +274,7 @@
   debuginstall: template
   debugknown: 
   debuglabelcomplete: 
-  debuglocks: force-lock, force-wlock
+  debuglocks: force-lock, force-wlock, set-lock, set-wlock
   debugmergestate: 
   debugnamecomplete: 
   debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
--- a/tests/test-config.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-config.t	Tue Dec 19 16:27:24 2017 -0500
@@ -7,7 +7,7 @@
   > novaluekey
   > EOF
   $ hg showconfig
-  hg: parse error at $TESTTMP/.hg/hgrc:1: novaluekey (glob)
+  hg: parse error at $TESTTMP/.hg/hgrc:1: novaluekey
   [255]
 
 Invalid syntax: no key
@@ -16,7 +16,7 @@
   > =nokeyvalue
   > EOF
   $ hg showconfig
-  hg: parse error at $TESTTMP/.hg/hgrc:1: =nokeyvalue (glob)
+  hg: parse error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
   [255]
 
 Test hint about invalid syntax from leading white space
@@ -25,7 +25,7 @@
   >  key=value
   > EOF
   $ hg showconfig
-  hg: parse error at $TESTTMP/.hg/hgrc:1:  key=value (glob)
+  hg: parse error at $TESTTMP/.hg/hgrc:1:  key=value
   unexpected leading whitespace
   [255]
 
@@ -34,7 +34,7 @@
   > key=value
   > EOF
   $ hg showconfig
-  hg: parse error at $TESTTMP/.hg/hgrc:1:  [section] (glob)
+  hg: parse error at $TESTTMP/.hg/hgrc:1:  [section]
   unexpected leading whitespace
   [255]
 
--- a/tests/test-context.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-context.py	Tue Dec 19 16:27:24 2017 -0500
@@ -32,7 +32,7 @@
 # test memctx with non-ASCII commit message
 
 def filectxfn(repo, memctx, path):
-    return context.memfilectx(repo, "foo", "")
+    return context.memfilectx(repo, memctx, "foo", "")
 
 ctx = context.memctx(repo, ['tip', None],
                      encoding.tolocal("Gr\xc3\xbcezi!"),
@@ -49,7 +49,7 @@
     data, flags = fctx.data(), fctx.flags()
     if f == 'foo':
         data += 'bar\n'
-    return context.memfilectx(repo, f, data, 'l' in flags, 'x' in flags)
+    return context.memfilectx(repo, memctx, f, data, 'l' in flags, 'x' in flags)
 
 ctxa = repo.changectx(0)
 ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"],
--- a/tests/test-contrib-check-code.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-contrib-check-code.t	Tue Dec 19 16:27:24 2017 -0500
@@ -173,6 +173,17 @@
    don't use old-style two-argument raise, use Exception(message)
   [1]
 
+  $ cat <<EOF > tab.t
+  > 	indent
+  >   > 	heredoc
+  > EOF
+  $ "$check_code" tab.t
+  tab.t:1:
+   > 	indent
+   don't use tabs to indent
+  [1]
+  $ rm tab.t
+
   $ cat > rst.py <<EOF
   > """problematic rst text
   > 
--- a/tests/test-contrib-perf.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-contrib-perf.t	Tue Dec 19 16:27:24 2017 -0500
@@ -55,6 +55,8 @@
                  benchmark parsing bookmarks from disk to memory
    perfbranchmap
                  benchmark the update of a branchmap
+   perfbundleread
+                 Benchmark reading of bundle files.
    perfcca       (no help text available)
    perfchangegroupchangelog
                  Benchmark producing a changelog group for a changegroup.
@@ -173,3 +175,7 @@
   $ (testrepohg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
   >  testrepohg files -r tip glob:mercurial/*.c glob:mercurial/*.py) |
   > "$TESTDIR"/check-perf-code.py contrib/perf.py
+  contrib/perf.py:498:
+   >     from mercurial import (
+   import newer module separately in try clause for early Mercurial
+  [1]
--- a/tests/test-convert-authormap.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-convert-authormap.t	Tue Dec 19 16:27:24 2017 -0500
@@ -27,7 +27,7 @@
   sorting...
   converting...
   0 foo
-  writing author map file $TESTTMP/new/.hg/authormap (glob)
+  writing author map file $TESTTMP/new/.hg/authormap
   $ cat new/.hg/authormap
   user name=Long User Name
   $ hg -Rnew log
@@ -44,7 +44,7 @@
   $ hg init new
   $ mv authormap.txt new/.hg/authormap
   $ hg convert orig new
-  ignoring bad line in author map file $TESTTMP/new/.hg/authormap: this line is ignored (glob)
+  ignoring bad line in author map file $TESTTMP/new/.hg/authormap: this line is ignored
   scanning source...
   sorting...
   converting...
--- a/tests/test-convert-filemap.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-convert-filemap.t	Tue Dec 19 16:27:24 2017 -0500
@@ -637,7 +637,7 @@
   $ cd namedbranch
   $ hg --config extensions.mq= strip tip
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/namedbranch/.hg/strip-backup/73899bcbe45c-92adf160-backup.hg (glob)
+  saved backup bundle to $TESTTMP/namedbranch/.hg/strip-backup/73899bcbe45c-92adf160-backup.hg
   $ hg up foo
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg merge default
--- a/tests/test-convert-git.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-convert-git.t	Tue Dec 19 16:27:24 2017 -0500
@@ -936,7 +936,7 @@
   $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
   $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp
   $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
-  abort: cannot retrieve number of commits in $TESTTMP/git-repo4/.git (glob)
+  abort: cannot retrieve number of commits in $TESTTMP/git-repo4/.git
   $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ
 damage git repository by renaming a blob object
 
--- a/tests/test-convert-svn-encoding.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-convert-svn-encoding.t	Tue Dec 19 16:27:24 2017 -0500
@@ -12,7 +12,7 @@
 
   $ hg --debug convert svn-repo A-hg --config progress.debug=1
   initializing destination A-hg repository
-  reparent to file://*/svn-repo (glob)
+  reparent to file:/*/$TESTTMP/svn-repo (glob)
   run hg sink pre-conversion action
   scanning source...
   found trunk at 'trunk'
@@ -21,7 +21,7 @@
   found branch branch\xc3\xa9 at 5 (esc)
   found branch branch\xc3\xa9e at 6 (esc)
   scanning: 1/4 revisions (25.00%)
-  reparent to file://*/svn-repo/trunk (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/trunk (glob)
   fetching revision log for "/trunk" from 4 to 0
   parsing revision 4 (2 changes)
   parsing revision 3 (4 changes)
@@ -31,18 +31,18 @@
   '/branches' is not under '/trunk', ignoring
   '/tags' is not under '/trunk', ignoring
   scanning: 2/4 revisions (50.00%)
-  reparent to file://*/svn-repo/branches/branch%C3%A9 (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/branches/branch%C3%A9 (glob)
   fetching revision log for "/branches/branch\xc3\xa9" from 5 to 0 (esc)
   parsing revision 5 (1 changes)
-  reparent to file://*/svn-repo (glob)
-  reparent to file://*/svn-repo/branches/branch%C3%A9 (glob)
+  reparent to file:/*/$TESTTMP/svn-repo (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/branches/branch%C3%A9 (glob)
   found parent of branch /branches/branch\xc3\xa9 at 4: /trunk (esc)
   scanning: 3/4 revisions (75.00%)
-  reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/branches/branch%C3%A9e (glob)
   fetching revision log for "/branches/branch\xc3\xa9e" from 6 to 0 (esc)
   parsing revision 6 (1 changes)
-  reparent to file://*/svn-repo (glob)
-  reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
+  reparent to file:/*/$TESTTMP/svn-repo (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/branches/branch%C3%A9e (glob)
   found parent of branch /branches/branch\xc3\xa9e at 5: /branches/branch\xc3\xa9 (esc)
   scanning: 4/4 revisions (100.00%)
   scanning: 5/4 revisions (125.00%)
@@ -57,7 +57,7 @@
   4 hello
   source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@2
   converting: 1/6 revisions (16.67%)
-  reparent to file://*/svn-repo/trunk (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/trunk (glob)
   scanning paths: /trunk/\xc3\xa0 0/3 paths (0.00%) (esc)
   scanning paths: /trunk/\xc3\xa0/e\xcc\x81 1/3 paths (33.33%) (esc)
   scanning paths: /trunk/\xc3\xa9 2/3 paths (66.67%) (esc)
@@ -74,14 +74,14 @@
   converting: 2/6 revisions (33.33%)
   scanning paths: /trunk/\xc3\xa0 0/4 paths (0.00%) (esc)
   gone from -1
-  reparent to file://*/svn-repo (glob)
-  reparent to file://*/svn-repo/trunk (glob)
+  reparent to file:/*/$TESTTMP/svn-repo (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/trunk (glob)
   scanning paths: /trunk/\xc3\xa8 1/4 paths (25.00%) (esc)
   copied to \xc3\xa8 from \xc3\xa9@2 (esc)
   scanning paths: /trunk/\xc3\xa9 2/4 paths (50.00%) (esc)
   gone from -1
-  reparent to file://*/svn-repo (glob)
-  reparent to file://*/svn-repo/trunk (glob)
+  reparent to file:/*/$TESTTMP/svn-repo (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/trunk (glob)
   scanning paths: /trunk/\xc3\xb9 3/4 paths (75.00%) (esc)
   mark /trunk/\xc3\xb9 came from \xc3\xa0:2 (esc)
   getting files: \xc3\xa0/e\xcc\x81 1/4 files (25.00%) (esc)
@@ -101,12 +101,12 @@
   converting: 3/6 revisions (50.00%)
   scanning paths: /trunk/\xc3\xa8 0/2 paths (0.00%) (esc)
   gone from -1
-  reparent to file://*/svn-repo (glob)
-  reparent to file://*/svn-repo/trunk (glob)
+  reparent to file:/*/$TESTTMP/svn-repo (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/trunk (glob)
   scanning paths: /trunk/\xc3\xb9 1/2 paths (50.00%) (esc)
   gone from -1
-  reparent to file://*/svn-repo (glob)
-  reparent to file://*/svn-repo/trunk (glob)
+  reparent to file:/*/$TESTTMP/svn-repo (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/trunk (glob)
   getting files: \xc3\xa8 1/2 files (50.00%) (esc)
   getting files: \xc3\xb9/e\xcc\x81 2/2 files (100.00%) (esc)
   committing files:
@@ -116,21 +116,21 @@
   1 branch to branch?
   source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/branches/branch?@5
   converting: 4/6 revisions (66.67%)
-  reparent to file://*/svn-repo/branches/branch%C3%A9 (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/branches/branch%C3%A9 (glob)
   scanning paths: /branches/branch\xc3\xa9 0/1 paths (0.00%) (esc)
   committing changelog
   updating the branch cache
   0 branch to branch?e
   source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/branches/branch?e@6
   converting: 5/6 revisions (83.33%)
-  reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/branches/branch%C3%A9e (glob)
   scanning paths: /branches/branch\xc3\xa9e 0/1 paths (0.00%) (esc)
   committing changelog
   updating the branch cache
-  reparent to file://*/svn-repo (glob)
-  reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
-  reparent to file://*/svn-repo (glob)
-  reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
+  reparent to file:/*/$TESTTMP/svn-repo (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/branches/branch%C3%A9e (glob)
+  reparent to file:/*/$TESTTMP/svn-repo (glob)
+  reparent to file:/*/$TESTTMP/svn-repo/branches/branch%C3%A9e (glob)
   updating tags
   committing files:
   .hgtags
--- a/tests/test-convert-svn-sink.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-convert-svn-sink.t	Tue Dec 19 16:27:24 2017 -0500
@@ -48,8 +48,8 @@
   0 modify a file
   $ svnupanddisplay a-hg-wc 2
    2 1 test d1
-   2 1 test d1/d2 (glob)
-   2 1 test d1/d2/b (glob)
+   2 1 test d1/d2
+   2 1 test d1/d2/b
    2 2 test .
    2 2 test a
   revision: 2
@@ -89,8 +89,8 @@
   0 rename a file
   $ svnupanddisplay a-hg-wc 1
    3 1 test d1
-   3 1 test d1/d2 (glob)
-   3 1 test d1/d2/b (glob)
+   3 1 test d1/d2
+   3 1 test d1/d2/b
    3 3 test .
    3 3 test b
   revision: 3
@@ -124,8 +124,8 @@
   0 copy a file
   $ svnupanddisplay a-hg-wc 1
    4 1 test d1
-   4 1 test d1/d2 (glob)
-   4 1 test d1/d2/b (glob)
+   4 1 test d1/d2
+   4 1 test d1/d2/b
    4 3 test b
    4 4 test .
    4 4 test c
@@ -161,8 +161,8 @@
   0 remove a file
   $ svnupanddisplay a-hg-wc 1
    5 1 test d1
-   5 1 test d1/d2 (glob)
-   5 1 test d1/d2/b (glob)
+   5 1 test d1/d2
+   5 1 test d1/d2/b
    5 4 test c
    5 5 test .
   revision: 5
@@ -203,8 +203,8 @@
   0 make a file executable
   $ svnupanddisplay a-hg-wc 1
    6 1 test d1
-   6 1 test d1/d2 (glob)
-   6 1 test d1/d2/b (glob)
+   6 1 test d1/d2
+   6 1 test d1/d2/b
    6 6 test .
    6 6 test c
   revision: 6
@@ -256,7 +256,7 @@
   $ hg --cwd a up 5
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg --cwd a --config extensions.strip= strip -r 6
-  saved backup bundle to $TESTTMP/a/.hg/strip-backup/bd4f7b7a7067-ed505e42-backup.hg (glob)
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/bd4f7b7a7067-ed505e42-backup.hg
 
 #endif
 
@@ -312,7 +312,7 @@
   $ svnupanddisplay a-hg-wc 1
    1 1 test .
    1 1 test d1
-   1 1 test d1/a (glob)
+   1 1 test d1/a
   revision: 1
   author: test
   msg: add executable file in new directory
@@ -337,10 +337,10 @@
   0 copy file to new directory
   $ svnupanddisplay a-hg-wc 1
    2 1 test d1
-   2 1 test d1/a (glob)
+   2 1 test d1/a
    2 2 test .
    2 2 test d2
-   2 2 test d2/a (glob)
+   2 2 test d2/a
   revision: 2
   author: test
   msg: copy file to new directory
--- a/tests/test-convert-svn-source.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-convert-svn-source.t	Tue Dec 19 16:27:24 2017 -0500
@@ -32,8 +32,8 @@
   $ cd ..
 
   $ svn import -m "init projB" projB "$SVNREPOURL/proj%20B" | filter_svn_output | sort
-  Adding         projB/mytrunk (glob)
-  Adding         projB/tags (glob)
+  Adding         projB/mytrunk
+  Adding         projB/tags
   Committed revision 1.
 
 Update svn repository
--- a/tests/test-convert.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-convert.t	Tue Dec 19 16:27:24 2017 -0500
@@ -476,7 +476,7 @@
   assuming destination emptydir-hg
   initializing destination emptydir-hg repository
   emptydir does not look like a CVS checkout
-  $TESTTMP/emptydir does not look like a Git repository (glob)
+  $TESTTMP/emptydir does not look like a Git repository
   emptydir does not look like a Subversion repository
   emptydir is not a local Mercurial repository
   emptydir does not look like a darcs repository
--- a/tests/test-copy-move-merge.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-copy-move-merge.t	Tue Dec 19 16:27:24 2017 -0500
@@ -82,7 +82,7 @@
 
   $ hg strip -r . --config extensions.strip=
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/t/.hg/strip-backup/550bd84c0cd3-fc575957-backup.hg (glob)
+  saved backup bundle to $TESTTMP/t/.hg/strip-backup/550bd84c0cd3-fc575957-backup.hg
   $ hg up -qC 2
   $ hg rebase --keep -d 1 -b 2 --config extensions.rebase= --config experimental.copytrace=off --config ui.interactive=True << EOF
   > c
@@ -122,7 +122,7 @@
   
   $ hg rebase -d . -b 2 --config extensions.rebase= --config experimental.copytrace=off
   rebasing 2:6adcf8c12e7d "copy b->x"
-  saved backup bundle to $TESTTMP/copydisable/.hg/strip-backup/6adcf8c12e7d-ce4b3e75-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/copydisable/.hg/strip-backup/6adcf8c12e7d-ce4b3e75-rebase.hg
   $ hg up -q 3
   $ hg log -f x -T '{rev} {desc}\n'
   3 copy b->x
@@ -155,7 +155,7 @@
   
   $ hg rebase -d 2 -s 3 --config extensions.rebase= --config experimental.copytrace=off
   rebasing 3:47e1a9e6273b "copy a->b (2)" (tip)
-  saved backup bundle to $TESTTMP/copydisable3/.hg/strip-backup/47e1a9e6273b-2d099c59-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/copydisable3/.hg/strip-backup/47e1a9e6273b-2d099c59-rebase.hg
 
   $ hg log -G -f b
   @  changeset:   3:76024fb4b05b
--- a/tests/test-copytrace-heuristics.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-copytrace-heuristics.t	Tue Dec 19 16:27:24 2017 -0500
@@ -55,7 +55,7 @@
   rebasing 2:557f403c0afd "mod a, mod dir/file.txt" (tip)
   merging b and a to b
   merging dir2/file.txt and dir/file.txt to dir2/file.txt
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/557f403c0afd-9926eeff-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/557f403c0afd-9926eeff-rebase.hg
   $ cd ..
   $ rm -rf repo
 
@@ -125,7 +125,7 @@
   $ hg rebase -s . -d 2
   rebasing 3:9d5cf99c3d9f "mod a" (tip)
   merging b and a to b
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9d5cf99c3d9f-f02358cc-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9d5cf99c3d9f-f02358cc-rebase.hg
   $ cd ..
   $ rm -rf repo
 
@@ -160,7 +160,7 @@
   $ hg rebase -s . -d 0
   rebasing 3:fbe97126b396 "mod b" (tip)
   merging a and b to a
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fbe97126b396-cf5452a1-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fbe97126b396-cf5452a1-rebase.hg
   $ cd ..
   $ rm -rf repo
 
@@ -197,7 +197,7 @@
   $ hg rebase -s . -d 2
   rebasing 3:6b2f4cece40f "mod dir/a" (tip)
   merging dir/b and dir/a to dir/b
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/6b2f4cece40f-503efe60-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/6b2f4cece40f-503efe60-rebase.hg
   $ cd ..
   $ rm -rf repo
 
@@ -255,7 +255,7 @@
   $ hg rebase -s 2 -d 1
   rebasing 2:ef716627c70b "mod a" (tip)
   merging foo and a to foo
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg
 
   $ cd ..
   $ rm -rf repo
@@ -286,7 +286,7 @@
 
   $ hg rebase -s 1 -d 2
   rebasing 1:472e38d57782 "mv a b"
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/472e38d57782-17d50e29-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/472e38d57782-17d50e29-rebase.hg
   $ hg up -q c492ed3c7e35dcd1dc938053b8adf56e2cfbd062
   $ ls
   b
@@ -320,7 +320,7 @@
   $ hg rebase -s . -d 1
   rebasing 2:a33d80b6e352 "mv dir/ dir2/" (tip)
   merging dir/a and dir2/a to dir2/a
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/a33d80b6e352-fecb9ada-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/a33d80b6e352-fecb9ada-rebase.hg
   $ cd ..
   $ rm -rf server
   $ rm -rf repo
@@ -355,7 +355,7 @@
   $ hg rebase -s . -d 2
   rebasing 3:d41316942216 "mod a" (tip)
   merging c and a to c
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d41316942216-2b5949bc-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d41316942216-2b5949bc-rebase.hg
 
   $ cd ..
   $ rm -rf repo
@@ -391,7 +391,7 @@
   merging a and b to b
   rebasing 2:d3efd280421d "mv b c"
   merging b and c to c
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/472e38d57782-ab8d3c58-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/472e38d57782-ab8d3c58-rebase.hg
 
   $ cd ..
   $ rm -rf repo
@@ -428,7 +428,7 @@
   $ hg rebase -s . -d 2
   rebasing 3:ef716627c70b "mod a" (tip)
   merging b and a to b
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg
   $ ls
   b
   c
@@ -500,7 +500,7 @@
   rebasing 2:ef716627c70b "mod a" (tip)
   merging b and a to b
   merging c and a to c
-  saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg
   $ ls
   b
   c
@@ -624,7 +624,7 @@
   $ hg rebase -s . -d 1 --config experimental.copytrace.sourcecommitlimit=100
   rebasing 2:6207d2d318e7 "mod a" (tip)
   merging dir2/b and dir1/a to dir2/b
-  saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/6207d2d318e7-1c9779ad-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/6207d2d318e7-1c9779ad-rebase.hg
   $ cat dir2/b
   a
   b
@@ -661,7 +661,7 @@
 
   $ hg rebase -s . -d 1 --config experimental.copytrace.sourcecommitlimit=100
   rebasing 2:e8919e7df8d0 "mv dir1 dir2" (tip)
-  saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/e8919e7df8d0-f62fab62-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/e8919e7df8d0-f62fab62-rebase.hg
   $ ls dir2
   a
   dummy
@@ -711,6 +711,6 @@
   $ hg rebase -s 8b6e13696 -d . --config experimental.copytrace.sourcecommitlimit=100
   rebasing 1:8b6e13696c38 "added more things to a"
   merging foo/bar and a to foo/bar
-  saved backup bundle to $TESTTMP/repo/repo/repo/.hg/strip-backup/8b6e13696c38-fc14ac83-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/repo/repo/.hg/strip-backup/8b6e13696c38-fc14ac83-rebase.hg
   $ cd ..
   $ rm -rf repo
--- a/tests/test-debugcommands.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-debugcommands.t	Tue Dec 19 16:27:24 2017 -0500
@@ -1,4 +1,6 @@
   $ cat << EOF >> $HGRCPATH
+  > [ui]
+  > interactive=yes
   > [format]
   > usegeneraldelta=yes
   > EOF
@@ -77,6 +79,40 @@
    }
   ]
 
+debugdelta chain with sparse read enabled
+
+  $ cat >> $HGRCPATH <<EOF
+  > [experimental]
+  > sparse-read = True
+  > EOF
+  $ hg debugdeltachain -m
+      rev  chain# chainlen     prev   delta       size    rawsize  chainsize     ratio   lindist extradist extraratio   readsize largestblk rddensity
+        0       1        1       -1    base         44         43         44   1.02326        44         0    0.00000         44         44   1.00000
+
+  $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen} {readsize} {largestblock} {readdensity}\n'
+  0 1 1 44 44 1.0
+
+  $ hg debugdeltachain -m -Tjson
+  [
+   {
+    "chainid": 1,
+    "chainlen": 1,
+    "chainratio": 1.02325581395,
+    "chainsize": 44,
+    "compsize": 44,
+    "deltatype": "base",
+    "extradist": 0,
+    "extraratio": 0.0,
+    "largestblock": 44,
+    "lindist": 44,
+    "prevrev": -1,
+    "readdensity": 1.0,
+    "readsize": 44,
+    "rev": 0,
+    "uncompsize": 43
+   }
+  ]
+
 Test max chain len
   $ cat >> $HGRCPATH << EOF
   > [format]
@@ -111,6 +147,126 @@
       7     6    -1   ???   ???        ???  ???  ???    0     ???      ????           ?     1        2 (glob)
       8     7    -1   ???   ???        ???  ???  ???    0     ???      ????           ?     1        3 (glob)
 
+Test debuglocks command:
+
+  $ hg debuglocks
+  lock:  free
+  wlock: free
+
+* Test setting the lock
+
+waitlock <file> will wait for file to be created. If it isn't in a reasonable
+amount of time, displays error message and returns 1
+  $ waitlock() {
+  >     start=`date +%s`
+  >     timeout=5
+  >     while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do
+  >         now=`date +%s`
+  >         if [ "`expr $now - $start`" -gt $timeout ]; then
+  >             echo "timeout: $1 was not created in $timeout seconds"
+  >             return 1
+  >         fi
+  >         sleep 0.1
+  >     done
+  > }
+  $ dolock() {
+  >     {
+  >         waitlock .hg/unlock
+  >         rm -f .hg/unlock
+  >         echo y
+  >     } | hg debuglocks "$@" > /dev/null
+  > }
+  $ dolock -s &
+  $ waitlock .hg/store/lock
+
+  $ hg debuglocks
+  lock:  user *, process * (*s) (glob)
+  wlock: free
+  [1]
+  $ touch .hg/unlock
+  $ wait
+  $ [ -f .hg/store/lock ] || echo "There is no lock"
+  There is no lock
+
+* Test setting the wlock
+
+  $ dolock -S &
+  $ waitlock .hg/wlock
+
+  $ hg debuglocks
+  lock:  free
+  wlock: user *, process * (*s) (glob)
+  [1]
+  $ touch .hg/unlock
+  $ wait
+  $ [ -f .hg/wlock ] || echo "There is no wlock"
+  There is no wlock
+
+* Test setting both locks
+
+  $ dolock -Ss &
+  $ waitlock .hg/wlock && waitlock .hg/store/lock
+
+  $ hg debuglocks
+  lock:  user *, process * (*s) (glob)
+  wlock: user *, process * (*s) (glob)
+  [2]
+
+* Test failing to set a lock
+
+  $ hg debuglocks -s
+  abort: lock is already held
+  [255]
+
+  $ hg debuglocks -S
+  abort: wlock is already held
+  [255]
+
+  $ touch .hg/unlock
+  $ wait
+
+  $ hg debuglocks
+  lock:  free
+  wlock: free
+
+* Test forcing the lock
+
+  $ dolock -s &
+  $ waitlock .hg/store/lock
+
+  $ hg debuglocks
+  lock:  user *, process * (*s) (glob)
+  wlock: free
+  [1]
+
+  $ hg debuglocks -L
+
+  $ hg debuglocks
+  lock:  free
+  wlock: free
+
+  $ touch .hg/unlock
+  $ wait
+
+* Test forcing the wlock
+
+  $ dolock -S &
+  $ waitlock .hg/wlock
+
+  $ hg debuglocks
+  lock:  free
+  wlock: user *, process * (*s) (glob)
+  [1]
+
+  $ hg debuglocks -W
+
+  $ hg debuglocks
+  lock:  free
+  wlock: free
+
+  $ touch .hg/unlock
+  $ wait
+
 Test WdirUnsupported exception
 
   $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
@@ -156,3 +312,38 @@
   from h hidden in g at:
    debugstacktrace.py:6 in f
    debugstacktrace.py:9 in g
+
+Test debugcapabilities command:
+
+  $ hg debugcapabilities ./debugrevlog/
+  Main capabilities:
+    branchmap
+    $USUAL_BUNDLE2_CAPS$
+    getbundle
+    known
+    lookup
+    pushkey
+    unbundle
+  Bundle2 capabilities:
+    HG20
+    bookmarks
+    changegroup
+      01
+      02
+    digests
+      md5
+      sha1
+      sha512
+    error
+      abort
+      unsupportedcontent
+      pushraced
+      pushkey
+    hgtagsfnodes
+    listkeys
+    phases
+      heads
+    pushkey
+    remote-changegroup
+      http
+      https
--- a/tests/test-default-push.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-default-push.t	Tue Dec 19 16:27:24 2017 -0500
@@ -27,7 +27,7 @@
 Push should push to 'default' when 'default-push' not set:
 
   $ hg --cwd b push
-  pushing to $TESTTMP/a (glob)
+  pushing to $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
@@ -39,7 +39,7 @@
   $ echo '[paths]' >> b/.hg/hgrc
   $ echo 'default-push = ../c' >> b/.hg/hgrc
   $ hg --cwd b push
-  pushing to $TESTTMP/c (glob)
+  pushing to $TESTTMP/c
   searching for changes
   adding changesets
   adding manifests
@@ -49,7 +49,7 @@
 But push should push to 'default' if explicitly specified (issue5000):
 
   $ hg --cwd b push default
-  pushing to $TESTTMP/a (glob)
+  pushing to $TESTTMP/a
   searching for changes
   no changes found
   [1]
@@ -63,7 +63,7 @@
   $ touch foo
   $ hg -q commit -A -m 'add foo'
   $ hg --config paths.default-push=../a push
-  pushing to $TESTTMP/a (glob)
+  pushing to $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-diff-color.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-diff-color.t	Tue Dec 19 16:27:24 2017 -0500
@@ -259,3 +259,134 @@
   \x1b[0;32m+\x1b[0m\x1b[0;1;35m	\x1b[0m\x1b[0;32mall\x1b[0m\x1b[0;1;35m		\x1b[0m\x1b[0;32mtabs\x1b[0m\x1b[0;1;41m	\x1b[0m (esc)
 
   $ cd ..
+
+test inline color diff
+
+  $ hg init inline
+  $ cd inline
+  $ cat > file1 << EOF
+  > this is the first line
+  > this is the second line
+  >     third line starts with space
+  > + starts with a plus sign
+  > 	this one with one tab
+  > 		now with full two tabs
+  > 	now tabs		everywhere, much fun
+  > 
+  > this line won't change
+  > 
+  > two lines are going to
+  > be changed into three!
+  > 
+  > three of those lines will
+  > collapse onto one
+  > (to see if it works)
+  > EOF
+  $ hg add file1
+  $ hg ci -m 'commit'
+
+  $ cat > file1 << EOF
+  > that is the first paragraph
+  >     this is the second line
+  > third line starts with space
+  > - starts with a minus sign
+  > 	this one with two tab
+  > 			now with full three tabs
+  > 	now there are tabs		everywhere, much fun
+  > 
+  > this line won't change
+  > 
+  > two lines are going to
+  > (entirely magically,
+  >  assuming this works)
+  > be changed into four!
+  > 
+  > three of those lines have
+  > collapsed onto one
+  > EOF
+  $ hg diff --config experimental.worddiff=False --color=debug
+  [diff.diffline|diff --git a/file1 b/file1]
+  [diff.file_a|--- a/file1]
+  [diff.file_b|+++ b/file1]
+  [diff.hunk|@@ -1,16 +1,17 @@]
+  [diff.deleted|-this is the first line]
+  [diff.deleted|-this is the second line]
+  [diff.deleted|-    third line starts with space]
+  [diff.deleted|-+ starts with a plus sign]
+  [diff.deleted|-][diff.tab|	][diff.deleted|this one with one tab]
+  [diff.deleted|-][diff.tab|		][diff.deleted|now with full two tabs]
+  [diff.deleted|-][diff.tab|	][diff.deleted|now tabs][diff.tab|		][diff.deleted|everywhere, much fun]
+  [diff.inserted|+that is the first paragraph]
+  [diff.inserted|+    this is the second line]
+  [diff.inserted|+third line starts with space]
+  [diff.inserted|+- starts with a minus sign]
+  [diff.inserted|+][diff.tab|	][diff.inserted|this one with two tab]
+  [diff.inserted|+][diff.tab|			][diff.inserted|now with full three tabs]
+  [diff.inserted|+][diff.tab|	][diff.inserted|now there are tabs][diff.tab|		][diff.inserted|everywhere, much fun]
+   
+   this line won't change
+   
+   two lines are going to
+  [diff.deleted|-be changed into three!]
+  [diff.inserted|+(entirely magically,]
+  [diff.inserted|+ assuming this works)]
+  [diff.inserted|+be changed into four!]
+   
+  [diff.deleted|-three of those lines will]
+  [diff.deleted|-collapse onto one]
+  [diff.deleted|-(to see if it works)]
+  [diff.inserted|+three of those lines have]
+  [diff.inserted|+collapsed onto one]
+  $ hg diff --config experimental.worddiff=True --color=debug
+  [diff.diffline|diff --git a/file1 b/file1]
+  [diff.file_a|--- a/file1]
+  [diff.file_b|+++ b/file1]
+  [diff.hunk|@@ -1,16 +1,17 @@]
+  [diff.deleted|-this is the ][diff.deleted.highlight|first][diff.deleted| line]
+  [diff.deleted|-this is the second line]
+  [diff.deleted|-][diff.deleted.highlight|    ][diff.deleted|third line starts with space]
+  [diff.deleted|-][diff.deleted.highlight|+][diff.deleted| starts with a ][diff.deleted.highlight|plus][diff.deleted| sign]
+  [diff.deleted|-][diff.tab|	][diff.deleted|this one with ][diff.deleted.highlight|one][diff.deleted| tab]
+  [diff.deleted|-][diff.tab|		][diff.deleted|now with full ][diff.deleted.highlight|two][diff.deleted| tabs]
+  [diff.deleted|-][diff.tab|	][diff.deleted|now tabs][diff.tab|		][diff.deleted|everywhere, much fun]
+  [diff.inserted|+that is the first paragraph]
+  [diff.inserted|+][diff.inserted.highlight|    ][diff.inserted|this is the ][diff.inserted.highlight|second][diff.inserted| line]
+  [diff.inserted|+third line starts with space]
+  [diff.inserted|+][diff.inserted.highlight|-][diff.inserted| starts with a ][diff.inserted.highlight|minus][diff.inserted| sign]
+  [diff.inserted|+][diff.tab|	][diff.inserted|this one with ][diff.inserted.highlight|two][diff.inserted| tab]
+  [diff.inserted|+][diff.tab|			][diff.inserted|now with full ][diff.inserted.highlight|three][diff.inserted| tabs]
+  [diff.inserted|+][diff.tab|	][diff.inserted|now][diff.inserted.highlight| there are][diff.inserted| tabs][diff.tab|		][diff.inserted|everywhere, much fun]
+   
+   this line won't change
+   
+   two lines are going to
+  [diff.deleted|-be changed into ][diff.deleted.highlight|three][diff.deleted|!]
+  [diff.inserted|+(entirely magically,]
+  [diff.inserted|+ assuming this works)]
+  [diff.inserted|+be changed into ][diff.inserted.highlight|four][diff.inserted|!]
+   
+  [diff.deleted|-three of those lines ][diff.deleted.highlight|will]
+  [diff.deleted|-][diff.deleted.highlight|collapse][diff.deleted| onto one]
+  [diff.deleted|-(to see if it works)]
+  [diff.inserted|+three of those lines ][diff.inserted.highlight|have]
+  [diff.inserted|+][diff.inserted.highlight|collapsed][diff.inserted| onto one]
+
+multibyte character shouldn't be broken up in word diff:
+
+  $ $PYTHON <<'EOF'
+  > with open("utf8", "wb") as f:
+  >     f.write(b"blah \xe3\x82\xa2 blah\n")
+  > EOF
+  $ hg ci -Am 'add utf8 char' utf8
+  $ $PYTHON <<'EOF'
+  > with open("utf8", "wb") as f:
+  >     f.write(b"blah \xe3\x82\xa4 blah\n")
+  > EOF
+  $ hg ci -m 'slightly change utf8 char' utf8
+  $ hg diff --config experimental.worddiff=True --color=debug -c.
+  [diff.diffline|diff --git a/utf8 b/utf8]
+  [diff.file_a|--- a/utf8]
+  [diff.file_b|+++ b/utf8]
+  [diff.hunk|@@ -1,1 +1,1 @@]
+  [diff.deleted|-blah ][diff.deleted.highlight|\xe3\x82\xa2][diff.deleted| blah] (esc)
+  [diff.inserted|+blah ][diff.inserted.highlight|\xe3\x82\xa4][diff.inserted| blah] (esc)
--- a/tests/test-diffstat.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-diffstat.t	Tue Dec 19 16:27:24 2017 -0500
@@ -151,7 +151,7 @@
    1 files changed, 1 insertions(+), 0 deletions(-)
 
   $ hg diff --stat --root ../dir1 ../dir2
-  warning: ../dir2 not inside relative root . (glob)
+  warning: ../dir2 not inside relative root .
 
   $ hg diff --stat --root . -I old
 
--- a/tests/test-dirstate-race.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-dirstate-race.t	Tue Dec 19 16:27:24 2017 -0500
@@ -45,7 +45,7 @@
 #endif
 
   $ hg add b dir1 d e
-  adding dir1/c (glob)
+  adding dir1/c
   $ hg commit -m test2
 
   $ cat >> $TESTTMP/dirstaterace.py << EOF
--- a/tests/test-dirstate.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-dirstate.t	Tue Dec 19 16:27:24 2017 -0500
@@ -11,9 +11,9 @@
   adding a/b/c/d/y
   adding a/b/c/d/z
   $ hg mv a z
-  moving a/b/c/d/x to z/b/c/d/x (glob)
-  moving a/b/c/d/y to z/b/c/d/y (glob)
-  moving a/b/c/d/z to z/b/c/d/z (glob)
+  moving a/b/c/d/x to z/b/c/d/x
+  moving a/b/c/d/y to z/b/c/d/y
+  moving a/b/c/d/z to z/b/c/d/z
 
 Test name collisions
 
--- a/tests/test-dispatch.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-dispatch.t	Tue Dec 19 16:27:24 2017 -0500
@@ -37,10 +37,17 @@
   hg log [OPTION]... [FILE]
   (use 'hg log -h' to show more help)
 
-  $ hg log -R -- 2>&1 | grep 'hg log'
-  hg log: option -R requires argument
-  hg log [OPTION]... [FILE]
-  (use 'hg log -h' to show more help)
+"--" may be an option value:
+
+  $ hg -R -- log
+  abort: repository -- not found!
+  [255]
+  $ hg log -R --
+  abort: repository -- not found!
+  [255]
+  $ hg log -T --
+  -- (no-eol)
+  $ hg log -T -- -k nomatch
 
 Parsing of early options should stop at "--":
 
@@ -87,7 +94,7 @@
   [255]
 
   $ hg log -b --cwd=inexistent default
-  abort: No such file or directory: 'inexistent'
+  abort: $ENOENT$: 'inexistent'
   [255]
 
   $ hg log -b '--config=ui.traceback=yes' 2>&1 | grep '^Traceback'
@@ -149,6 +156,10 @@
   [255]
   $ HGPLAIN=+strictflags hg --cwd .. -q -Ra log -b default
   0:cb9a9f314b8b
+  $ HGPLAIN=+strictflags hg --cwd .. -q --repository a log -b default
+  0:cb9a9f314b8b
+  $ HGPLAIN=+strictflags hg --cwd .. -q --repo a log -b default
+  0:cb9a9f314b8b
 
 For compatibility reasons, HGPLAIN=+strictflags is not enabled by plain HGPLAIN:
 
@@ -200,7 +211,7 @@
 The output could be one of the following and something else:
  chg: abort: failed to getcwd (errno = *) (glob)
  abort: error getting current working directory: * (glob)
- sh: 0: getcwd() failed: No such file or directory
+ sh: 0: getcwd() failed: $ENOENT$
 Since the exact behavior depends on the shell, only check it returns non-zero.
   $ HGDEMANDIMPORT=disable hg version -q 2>/dev/null || false
   [1]
--- a/tests/test-drawdag.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-drawdag.t	Tue Dec 19 16:27:24 2017 -0500
@@ -227,11 +227,11 @@
   o  A 426bada5c67598ca65036d57d9e4b64b0c1ce7a0
   
   $ hg debugobsolete
-  112478962961147124edd43549aedd1a335e44bf 7fb047a69f220c21711122dfd94305a9efb60cba 64a8289d249234b9886244d379f15e6b650b28e3 711f53bbef0bebd12eb6f0511d5e2e998b984846 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'split', 'user': 'test'}
-  26805aba1e600a82e93661149f2313866a221a7b be0ef73c17ade3fc89dc41701eb9fc3a91b58282 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'replace', 'user': 'test'}
-  be0ef73c17ade3fc89dc41701eb9fc3a91b58282 575c4b5ec114d64b681d33f8792853568bfb2b2c 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'replace', 'user': 'test'}
-  64a8289d249234b9886244d379f15e6b650b28e3 0 {7fb047a69f220c21711122dfd94305a9efb60cba} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'prune', 'user': 'test'}
-  58e6b987bf7045fcd9c54f496396ca1d1fc81047 0 {575c4b5ec114d64b681d33f8792853568bfb2b2c} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'prune', 'user': 'test'}
+  112478962961147124edd43549aedd1a335e44bf 7fb047a69f220c21711122dfd94305a9efb60cba 64a8289d249234b9886244d379f15e6b650b28e3 711f53bbef0bebd12eb6f0511d5e2e998b984846 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'split', 'user': 'test'}
+  26805aba1e600a82e93661149f2313866a221a7b be0ef73c17ade3fc89dc41701eb9fc3a91b58282 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'replace', 'user': 'test'}
+  be0ef73c17ade3fc89dc41701eb9fc3a91b58282 575c4b5ec114d64b681d33f8792853568bfb2b2c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
+  64a8289d249234b9886244d379f15e6b650b28e3 0 {7fb047a69f220c21711122dfd94305a9efb60cba} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
+  58e6b987bf7045fcd9c54f496396ca1d1fc81047 0 {575c4b5ec114d64b681d33f8792853568bfb2b2c} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
 
 Change file contents via comments
 
@@ -261,12 +261,12 @@
   a
   FILE B
   b
-  FILE dir1/a (glob)
+  FILE dir1/a
   1
   2
-  FILE dir1/c (glob)
+  FILE dir1/c
   5
-  FILE dir2/b (glob)
+  FILE dir2/b
   34
-  FILE dir2/c (glob)
+  FILE dir2/c
   6
--- a/tests/test-extdata.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-extdata.t	Tue Dec 19 16:27:24 2017 -0500
@@ -46,8 +46,8 @@
 test non-zero exit of shell command
 
   $ hg log -qr "extdata(emptygrep)"
-  $ hg log -qr "extdata(emptygrep)" --debug
-  extdata command 'cat extdata.txt | grep empty' exited with status * (glob)
+  abort: extdata command 'cat extdata.txt | grep empty' failed: exited with status 1
+  [255]
 
 test bad extdata() revset source
 
@@ -88,8 +88,7 @@
   $ mkdir sub
   $ cd sub
   $ hg log -qr "extdata(filedata)"
-  abort: error: The system cannot find the file specified (windows !)
-  abort: error: No such file or directory (no-windows !)
+  abort: error: $ENOENT$
   [255]
   $ hg log -qr "extdata(shelldata)"
   2:f6ed99a58333
--- a/tests/test-extension.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-extension.t	Tue Dec 19 16:27:24 2017 -0500
@@ -180,7 +180,7 @@
   > EOF
   $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
   ambigabs.s=libroot/ambig.py
-  $TESTTMP/a (glob)
+  $TESTTMP/a
 
 #if no-py3k
   $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF
@@ -194,7 +194,7 @@
   > EOF
   $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
   ambigrel.s=libroot/mod/ambig.py
-  $TESTTMP/a (glob)
+  $TESTTMP/a
 #endif
 
 Check absolute/relative import of extension specific modules
@@ -245,7 +245,7 @@
   (extroot) import extroot: this is extroot.__init__
   (extroot) from extroot.bar import s: this is extroot.bar
   (extroot) import extroot.bar in func(): this is extroot.bar
-  $TESTTMP/a (glob)
+  $TESTTMP/a
 
 #if no-py3k
   $ rm "$TESTTMP"/extroot/foo.*
@@ -277,7 +277,7 @@
   (extroot) import sub1: this is extroot.sub1.__init__
   (extroot) from bar import s: this is extroot.bar
   (extroot) import bar in func(): this is extroot.bar
-  $TESTTMP/a (glob)
+  $TESTTMP/a
 #endif
 
 #if demandimport
@@ -1225,7 +1225,7 @@
   > cmdtable = None
   > EOF
   $ hg --config extensions.path=./path.py help foo > /dev/null
-  warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
+  warning: error finding commands in $TESTTMP/hgext/forest.py
   abort: no such help topic: foo
   (try 'hg help --keyword foo')
   [255]
@@ -1503,17 +1503,17 @@
   $ echo '# enable extension locally' >> src/.hg/hgrc
   $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
   $ hg -R src status
-  reposetup() for $TESTTMP/reposetup-test/src (glob)
-  reposetup() for $TESTTMP/reposetup-test/src (glob) (chg !)
+  reposetup() for $TESTTMP/reposetup-test/src
+  reposetup() for $TESTTMP/reposetup-test/src (chg !)
 
   $ hg clone -U src clone-dst1
-  reposetup() for $TESTTMP/reposetup-test/src (glob)
+  reposetup() for $TESTTMP/reposetup-test/src
   $ hg init push-dst1
   $ hg -q -R src push push-dst1
-  reposetup() for $TESTTMP/reposetup-test/src (glob)
+  reposetup() for $TESTTMP/reposetup-test/src
   $ hg init pull-src1
   $ hg -q -R pull-src1 pull src
-  reposetup() for $TESTTMP/reposetup-test/src (glob)
+  reposetup() for $TESTTMP/reposetup-test/src
 
   $ cat <<EOF >> $HGRCPATH
   > [extensions]
@@ -1521,13 +1521,13 @@
   > reposetuptest = !
   > EOF
   $ hg clone -U src clone-dst2
-  reposetup() for $TESTTMP/reposetup-test/src (glob)
+  reposetup() for $TESTTMP/reposetup-test/src
   $ hg init push-dst2
   $ hg -q -R src push push-dst2
-  reposetup() for $TESTTMP/reposetup-test/src (glob)
+  reposetup() for $TESTTMP/reposetup-test/src
   $ hg init pull-src2
   $ hg -q -R pull-src2 pull src
-  reposetup() for $TESTTMP/reposetup-test/src (glob)
+  reposetup() for $TESTTMP/reposetup-test/src
 
   $ cat <<EOF >> $HGRCPATH
   > [extensions]
@@ -1535,32 +1535,32 @@
   > reposetuptest = $TESTTMP/reposetuptest.py
   > EOF
   $ hg clone -U src clone-dst3
-  reposetup() for $TESTTMP/reposetup-test/src (glob)
-  reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob)
+  reposetup() for $TESTTMP/reposetup-test/src
+  reposetup() for $TESTTMP/reposetup-test/clone-dst3
   $ hg init push-dst3
-  reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
+  reposetup() for $TESTTMP/reposetup-test/push-dst3
   $ hg -q -R src push push-dst3
-  reposetup() for $TESTTMP/reposetup-test/src (glob)
-  reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
+  reposetup() for $TESTTMP/reposetup-test/src
+  reposetup() for $TESTTMP/reposetup-test/push-dst3
   $ hg init pull-src3
-  reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
+  reposetup() for $TESTTMP/reposetup-test/pull-src3
   $ hg -q -R pull-src3 pull src
-  reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
-  reposetup() for $TESTTMP/reposetup-test/src (glob)
+  reposetup() for $TESTTMP/reposetup-test/pull-src3
+  reposetup() for $TESTTMP/reposetup-test/src
 
   $ echo '[extensions]' >> src/.hg/hgrc
   $ echo '# disable extension locally' >> src/.hg/hgrc
   $ echo 'reposetuptest = !' >> src/.hg/hgrc
   $ hg clone -U src clone-dst4
-  reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob)
+  reposetup() for $TESTTMP/reposetup-test/clone-dst4
   $ hg init push-dst4
-  reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
+  reposetup() for $TESTTMP/reposetup-test/push-dst4
   $ hg -q -R src push push-dst4
-  reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
+  reposetup() for $TESTTMP/reposetup-test/push-dst4
   $ hg init pull-src4
-  reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
+  reposetup() for $TESTTMP/reposetup-test/pull-src4
   $ hg -q -R pull-src4 pull src
-  reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
+  reposetup() for $TESTTMP/reposetup-test/pull-src4
 
 disabling in command line overlays with all configuration
   $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
@@ -1605,8 +1605,8 @@
   $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
   $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
   $ hg -R parent status -S -A
-  reposetup() for $TESTTMP/reposetup-test/parent (glob)
-  reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob)
+  reposetup() for $TESTTMP/reposetup-test/parent
+  reposetup() for $TESTTMP/reposetup-test/parent/sub2
   C .hgsub
   C .hgsubstate
   C sub1/1
--- a/tests/test-flagprocessor.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-flagprocessor.t	Tue Dec 19 16:27:24 2017 -0500
@@ -81,7 +81,7 @@
 
 # Push to the server
   $ hg push
-  pushing to $TESTTMP/server (glob)
+  pushing to $TESTTMP/server
   searching for changes
   adding changesets
   adding manifests
@@ -101,7 +101,7 @@
 
 # Pull from server and update to latest revision
   $ hg pull default
-  pulling from $TESTTMP/server (glob)
+  pulling from $TESTTMP/server
   requesting all changes
   adding changesets
   adding manifests
--- a/tests/test-fncache.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-fncache.t	Tue Dec 19 16:27:24 2017 -0500
@@ -14,7 +14,7 @@
   $ mkdir a.i
   $ echo "some other text" > a.i/b
   $ hg add
-  adding a.i/b (glob)
+  adding a.i/b
   $ hg ci -m second
   $ cat .hg/store/fncache | sort
   data/a.i
@@ -25,7 +25,7 @@
   $ mkdir a.i.hg
   $ echo "yet another text" > a.i.hg/c
   $ hg add
-  adding a.i.hg/c (glob)
+  adding a.i.hg/c
   $ hg ci -m third
   $ cat .hg/store/fncache | sort
   data/a.i
--- a/tests/test-generaldelta.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-generaldelta.t	Tue Dec 19 16:27:24 2017 -0500
@@ -154,7 +154,7 @@
 Test that strip bundle use bundle2
   $ hg --config extensions.strip= strip .
   0 files updated, 0 files merged, 5 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/aggressive/.hg/strip-backup/1c5d4dc9a8b8-6c68e60c-backup.hg (glob)
+  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}
--- a/tests/test-getbundle.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-getbundle.t	Tue Dec 19 16:27:24 2017 -0500
@@ -264,9 +264,9 @@
 
   $ cat access.log
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=700b7e19db54103633c4bf4a6a6b6d55f4d50c03+d5f6e1ea452285324836a49d7d3c2a63cfed1d31&heads=13c0170174366b441dc68e8e33757232fa744458+bac16991d12ff45f9dc43c52da1946dfadb83e80 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=700b7e19db54103633c4bf4a6a6b6d55f4d50c03+d5f6e1ea452285324836a49d7d3c2a63cfed1d31&heads=13c0170174366b441dc68e8e33757232fa744458+bac16991d12ff45f9dc43c52da1946dfadb83e80 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
 
   $ cat error.log
 
--- a/tests/test-git-export.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-git-export.t	Tue Dec 19 16:27:24 2017 -0500
@@ -99,7 +99,7 @@
   warning: dir2 not inside relative root dir1
 
   $ hg diff --git --root dir1 -r 1:tip 'dir2/{copy}'
-  warning: dir2/{copy} not inside relative root dir1 (glob)
+  warning: dir2/{copy} not inside relative root dir1
 
   $ cd dir1
   $ hg diff --git --root .. -r 1:tip
@@ -161,7 +161,7 @@
    new
   +copy1
   $ hg diff --git --root . -r 1:tip ../dir2
-  warning: ../dir2 not inside relative root . (glob)
+  warning: ../dir2 not inside relative root .
   $ hg diff --git --root . -r 1:tip '../dir2/*'
   warning: ../dir2/* not inside relative root . (glob)
   $ cd ..
--- a/tests/test-globalopts.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-globalopts.t	Tue Dec 19 16:27:24 2017 -0500
@@ -88,7 +88,7 @@
   abort: no repository found in '$TESTTMP' (.hg not found)!
   [255]
   $ hg -R b ann a/a
-  abort: a/a not under root '$TESTTMP/b' (glob)
+  abort: a/a not under root '$TESTTMP/b'
   (consider using '--cwd b')
   [255]
   $ hg log
@@ -355,6 +355,7 @@
    environment   Environment Variables
    extensions    Using Additional Features
    filesets      Specifying File Sets
+   flags         Command-line flags
    glossary      Glossary
    hgignore      Syntax for Mercurial Ignore Files
    hgweb         Configuring hgweb
@@ -439,6 +440,7 @@
    environment   Environment Variables
    extensions    Using Additional Features
    filesets      Specifying File Sets
+   flags         Command-line flags
    glossary      Glossary
    hgignore      Syntax for Mercurial Ignore Files
    hgweb         Configuring hgweb
--- a/tests/test-graft.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-graft.t	Tue Dec 19 16:27:24 2017 -0500
@@ -811,7 +811,7 @@
   $ hg up -qC 7
   $ hg tag -l -r 13 tmp
   $ hg --config extensions.strip= strip 2
-  saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg (glob)
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
   $ hg graft tmp
   skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
   [255]
--- a/tests/test-hardlinks.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hardlinks.t	Tue Dec 19 16:27:24 2017 -0500
@@ -155,7 +155,7 @@
 
   $ cd r3
   $ hg push
-  pushing to $TESTTMP/r1 (glob)
+  pushing to $TESTTMP/r1
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-help.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-help.t	Tue Dec 19 16:27:24 2017 -0500
@@ -110,6 +110,7 @@
    environment   Environment Variables
    extensions    Using Additional Features
    filesets      Specifying File Sets
+   flags         Command-line flags
    glossary      Glossary
    hgignore      Syntax for Mercurial Ignore Files
    hgweb         Configuring hgweb
@@ -188,6 +189,7 @@
    environment   Environment Variables
    extensions    Using Additional Features
    filesets      Specifying File Sets
+   flags         Command-line flags
    glossary      Glossary
    hgignore      Syntax for Mercurial Ignore Files
    hgweb         Configuring hgweb
@@ -865,6 +867,7 @@
    environment   Environment Variables
    extensions    Using Additional Features
    filesets      Specifying File Sets
+   flags         Command-line flags
    glossary      Glossary
    hgignore      Syntax for Mercurial Ignore Files
    hgweb         Configuring hgweb
@@ -895,6 +898,8 @@
                  builds a repo with a given DAG from scratch in the current
                  empty repo
    debugbundle   lists the contents of a bundle
+   debugcapabilities
+                 lists the capabilities of a remote peer
    debugcheckstate
                  validate the correctness of the current dirstate
    debugcolor    show available color, effects or style
@@ -917,6 +922,7 @@
    debugextensions
                  show information about active extensions
    debugfileset  parse and apply a fileset specification
+   debugformat   display format information about the current repository
    debugfsinfo   show information detected about current filesystem
    debuggetbundle
                  retrieves a bundle from a repo
@@ -2011,6 +2017,13 @@
   Specifying File Sets
   </td></tr>
   <tr><td>
+  <a href="/help/flags">
+  flags
+  </a>
+  </td><td>
+  Command-line flags
+  </td></tr>
+  <tr><td>
   <a href="/help/glossary">
   glossary
   </a>
--- a/tests/test-hgignore.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgignore.t	Tue Dec 19 16:27:24 2017 -0500
@@ -59,9 +59,9 @@
   I dir/c.o
 
   $ hg debugignore dir/c.o dir/missing.o
-  dir/c.o is ignored (glob)
+  dir/c.o is ignored
   (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
-  dir/missing.o is ignored (glob)
+  dir/missing.o is ignored
   (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
   $ cd dir
   $ hg debugignore c.o missing.o
@@ -164,7 +164,7 @@
 
   $ echo "syntax: invalid" > .hgignore
   $ hg status
-  $TESTTMP/ignorerepo/.hgignore: ignoring invalid syntax 'invalid' (glob)
+  $TESTTMP/ignorerepo/.hgignore: ignoring invalid syntax 'invalid'
   A dir/b.o
   ? .hgignore
   ? a.c
@@ -236,7 +236,7 @@
   $ hg debugignore a.c
   a.c is not ignored
   $ hg debugignore dir/c.o
-  dir/c.o is ignored (glob)
+  dir/c.o is ignored
   (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob)
 
 Check using 'include:' in ignore file
@@ -265,7 +265,7 @@
   $ cp otherignore goodignore
   $ echo "include:badignore" >> otherignore
   $ hg status
-  skipping unreadable pattern file 'badignore': No such file or directory
+  skipping unreadable pattern file 'badignore': $ENOENT$
   A dir/b.o
 
   $ mv goodignore otherignore
@@ -322,7 +322,7 @@
   $ hg status | grep file2
   [1]
   $ hg debugignore dir1/file2
-  dir1/file2 is ignored (glob)
+  dir1/file2 is ignored
   (ignore rule in dir2/.hgignore, line 1: 'file*2')
 
 #if windows
--- a/tests/test-hgrc.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgrc.t	Tue Dec 19 16:27:24 2017 -0500
@@ -30,7 +30,7 @@
   $ cat .hg/hgrc
   # example repository config (see 'hg help config' for more info)
   [paths]
-  default = $TESTTMP/foo%bar (glob)
+  default = $TESTTMP/foo%bar
   
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
@@ -43,10 +43,10 @@
   # name and email (local to this repository, optional), e.g.
   # username = Jane Doe <jdoe@example.com>
   $ hg paths
-  default = $TESTTMP/foo%bar (glob)
+  default = $TESTTMP/foo%bar
   $ hg showconfig
-  bundle.mainreporoot=$TESTTMP/foobar (glob)
-  paths.default=$TESTTMP/foo%bar (glob)
+  bundle.mainreporoot=$TESTTMP/foobar
+  paths.default=$TESTTMP/foo%bar
   $ cd ..
 
 issue1829: wrong indentation
@@ -242,4 +242,4 @@
   $ hg showconfig --debug paths
   plain: True
   read config from: $TESTTMP/hgrc
-  $TESTTMP/hgrc:17: paths.foo=$TESTTMP/bar (glob)
+  $TESTTMP/hgrc:17: paths.foo=$TESTTMP/bar
--- a/tests/test-hgweb-bundle.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgweb-bundle.t	Tue Dec 19 16:27:24 2017 -0500
@@ -18,7 +18,7 @@
 
   $ hg strip -r 1
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/server/.hg/strip-backup/ed602e697e0f-cc9fff6a-backup.hg (glob)
+  saved backup bundle to $TESTTMP/server/.hg/strip-backup/ed602e697e0f-cc9fff6a-backup.hg
 
 Serve from a bundle file
 
--- a/tests/test-hgweb-commands.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgweb-commands.t	Tue Dec 19 16:27:24 2017 -0500
@@ -775,7 +775,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/cad8025a2e87">branch commit with null character: </a>
-     <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">something</span> 
     </td>
    </tr>
    <tr>
@@ -783,7 +783,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/1d22e65f027e">branch</a>
-     <span class="branchhead">stable</span> 
+     <span class="phase">draft</span> <span class="branchhead">stable</span> 
     </td>
    </tr>
    <tr>
@@ -791,7 +791,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/a4f92ed23982">Added tag 1.0 for changeset 2ef0ac749a14</a>
-     <span class="branchhead">default</span> 
+     <span class="phase">draft</span> <span class="branchhead">default</span> 
     </td>
    </tr>
    <tr>
@@ -799,7 +799,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/2ef0ac749a14">base</a>
-     <span class="tag">1.0</span> <span class="tag">anotherthing</span> 
+     <span class="phase">draft</span> <span class="tag">1.0</span> <span class="tag">anotherthing</span> 
     </td>
    </tr>
   
@@ -880,7 +880,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    changeset 0:<a href="/rev/2ef0ac749a14">2ef0ac749a14</a>
-   <span class="tag">1.0</span> <span class="tag">anotherthing</span> 
+   <span class="phase">draft</span> <span class="tag">1.0</span> <span class="tag">anotherthing</span> 
   </h3>
   
   
@@ -1054,7 +1054,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/2ef0ac749a14">base</a>
-     <span class="tag">1.0</span> <span class="tag">anotherthing</span> 
+     <span class="phase">draft</span> <span class="tag">1.0</span> <span class="tag">anotherthing</span> 
     </td>
    </tr>
   
@@ -1312,7 +1312,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    view foo @ 1:<a href="/rev/a4f92ed23982">a4f92ed23982</a>
-   
+   <span class="phase">draft</span> <span class="branchhead">default</span> 
   </h3>
   
   
@@ -1446,7 +1446,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    view foo @ 2:<a href="/rev/1d22e65f027e">1d22e65f027e</a>
-   <span class="branchname">stable</span> 
+   <span class="phase">draft</span> <span class="branchhead">stable</span> 
   </h3>
   
   
@@ -1572,7 +1572,7 @@
   <table cellspacing="0">
   <tr><td>description</td><td>unknown</td></tr>
   <tr><td>owner</td><td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td></tr>
-  <tr><td>last change</td><td>Thu, 01 Jan 1970 00:00:00 +0000</td></tr>
+  <tr><td>last change</td><td class="date age">Thu, 01 Jan 1970 00:00:00 +0000</td></tr>
   </table>
   
   <div><a  class="title" href="/shortlog?style=gitweb">changes</a></div>
@@ -1584,7 +1584,7 @@
   <td>
   <a class="list" href="/rev/cad8025a2e87?style=gitweb">
   <b>branch commit with null character: </b>
-  <span class="logtags"><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="something">something</span> </span>
   </a>
   </td>
   <td class="link" nowrap>
@@ -1598,7 +1598,7 @@
   <td>
   <a class="list" href="/rev/1d22e65f027e?style=gitweb">
   <b>branch</b>
-  <span class="logtags"><span class="branchtag" title="stable">stable</span> </span>
+  <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="stable">stable</span> </span>
   </a>
   </td>
   <td class="link" nowrap>
@@ -1612,7 +1612,7 @@
   <td>
   <a class="list" href="/rev/a4f92ed23982?style=gitweb">
   <b>Added tag 1.0 for changeset 2ef0ac749a14</b>
-  <span class="logtags"><span class="branchtag" title="default">default</span> </span>
+  <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="default">default</span> </span>
   </a>
   </td>
   <td class="link" nowrap>
@@ -1626,7 +1626,7 @@
   <td>
   <a class="list" href="/rev/2ef0ac749a14?style=gitweb">
   <b>base</b>
-  <span class="logtags"><span class="tagtag" title="1.0">1.0</span> <span class="bookmarktag" title="anotherthing">anotherthing</span> </span>
+  <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="tagtag" title="1.0">1.0</span> <span class="bookmarktag" title="anotherthing">anotherthing</span> </span>
   </a>
   </td>
   <td class="link" nowrap>
@@ -1781,65 +1781,49 @@
   
   <div id="wrapper">
   <ul id="nodebgs"></ul>
-  <canvas id="graph" width="39" height="168"></canvas>
-  <ul id="graphnodes"></ul>
+  <canvas id="graph"></canvas>
+  <ul id="graphnodes"><li data-node="cad8025a2e87">
+   <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="info">1970-01-01, by test</span>
+  </li>
+  <li data-node="1d22e65f027e">
+   <span class="desc">
+    <a class="list" href="/rev/1d22e65f027e?style=gitweb"><b>branch</b></a>
+   </span>
+   <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="stable">stable</span> </span>
+   <span class="info">1970-01-01, by test</span>
+  </li>
+  <li data-node="a4f92ed23982">
+   <span class="desc">
+    <a class="list" href="/rev/a4f92ed23982?style=gitweb"><b>Added tag 1.0 for changeset 2ef0ac749a14</b></a>
+   </span>
+   <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="default">default</span> </span>
+   <span class="info">1970-01-01, by test</span>
+  </li>
+  <li data-node="2ef0ac749a14">
+   <span class="desc">
+    <a class="list" href="/rev/2ef0ac749a14?style=gitweb"><b>base</b></a>
+   </span>
+   <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="tagtag" title="1.0">1.0</span> <span class="bookmarktag" title="anotherthing">anotherthing</span> </span>
+   <span class="info">1970-01-01, by test</span>
+  </li>
+  </ul>
   </div>
   
   <script>
-  <!-- hide script content
-  
-  var data = [["cad8025a2e87", [0, 1], [[0, 0, 1, 3, "FF0000"]], "branch commit with null character: \u0000", "test", "1970-01-01", ["unstable", true], ["tip"], ["something"]], ["1d22e65f027e", [0, 1], [[0, 0, 1, 3, ""]], "branch", "test", "1970-01-01", ["stable", true], [], []], ["a4f92ed23982", [0, 1], [[0, 0, 1, 3, ""]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], [], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"], ["anotherthing"]]];
+  var data = [{"edges": [[0, 0, 1, 3, "FF0000"]], "node": "cad8025a2e87", "vertex": [0, 1]}, {"edges": [[0, 0, 1, 3, ""]], "node": "1d22e65f027e", "vertex": [0, 1]}, {"edges": [[0, 0, 1, 3, ""]], "node": "a4f92ed23982", "vertex": [0, 1]}, {"edges": [], "node": "2ef0ac749a14", "vertex": [0, 1]}];
   var graph = new Graph();
   graph.scale(39);
   
-  graph.vertex = function(x, y, color, parity, cur) {
-  	
-  	this.ctx.beginPath();
-  	color = this.setColor(color, 0.25, 0.75);
-  	this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
-  	this.ctx.fill();
-  	
-  	var bg = '<li class="bg parity' + parity + '"></li>';
-  	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
-  	var nstyle = 'padding-left: ' + left + 'px;';
-  	
-  	var tagspan = '';
-  	if (cur[7].length || cur[8].length || (cur[6][0] != 'default' || cur[6][1])) {
-  		tagspan = '<span class="logtags">';
-  		if (cur[6][1]) {
-  			tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
-  			tagspan += cur[6][0] + '</span> ';
-  		} else if (!cur[6][1] && cur[6][0] != 'default') {
-  			tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
-  			tagspan += cur[6][0] + '</span> ';
-  		}
-  		if (cur[7].length) {
-  			for (var t in cur[7]) {
-  				var tag = cur[7][t];
-  				tagspan += '<span class="tagtag">' + tag + '</span> ';
-  			}
-  		}
-  		if (cur[8].length) {
-  			for (var t in cur[8]) {
-  				var bookmark = cur[8][t];
-  				tagspan += '<span class="bookmarktag">' + bookmark + '</span> ';
-  			}
-  		}
-  		tagspan += '</span>';
-  	}
-  	
-  	var item = '<li style="' + nstyle + '"><span class="desc">';
-  	item += '<a class="list" href="/rev/' + cur[0] + '?style=gitweb" title="' + cur[0] + '"><b>' + cur[3] + '</b></a>';
-  	item += '</span> ' + tagspan + '';
-  	item += '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
-  
-  	return [bg, item];
-  	
+  graph.vertex = function(x, y, radius, color, parity, cur) {
+  	Graph.prototype.vertex.apply(this, arguments);
+  	return ['<li class="bg parity' + parity + '"></li>', ''];
   }
   
   graph.render(data);
-  
-  // stop hiding script -->
   </script>
   
   <div class="extra_nav">
@@ -1850,9 +1834,12 @@
   
   <script type="text/javascript">
       ajaxScrollInit(
-              '/graph/3?revcount=%next%&style=gitweb',
-              60+60,
-              function (htmlText, previousVal) { return previousVal + 60; },
+              '/graph/%next%?graphtop=cad8025a2e87f88c06259790adfa15acb4080123&style=gitweb',
+              '', <!-- NEXTHASH
+              function (htmlText, previousVal) {
+                  var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/);
+                  return m ? m[1] : null;
+              },
               '#wrapper',
               '<div class="%class%" style="text-align: center;">%text%</div>',
               'graph'
@@ -1926,7 +1913,7 @@
   $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities'; echo
   200 Script output follows
   
-  lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Aphases%3Dheads%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=*zlib (glob)
+  lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch $USUAL_BUNDLE2_CAPS$ unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=*zlib (glob)
 
 heads
 
@@ -2093,8 +2080,6 @@
   ul#graphnodes li .info {
   	display: block;
   	font-size: 70%;
-  	position: relative;
-  	top: -1px;
   }
 
 Stop and restart the server at the directory different from the repository
@@ -2126,27 +2111,6 @@
   
   
 
-Stop and restart with HGENCODING=cp932 and preferuncompressed
-
-  $ killdaemons.py
-  $ HGENCODING=cp932 hg serve --config server.preferuncompressed=True -n test \
-  >     -p $HGPORT -d --pid-file=hg.pid -E errors.log
-  $ cat hg.pid >> $DAEMON_PIDS
-
-commit message with Japanese Kanji 'Noh', which ends with '\x5c'
-
-  $ echo foo >> foo
-  $ HGENCODING=cp932 hg ci -m `$PYTHON -c 'print("\x94\x5c")'`
-
-Graph json escape of multibyte character
-
-  $ get-with-headers.py $LOCALIP:$HGPORT 'graph/' > out
-  >>> from __future__ import print_function
-  >>> for line in open("out"):
-  ...     if line.startswith("var data ="):
-  ...         print(line, end='')
-  var data = [["061dd13ba3c3", [0, 1], [[0, 0, 1, -1, ""]], "\u80fd", "test", "1970-01-01", ["unstable", true], ["tip"], ["something"]], ["cad8025a2e87", [0, 1], [[0, 0, 1, 3, "FF0000"]], "branch commit with null character: \u0000", "test", "1970-01-01", ["unstable", false], [], []], ["1d22e65f027e", [0, 1], [[0, 0, 1, 3, ""]], "branch", "test", "1970-01-01", ["stable", true], [], []], ["a4f92ed23982", [0, 1], [[0, 0, 1, 3, ""]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], [], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"], ["anotherthing"]]];
-
 capabilities
 
 (plain version to check the format)
@@ -2174,7 +2138,7 @@
   batch
   stream-preferred
   streamreqs=generaldelta,revlogv1
-  bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Aphases%3Dheads%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps
+  $USUAL_BUNDLE2_CAPS$
   unbundle=HG10GZ,HG10BZ,HG10UN
   httpheader=1024
   httpmediatype=0.1rx,0.1tx,0.2tx
--- a/tests/test-hgweb-descend-empties.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgweb-descend-empties.t	Tue Dec 19 16:27:24 2017 -0500
@@ -73,7 +73,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    directory / @ 0:<a href="/rev/c9f45f7a1659">c9f45f7a1659</a>
-   <span class="tag">tip</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -193,7 +193,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    directory / @ 0:<a href="/rev/c9f45f7a1659?style=coal">c9f45f7a1659</a>
-   <span class="tag">tip</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -317,7 +317,7 @@
       </ul>
   
       <h2 class="no-link no-border">files</h2>
-      <p class="files">/ <span class="logtags"><span class="branchtag" title="default">default</span> <span class="tagtag" title="tip">tip</span> </span></p>
+      <p class="files">/ <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="default">default</span> <span class="tagtag" title="tip">tip</span> </span></p>
   
       <table>
           <tr class="parity0">
@@ -431,7 +431,7 @@
   </div>
   </div>
   
-  <div class="title">/ <span class="logtags"><span class="branchtag" title="default">default</span> <span class="tagtag" title="tip">tip</span> </span></div>
+  <div class="title">/ <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="default">default</span> <span class="tagtag" title="tip">tip</span> </span></div>
   <table cellspacing="0">
   <tr class="parity0">
   <td style="font-family:monospace">drwxr-xr-x</td>
--- a/tests/test-hgweb-diffs.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgweb-diffs.t	Tue Dec 19 16:27:24 2017 -0500
@@ -81,7 +81,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    changeset 0:<a href="/rev/0cd96de13884">0cd96de13884</a>
-   
+   <span class="phase">draft</span> 
   </h3>
   
   
@@ -254,7 +254,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    diff b @ 1:<a href="/rev/559edbd9ed20">559edbd9ed20</a>
-   <span class="tag">tip</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -376,7 +376,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    changeset 0:<a href="/rev/0cd96de13884">0cd96de13884</a>
-   
+   <span class="phase">draft</span> 
   </h3>
   
   
@@ -553,7 +553,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    diff a @ 1:<a href="/rev/559edbd9ed20">559edbd9ed20</a>
-   <span class="tag">tip</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -659,7 +659,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    comparison a @ 0:<a href="/rev/0cd96de13884">0cd96de13884</a>
-   
+   <span class="phase">draft</span> 
   </h3>
   
   
@@ -789,7 +789,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    comparison a @ 2:<a href="/rev/d73db4d812ff">d73db4d812ff</a>
-   <span class="tag">tip</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -921,7 +921,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    comparison a @ 3:<a href="/rev/20e80271eb7a">20e80271eb7a</a>
-   <span class="tag">tip</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -1059,7 +1059,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    comparison e @ 5:<a href="/rev/41d9fc4a6ae1">41d9fc4a6ae1</a>
-   <span class="tag">tip</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
--- a/tests/test-hgweb-empty.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgweb-empty.t	Tue Dec 19 16:27:24 2017 -0500
@@ -295,64 +295,21 @@
   
   <div id="wrapper">
   <ul id="nodebgs" class="stripes2"></ul>
-  <canvas id="graph" width="39" height="12"></canvas>
+  <canvas id="graph"></canvas>
   <ul id="graphnodes"></ul>
   </div>
   
   <script type="text/javascript">
-  <!-- hide script content
-  
   var data = [];
   var graph = new Graph();
   graph.scale(39);
   
-  graph.vertex = function(x, y, color, parity, cur) {
-  	
-  	this.ctx.beginPath();
-  	color = this.setColor(color, 0.25, 0.75);
-  	this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
-  	this.ctx.fill();
-  	
-  	var bg = '<li class="bg"></li>';
-  	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
-  	var nstyle = 'padding-left: ' + left + 'px;';
-  
-  	var tagspan = '';
-  	if (cur[7].length || cur[8].length || (cur[6][0] != 'default' || cur[6][1])) {
-  		tagspan = '<span class="logtags">';
-  		if (cur[6][1]) {
-  			tagspan += '<span class="branchhead" title="' + cur[6][0] + '">';
-  			tagspan += cur[6][0] + '</span> ';
-  		} else if (!cur[6][1] && cur[6][0] != 'default') {
-  			tagspan += '<span class="branchname" title="' + cur[6][0] + '">';
-  			tagspan += cur[6][0] + '</span> ';
-  		}
-  		if (cur[7].length) {
-  			for (var t in cur[7]) {
-  				var tag = cur[7][t];
-  				tagspan += '<span class="tag">' + tag + '</span> ';
-  			}
-  		}
-  		if (cur[8].length) {
-  			for (var b in cur[8]) {
-  				var bookmark = cur[8][b];
-  				tagspan += '<span class="tag">' + bookmark + '</span> ';
-  			}
-  		}
-  		tagspan += '</span>';
-  	}
-  
-  	var item = '<li style="' + nstyle + '"><span class="desc">';
-  	item += '<a href="/rev/' + cur[0] + '" title="' + cur[0] + '">' + cur[3] + '</a>';
-  	item += '</span>' + tagspan + '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
-  	
-  	return [bg, item];
-  	
+  graph.vertex = function(x, y, radius, color, parity, cur) {
+  	Graph.prototype.vertex.apply(this, arguments);
+  	return ['<li class="bg"></li>', ''];
   }
   
   graph.render(data);
-  
-  // stop hiding script -->
   </script>
   
   <div class="navigate">
@@ -363,9 +320,12 @@
   
   <script type="text/javascript">
       ajaxScrollInit(
-              '/graph/-1?revcount=%next%&style=paper',
-              60+60,
-              function (htmlText, previousVal) { return previousVal + 60; },
+              '/graph/%next%?graphtop=0000000000000000000000000000000000000000',
+              '', <!-- NEXTHASH
+              function (htmlText, previousVal) {
+                  var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/);
+                  return m ? m[1] : null;
+              },
               '#wrapper',
               '<div class="%class%" style="text-align: center;">%text%</div>',
               'graph'
--- a/tests/test-hgweb-filelog.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgweb-filelog.t	Tue Dec 19 16:27:24 2017 -0500
@@ -189,7 +189,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log a @ 4:<a href="/rev/3f41bc784e7e">3f41bc784e7e</a>
-   <span class="branchname">a-branch</span> 
+   <span class="phase">draft</span> <span class="branchname">a-branch</span> 
    
   </h3>
   
@@ -220,7 +220,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/3f41bc784e7e">second a</a>
-     <span class="branchname">a-branch</span> 
+     <span class="phase">draft</span> <span class="branchname">a-branch</span> 
     </td>
    </tr>
    
@@ -229,7 +229,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/5ed941583260">first a</a>
-     <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
+     <span class="phase">draft</span> <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
     </td>
    </tr>
    
@@ -312,7 +312,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log a @ 4:<a href="/rev/3f41bc784e7e">3f41bc784e7e</a>
-   <span class="branchname">a-branch</span> 
+   <span class="phase">draft</span> <span class="branchname">a-branch</span> 
    
   </h3>
   
@@ -343,7 +343,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/3f41bc784e7e">second a</a>
-     <span class="branchname">a-branch</span> 
+     <span class="phase">draft</span> <span class="branchname">a-branch</span> 
     </td>
    </tr>
    
@@ -352,7 +352,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/5ed941583260">first a</a>
-     <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
+     <span class="phase">draft</span> <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
     </td>
    </tr>
    
@@ -435,7 +435,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log a @ 1:<a href="/rev/5ed941583260">5ed941583260</a>
-   <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
+   <span class="phase">draft</span> <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
    
   </h3>
   
@@ -466,7 +466,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/5ed941583260">first a</a>
-     <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
+     <span class="phase">draft</span> <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
     </td>
    </tr>
    
@@ -549,7 +549,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log a @ 1:<a href="/rev/5ed941583260">5ed941583260</a>
-   <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
+   <span class="phase">draft</span> <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
    
   </h3>
   
@@ -580,7 +580,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/5ed941583260">first a</a>
-     <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
+     <span class="phase">draft</span> <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
     </td>
    </tr>
    
@@ -740,8 +740,8 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log c @ 7:<a href="/rev/46c1a66bd8fc">46c1a66bd8fc</a>
-   <span class="branchname">a-branch</span> <span class="tag">tip</span> 
-    (following lines 1:2 <a href="/log/tip/c">back to filelog</a>)
+   <span class="phase">draft</span> <span class="branchhead">a-branch</span> <span class="tag">tip</span> 
+    (following lines 1:2 <a href="/log/tip/c">all revisions for this file</a>)
   </h3>
   
   
@@ -771,7 +771,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/46c1a66bd8fc">change c</a>
-     <span class="branchhead">a-branch</span> <span class="tag">tip</span> 
+     <span class="phase">draft</span> <span class="branchhead">a-branch</span> <span class="tag">tip</span> 
     </td>
    </tr>
    
@@ -780,7 +780,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/6563da9dcf87">b</a>
-     
+     <span class="phase">draft</span> 
     </td>
    </tr>
    
@@ -860,8 +860,8 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log c @ 7:<a href="/rev/46c1a66bd8fc?revcount=1">46c1a66bd8fc</a>
-   <span class="branchname">a-branch</span> <span class="tag">tip</span> 
-    (following lines 1:2 <a href="/log/tip/c?revcount=1">back to filelog</a>)
+   <span class="phase">draft</span> <span class="branchhead">a-branch</span> <span class="tag">tip</span> 
+    (following lines 1:2 <a href="/log/tip/c?revcount=1">all revisions for this file</a>)
   </h3>
   
   
@@ -891,7 +891,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/46c1a66bd8fc?revcount=1">change c</a>
-     <span class="branchhead">a-branch</span> <span class="tag">tip</span> 
+     <span class="phase">draft</span> <span class="branchhead">a-branch</span> <span class="tag">tip</span> 
     </td>
    </tr>
    
@@ -1097,7 +1097,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log a @ 4:<a href="/rev/3f41bc784e7e">3f41bc784e7e</a>
-   <span class="branchname">a-branch</span> 
+   <span class="phase">draft</span> <span class="branchname">a-branch</span> 
    
   </h3>
   
@@ -1128,7 +1128,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/3f41bc784e7e">second a</a>
-     <span class="branchname">a-branch</span> 
+     <span class="phase">draft</span> <span class="branchname">a-branch</span> 
     </td>
    </tr>
    <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -1141,7 +1141,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/5ed941583260">first a</a>
-     <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
+     <span class="phase">draft</span> <span class="tag">a-tag</span> <span class="tag">a-bookmark</span> 
     </td>
    </tr>
    <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -1379,8 +1379,8 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log c @ 12:<a href="/rev/6e4182052f7b">6e4182052f7b</a>
-   <span class="branchname">a-branch</span> <span class="tag">tip</span> 
-    (following lines 3:4 <a href="/log/tip/c">back to filelog</a>)
+   <span class="phase">draft</span> <span class="branchhead">a-branch</span> <span class="tag">tip</span> 
+    (following lines 3:4 <a href="/log/tip/c">all revisions for this file</a>)
   </h3>
   
   
@@ -1410,7 +1410,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/fb9bc322513a">touching beginning and end of c</a>
-     <span class="branchname">a-branch</span> 
+     <span class="phase">draft</span> <span class="branchname">a-branch</span> 
     </td>
    </tr>
    <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -1429,7 +1429,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/e95928d60479">touch beginning of c</a>
-     <span class="branchname">a-branch</span> 
+     <span class="phase">draft</span> <span class="branchname">a-branch</span> 
     </td>
    </tr>
    <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -1449,7 +1449,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/5c6574614c37">make c bigger and touch its beginning</a>
-     <span class="branchname">a-branch</span> 
+     <span class="phase">draft</span> <span class="branchname">a-branch</span> 
     </td>
    </tr>
    <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -1473,7 +1473,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/46c1a66bd8fc">change c</a>
-     <span class="branchname">a-branch</span> 
+     <span class="phase">draft</span> <span class="branchname">a-branch</span> 
     </td>
    </tr>
    <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -1487,7 +1487,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/6563da9dcf87">b</a>
-     
+     <span class="phase">draft</span> 
     </td>
    </tr>
    <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -1636,8 +1636,8 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    log c @ 8:<a href="/rev/5c6574614c37">5c6574614c37</a>
-   <span class="branchname">a-branch</span> 
-    (following lines 3:4, descending <a href="/log/8/c">back to filelog</a>)
+   <span class="phase">draft</span> <span class="branchname">a-branch</span> 
+    (following lines 3:4, descending <a href="/log/8/c">all revisions for this file</a>)
   </h3>
   
   
@@ -1667,7 +1667,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/5c6574614c37">make c bigger and touch its beginning</a>
-     <span class="branchname">a-branch</span> 
+     <span class="phase">draft</span> <span class="branchname">a-branch</span> 
     </td>
    </tr>
    
@@ -1676,7 +1676,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/e95928d60479">touch beginning of c</a>
-     <span class="branchname">a-branch</span> 
+     <span class="phase">draft</span> <span class="branchname">a-branch</span> 
     </td>
    </tr>
    
@@ -1685,7 +1685,7 @@
     <td class="author">test</td>
     <td class="description">
      <a href="/rev/fb9bc322513a">touching beginning and end of c</a>
-     <span class="branchname">a-branch</span> 
+     <span class="phase">draft</span> <span class="branchname">a-branch</span> 
     </td>
    </tr>
    
--- a/tests/test-hgweb-json.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgweb-json.t	Tue Dec 19 16:27:24 2017 -0500
@@ -1335,7 +1335,356 @@
   $ request json-graph
   200 Script output follows
   
-  "not yet implemented"
+  {
+    "changeset_count": 10,
+    "changesets": [
+      {
+        "bookmarks": [],
+        "branch": "default",
+        "col": 0,
+        "color": 1,
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "merge test-branch into default",
+        "edges": [
+          {
+            "bcolor": "",
+            "col": 0,
+            "color": 1,
+            "nextcol": 0,
+            "width": -1
+          },
+          {
+            "bcolor": "",
+            "col": 0,
+            "color": 1,
+            "nextcol": 1,
+            "width": -1
+          }
+        ],
+        "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
+        "parents": [
+          "ceed296fe500c3fac9541e31dad860cb49c89e45",
+          "ed66c30e87eb65337c05a4229efaa5f1d5285a90"
+        ],
+        "phase": "draft",
+        "row": 0,
+        "tags": [
+          "tip"
+        ],
+        "user": "test"
+      },
+      {
+        "bookmarks": [],
+        "branch": "test-branch",
+        "col": 1,
+        "color": 2,
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "another commit in test-branch",
+        "edges": [
+          {
+            "bcolor": "",
+            "col": 0,
+            "color": 1,
+            "nextcol": 0,
+            "width": -1
+          },
+          {
+            "bcolor": "",
+            "col": 1,
+            "color": 2,
+            "nextcol": 1,
+            "width": -1
+          }
+        ],
+        "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
+        "parents": [
+          "6ab967a8ab3489227a83f80e920faa039a71819f"
+        ],
+        "phase": "draft",
+        "row": 1,
+        "tags": [],
+        "user": "test"
+      },
+      {
+        "bookmarks": [],
+        "branch": "test-branch",
+        "col": 1,
+        "color": 2,
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "create test branch",
+        "edges": [
+          {
+            "bcolor": "",
+            "col": 0,
+            "color": 1,
+            "nextcol": 0,
+            "width": -1
+          },
+          {
+            "bcolor": "",
+            "col": 1,
+            "color": 2,
+            "nextcol": 1,
+            "width": -1
+          }
+        ],
+        "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
+        "parents": [
+          "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
+        ],
+        "phase": "draft",
+        "row": 2,
+        "tags": [],
+        "user": "test"
+      },
+      {
+        "bookmarks": [
+          "bookmark2"
+        ],
+        "branch": "default",
+        "col": 0,
+        "color": 1,
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "create tag2",
+        "edges": [
+          {
+            "bcolor": "",
+            "col": 0,
+            "color": 1,
+            "nextcol": 0,
+            "width": -1
+          },
+          {
+            "bcolor": "",
+            "col": 1,
+            "color": 2,
+            "nextcol": 1,
+            "width": -1
+          }
+        ],
+        "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
+        "parents": [
+          "f2890a05fea49bfaf9fb27ed5490894eba32da78"
+        ],
+        "phase": "draft",
+        "row": 3,
+        "tags": [],
+        "user": "test"
+      },
+      {
+        "bookmarks": [],
+        "branch": "default",
+        "col": 0,
+        "color": 1,
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "another commit to da/foo",
+        "edges": [
+          {
+            "bcolor": "",
+            "col": 0,
+            "color": 1,
+            "nextcol": 0,
+            "width": -1
+          },
+          {
+            "bcolor": "",
+            "col": 1,
+            "color": 2,
+            "nextcol": 1,
+            "width": -1
+          }
+        ],
+        "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
+        "parents": [
+          "93a8ce14f89156426b7fa981af8042da53f03aa0"
+        ],
+        "phase": "draft",
+        "row": 4,
+        "tags": [
+          "tag2"
+        ],
+        "user": "test"
+      },
+      {
+        "bookmarks": [],
+        "branch": "default",
+        "col": 0,
+        "color": 1,
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "create tag",
+        "edges": [
+          {
+            "bcolor": "",
+            "col": 0,
+            "color": 1,
+            "nextcol": 0,
+            "width": -1
+          },
+          {
+            "bcolor": "",
+            "col": 1,
+            "color": 2,
+            "nextcol": 1,
+            "width": -1
+          }
+        ],
+        "node": "93a8ce14f89156426b7fa981af8042da53f03aa0",
+        "parents": [
+          "78896eb0e102174ce9278438a95e12543e4367a7"
+        ],
+        "phase": "public",
+        "row": 5,
+        "tags": [],
+        "user": "test"
+      },
+      {
+        "bookmarks": [],
+        "branch": "default",
+        "col": 0,
+        "color": 1,
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "move foo",
+        "edges": [
+          {
+            "bcolor": "",
+            "col": 0,
+            "color": 1,
+            "nextcol": 0,
+            "width": -1
+          },
+          {
+            "bcolor": "",
+            "col": 1,
+            "color": 2,
+            "nextcol": 1,
+            "width": -1
+          }
+        ],
+        "node": "78896eb0e102174ce9278438a95e12543e4367a7",
+        "parents": [
+          "8d7c456572acf3557e8ed8a07286b10c408bcec5"
+        ],
+        "phase": "public",
+        "row": 6,
+        "tags": [
+          "tag1"
+        ],
+        "user": "test"
+      },
+      {
+        "bookmarks": [
+          "bookmark1"
+        ],
+        "branch": "default",
+        "col": 0,
+        "color": 1,
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "modify da/foo",
+        "edges": [
+          {
+            "bcolor": "",
+            "col": 0,
+            "color": 1,
+            "nextcol": 0,
+            "width": -1
+          },
+          {
+            "bcolor": "",
+            "col": 1,
+            "color": 2,
+            "nextcol": 1,
+            "width": -1
+          }
+        ],
+        "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
+        "parents": [
+          "f8bbb9024b10f93cdbb8d940337398291d40dea8"
+        ],
+        "phase": "public",
+        "row": 7,
+        "tags": [],
+        "user": "test"
+      },
+      {
+        "bookmarks": [],
+        "branch": "default",
+        "col": 0,
+        "color": 1,
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "modify foo",
+        "edges": [
+          {
+            "bcolor": "",
+            "col": 0,
+            "color": 1,
+            "nextcol": 0,
+            "width": -1
+          },
+          {
+            "bcolor": "",
+            "col": 1,
+            "color": 2,
+            "nextcol": 0,
+            "width": -1
+          }
+        ],
+        "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
+        "parents": [
+          "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
+        ],
+        "phase": "public",
+        "row": 8,
+        "tags": [],
+        "user": "test"
+      },
+      {
+        "bookmarks": [],
+        "branch": "default",
+        "col": 0,
+        "color": 2,
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "initial",
+        "edges": [],
+        "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
+        "parents": [],
+        "phase": "public",
+        "row": 9,
+        "tags": [],
+        "user": "test"
+      }
+    ],
+    "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7"
+  }
 
 help/ shows help topics
 
@@ -1581,6 +1930,10 @@
         "topic": "filesets"
       },
       {
+        "summary": "Command-line flags",
+        "topic": "flags"
+      },
+      {
         "summary": "Glossary",
         "topic": "glossary"
       },
@@ -1644,3 +1997,28 @@
     "rawdoc": "Working with Phases\n*", (glob)
     "topic": "phases"
   }
+
+Commit message with Japanese Kanji 'Noh', which ends with '\x5c'
+
+  $ echo foo >> da/foo
+  $ HGENCODING=cp932 hg ci -m `$PYTHON -c 'print("\x94\x5c")'`
+
+Commit message with null character
+
+  $ echo foo >> da/foo
+  >>> open('msg', 'wb').write('commit with null character: \0\n')
+  $ hg ci -l msg
+  $ rm msg
+
+Stop and restart with HGENCODING=cp932
+
+  $ killdaemons.py
+  $ HGENCODING=cp932 hg serve -p $HGPORT -d --pid-file=hg.pid \
+  > -A access.log -E error.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+Test json escape of multibyte characters
+
+  $ request json-filelog/tip/da/foo?revcount=2 | grep '"desc":'
+        "desc": "commit with null character: \u0000",
+        "desc": "\u80fd",
--- a/tests/test-hgweb-removed.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgweb-removed.t	Tue Dec 19 16:27:24 2017 -0500
@@ -62,7 +62,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    changeset 1:<a href="/rev/c78f6c5cbea9">c78f6c5cbea9</a>
-   <span class="tag">tip</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -190,7 +190,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    diff a @ 1:<a href="/rev/c78f6c5cbea9">c78f6c5cbea9</a>
-   <span class="tag">tip</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
--- a/tests/test-hgweb-symrev.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgweb-symrev.t	Tue Dec 19 16:27:24 2017 -0500
@@ -59,6 +59,9 @@
   <a href="/graph/tip?revcount=30&style=paper">less</a>
   <a href="/graph/tip?revcount=120&style=paper">more</a>
   | rev 2: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a> 
+    <a href="/rev/9d8c40cba617?style=paper">third</a>
+    <a href="/rev/a7c1559b7bba?style=paper">second</a>
+    <a href="/rev/43c799df6e75?style=paper">first</a>
   <a href="/graph/tip?revcount=30&style=paper">less</a>
   <a href="/graph/tip?revcount=120&style=paper">more</a>
   | rev 2: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a> 
@@ -123,6 +126,8 @@
   <a href="/graph/xyzzy?revcount=30&style=paper">less</a>
   <a href="/graph/xyzzy?revcount=120&style=paper">more</a>
   | rev 1: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a> 
+    <a href="/rev/a7c1559b7bba?style=paper">second</a>
+    <a href="/rev/43c799df6e75?style=paper">first</a>
   <a href="/graph/xyzzy?revcount=30&style=paper">less</a>
   <a href="/graph/xyzzy?revcount=120&style=paper">more</a>
   | rev 1: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a> 
@@ -254,6 +259,9 @@
   <a href="/graph/tip?revcount=30&style=coal">less</a>
   <a href="/graph/tip?revcount=120&style=coal">more</a>
   | rev 2: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a> 
+    <a href="/rev/9d8c40cba617?style=coal">third</a>
+    <a href="/rev/a7c1559b7bba?style=coal">second</a>
+    <a href="/rev/43c799df6e75?style=coal">first</a>
   <a href="/graph/tip?revcount=30&style=coal">less</a>
   <a href="/graph/tip?revcount=120&style=coal">more</a>
   | rev 2: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a> 
@@ -318,6 +326,8 @@
   <a href="/graph/xyzzy?revcount=30&style=coal">less</a>
   <a href="/graph/xyzzy?revcount=120&style=coal">more</a>
   | rev 1: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a> 
+    <a href="/rev/a7c1559b7bba?style=coal">second</a>
+    <a href="/rev/43c799df6e75?style=coal">first</a>
   <a href="/graph/xyzzy?revcount=30&style=coal">less</a>
   <a href="/graph/xyzzy?revcount=120&style=coal">more</a>
   | rev 1: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a> 
@@ -468,11 +478,11 @@
   <a href="/graph/tip?style=gitweb">graph</a> |
   <a href="/file/tip?style=gitweb">files</a> | <a href="/archive/tip.zip">zip</a>  |
   <a href="/log/43c799df6e75?style=gitweb">(0)</a>  <a href="/log/tip?style=gitweb">tip</a> <br/>
-  <a class="title" href="/rev/9d8c40cba617?style=gitweb"><span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span>third<span class="logtags"> <span class="branchtag" title="default">default</span> <span class="tagtag" title="tip">tip</span> </span></a>
+   <a class="title" href="/rev/9d8c40cba617?style=gitweb">
   <a href="/rev/9d8c40cba617?style=gitweb">changeset</a><br/>
-  <a class="title" href="/rev/a7c1559b7bba?style=gitweb"><span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span>second<span class="logtags"> <span class="bookmarktag" title="xyzzy">xyzzy</span> </span></a>
+   <a class="title" href="/rev/a7c1559b7bba?style=gitweb">
   <a href="/rev/a7c1559b7bba?style=gitweb">changeset</a><br/>
-  <a class="title" href="/rev/43c799df6e75?style=gitweb"><span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span>first<span class="logtags"> </span></a>
+   <a class="title" href="/rev/43c799df6e75?style=gitweb">
   <a href="/rev/43c799df6e75?style=gitweb">changeset</a><br/>
   <a href="/log/43c799df6e75?style=gitweb">(0)</a>  <a href="/log/tip?style=gitweb">tip</a> <br/>
 
@@ -483,6 +493,9 @@
   <a href="/graph/tip?revcount=30&style=gitweb">less</a>
   <a href="/graph/tip?revcount=120&style=gitweb">more</a>
   | <a href="/graph/43c799df6e75?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a> 
+    <a class="list" href="/rev/9d8c40cba617?style=gitweb"><b>third</b></a>
+    <a class="list" href="/rev/a7c1559b7bba?style=gitweb"><b>second</b></a>
+    <a class="list" href="/rev/43c799df6e75?style=gitweb"><b>first</b></a>
   <a href="/graph/tip?revcount=30&style=gitweb">less</a>
   <a href="/graph/tip?revcount=120&style=gitweb">more</a>
   | <a href="/graph/43c799df6e75?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a> 
@@ -518,11 +531,11 @@
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'shortlog?style=gitweb&rev=all()' | egrep $REVLINKS
   <a href="/file?style=gitweb">files</a> | <a href="/archive/tip.zip">zip</a> 
-  <a class="title" href="/rev/9d8c40cba617?style=gitweb"><span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span>third<span class="logtags"> <span class="branchtag" title="default">default</span> <span class="tagtag" title="tip">tip</span> </span></a>
+   <a class="title" href="/rev/9d8c40cba617?style=gitweb">
   <a href="/rev/9d8c40cba617?style=gitweb">changeset</a><br/>
-  <a class="title" href="/rev/a7c1559b7bba?style=gitweb"><span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span>second<span class="logtags"> <span class="bookmarktag" title="xyzzy">xyzzy</span> </span></a>
+   <a class="title" href="/rev/a7c1559b7bba?style=gitweb">
   <a href="/rev/a7c1559b7bba?style=gitweb">changeset</a><br/>
-  <a class="title" href="/rev/43c799df6e75?style=gitweb"><span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span>first<span class="logtags"> </span></a>
+   <a class="title" href="/rev/43c799df6e75?style=gitweb">
   <a href="/rev/43c799df6e75?style=gitweb">changeset</a><br/>
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'rev/xyzzy?style=gitweb' | egrep $REVLINKS
@@ -531,7 +544,7 @@
   <a href="/graph/xyzzy?style=gitweb">graph</a> |
   <a href="/file/xyzzy?style=gitweb">files</a> |
   <a href="/raw-rev/xyzzy">raw</a>  | <a href="/archive/xyzzy.zip">zip</a>  |
-  <a class="title" href="/raw-rev/a7c1559b7bba">second <span class="logtags"><span class="bookmarktag" title="xyzzy">xyzzy</span> </span></a>
+   <a class="title" href="/raw-rev/a7c1559b7bba">
    <td style="font-family:monospace"><a class="list" href="/rev/a7c1559b7bba?style=gitweb">a7c1559b7bba</a></td>
   <a class="list" href="/rev/43c799df6e75?style=gitweb">43c799df6e75</a>
   <a class="list" href="/rev/9d8c40cba617?style=gitweb">9d8c40cba617</a>
@@ -560,9 +573,9 @@
   <a href="/graph/xyzzy?style=gitweb">graph</a> |
   <a href="/file/xyzzy?style=gitweb">files</a> | <a href="/archive/xyzzy.zip">zip</a>  |
   <a href="/log/43c799df6e75?style=gitweb">(0)</a>  <a href="/log/tip?style=gitweb">tip</a> <br/>
-  <a class="title" href="/rev/a7c1559b7bba?style=gitweb"><span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span>second<span class="logtags"> <span class="bookmarktag" title="xyzzy">xyzzy</span> </span></a>
+   <a class="title" href="/rev/a7c1559b7bba?style=gitweb">
   <a href="/rev/a7c1559b7bba?style=gitweb">changeset</a><br/>
-  <a class="title" href="/rev/43c799df6e75?style=gitweb"><span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span>first<span class="logtags"> </span></a>
+   <a class="title" href="/rev/43c799df6e75?style=gitweb">
   <a href="/rev/43c799df6e75?style=gitweb">changeset</a><br/>
   <a href="/log/43c799df6e75?style=gitweb">(0)</a>  <a href="/log/tip?style=gitweb">tip</a> <br/>
 
@@ -573,6 +586,8 @@
   <a href="/graph/xyzzy?revcount=30&style=gitweb">less</a>
   <a href="/graph/xyzzy?revcount=120&style=gitweb">more</a>
   | <a href="/graph/43c799df6e75?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a> 
+    <a class="list" href="/rev/a7c1559b7bba?style=gitweb"><b>second</b></a>
+    <a class="list" href="/rev/43c799df6e75?style=gitweb"><b>first</b></a>
   <a href="/graph/xyzzy?revcount=30&style=gitweb">less</a>
   <a href="/graph/xyzzy?revcount=120&style=gitweb">more</a>
   | <a href="/graph/43c799df6e75?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a> 
@@ -709,13 +724,16 @@
               <li><a href="/graph/tip?style=monoblue">graph</a></li>
               <li><a href="/file/tip?style=monoblue">files</a></li>
               <li><a href="/archive/tip.zip">zip</a></li>
-      <h3 class="changelog"><a class="title" href="/rev/9d8c40cba617?style=monoblue">third<span class="logtags"> <span class="branchtag" title="default">default</span> <span class="tagtag" title="tip">tip</span> </span></a></h3>
-  <h3 class="changelog"><a class="title" href="/rev/a7c1559b7bba?style=monoblue">second<span class="logtags"> <span class="bookmarktag" title="xyzzy">xyzzy</span> </span></a></h3>
-  <h3 class="changelog"><a class="title" href="/rev/43c799df6e75?style=monoblue">first<span class="logtags"> </span></a></h3>
+      <a class="title" href="/rev/9d8c40cba617?style=monoblue">
+      <a class="title" href="/rev/a7c1559b7bba?style=monoblue">
+      <a class="title" href="/rev/43c799df6e75?style=monoblue">
   <a href="/log/43c799df6e75?style=monoblue">(0)</a>  <a href="/log/tip?style=monoblue">tip</a> 
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'graph?style=monoblue' | egrep $REVLINKS
               <li><a href="/file/tip?style=monoblue">files</a></li>
+          <a href="/rev/9d8c40cba617?style=monoblue">third</a>
+          <a href="/rev/a7c1559b7bba?style=monoblue">second</a>
+          <a href="/rev/43c799df6e75?style=monoblue">first</a>
           <a href="/graph/tip?revcount=30&style=monoblue">less</a>
           <a href="/graph/tip?revcount=120&style=monoblue">more</a>
           | <a href="/graph/43c799df6e75?style=monoblue">(0)</a> <a href="/graph/tip?style=monoblue">tip</a> 
@@ -753,16 +771,16 @@
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'shortlog?style=monoblue&rev=all()' | egrep $REVLINKS
               <li><a href="/archive/tip.zip">zip</a></li>
-      <h3 class="changelog"><a class="title" href="/rev/9d8c40cba617?style=monoblue">third<span class="logtags"> <span class="branchtag" title="default">default</span> <span class="tagtag" title="tip">tip</span> </span></a></h3>
-  <h3 class="changelog"><a class="title" href="/rev/a7c1559b7bba?style=monoblue">second<span class="logtags"> <span class="bookmarktag" title="xyzzy">xyzzy</span> </span></a></h3>
-  <h3 class="changelog"><a class="title" href="/rev/43c799df6e75?style=monoblue">first<span class="logtags"> </span></a></h3>
+      <a class="title" href="/rev/9d8c40cba617?style=monoblue">
+      <a class="title" href="/rev/a7c1559b7bba?style=monoblue">
+      <a class="title" href="/rev/43c799df6e75?style=monoblue">
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'rev/xyzzy?style=monoblue' | egrep $REVLINKS
               <li><a href="/graph/xyzzy?style=monoblue">graph</a></li>
               <li><a href="/file/xyzzy?style=monoblue">files</a></li>
           <li><a href="/raw-rev/xyzzy">raw</a></li>
           <li><a href="/archive/xyzzy.zip">zip</a></li>
-      <h3 class="changeset"><a href="/raw-rev/a7c1559b7bba">second <span class="logtags"><span class="bookmarktag" title="xyzzy">xyzzy</span> </span></a></h3>
+          <a href="/raw-rev/a7c1559b7bba">
           <dd><a href="/rev/a7c1559b7bba?style=monoblue">a7c1559b7bba</a></dd>
   <dd><a href="/rev/43c799df6e75?style=monoblue">43c799df6e75</a></dd>
   <dd><a href="/rev/9d8c40cba617?style=monoblue">9d8c40cba617</a></dd>
@@ -789,12 +807,14 @@
               <li><a href="/graph/xyzzy?style=monoblue">graph</a></li>
               <li><a href="/file/xyzzy?style=monoblue">files</a></li>
               <li><a href="/archive/xyzzy.zip">zip</a></li>
-      <h3 class="changelog"><a class="title" href="/rev/a7c1559b7bba?style=monoblue">second<span class="logtags"> <span class="bookmarktag" title="xyzzy">xyzzy</span> </span></a></h3>
-  <h3 class="changelog"><a class="title" href="/rev/43c799df6e75?style=monoblue">first<span class="logtags"> </span></a></h3>
+      <a class="title" href="/rev/a7c1559b7bba?style=monoblue">
+      <a class="title" href="/rev/43c799df6e75?style=monoblue">
   <a href="/log/43c799df6e75?style=monoblue">(0)</a>  <a href="/log/tip?style=monoblue">tip</a> 
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'graph/xyzzy?style=monoblue' | egrep $REVLINKS
               <li><a href="/file/xyzzy?style=monoblue">files</a></li>
+          <a href="/rev/a7c1559b7bba?style=monoblue">second</a>
+          <a href="/rev/43c799df6e75?style=monoblue">first</a>
           <a href="/graph/xyzzy?revcount=30&style=monoblue">less</a>
           <a href="/graph/xyzzy?revcount=120&style=monoblue">more</a>
           | <a href="/graph/43c799df6e75?style=monoblue">(0)</a> <a href="/graph/tip?style=monoblue">tip</a> 
@@ -926,6 +946,9 @@
   <a href="/shortlog/tip?style=spartan">shortlog</a>
   <a href="/file/tip/?style=spartan">files</a>
   navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small>
+    <a href="/rev/9d8c40cba617?style=spartan">third</a>
+    <a href="/rev/a7c1559b7bba?style=spartan">second</a>
+    <a href="/rev/43c799df6e75?style=spartan">first</a>
   navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small>
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'tags?style=spartan' | egrep $REVLINKS
@@ -1003,6 +1026,8 @@
   <a href="/shortlog/xyzzy?style=spartan">shortlog</a>
   <a href="/file/xyzzy/?style=spartan">files</a>
   navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small>
+    <a href="/rev/a7c1559b7bba?style=spartan">second</a>
+    <a href="/rev/43c799df6e75?style=spartan">first</a>
   navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small>
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'file/xyzzy?style=spartan' | egrep $REVLINKS
--- a/tests/test-hgweb.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hgweb.t	Tue Dec 19 16:27:24 2017 -0500
@@ -267,7 +267,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    directory / @ 0:<a href="/rev/2ef0ac749a14">2ef0ac749a14</a>
-   <span class="tag">tip</span> <span class="tag">@</span> <span class="tag">a b c</span> <span class="tag">d/e/f</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> <span class="tag">@</span> <span class="tag">a b c</span> <span class="tag">d/e/f</span> 
   </h3>
   
   
@@ -340,7 +340,7 @@
 
   $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server
   200 Script output follows
-  content-length: 9066
+  content-length: 9152
   content-type: text/css
   
   body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
@@ -406,8 +406,6 @@
   }
   td.indexlinks a:hover { background-color: #6666aa; }
   div.pre { font-family:monospace; font-size:12px; white-space:pre; }
-  div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; }
-  div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; }
   
   .search {
       margin-right: 8px;
@@ -467,6 +465,18 @@
   	background-color: #ffaaff;
   	border-color: #ffccff #ff00ee #ff00ee #ffccff;
   }
+  span.logtags span.phasetag {
+  	background-color: #dfafff;
+  	border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
+  }
+  span.logtags span.obsoletetag {
+  	background-color: #dddddd;
+  	border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
+  }
+  span.logtags span.instabilitytag {
+  	background-color: #ffb1c0;
+  	border-color: #ffbbc8 #ff4476 #ff4476 #ffbbc8;
+  }
   span.logtags span.tagtag {
   	background-color: #ffffaa;
   	border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
@@ -536,10 +546,9 @@
   }
   
   div#followlines {
-    background-color: #B7B7B7;
-    border: 1px solid #CCC;
-    border-radius: 5px;
-    padding: 4px;
+    background-color: #FFF;
+    border: 1px solid #d9d8d1;
+    padding: 5px;
     position: fixed;
   }
   
@@ -660,8 +669,6 @@
   ul#graphnodes li .info {
   	display: block;
   	font-size: 100%;
-  	position: relative;
-  	top: -3px;
   	font-style: italic;
   }
   
--- a/tests/test-highlight.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-highlight.t	Tue Dec 19 16:27:24 2017 -0500
@@ -113,7 +113,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    view primes.py @ 0:<a href="/rev/f4fca47b67e6">f4fca47b67e6</a>
-   <span class="tag">tip</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
@@ -252,7 +252,7 @@
   <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
   <h3>
    annotate primes.py @ 0:<a href="/rev/f4fca47b67e6">f4fca47b67e6</a>
-   <span class="tag">tip</span> 
+   <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> 
   </h3>
   
   
--- a/tests/test-histedit-arguments.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-histedit-arguments.t	Tue Dec 19 16:27:24 2017 -0500
@@ -148,7 +148,7 @@
   $ mv .hg/histedit-state.back .hg/histedit-state
 
   $ hg histedit --continue
-  saved backup bundle to $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-histedit.hg (glob)
+  saved backup bundle to $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-histedit.hg
   $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2::
   @  4 f5ed five
   |
@@ -265,7 +265,7 @@
   HG: user: test
   HG: branch 'default'
   HG: changed alpha
-  saved backup bundle to $TESTTMP/foo/.hg/strip-backup/c8e68270e35a-63d8b8d8-histedit.hg (glob)
+  saved backup bundle to $TESTTMP/foo/.hg/strip-backup/c8e68270e35a-63d8b8d8-histedit.hg
 
   $ hg update -q 2
   $ echo x > x
@@ -354,7 +354,8 @@
   $ mv ../corrupt-histedit .hg/histedit-state
   $ hg histedit --abort
   warning: encountered an exception during histedit --abort; the repository may not have been completely cleaned up
-  abort: .*(No such file or directory:|The system cannot find the file specified).* (re)
+  abort: $TESTTMP/foo/.hg/strip-backup/*-histedit.hg: $ENOENT$ (glob) (windows !)
+  abort: $ENOENT$: $TESTTMP/foo/.hg/strip-backup/*-histedit.hg (glob) (no-windows !)
   [255]
 Histedit state has been exited
   $ hg summary -q
--- a/tests/test-histedit-bookmark-motion.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-histedit-bookmark-motion.t	Tue Dec 19 16:27:24 2017 -0500
@@ -88,7 +88,7 @@
   > fold e860deea161a 4 e
   > pick 652413bf663e 5 f
   > EOF
-  saved backup bundle to $TESTTMP/r/.hg/strip-backup/96e494a2d553-45c027ab-histedit.hg (glob)
+  saved backup bundle to $TESTTMP/r/.hg/strip-backup/96e494a2d553-45c027ab-histedit.hg
   $ hg log --graph
   @  changeset:   3:cacdfd884a93
   |  bookmark:    five
@@ -143,7 +143,7 @@
   > pick cacdfd884a93 3 f
   > pick 59d9f330561f 2 d
   > EOF
-  saved backup bundle to $TESTTMP/r/.hg/strip-backup/59d9f330561f-073008af-histedit.hg (glob)
+  saved backup bundle to $TESTTMP/r/.hg/strip-backup/59d9f330561f-073008af-histedit.hg
 
 We expect 'five' to stay at tip, since the tipmost bookmark is most
 likely the useful signal.
--- a/tests/test-histedit-commute.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-histedit-commute.t	Tue Dec 19 16:27:24 2017 -0500
@@ -420,7 +420,7 @@
   > EOF
 
   $ HGEDITOR="sh ./editor.sh" hg histedit 0
-  saved backup bundle to $TESTTMP/issue4251/.hg/strip-backup/b0f4233702ca-4cf5af69-histedit.hg (glob)
+  saved backup bundle to $TESTTMP/issue4251/.hg/strip-backup/b0f4233702ca-4cf5af69-histedit.hg
 
   $ hg --config diff.git=yes export 0
   # HG changeset patch
--- a/tests/test-histedit-edit.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-histedit-edit.t	Tue Dec 19 16:27:24 2017 -0500
@@ -273,7 +273,7 @@
   HG: user: test
   HG: branch 'default'
   HG: added f
-  saved backup bundle to $TESTTMP/r/.hg/strip-backup/b5f70786f9b0-c28d9c86-histedit.hg (glob)
+  saved backup bundle to $TESTTMP/r/.hg/strip-backup/b5f70786f9b0-c28d9c86-histedit.hg
 
   $ hg status
 
@@ -437,7 +437,7 @@
   (hg histedit --continue to resume)
   [1]
   $ HGEDITOR=true hg histedit --continue
-  saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b-histedit.hg (glob)
+  saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b-histedit.hg
 
   $ hg log -G
   @  changeset:   0:0efcea34f18a
--- a/tests/test-histedit-fold.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-histedit-fold.t	Tue Dec 19 16:27:24 2017 -0500
@@ -317,7 +317,7 @@
   continue: hg histedit --continue
   $ hg histedit --continue
   251d831eeec5: empty changeset
-  saved backup bundle to $TESTTMP/fold-to-empty-test/.hg/strip-backup/888f9082bf99-daa0b8b3-histedit.hg (glob)
+  saved backup bundle to $TESTTMP/fold-to-empty-test/.hg/strip-backup/888f9082bf99-daa0b8b3-histedit.hg
   $ hg logt --graph
   @  1:617f94f13c0f +4
   |
@@ -394,7 +394,7 @@
   HG: user: test
   HG: branch 'default'
   HG: changed file
-  saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-3d69522c-histedit.hg (glob)
+  saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-3d69522c-histedit.hg
   $ hg logt -G
   @  1:10c647b2cdd5 +4
   |
--- a/tests/test-histedit-obsolete.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-histedit-obsolete.t	Tue Dec 19 16:27:24 2017 -0500
@@ -51,9 +51,9 @@
   o  0:cb9a9f314b8b a
   
   $ hg debugobsolete
-  e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
-  114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
+  e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
+  1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'}
+  114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'}
 
 With some node gone missing during the edit.
 
@@ -80,13 +80,13 @@
   o  0:cb9a9f314b8b a
   
   $ hg debugobsolete
-  e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
-  114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
-  76f72745eac0643d16530e56e2f86e36e40631f1 2ca853e48edbd6453a0674dc0fe28a0974c51b9c 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  2ca853e48edbd6453a0674dc0fe28a0974c51b9c aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  49d44ab2be1b67a79127568a67c9c99430633b48 273c1f3b86267ed3ec684bb13af1fa4d6ba56e02 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
-  46abc7c4d8738e8563e577f7889e1b6db3da4199 aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
+  e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
+  1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'}
+  114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'}
+  76f72745eac0643d16530e56e2f86e36e40631f1 2ca853e48edbd6453a0674dc0fe28a0974c51b9c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
+  2ca853e48edbd6453a0674dc0fe28a0974c51b9c aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
+  49d44ab2be1b67a79127568a67c9c99430633b48 273c1f3b86267ed3ec684bb13af1fa4d6ba56e02 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'}
+  46abc7c4d8738e8563e577f7889e1b6db3da4199 aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '5', 'operation': 'histedit', 'user': 'test'}
   $ cd ..
 
 Base setup for the rest of the testing
@@ -170,13 +170,13 @@
   o  0:cb9a9f314b8b a
   
   $ hg debugobsolete
-  d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
-  177f92b773850b59254aa5e923436f921b55483b b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
-  055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
-  e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
-  652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
-  96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
-  b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'}
+  d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+  177f92b773850b59254aa5e923436f921b55483b b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'}
+  055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'histedit', 'user': 'test'}
+  e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'histedit', 'user': 'test'}
+  652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'}
+  96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+  b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'histedit', 'user': 'test'}
 
 
 Ensure hidden revision does not prevent histedit
@@ -526,7 +526,7 @@
 
   $ hg histedit --abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg (glob)
+  saved backup bundle to $TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg
 
   $ hg log -G
   @  18:ee118ab9fa44 (secret) k
@@ -575,4 +575,4 @@
   o  0:cb9a9f314b8b (public) a
   
   $ hg debugobsolete --rev .
-  ee118ab9fa44ebb86be85996548b5517a39e5093 175d6b286a224c23f192e79a581ce83131a53fa2 0 (*) {'operation': 'histedit', 'user': 'test'} (glob)
+  ee118ab9fa44ebb86be85996548b5517a39e5093 175d6b286a224c23f192e79a581ce83131a53fa2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-histedit-templates.t	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,54 @@
+Testing templating for histedit command
+
+Setup
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > histedit=
+  > [experimental]
+  > evolution=createmarkers
+  > EOF
+
+  $ hg init repo
+  $ cd repo
+  $ for ch in a b c d; do echo foo > $ch; hg commit -Aqm "Added "$ch; done
+
+  $ hg log -G -T "{rev}:{node|short} {desc}"
+  @  3:62615734edd5 Added d
+  |
+  o  2:28ad74487de9 Added c
+  |
+  o  1:29becc82797a Added b
+  |
+  o  0:18d04c59bb5d Added a
+  
+Getting the JSON output for nodechanges
+
+  $ hg histedit -Tjson --commands - 2>&1 <<EOF
+  > pick 28ad74487de9 Added c
+  > pick 62615734edd5 Added d
+  > pick 18d04c59bb5d Added a
+  > pick 29becc82797a Added b
+  > EOF
+  [
+   {
+    "nodechanges": {"18d04c59bb5d2d4090ad9a5b59bd6274adb63add": ["109f8ec895447f81b380ba8d4d8b66539ccdcb94"], "28ad74487de9599d00d81085be739c61fc340652": ["bff9e07c1807942b161dab768aa793b48e9a7f9d"], "29becc82797a4bc11ec8880b58eaecd2ab3e7760": ["f5dcf3b4db23f31f1aacf46c33d1393de303d26f"], "62615734edd52f06b6fb9c2beb429e4fe30d57b8": ["201423b441c84d9e6858daed653e0d22485c1cfa"]}
+   }
+  ]
+
+  $ hg log -G -T "{rev}:{node|short} {desc}"
+  @  7:f5dcf3b4db23 Added b
+  |
+  o  6:109f8ec89544 Added a
+  |
+  o  5:201423b441c8 Added d
+  |
+  o  4:bff9e07c1807 Added c
+  
+  $ hg histedit -T "{nodechanges|json}" --commands - 2>&1 <<EOF
+  > pick bff9e07c1807 Added c
+  > pick 201423b441c8 Added d
+  > pick 109f8ec89544 Added a
+  > roll f5dcf3b4db23 Added b
+  > EOF
+  {"109f8ec895447f81b380ba8d4d8b66539ccdcb94": ["8d01470bfeab64d3de13c49adb79d88790d38396"], "f3ec56a374bdbdf1953cacca505161442c6f3a3e": [], "f5dcf3b4db23f31f1aacf46c33d1393de303d26f": ["8d01470bfeab64d3de13c49adb79d88790d38396"]} (no-eol)
--- a/tests/test-hook.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-hook.t	Tue Dec 19 16:27:24 2017 -0500
@@ -244,7 +244,6 @@
   no changes found
   pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
   pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
-  pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
   txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
   exporting bookmark foo
   [1]
@@ -281,9 +280,8 @@
   listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
   no changes found
   pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
-  prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
-  pushkey-abort: prepushkey hook exited with status 1
-  abort: exporting bookmark baz failed!
+  prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmark HG_NEW=0000000000000000000000000000000000000000 HG_PUSHKEYCOMPAT=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
+  abort: prepushkey hook exited with status 1
   [255]
   $ cd ../a
 
@@ -685,7 +683,7 @@
 
   $ hg up null
   loading update.ne hook failed:
-  abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py
+  abort: $ENOENT$: $TESTTMP/d/repo/nonexistent.py
   [255]
 
   $ hg id
@@ -794,7 +792,7 @@
   $ echo aa >> from/a
   $ hg --cwd from ci -mb
   $ hg --cwd from push
-  pushing to $TESTTMP/to (glob)
+  pushing to $TESTTMP/to
   searching for changes
   changeset:   0:cb9a9f314b8b
   tag:         tip
--- a/tests/test-http-bad-server.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-http-bad-server.t	Tue Dec 19 16:27:24 2017 -0500
@@ -36,8 +36,7 @@
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
-  abort: error: Connection reset by peer (no-windows !)
-  abort: error: An existing connection was forcibly closed by the remote host (windows !)
+  abort: error: $ECONNRESET$
   [255]
 
 (The server exits on its own, but there is a race between that and starting a new server.
@@ -54,8 +53,7 @@
 error: '' on FreeBSD and OS X.
 What we ideally want are:
 
-abort: error: Connection reset by peer (no-windows !)
-abort: error: An existing connection was forcibly closed by the remote host (windows !)
+abort: error: $ECONNRESET$
 
 The flakiness in this output was observable easily with
 --runs-per-test=20 on macOS 10.12 during the freeze for 4.2.
@@ -120,9 +118,9 @@
   write(23) -> Server: badhttpserver\r\n
   write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
   write(41) -> Content-Type: application/mercurial-0.1\r\n
-  write(21) -> Content-Length: 405\r\n
+  write(21) -> Content-Length: 417\r\n
   write(2) -> \r\n
-  write(405) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
+  write(417) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
   readline(4? from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob)
   readline(1? from -1) -> (1?) Accept-Encoding* (glob)
   read limit reached; closing socket
@@ -130,7 +128,7 @@
   readline(184 from -1) -> (27) Accept-Encoding: identity\r\n
   readline(157 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
   readline(128 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
-  readline(87 from -1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
+  readline(87 from -1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n
   readline(39 from -1) -> (35) accept: application/mercurial-0.1\r\n
   readline(4 from -1) -> (4) host
   read limit reached; closing socket
@@ -139,7 +137,7 @@
 
 Failure to read getbundle HTTP request
 
-  $ hg serve --config badserver.closeafterrecvbytes=292 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeafterrecvbytes=304 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
   $ hg clone http://localhost:$HGPORT/ clone
   requesting all changes
@@ -149,34 +147,36 @@
   $ killdaemons.py $DAEMON_PIDS
 
   $ cat error.log
-  readline(292 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
-  readline(259 from -1) -> (27) Accept-Encoding: identity\r\n
-  readline(232 from -1) -> (35) accept: application/mercurial-0.1\r\n
-  readline(197 from -1) -> (2?) host: localhost:$HGPORT\r\n (glob)
-  readline(17? from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob)
-  readline(12? from -1) -> (2) \r\n (glob)
+  readline(1 from -1) -> (1) x (?)
+  readline(1 from -1) -> (1) x (?)
+  readline(304 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
+  readline(271 from -1) -> (27) Accept-Encoding: identity\r\n
+  readline(244 from -1) -> (35) accept: application/mercurial-0.1\r\n
+  readline(209 from -1) -> (2?) host: localhost:$HGPORT\r\n (glob)
+  readline(18? from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob)
+  readline(13? from -1) -> (2) \r\n (glob)
   write(36) -> HTTP/1.1 200 Script output follows\r\n
   write(23) -> Server: badhttpserver\r\n
   write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
   write(41) -> Content-Type: application/mercurial-0.1\r\n
-  write(21) -> Content-Length: 405\r\n
+  write(21) -> Content-Length: 417\r\n
   write(2) -> \r\n
-  write(405) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
-  readline\(12[34] from 65537\) -> \(2[67]\) GET /\?cmd=batch HTTP/1.1\\r\\n (re)
-  readline(9? from -1) -> (27) Accept-Encoding: identity\r\n (glob)
-  readline(7? from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob)
-  readline(4? from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob)
-  readline(1 from -1) -> (1) x (?)
+  write(417) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
+  readline(13? from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob)
+  readline(1?? from -1) -> (27) Accept-Encoding: identity\r\n (glob)
+  readline(8? from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob)
+  readline(5? from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob)
+  readline(1? from -1) -> (1?) x-hgproto-1:* (glob)
   read limit reached; closing socket
-  readline(292 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
-  readline(266 from -1) -> (27) Accept-Encoding: identity\r\n
-  readline(239 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
-  readline(210 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
-  readline(169 from -1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
-  readline(121 from -1) -> (35) accept: application/mercurial-0.1\r\n
-  readline(86 from -1) -> (2?) host: localhost:$HGPORT\r\n (glob)
-  readline(6? from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob)
-  readline(1? from -1) -> (2) \r\n (glob)
+  readline(304 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
+  readline(278 from -1) -> (27) Accept-Encoding: identity\r\n
+  readline(251 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
+  readline(222 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
+  readline(181 from -1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n
+  readline(133 from -1) -> (35) accept: application/mercurial-0.1\r\n
+  readline(98 from -1) -> (2?) host: localhost:$HGPORT\r\n (glob)
+  readline(7? from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob)
+  readline(2? from -1) -> (2) \r\n (glob)
   write(36) -> HTTP/1.1 200 Script output follows\r\n
   write(23) -> Server: badhttpserver\r\n
   write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
@@ -184,12 +184,12 @@
   write(20) -> Content-Length: 42\r\n
   write(2) -> \r\n
   write(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n;
-  readline\(1[23] from 65537\) -> \(1[23]\) GET /\?cmd=ge.? (re)
+  readline(2? from 65537) -> (2?) GET /?cmd=getbundle HTTP* (glob)
   read limit reached; closing socket
-  readline(292 from 65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
-  readline(262 from -1) -> (27) Accept-Encoding: identity\r\n
-  readline(235 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
-  readline(206 from -1) -> (206) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Ali
+  readline(304 from 65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
+  readline(274 from -1) -> (27) Accept-Encoding: identity\r\n
+  readline(247 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
+  readline(218 from -1) -> (218) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtag
   read limit reached; closing socket
 
   $ rm -f error.log
@@ -216,9 +216,9 @@
   write(23) -> Server: badhttpserver\r\n
   write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
   write(41) -> Content-Type: application/mercurial-0.1\r\n
-  write(21) -> Content-Length: 418\r\n
+  write(21) -> Content-Length: 430\r\n
   write(2) -> \r\n
-  write(418) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httppostargs httpmediatype=0.1rx,0.1tx,0.2tx compression=none
+  write(430) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httppostargs httpmediatype=0.1rx,0.1tx,0.2tx compression=none
   readline\(14[67] from 65537\) -> \(2[67]\) POST /\?cmd=batch HTTP/1.1\\r\\n (re)
   readline\(1(19|20) from -1\) -> \(27\) Accept-Encoding: identity\\r\\n (re)
   readline(9? from -1) -> (41) content-type: application/mercurial-0.1\r\n (glob)
@@ -231,7 +231,7 @@
   readline(261 from -1) -> (41) content-type: application/mercurial-0.1\r\n
   readline(220 from -1) -> (19) vary: X-HgProto-1\r\n
   readline(201 from -1) -> (19) x-hgargs-post: 28\r\n
-  readline(182 from -1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
+  readline(182 from -1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n
   readline(134 from -1) -> (35) accept: application/mercurial-0.1\r\n
   readline(99 from -1) -> (20) content-length: 28\r\n
   readline(79 from -1) -> (2?) host: localhost:$HGPORT\r\n (glob)
@@ -275,7 +275,7 @@
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
-  abort: HTTP request error (incomplete response; expected 385 bytes got 20)
+  abort: HTTP request error (incomplete response; expected 397 bytes got 20)
   (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator)
   [255]
 
@@ -292,9 +292,9 @@
   write(23 from 23) -> (121) Server: badhttpserver\r\n
   write(37 from 37) -> (84) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
   write(41 from 41) -> (43) Content-Type: application/mercurial-0.1\r\n
-  write(21 from 21) -> (22) Content-Length: 405\r\n
+  write(21 from 21) -> (22) Content-Length: 417\r\n
   write(2 from 2) -> (20) \r\n
-  write(20 from 405) -> (0) lookup changegroupsu
+  write(20 from 417) -> (0) lookup changegroupsu
   write limit reached; closing socket
 
   $ rm -f error.log
@@ -308,7 +308,7 @@
 
   $ hg clone http://localhost:$HGPORT/ clone
   abort: 'http://localhost:$HGPORT/' does not appear to be an hg repository:
-  ---%<--- (application/mercuria)
+  ---%<--- (applicat)
   
   ---%<---
   !
@@ -327,22 +327,22 @@
   write(23 from 23) -> (636) Server: badhttpserver\r\n
   write(37 from 37) -> (599) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
   write(41 from 41) -> (558) Content-Type: application/mercurial-0.1\r\n
-  write(21 from 21) -> (537) Content-Length: 405\r\n
+  write(21 from 21) -> (537) Content-Length: 417\r\n
   write(2 from 2) -> (535) \r\n
-  write(405 from 405) -> (130) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
+  write(417 from 417) -> (118) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
   readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
   readline(-1) -> (27) Accept-Encoding: identity\r\n
   readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
   readline(-1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
-  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
+  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n
   readline(-1) -> (35) accept: application/mercurial-0.1\r\n
   readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob)
   readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
   readline(-1) -> (2) \r\n
-  write(36 from 36) -> (94) HTTP/1.1 200 Script output follows\r\n
-  write(23 from 23) -> (71) Server: badhttpserver\r\n
-  write(37 from 37) -> (34) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
-  write(34 from 41) -> (0) Content-Type: application/mercuria
+  write(36 from 36) -> (82) HTTP/1.1 200 Script output follows\r\n
+  write(23 from 23) -> (59) Server: badhttpserver\r\n
+  write(37 from 37) -> (22) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(22 from 41) -> (0) Content-Type: applicat
   write limit reached; closing socket
   write(36) -> HTTP/1.1 500 Internal Server Error\r\n
 
@@ -375,32 +375,32 @@
   write(23 from 23) -> (701) Server: badhttpserver\r\n
   write(37 from 37) -> (664) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
   write(41 from 41) -> (623) Content-Type: application/mercurial-0.1\r\n
-  write(21 from 21) -> (602) Content-Length: 405\r\n
+  write(21 from 21) -> (602) Content-Length: 417\r\n
   write(2 from 2) -> (600) \r\n
-  write(405 from 405) -> (195) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
+  write(417 from 417) -> (183) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
   readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
   readline(-1) -> (27) Accept-Encoding: identity\r\n
   readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
   readline(-1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
-  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
+  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n
   readline(-1) -> (35) accept: application/mercurial-0.1\r\n
   readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob)
   readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
   readline(-1) -> (2) \r\n
-  write(36 from 36) -> (159) HTTP/1.1 200 Script output follows\r\n
-  write(23 from 23) -> (136) Server: badhttpserver\r\n
-  write(37 from 37) -> (99) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
-  write(41 from 41) -> (58) Content-Type: application/mercurial-0.1\r\n
-  write(20 from 20) -> (38) Content-Length: 42\r\n
-  write(2 from 2) -> (36) \r\n
-  write(36 from 42) -> (0) 96ee1d7354c4ad7372047672c36a1f561e3a
+  write(36 from 36) -> (147) HTTP/1.1 200 Script output follows\r\n
+  write(23 from 23) -> (124) Server: badhttpserver\r\n
+  write(37 from 37) -> (87) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(41 from 41) -> (46) Content-Type: application/mercurial-0.1\r\n
+  write(20 from 20) -> (26) Content-Length: 42\r\n
+  write(2 from 2) -> (24) \r\n
+  write(24 from 42) -> (0) 96ee1d7354c4ad7372047672
   write limit reached; closing socket
 
   $ rm -f error.log
 
 Server sends incomplete headers for getbundle response
 
-  $ hg serve --config badserver.closeaftersendbytes=895 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=907 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
 TODO this output is terrible
@@ -423,18 +423,18 @@
   readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob)
   readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
   readline(-1) -> (2) \r\n
-  write(36 from 36) -> (859) HTTP/1.1 200 Script output follows\r\n
-  write(23 from 23) -> (836) Server: badhttpserver\r\n
-  write(37 from 37) -> (799) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
-  write(41 from 41) -> (758) Content-Type: application/mercurial-0.1\r\n
-  write(21 from 21) -> (737) Content-Length: 405\r\n
-  write(2 from 2) -> (735) \r\n
-  write(405 from 405) -> (330) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
+  write(36 from 36) -> (871) HTTP/1.1 200 Script output follows\r\n
+  write(23 from 23) -> (848) Server: badhttpserver\r\n
+  write(37 from 37) -> (811) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(41 from 41) -> (770) Content-Type: application/mercurial-0.1\r\n
+  write(21 from 21) -> (749) Content-Length: 417\r\n
+  write(2 from 2) -> (747) \r\n
+  write(417 from 417) -> (330) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
   readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
   readline(-1) -> (27) Accept-Encoding: identity\r\n
   readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
   readline(-1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
-  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
+  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n
   readline(-1) -> (35) accept: application/mercurial-0.1\r\n
   readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob)
   readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
@@ -449,8 +449,8 @@
   readline(65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
   readline(-1) -> (27) Accept-Encoding: identity\r\n
   readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
-  readline(-1) -> (396) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n
-  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
+  readline(-1) -> (422) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n
+  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n
   readline(-1) -> (35) accept: application/mercurial-0.1\r\n
   readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob)
   readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
@@ -466,7 +466,7 @@
 
 Server sends empty HTTP body for getbundle
 
-  $ hg serve --config badserver.closeaftersendbytes=933 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=945 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -484,18 +484,18 @@
   readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob)
   readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
   readline(-1) -> (2) \r\n
-  write(36 from 36) -> (897) HTTP/1.1 200 Script output follows\r\n
-  write(23 from 23) -> (874) Server: badhttpserver\r\n
-  write(37 from 37) -> (837) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
-  write(41 from 41) -> (796) Content-Type: application/mercurial-0.1\r\n
-  write(21 from 21) -> (775) Content-Length: 405\r\n
-  write(2 from 2) -> (773) \r\n
-  write(405 from 405) -> (368) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
+  write(36 from 36) -> (909) HTTP/1.1 200 Script output follows\r\n
+  write(23 from 23) -> (886) Server: badhttpserver\r\n
+  write(37 from 37) -> (849) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(41 from 41) -> (808) Content-Type: application/mercurial-0.1\r\n
+  write(21 from 21) -> (787) Content-Length: 417\r\n
+  write(2 from 2) -> (785) \r\n
+  write(417 from 417) -> (368) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
   readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
   readline(-1) -> (27) Accept-Encoding: identity\r\n
   readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
   readline(-1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
-  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
+  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n
   readline(-1) -> (35) accept: application/mercurial-0.1\r\n
   readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob)
   readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
@@ -510,8 +510,8 @@
   readline(65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
   readline(-1) -> (27) Accept-Encoding: identity\r\n
   readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
-  readline(-1) -> (396) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n
-  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
+  readline(-1) -> (422) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n
+  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n
   readline(-1) -> (35) accept: application/mercurial-0.1\r\n
   readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob)
   readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
@@ -529,12 +529,12 @@
 
 Server sends partial compression string
 
-  $ hg serve --config badserver.closeaftersendbytes=945 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=969 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
   requesting all changes
-  abort: HTTP request error (incomplete response; expected 1 bytes got 3)
+  abort: HTTP request error (incomplete response)
   (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator)
   [255]
 
@@ -547,46 +547,47 @@
   readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob)
   readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
   readline(-1) -> (2) \r\n
-  write(36 from 36) -> (909) HTTP/1.1 200 Script output follows\r\n
-  write(23 from 23) -> (886) Server: badhttpserver\r\n
-  write(37 from 37) -> (849) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
-  write(41 from 41) -> (808) Content-Type: application/mercurial-0.1\r\n
-  write(21 from 21) -> (787) Content-Length: 405\r\n
-  write(2 from 2) -> (785) \r\n
-  write(405 from 405) -> (380) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
+  write(36 from 36) -> (933) HTTP/1.1 200 Script output follows\r\n
+  write(23 from 23) -> (910) Server: badhttpserver\r\n
+  write(37 from 37) -> (873) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(41 from 41) -> (832) Content-Type: application/mercurial-0.1\r\n
+  write(21 from 21) -> (811) Content-Length: 417\r\n
+  write(2 from 2) -> (809) \r\n
+  write(417 from 417) -> (392) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
   readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
   readline(-1) -> (27) Accept-Encoding: identity\r\n
   readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
   readline(-1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
-  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
+  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n
   readline(-1) -> (35) accept: application/mercurial-0.1\r\n
   readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob)
   readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
   readline(-1) -> (2) \r\n
-  write(36 from 36) -> (344) HTTP/1.1 200 Script output follows\r\n
-  write(23 from 23) -> (321) Server: badhttpserver\r\n
-  write(37 from 37) -> (284) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
-  write(41 from 41) -> (243) Content-Type: application/mercurial-0.1\r\n
-  write(20 from 20) -> (223) Content-Length: 42\r\n
-  write(2 from 2) -> (221) \r\n
-  write(42 from 42) -> (179) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n;
+  write(36 from 36) -> (356) HTTP/1.1 200 Script output follows\r\n
+  write(23 from 23) -> (333) Server: badhttpserver\r\n
+  write(37 from 37) -> (296) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(41 from 41) -> (255) Content-Type: application/mercurial-0.1\r\n
+  write(20 from 20) -> (235) Content-Length: 42\r\n
+  write(2 from 2) -> (233) \r\n
+  write(42 from 42) -> (191) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n;
   readline(65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
   readline(-1) -> (27) Accept-Encoding: identity\r\n
   readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
-  readline(-1) -> (396) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n
-  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=zstd,zlib,none,bzip2\r\n
+  readline(-1) -> (422) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n
+  readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n
   readline(-1) -> (35) accept: application/mercurial-0.1\r\n
   readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob)
   readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n
   readline(-1) -> (2) \r\n
-  write(36 from 36) -> (143) HTTP/1.1 200 Script output follows\r\n
-  write(23 from 23) -> (120) Server: badhttpserver\r\n
-  write(37 from 37) -> (83) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
-  write(41 from 41) -> (42) Content-Type: application/mercurial-0.2\r\n
-  write(28 from 28) -> (14) Transfer-Encoding: chunked\r\n
-  write(2 from 2) -> (12) \r\n
-  write(6 from 6) -> (6) 1\\r\\n\x04\\r\\n (esc)
-  write(6 from 9) -> (0) 4\r\nnon
+  write(36 from 36) -> (155) HTTP/1.1 200 Script output follows\r\n
+  write(23 from 23) -> (132) Server: badhttpserver\r\n
+  write(37 from 37) -> (95) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(41 from 41) -> (54) Content-Type: application/mercurial-0.2\r\n
+  write(28 from 28) -> (26) Transfer-Encoding: chunked\r\n
+  write(2 from 2) -> (24) \r\n
+  write(6 from 6) -> (18) 1\\r\\n\x04\\r\\n (esc)
+  write(9 from 9) -> (9) 4\r\nnone\r\n
+  write(9 from 9) -> (0) 4\r\nHG20\r\n
   write limit reached; closing socket
   write(27) -> 15\r\nInternal Server Error\r\n
 
@@ -594,7 +595,7 @@
 
 Server sends partial bundle2 header magic
 
-  $ hg serve --config badserver.closeaftersendbytes=954 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=966 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -618,7 +619,7 @@
 
 Server sends incomplete bundle2 stream params length
 
-  $ hg serve --config badserver.closeaftersendbytes=963 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=975 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -643,7 +644,7 @@
 
 Servers stops after bundle2 stream params header
 
-  $ hg serve --config badserver.closeaftersendbytes=966 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=978 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -668,7 +669,7 @@
 
 Server stops sending after bundle2 part header length
 
-  $ hg serve --config badserver.closeaftersendbytes=975 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=987 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -694,7 +695,7 @@
 
 Server stops sending after bundle2 part header
 
-  $ hg serve --config badserver.closeaftersendbytes=1022 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=1034 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -724,7 +725,7 @@
 
 Server stops after bundle2 part payload chunk size
 
-  $ hg serve --config badserver.closeaftersendbytes=1031 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=1055 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -732,22 +733,22 @@
   adding changesets
   transaction abort!
   rollback completed
-  abort: HTTP request error (incomplete response)
+  abort: HTTP request error (incomplete response; expected 459 bytes got 7)
   (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator)
   [255]
 
   $ killdaemons.py $DAEMON_PIDS
 
   $ tail -11 error.log
-  write(28 from 28) -> (100) Transfer-Encoding: chunked\r\n
-  write(2 from 2) -> (98) \r\n
-  write(6 from 6) -> (92) 1\\r\\n\x04\\r\\n (esc)
-  write(9 from 9) -> (83) 4\r\nnone\r\n
-  write(9 from 9) -> (74) 4\r\nHG20\r\n
-  write(9 from 9) -> (65) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc)
-  write(9 from 9) -> (56) 4\\r\\n\x00\x00\x00)\\r\\n (esc)
-  write(47 from 47) -> (9) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02	\x01version02nbchanges1\\r\\n (esc)
-  write(9 from 9) -> (0) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc)
+  write(2 from 2) -> (110) \r\n
+  write(6 from 6) -> (104) 1\\r\\n\x04\\r\\n (esc)
+  write(9 from 9) -> (95) 4\r\nnone\r\n
+  write(9 from 9) -> (86) 4\r\nHG20\r\n
+  write(9 from 9) -> (77) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc)
+  write(9 from 9) -> (68) 4\\r\\n\x00\x00\x00)\\r\\n (esc)
+  write(47 from 47) -> (21) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02	\x01version02nbchanges1\\r\\n (esc)
+  write(9 from 9) -> (12) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc)
+  write(12 from 473) -> (0) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1d (esc)
   write limit reached; closing socket
   write(27) -> 15\r\nInternal Server Error\r\n
 
@@ -755,7 +756,7 @@
 
 Server stops sending in middle of bundle2 payload chunk
 
-  $ hg serve --config badserver.closeaftersendbytes=1504 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=1516 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -787,7 +788,7 @@
 
 Server stops sending after 0 length payload chunk size
 
-  $ hg serve --config badserver.closeaftersendbytes=1513 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=1547 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -798,24 +799,24 @@
   added 1 changesets with 1 changes to 1 files
   transaction abort!
   rollback completed
-  abort: HTTP request error (incomplete response)
+  abort: HTTP request error (incomplete response; expected 23 bytes got 9)
   (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator)
   [255]
 
   $ killdaemons.py $DAEMON_PIDS
 
   $ tail -13 error.log
-  write(28 from 28) -> (582) Transfer-Encoding: chunked\r\n
-  write(2 from 2) -> (580) \r\n
-  write(6 from 6) -> (574) 1\\r\\n\x04\\r\\n (esc)
-  write(9 from 9) -> (565) 4\r\nnone\r\n
-  write(9 from 9) -> (556) 4\r\nHG20\r\n
-  write(9 from 9) -> (547) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc)
-  write(9 from 9) -> (538) 4\\r\\n\x00\x00\x00)\\r\\n (esc)
-  write(47 from 47) -> (491) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02	\x01version02nbchanges1\\r\\n (esc)
-  write(9 from 9) -> (482) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc)
-  write(473 from 473) -> (9) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f<O\x8e(\xf4\xf9\xa8\x14)\x9a<\xbb_P\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00b80de5d138758541c5f05265ad144ab9fa86d1db\\n\x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00h\xb8\\r\xe5\xd18u\x85A\xc5\xf0Re\xad\x14J\xb9\xfa\x86\xd1\xdb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\\r\\n (esc)
-  write(9 from 9) -> (0) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc)
+  write(6 from 6) -> (596) 1\\r\\n\x04\\r\\n (esc)
+  write(9 from 9) -> (587) 4\r\nnone\r\n
+  write(9 from 9) -> (578) 4\r\nHG20\r\n
+  write(9 from 9) -> (569) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc)
+  write(9 from 9) -> (560) 4\\r\\n\x00\x00\x00)\\r\\n (esc)
+  write(47 from 47) -> (513) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02	\x01version02nbchanges1\\r\\n (esc)
+  write(9 from 9) -> (504) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc)
+  write(473 from 473) -> (31) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f<O\x8e(\xf4\xf9\xa8\x14)\x9a<\xbb_P\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00b80de5d138758541c5f05265ad144ab9fa86d1db\\n\x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00h\xb8\\r\xe5\xd18u\x85A\xc5\xf0Re\xad\x14J\xb9\xfa\x86\xd1\xdb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\\r\\n (esc)
+  write(9 from 9) -> (22) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc)
+  write(9 from 9) -> (13) 4\\r\\n\x00\x00\x00 \\r\\n (esc)
+  write(13 from 38) -> (0) 20\\r\\n\x08LISTKEYS (esc)
   write limit reached; closing socket
   write(27) -> 15\r\nInternal Server Error\r\n
 
@@ -824,7 +825,7 @@
 Server stops sending after 0 part bundle part header (indicating end of bundle2 payload)
 This is before the 0 size chunked transfer part that signals end of HTTP response.
 
-  $ hg serve --config badserver.closeaftersendbytes=1710 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=1722 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -868,7 +869,7 @@
 
 Server sends a size 0 chunked-transfer size without terminating \r\n
 
-  $ hg serve --config badserver.closeaftersendbytes=1713 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve --config badserver.closeaftersendbytes=1725 -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
--- a/tests/test-http-bundle1.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-http-bundle1.t	Tue Dec 19 16:27:24 2017 -0500
@@ -26,15 +26,10 @@
 
 Test server address cannot be reused
 
-#if windows
   $ hg serve -p $HGPORT1 2>&1
-  abort: cannot start server at 'localhost:$HGPORT1': * (glob)
+  abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$
   [255]
-#else
-  $ hg serve -p $HGPORT1 2>&1
-  abort: cannot start server at 'localhost:$HGPORT1': Address already in use
-  [255]
-#endif
+
   $ cd ..
   $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
 
@@ -265,66 +260,66 @@
 
   $ sed 's/.*] "/"/' < ../access.log
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+5eb5abfefeea63c80dd7553bcc3783f37e0c5524* (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
 
   $ cd ..
 
--- a/tests/test-http-proxy.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-http-proxy.t	Tue Dec 19 16:27:24 2017 -0500
@@ -107,19 +107,19 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat proxy.log
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=branchmap HTTP/1.1" - - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D83180e7845de420a1bb46896fd5fe05294f8d629 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=83180e7845de420a1bb46896fd5fe05294f8d629&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=branchmap HTTP/1.1" - - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D83180e7845de420a1bb46896fd5fe05294f8d629 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=83180e7845de420a1bb46896fd5fe05294f8d629&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
--- a/tests/test-http.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-http.t	Tue Dec 19 16:27:24 2017 -0500
@@ -17,15 +17,10 @@
 
 Test server address cannot be reused
 
-#if windows
   $ hg serve -p $HGPORT1 2>&1
-  abort: cannot start server at 'localhost:$HGPORT1': * (glob)
+  abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$
   [255]
-#else
-  $ hg serve -p $HGPORT1 2>&1
-  abort: cannot start server at 'localhost:$HGPORT1': Address already in use
-  [255]
-#endif
+
   $ cd ..
   $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
 
@@ -256,63 +251,63 @@
 
   $ sed 's/.*] "/"/' < ../access.log
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=getbundle HTTP/1.1" 401 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=getbundle HTTP/1.1" 401 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365* (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
 
   $ cd ..
 
--- a/tests/test-https.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-https.t	Tue Dec 19 16:27:24 2017 -0500
@@ -34,15 +34,10 @@
 
 Test server address cannot be reused
 
-#if windows
   $ hg serve -p $HGPORT --certificate=$PRIV 2>&1
-  abort: cannot start server at 'localhost:$HGPORT': * (glob)
+  abort: cannot start server at 'localhost:$HGPORT': $EADDRINUSE$
   [255]
-#else
-  $ hg serve -p $HGPORT --certificate=$PRIV 2>&1
-  abort: cannot start server at 'localhost:$HGPORT': Address already in use
-  [255]
-#endif
+
   $ cd ..
 
 Our test cert is not signed by a trusted CA. It should fail to verify if
--- a/tests/test-import-git.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-import-git.t	Tue Dec 19 16:27:24 2017 -0500
@@ -648,8 +648,8 @@
   d
   dddd
   $ hg revert -aC
-  forgetting dir/a (glob)
-  reverting dir/d (glob)
+  forgetting dir/a
+  reverting dir/d
   $ rm dir/a
 
 prefix with default strip
@@ -673,8 +673,8 @@
   d
   dd
   $ hg revert -aC
-  forgetting dir/a (glob)
-  reverting dir/d (glob)
+  forgetting dir/a
+  reverting dir/d
   $ rm dir/a
 (test that prefixes are relative to the cwd)
   $ mkdir tmpdir
@@ -714,11 +714,11 @@
 Renames, similarity and git diff
 
   $ hg revert -aC
-  forgetting dir/a (glob)
-  undeleting dir/d (glob)
-  undeleting dir/dir2/b (glob)
-  forgetting dir/dir2/b2 (glob)
-  reverting dir/dir2/c (glob)
+  forgetting dir/a
+  undeleting dir/d
+  undeleting dir/dir2/b
+  forgetting dir/dir2/b2
+  reverting dir/dir2/c
   $ rm dir/a dir/dir2/b2
   $ hg import --similarity 90 --no-commit - <<EOF
   > diff --git a/a b/b
--- a/tests/test-import.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-import.t	Tue Dec 19 16:27:24 2017 -0500
@@ -938,7 +938,7 @@
   > rename to bar
   > EOF
   applying patch from stdin
-  abort: path contains illegal component: ../outside/foo (glob)
+  abort: path contains illegal component: ../outside/foo
   [255]
   $ cd ..
 
@@ -1349,6 +1349,93 @@
 
   $ cd ..
 
+commit message that looks like a diff header (issue1879)
+
+  $ hg init headerlikemsg
+  $ cd headerlikemsg
+  $ touch empty
+  $ echo nonempty >> nonempty
+  $ hg ci -qAl - <<EOF
+  > blah blah
+  > diff blah
+  > blah blah
+  > EOF
+  $ hg --config diff.git=1 log -pv
+  changeset:   0:c6ef204ef767
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  files:       empty nonempty
+  description:
+  blah blah
+  diff blah
+  blah blah
+  
+  
+  diff --git a/empty b/empty
+  new file mode 100644
+  diff --git a/nonempty b/nonempty
+  new file mode 100644
+  --- /dev/null
+  +++ b/nonempty
+  @@ -0,0 +1,1 @@
+  +nonempty
+  
+
+ (without --git, empty file is lost, but commit message should be preserved)
+
+  $ hg init plain
+  $ hg export 0 | hg -R plain import -
+  applying patch from stdin
+  $ hg --config diff.git=1 -R plain log -pv
+  changeset:   0:60a2d231e71f
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  files:       nonempty
+  description:
+  blah blah
+  diff blah
+  blah blah
+  
+  
+  diff --git a/nonempty b/nonempty
+  new file mode 100644
+  --- /dev/null
+  +++ b/nonempty
+  @@ -0,0 +1,1 @@
+  +nonempty
+  
+
+ (with --git, patch contents should be fully preserved)
+
+  $ hg init git
+  $ hg --config diff.git=1 export 0 | hg -R git import -
+  applying patch from stdin
+  $ hg --config diff.git=1 -R git log -pv
+  changeset:   0:c6ef204ef767
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  files:       empty nonempty
+  description:
+  blah blah
+  diff blah
+  blah blah
+  
+  
+  diff --git a/empty b/empty
+  new file mode 100644
+  diff --git a/nonempty b/nonempty
+  new file mode 100644
+  --- /dev/null
+  +++ b/nonempty
+  @@ -0,0 +1,1 @@
+  +nonempty
+  
+
+  $ cd ..
+
 no segfault while importing a unified diff which start line is zero but chunk
 size is non-zero
 
--- a/tests/test-incoming-outgoing.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-incoming-outgoing.t	Tue Dec 19 16:27:24 2017 -0500
@@ -491,3 +491,63 @@
   searching for changes
   no changes found
   [1]
+
+Create a "split" repo that pulls from r1 and pushes to r2, using default-push
+
+  $ hg clone r1 split
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat > split/.hg/hgrc << EOF
+  > [paths]
+  > default = $TESTTMP/r3
+  > default-push = $TESTTMP/r2
+  > EOF
+  $ hg -R split outgoing
+  comparing with $TESTTMP/r2
+  searching for changes
+  changeset:   0:3e92d79f743a
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     a
+  
+
+Use default:pushurl instead of default-push
+
+Windows needs a leading slash to make a URL that passes all of the checks
+  $ WD=`pwd`
+#if windows
+  $ WD="/$WD"
+#endif
+  $ cat > split/.hg/hgrc << EOF
+  > [paths]
+  > default = $WD/r3
+  > default:pushurl = file://$WD/r2
+  > EOF
+  $ hg -R split outgoing
+  comparing with file:/*/$TESTTMP/r2 (glob)
+  searching for changes
+  changeset:   0:3e92d79f743a
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     a
+  
+
+Push and then double-check outgoing
+
+  $ echo a >> split/foo
+  $ hg -R split commit -Ama
+  $ hg -R split push
+  pushing to file:/*/$TESTTMP/r2 (glob)
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  $ hg -R split outgoing
+  comparing with file:/*/$TESTTMP/r2 (glob)
+  searching for changes
+  no changes found
+  [1]
+
--- a/tests/test-install.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-install.t	Tue Dec 19 16:27:24 2017 -0500
@@ -14,6 +14,7 @@
   checking registered compression engines (*zlib*) (glob)
   checking available compression engines (*zlib*) (glob)
   checking available compression engines for wire protocol (*zlib*) (glob)
+  checking "re2" regexp engine \((available|missing)\) (re)
   checking templates (*mercurial?templates)... (glob)
   checking default template (*mercurial?templates?map-cmdline.default) (glob)
   checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
@@ -44,6 +45,7 @@
     "pythonlib": "*", (glob)
     "pythonsecurity": [*], (glob)
     "pythonver": "*.*.*", (glob)
+    "re2": (true|false), (re)
     "templatedirs": "*mercurial?templates", (glob)
     "username": "test",
     "usernameerror": null,
@@ -67,6 +69,7 @@
   checking registered compression engines (*zlib*) (glob)
   checking available compression engines (*zlib*) (glob)
   checking available compression engines for wire protocol (*zlib*) (glob)
+  checking "re2" regexp engine \((available|missing)\) (re)
   checking templates (*mercurial?templates)... (glob)
   checking default template (*mercurial?templates?map-cmdline.default) (glob)
   checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
@@ -110,6 +113,7 @@
   checking registered compression engines (*zlib*) (glob)
   checking available compression engines (*zlib*) (glob)
   checking available compression engines for wire protocol (*zlib*) (glob)
+  checking "re2" regexp engine \((available|missing)\) (re)
   checking templates (*mercurial?templates)... (glob)
   checking default template (*mercurial?templates?map-cmdline.default) (glob)
   checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
@@ -217,6 +221,7 @@
   checking registered compression engines (*) (glob)
   checking available compression engines (*) (glob)
   checking available compression engines for wire protocol (*) (glob)
+  checking "re2" regexp engine \((available|missing)\) (re)
   checking templates ($TESTTMP/installenv/*/site-packages/mercurial/templates)... (glob)
   checking default template ($TESTTMP/installenv/*/site-packages/mercurial/templates/map-cmdline.default) (glob)
   checking commit editor... (*) (glob)
--- a/tests/test-issue1089.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-issue1089.t	Tue Dec 19 16:27:24 2017 -0500
@@ -7,7 +7,7 @@
   adding a/b
 
   $ hg rm a
-  removing a/b (glob)
+  removing a/b
   $ hg ci -m m a
 
   $ mkdir a b
@@ -16,7 +16,7 @@
   adding a/b
 
   $ hg rm a
-  removing a/b (glob)
+  removing a/b
   $ cd b
 
 Relative delete:
--- a/tests/test-issue1502.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-issue1502.t	Tue Dec 19 16:27:24 2017 -0500
@@ -13,7 +13,7 @@
   $ echo "bar" > foo1/a && hg -R foo1 commit -m "edit a in foo1"
   $ echo "hi" > foo/a && hg -R foo commit -m "edited a foo"
   $ hg -R foo1 pull
-  pulling from $TESTTMP/foo (glob)
+  pulling from $TESTTMP/foo
   searching for changes
   adding changesets
   adding manifests
@@ -30,7 +30,7 @@
 
   $ echo "there" >> foo/a && hg -R foo commit -m "edited a again"
   $ hg -R foo1 pull
-  pulling from $TESTTMP/foo (glob)
+  pulling from $TESTTMP/foo
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-issue612.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-issue612.t	Tue Dec 19 16:27:24 2017 -0500
@@ -7,7 +7,7 @@
   adding src/a.c
 
   $ hg mv src source
-  moving src/a.c to source/a.c (glob)
+  moving src/a.c to source/a.c
 
   $ hg ci -Ammove
 
--- a/tests/test-issue660.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-issue660.t	Tue Dec 19 16:27:24 2017 -0500
@@ -67,9 +67,9 @@
 
   $ hg revert --all
   undeleting a
-  forgetting a/a (glob)
+  forgetting a/a
   forgetting b
-  undeleting b/b (glob)
+  undeleting b/b
 
   $ hg st
 
--- a/tests/test-keyword.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-keyword.t	Tue Dec 19 16:27:24 2017 -0500
@@ -272,7 +272,7 @@
   Message-Id: <hg.a2392c293916*> (glob)
   To: Test
   
-  changeset a2392c293916 in $TESTTMP/Test (glob)
+  changeset a2392c293916 in $TESTTMP/Test
   details: $TESTTMP/Test?cmd=changeset;node=a2392c293916
   description:
   	addsym
@@ -295,7 +295,7 @@
   Message-Id: <hg.ef63ca68695b*> (glob)
   To: Test
   
-  changeset ef63ca68695b in $TESTTMP/Test (glob)
+  changeset ef63ca68695b in $TESTTMP/Test
   details: $TESTTMP/Test?cmd=changeset;node=ef63ca68695b
   description:
   	absym
@@ -929,7 +929,7 @@
   > default = ../Test
   > EOF
   $ hg incoming
-  comparing with $TESTTMP/Test (glob)
+  comparing with $TESTTMP/Test
   searching for changes
   changeset:   2:bb948857c743
   tag:         tip
--- a/tests/test-largefiles-cache.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-largefiles-cache.t	Tue Dec 19 16:27:24 2017 -0500
@@ -207,7 +207,7 @@
   $ echo corruption > .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
   $ hg up -C
   getting changed largefiles
-  large: data corruption in $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 with hash 6a7bb2556144babe3899b25e5428123735bb1e27 (glob)
+  large: data corruption in $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 with hash 6a7bb2556144babe3899b25e5428123735bb1e27
   0 largefiles updated, 0 removed
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   updated to "cd24c147f45c: modified"
@@ -228,7 +228,7 @@
   $ hg push http://localhost:$HGPORT1 -f --config files.usercache=nocache
   pushing to http://localhost:$HGPORT1/
   searching for changes
-  abort: remotestore: could not open file $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020: HTTP Error 403: ssl required (glob)
+  abort: remotestore: could not open file $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020: HTTP Error 403: ssl required
   [255]
 
   $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
--- a/tests/test-largefiles-misc.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-largefiles-misc.t	Tue Dec 19 16:27:24 2017 -0500
@@ -66,8 +66,8 @@
   ./dirb/largefile
   $ cd ..
   $ hg mv dira dirc
-  moving .hglf/dira/baz/largefile to .hglf/dirc/baz/largefile (glob)
-  moving .hglf/dira/dirb/largefile to .hglf/dirc/dirb/largefile (glob)
+  moving .hglf/dira/baz/largefile to .hglf/dirc/baz/largefile
+  moving .hglf/dira/dirb/largefile to .hglf/dirc/dirb/largefile
   $ find * | sort
   dirc
   dirc/baz
@@ -292,9 +292,9 @@
   ? subrepo/renamed-large.txt
 
   $ hg addremove --dry-run subrepo
-  removing subrepo/large.txt (glob)
-  adding subrepo/normal.txt (glob)
-  adding subrepo/renamed-large.txt (glob)
+  removing subrepo/large.txt
+  adding subrepo/normal.txt
+  adding subrepo/renamed-large.txt
   $ hg status -S
   ! subrepo/large.txt
   ? large.dat
@@ -303,9 +303,9 @@
   $ cd ..
 
   $ hg -R statusmatch addremove --dry-run statusmatch/subrepo
-  removing statusmatch/subrepo/large.txt (glob)
-  adding statusmatch/subrepo/normal.txt (glob)
-  adding statusmatch/subrepo/renamed-large.txt (glob)
+  removing statusmatch/subrepo/large.txt
+  adding statusmatch/subrepo/normal.txt
+  adding statusmatch/subrepo/renamed-large.txt
   $ hg -R statusmatch status -S
   ! subrepo/large.txt
   ? large.dat
@@ -321,7 +321,7 @@
 
   $ mv subrepo/renamed-large.txt subrepo/large.txt
   $ hg addremove subrepo
-  adding subrepo/normal.txt (glob)
+  adding subrepo/normal.txt
   $ hg forget subrepo/normal.txt
 
   $ hg addremove -S
@@ -393,7 +393,7 @@
 Forget doesn't change the content of the file
   $ echo 'pre-forget content' > subrepo/large.txt
   $ hg forget -v subrepo/large.txt
-  removing subrepo/large.txt (glob)
+  removing subrepo/large.txt
   $ cat subrepo/large.txt
   pre-forget content
 
@@ -403,7 +403,7 @@
   C subrepo/large.txt
 
   $ hg rm -v subrepo/large.txt
-  removing subrepo/large.txt (glob)
+  removing subrepo/large.txt
   $ hg revert -R subrepo subrepo/large.txt
   $ rm subrepo/large.txt
   $ hg addremove -S
@@ -532,10 +532,10 @@
 Test orig files go where we want them
   $ echo moremore >> anotherlarge
   $ hg revert anotherlarge -v --config 'ui.origbackuppath=.hg/origbackups'
-  creating directory: $TESTTMP/addrm2/.hg/origbackups/.hglf/sub (glob)
-  saving current version of ../.hglf/sub/anotherlarge as $TESTTMP/addrm2/.hg/origbackups/.hglf/sub/anotherlarge (glob)
-  reverting ../.hglf/sub/anotherlarge (glob)
-  creating directory: $TESTTMP/addrm2/.hg/origbackups/sub (glob)
+  creating directory: $TESTTMP/addrm2/.hg/origbackups/.hglf/sub
+  saving current version of ../.hglf/sub/anotherlarge as $TESTTMP/addrm2/.hg/origbackups/.hglf/sub/anotherlarge
+  reverting ../.hglf/sub/anotherlarge
+  creating directory: $TESTTMP/addrm2/.hg/origbackups/sub
   found 90c622cf65cebe75c5842f9136c459333faf392e in store
   found 90c622cf65cebe75c5842f9136c459333faf392e in store
   $ ls ../.hg/origbackups/sub
@@ -608,7 +608,7 @@
 
   $ hg -q clone src clone2
   $ hg -R clone2 paths | grep default
-  default = $TESTTMP/issue3651/src (glob)
+  default = $TESTTMP/issue3651/src
 
   $ hg -R clone2 summary --large
   parent: 0:fc0bd45326d3 tip
@@ -619,14 +619,14 @@
   phases: 1 draft
   largefiles: (no files to upload)
   $ hg -R clone2 outgoing --large
-  comparing with $TESTTMP/issue3651/src (glob)
+  comparing with $TESTTMP/issue3651/src
   searching for changes
   no changes found
   largefiles: no files to upload
   [1]
 
   $ hg -R clone2 outgoing --large --graph --template "{rev}"
-  comparing with $TESTTMP/issue3651/src (glob)
+  comparing with $TESTTMP/issue3651/src
   searching for changes
   no changes found
   largefiles: no files to upload
@@ -647,7 +647,7 @@
   phases: 2 draft
   largefiles: 1 entities for 1 files to upload
   $ hg -R clone2 outgoing --large
-  comparing with $TESTTMP/issue3651/src (glob)
+  comparing with $TESTTMP/issue3651/src
   searching for changes
   changeset:   1:1acbe71ce432
   tag:         tip
@@ -659,7 +659,7 @@
   b
   
   $ hg -R clone2 outgoing --large --graph --template "{rev}"
-  comparing with $TESTTMP/issue3651/src (glob)
+  comparing with $TESTTMP/issue3651/src
   searching for changes
   @  1
   
@@ -683,7 +683,7 @@
   phases: 3 draft
   largefiles: 1 entities for 3 files to upload
   $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
-  comparing with $TESTTMP/issue3651/src (glob)
+  comparing with $TESTTMP/issue3651/src
   searching for changes
   1:1acbe71ce432
   2:6095d0695d70
@@ -695,7 +695,7 @@
   $ hg -R clone2 cat -r 1 clone2/.hglf/b
   89e6c98d92887913cadf06b2adb97f26cde4849b
   $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
-  comparing with $TESTTMP/issue3651/src (glob)
+  comparing with $TESTTMP/issue3651/src
   query 1; heads
   searching for changes
   all remote heads known locally
@@ -733,7 +733,7 @@
   phases: 6 draft
   largefiles: 3 entities for 3 files to upload
   $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
-  comparing with $TESTTMP/issue3651/src (glob)
+  comparing with $TESTTMP/issue3651/src
   searching for changes
   1:1acbe71ce432
   2:6095d0695d70
@@ -750,7 +750,7 @@
   $ hg -R clone2 cat -r 4 clone2/.hglf/b
   13f9ed0898e315bf59dc2973fec52037b6f441a2
   $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
-  comparing with $TESTTMP/issue3651/src (glob)
+  comparing with $TESTTMP/issue3651/src
   query 1; heads
   searching for changes
   all remote heads known locally
@@ -792,7 +792,7 @@
   phases: 6 draft
   largefiles: 2 entities for 1 files to upload
   $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
-  comparing with $TESTTMP/issue3651/src (glob)
+  comparing with $TESTTMP/issue3651/src
   searching for changes
   2:6095d0695d70
   3:7983dce246cc
@@ -802,7 +802,7 @@
   b
   
   $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
-  comparing with $TESTTMP/issue3651/src (glob)
+  comparing with $TESTTMP/issue3651/src
   query 1; heads
   searching for changes
   all remote heads known locally
@@ -843,7 +843,7 @@
   A d1/g
   $ hg up -qr0
   $ hg mv d1 d2
-  moving d1/f to d2/f (glob)
+  moving d1/f to d2/f
   $ hg ci -qm2
   Invoking status precommit hook
   A d2/f
@@ -962,7 +962,7 @@
   > largefiles=
   > EOF
   $ hg -R enabledlocally root
-  $TESTTMP/individualenabling/enabledlocally (glob)
+  $TESTTMP/individualenabling/enabledlocally
   $ hg -R notenabledlocally root
   abort: repository requires features unknown to this Mercurial: largefiles!
   (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
@@ -1088,18 +1088,14 @@
   */no-largefiles/normal1 */no-largefiles/normal1 (glob) (no-windows !)
   [1]
   $ hg -R subrepo-root revert --all
-  reverting subrepo-root/.hglf/large (glob)
+  reverting subrepo-root/.hglf/large
   reverting subrepo no-largefiles
-  reverting subrepo-root/no-largefiles/normal1 (glob)
+  reverting subrepo-root/no-largefiles/normal1
 
 Move (and then undo) a directory move with only largefiles.
 
-  $ listtree() {
-  >   $PYTHON $TESTDIR/list-tree.py $@
-  > }
-
   $ cd subrepo-root
-  $ listtree .hglf dir* large*
+  $ $PYTHON $TESTDIR/list-tree.py .hglf dir* large*
   .hglf/
   .hglf/dir/
   .hglf/dir/subdir/
@@ -1112,9 +1108,9 @@
   large.orig
 
   $ hg mv dir/subdir dir/subdir2
-  moving .hglf/dir/subdir/large.bin to .hglf/dir/subdir2/large.bin (glob)
+  moving .hglf/dir/subdir/large.bin to .hglf/dir/subdir2/large.bin
 
-  $ listtree .hglf dir* large*
+  $ $PYTHON $TESTDIR/list-tree.py .hglf dir* large*
   .hglf/
   .hglf/dir/
   .hglf/dir/subdir2/
@@ -1139,8 +1135,8 @@
   ? large.orig
 
   $ hg revert --all
-  undeleting .hglf/dir/subdir/large.bin (glob)
-  forgetting .hglf/dir/subdir2/large.bin (glob)
+  undeleting .hglf/dir/subdir/large.bin
+  forgetting .hglf/dir/subdir2/large.bin
   reverting subrepo no-largefiles
 
   $ hg status -C
@@ -1154,7 +1150,7 @@
 
 The standin for subdir2 should be deleted, not just dropped
 
-  $ listtree .hglf dir* large*
+  $ $PYTHON $TESTDIR/list-tree.py .hglf dir* large*
   .hglf/
   .hglf/dir/
   .hglf/dir/subdir/
@@ -1173,7 +1169,7 @@
 'subdir' should not be in the destination.  It would be if the subdir2 directory
 existed under .hglf/.
   $ hg mv dir/subdir dir/subdir2
-  moving .hglf/dir/subdir/large.bin to .hglf/dir/subdir2/large.bin (glob)
+  moving .hglf/dir/subdir/large.bin to .hglf/dir/subdir2/large.bin
 
   $ hg status -C
   A dir/subdir2/large.bin
@@ -1181,7 +1177,7 @@
   R dir/subdir/large.bin
   ? large.orig
 
-  $ listtree .hglf dir* large*
+  $ $PYTHON $TESTDIR/list-tree.py .hglf dir* large*
   .hglf/
   .hglf/dir/
   .hglf/dir/subdir2/
@@ -1199,14 +1195,14 @@
   $ hg --config extensions.purge= purge
 
   $ hg mv dir/subdir dir2/subdir
-  moving .hglf/dir/subdir/large.bin to .hglf/dir2/subdir/large.bin (glob)
+  moving .hglf/dir/subdir/large.bin to .hglf/dir2/subdir/large.bin
 
   $ hg status -C
   A dir2/subdir/large.bin
     dir/subdir/large.bin
   R dir/subdir/large.bin
 
-  $ listtree .hglf dir* large*
+  $ $PYTHON $TESTDIR/list-tree.py .hglf dir* large*
   .hglf/
   .hglf/dir2/
   .hglf/dir2/subdir/
@@ -1218,14 +1214,14 @@
   large
 
   $ hg revert --all
-  undeleting .hglf/dir/subdir/large.bin (glob)
-  forgetting .hglf/dir2/subdir/large.bin (glob)
+  undeleting .hglf/dir/subdir/large.bin
+  forgetting .hglf/dir2/subdir/large.bin
   reverting subrepo no-largefiles
 
   $ hg status -C
   ? dir2/subdir/large.bin
 
-  $ listtree .hglf dir* large*
+  $ $PYTHON $TESTDIR/list-tree.py .hglf dir* large*
   .hglf/
   .hglf/dir/
   .hglf/dir/subdir/
@@ -1261,7 +1257,7 @@
   > largefiles=
   > EOF
   $ hg -R dst pull --rebase
-  pulling from $TESTTMP/issue3861/src (glob)
+  pulling from $TESTTMP/issue3861/src
   requesting all changes
   adding changesets
   adding manifests
--- a/tests/test-largefiles-update.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-largefiles-update.t	Tue Dec 19 16:27:24 2017 -0500
@@ -216,8 +216,7 @@
   $ hg add --large largeY
 
   $ hg status -A large1
-  large1: The system cannot find the file specified (windows !)
-  large1: No such file or directory (no-windows !)
+  large1: $ENOENT$
 
   $ hg status -A large2
   ? large2
@@ -309,8 +308,7 @@
   rebasing 4:07d6153b5c04 "#4" (tip)
 
   $ hg status -A large1
-  large1: The system cannot find the file specified (windows !)
-  large1: No such file or directory (no-windows !)
+  large1: $ENOENT$
 
   $ hg status -A largeX
   C largeX
@@ -320,8 +318,7 @@
   $ hg transplant -q 1 4
 
   $ hg status -A large1
-  large1: The system cannot find the file specified (windows !)
-  large1: No such file or directory (no-windows !)
+  large1: $ENOENT$
 
   $ hg status -A largeX
   C largeX
@@ -331,8 +328,7 @@
   $ hg transplant -q --merge 1 --merge 4
 
   $ hg status -A large1
-  large1: The system cannot find the file specified (windows !)
-  large1: No such file or directory (no-windows !)
+  large1: $ENOENT$
 
   $ hg status -A largeX
   C largeX
@@ -444,7 +440,7 @@
 
   $ hg update -q -C 2
   $ hg strip 3 4
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9530e27857f7-2e7b195d-backup.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9530e27857f7-2e7b195d-backup.hg
   $ mv .hg/strip-backup/9530e27857f7-2e7b195d-backup.hg $TESTTMP
 
 (internal linear merging at "hg pull --update")
@@ -452,7 +448,7 @@
   $ echo 'large1 for linear merge (conflict)' > large1
   $ echo 'large2 for linear merge (conflict with normal file)' > large2
   $ hg pull --update --config debug.dirstate.delaywrite=2 $TESTTMP/9530e27857f7-2e7b195d-backup.hg
-  pulling from $TESTTMP/9530e27857f7-2e7b195d-backup.hg (glob)
+  pulling from $TESTTMP/9530e27857f7-2e7b195d-backup.hg
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-largefiles-wireproto.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-largefiles-wireproto.t	Tue Dec 19 16:27:24 2017 -0500
@@ -181,7 +181,7 @@
   pushing to http://localhost:$HGPORT1/
   searching for changes
   remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
-  abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
+  abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/
   [255]
   $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
 Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic
@@ -352,7 +352,7 @@
   searching 2 changesets for largefiles
   verified existence of 2 revisions of 2 largefiles
   $ tail -1 access.log
-  $LOCALIP - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3D972a1a11f19934401291cc99117ec614933374ce%3Bstatlfile+sha%3Dc801c9cfe94400963fcb683246217d5db77f9a9a x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3D972a1a11f19934401291cc99117ec614933374ce%3Bstatlfile+sha%3Dc801c9cfe94400963fcb683246217d5db77f9a9a x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   $ hg -R batchverifyclone update
   getting changed largefiles
   2 largefiles updated, 0 removed
@@ -390,7 +390,7 @@
   searching 3 changesets for largefiles
   verified existence of 3 revisions of 3 largefiles
   $ tail -1 access.log
-  $LOCALIP - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3Dc8559c3c9cfb42131794b7d8009230403b9b454c x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3Dc8559c3c9cfb42131794b7d8009230403b9b454c x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
 
   $ killdaemons.py
 
--- a/tests/test-largefiles.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-largefiles.t	Tue Dec 19 16:27:24 2017 -0500
@@ -343,8 +343,8 @@
   $ echo large6 > sub2/large6
   $ echo large7 > sub2/large7
   $ hg add --large sub2
-  adding sub2/large6 as a largefile (glob)
-  adding sub2/large7 as a largefile (glob)
+  adding sub2/large6 as a largefile
+  adding sub2/large7 as a largefile
   $ hg st
   M large3
   A large5
@@ -661,7 +661,7 @@
 
 Test that outgoing --large works (with revsets too)
   $ hg outgoing --rev '.^' --large
-  comparing with $TESTTMP/a (glob)
+  comparing with $TESTTMP/a
   searching for changes
   changeset:   8:c02fd3b77ec4
   user:        test
@@ -1098,7 +1098,7 @@
   $ rm "${USERCACHE}"/*
   $ cd a-backup
   $ hg pull --all-largefiles --config paths.default-push=bogus/path
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
@@ -1113,7 +1113,7 @@
   $ hg rollback
   repository tip rolled back to revision 1 (undo pull)
   $ hg pull -v --lfrev 'heads(pulled())+min(pulled())'
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   all local heads known remotely
   6 changesets found
@@ -1199,7 +1199,7 @@
 
   $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
   $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
-  pulling from $TESTTMP/b (glob)
+  pulling from $TESTTMP/b
   searching for changes
   adding changesets
   adding manifests
@@ -1210,7 +1210,7 @@
   Invoking status precommit hook
   M sub/normal4
   M sub2/large6
-  saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg
   0 largefiles cached
   $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
   $ hg log --template '{rev}:{node|short}  {desc|firstline}\n'
@@ -1270,7 +1270,7 @@
   Invoking status precommit hook
   M sub/normal4
   M sub2/large6
-  saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg
   $ hg log --template '{rev}:{node|short}  {desc|firstline}\n'
   9:598410d3eb9a  modify normal file largefile in repo d
   8:a381d2c8c80e  modify normal file and largefile in repo b
@@ -1500,8 +1500,8 @@
 # XXX we don't really want to report that we're reverting the standin;
 # that's just an implementation detail. But I don't see an obvious fix. ;-(
   $ hg revert sub
-  reverting .hglf/sub/large4 (glob)
-  reverting sub/normal4 (glob)
+  reverting .hglf/sub/large4
+  reverting sub/normal4
   $ hg status
   M normal3
   A sub2/large8
@@ -1513,8 +1513,8 @@
   $ cat sub/large4
   large4-modified
   $ hg revert -a --no-backup
-  undeleting .hglf/sub2/large6 (glob)
-  forgetting .hglf/sub2/large8 (glob)
+  undeleting .hglf/sub2/large6
+  forgetting .hglf/sub2/large8
   reverting normal3
   $ hg status
   ? sub/large4.orig
@@ -1528,12 +1528,12 @@
 
 revert some files to an older revision
   $ hg revert --no-backup -r 8 sub2
-  reverting .hglf/sub2/large6 (glob)
+  reverting .hglf/sub2/large6
   $ cat sub2/large6
   large6
   $ hg revert --no-backup -C -r '.^' sub2
   $ hg revert --no-backup sub2
-  reverting .hglf/sub2/large6 (glob)
+  reverting .hglf/sub2/large6
   $ hg status
 
 "verify --large" actually verifies largefiles
@@ -1542,7 +1542,7 @@
   $ pwd
   $TESTTMP/e
   $ hg paths
-  default = $TESTTMP/d (glob)
+  default = $TESTTMP/d
 
   $ hg verify --large
   checking changesets
@@ -1565,14 +1565,14 @@
   checking files
   10 files, 10 changesets, 28 total revisions
   searching 1 changesets for largefiles
-  changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob)
+  changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
   verified existence of 3 revisions of 3 largefiles
   [1]
 
 - introduce corruption and make sure that it is caught when checking content:
   $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
   $ hg verify -q --large --lfc
-  changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob)
+  changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
   [1]
 
 - cleanup
@@ -1582,16 +1582,16 @@
 - verifying all revisions will fail because we didn't clone all largefiles to d:
   $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
   $ hg verify -q --lfa --lfc
-  changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64 (glob)
-  changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d (glob)
-  changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f (glob)
-  changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
-  changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
-  changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
-  changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
-  changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c (glob)
-  changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9 (glob)
-  changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0 (glob)
+  changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64
+  changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d
+  changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f
+  changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
+  changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
+  changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
+  changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
+  changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c
+  changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9
+  changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0
   [1]
 
 - cleanup
@@ -1655,7 +1655,7 @@
 Pulling 0 revisions with --all-largefiles should not fetch for all revisions
 
   $ hg pull --all-largefiles
-  pulling from $TESTTMP/d (glob)
+  pulling from $TESTTMP/d
   searching for changes
   no changes found
 
@@ -1752,8 +1752,8 @@
 
 - revert should be able to revert files introduced in a pending merge
   $ hg revert --all -r .
-  removing .hglf/large (glob)
-  undeleting .hglf/sub2/large6 (glob)
+  removing .hglf/large
+  undeleting .hglf/sub2/large6
 
 Test that a normal file and a largefile with the same name and path cannot
 coexist.
@@ -1761,7 +1761,7 @@
   $ rm sub2/large7
   $ echo "largeasnormal" > sub2/large7
   $ hg add sub2/large7
-  sub2/large7 already a largefile (glob)
+  sub2/large7 already a largefile
 
 Test that transplanting a largefile change works correctly.
 
@@ -1832,7 +1832,7 @@
   $ hg cat .hglf/sub/large4
   e166e74c7303192238d60af5a9c4ce9bef0b7928
   $ hg cat .hglf/normal3
-  .hglf/normal3: no such file in rev 598410d3eb9a (glob)
+  .hglf/normal3: no such file in rev 598410d3eb9a
   [1]
 
 Test that renaming a largefile results in correct output for status
--- a/tests/test-lfconvert.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-lfconvert.t	Tue Dec 19 16:27:24 2017 -0500
@@ -215,7 +215,7 @@
   $ hg share -q -U bigfile-repo shared
   $ printf 'bogus' > shared/.hg/sharedpath
   $ hg lfconvert shared foo
-  abort: .hg/sharedpath points to nonexistent directory $TESTTMP/bogus! (glob)
+  abort: .hg/sharedpath points to nonexistent directory $TESTTMP/bogus!
   [255]
   $ hg lfconvert bigfile-repo largefiles-repo
   initializing destination largefiles-repo
@@ -340,12 +340,12 @@
   checking files
   9 files, 8 changesets, 13 total revisions
   searching 7 changesets for largefiles
-  changeset 0:d4892ec57ce2: large references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/2e000fa7e85759c7f4c254d4d9c33ef481e459a7 (glob)
-  changeset 1:334e5237836d: sub/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c (glob)
-  changeset 2:261ad3f3f037: stuff/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c (glob)
-  changeset 3:55759520c76f: sub/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/76236b6a2c6102826c61af4297dd738fb3b1de38 (glob)
-  changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/76236b6a2c6102826c61af4297dd738fb3b1de38 (glob)
-  changeset 6:17126745edfd: anotherlarge references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3 (glob)
+  changeset 0:d4892ec57ce2: large references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/2e000fa7e85759c7f4c254d4d9c33ef481e459a7
+  changeset 1:334e5237836d: sub/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
+  changeset 2:261ad3f3f037: stuff/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
+  changeset 3:55759520c76f: sub/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/76236b6a2c6102826c61af4297dd738fb3b1de38
+  changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/76236b6a2c6102826c61af4297dd738fb3b1de38
+  changeset 6:17126745edfd: anotherlarge references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3
   verified existence of 6 revisions of 4 largefiles
   [1]
   $ hg -R largefiles-repo-hg showconfig paths
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-lfs-largefiles.t	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,354 @@
+This tests the interaction between the largefiles and lfs extensions, and
+conversion from largefiles -> lfs.
+
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > largefiles =
+  > 
+  > [lfs]
+  > # standin files are 41 bytes.  Stay bigger for clarity.
+  > threshold = 42
+  > EOF
+
+Setup a repo with a normal file and a largefile, above and below the lfs
+threshold to test lfconvert.  *.txt start life as a normal file; *.bin start as
+an lfs/largefile.
+
+  $ hg init largefiles
+  $ cd largefiles
+  $ echo 'normal' > normal.txt
+  $ echo 'normal above lfs threshold 0000000000000000000000000' > lfs.txt
+  $ hg ci -Am 'normal.txt'
+  adding lfs.txt
+  adding normal.txt
+  $ echo 'largefile' > large.bin
+  $ echo 'largefile above lfs threshold 0000000000000000000000' > lfs.bin
+  $ hg add --large large.bin lfs.bin
+  $ hg ci -m 'add largefiles'
+
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > lfs =
+  > EOF
+
+Add an lfs file and normal file that collide with files on the other branch.
+large.bin is added as a normal file, and is named as such only to clash with the
+largefile on the other branch.
+
+  $ hg up -q '.^'
+  $ echo 'below lfs threshold' > large.bin
+  $ echo 'lfs above the lfs threshold for length 0000000000000' > lfs.bin
+  $ hg ci -Am 'add with lfs extension'
+  adding large.bin
+  adding lfs.bin
+  created new head
+
+  $ hg log -G
+  @  changeset:   2:e989d0fa3764
+  |  tag:         tip
+  |  parent:      0:29361292f54d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add with lfs extension
+  |
+  | o  changeset:   1:6513aaab9ca0
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     add largefiles
+  |
+  o  changeset:   0:29361292f54d
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     normal.txt
+  
+--------------------------------------------------------------------------------
+Merge largefiles into lfs branch
+
+The largefiles extension will prompt to use the normal or largefile when merged
+into the lfs files.  `hg manifest` will show standins if present.  They aren't,
+because largefiles merge doesn't merge content.  If it did, selecting (n)ormal
+would convert to lfs on commit, if appropriate.
+
+BUG: Largefiles isn't running the merge tool, like when two lfs files are
+merged.  This is probably by design, but it should probably at least prompt if
+content should be taken from (l)ocal or (o)ther as well.
+
+  $ hg --config ui.interactive=True merge 6513aaab9ca0 <<EOF
+  > n
+  > n
+  > EOF
+  remote turned local normal file large.bin into a largefile
+  use (l)argefile or keep (n)ormal file? n
+  remote turned local normal file lfs.bin into a largefile
+  use (l)argefile or keep (n)ormal file? n
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'merge lfs with largefiles -> normal'
+  $ hg manifest
+  large.bin
+  lfs.bin
+  lfs.txt
+  normal.txt
+
+The merged lfs.bin resolved to lfs because the (n)ormal option was picked.  The
+lfs.txt file is unchanged by the merge, because it was added before lfs was
+enabled, and the content didn't change.
+  $ hg debugdata lfs.bin 0
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:81c7492b2c05e130431f65a87651b54a30c5da72c99ce35a1e9b9872a807312b
+  size 53
+  x-is-binary 0
+  $ hg debugdata lfs.txt 0
+  normal above lfs threshold 0000000000000000000000000
+
+Another filelog entry is NOT made by the merge, so nothing is committed as lfs.
+  $ hg log -r . -T '{join(lfs_files, ", ")}\n'
+  
+
+Replay the last merge, but pick (l)arge this time.  The manifest will show any
+standins.
+
+  $ hg up -Cq e989d0fa3764
+
+  $ hg --config ui.interactive=True merge 6513aaab9ca0 <<EOF
+  > l
+  > l
+  > EOF
+  remote turned local normal file large.bin into a largefile
+  use (l)argefile or keep (n)ormal file? l
+  remote turned local normal file lfs.bin into a largefile
+  use (l)argefile or keep (n)ormal file? l
+  getting changed largefiles
+  2 largefiles updated, 0 removed
+  2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'merge lfs with largefiles -> large'
+  created new head
+  $ hg manifest
+  .hglf/large.bin
+  .hglf/lfs.bin
+  lfs.txt
+  normal.txt
+
+--------------------------------------------------------------------------------
+Merge lfs into largefiles branch
+
+  $ hg up -Cq 6513aaab9ca0
+  $ hg --config ui.interactive=True merge e989d0fa3764 <<EOF
+  > n
+  > n
+  > EOF
+  remote turned local largefile large.bin into a normal file
+  keep (l)argefile or use (n)ormal file? n
+  remote turned local largefile lfs.bin into a normal file
+  keep (l)argefile or use (n)ormal file? n
+  getting changed largefiles
+  0 largefiles updated, 0 removed
+  2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'merge largefiles with lfs -> normal'
+  created new head
+  $ hg manifest
+  large.bin
+  lfs.bin
+  lfs.txt
+  normal.txt
+
+The merged lfs.bin got converted to lfs because the (n)ormal option was picked.
+The lfs.txt file is unchanged by the merge, because it was added before lfs was
+enabled.
+  $ hg debugdata lfs.bin 0
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:81c7492b2c05e130431f65a87651b54a30c5da72c99ce35a1e9b9872a807312b
+  size 53
+  x-is-binary 0
+  $ hg debugdata lfs.txt 0
+  normal above lfs threshold 0000000000000000000000000
+
+Another filelog entry is NOT made by the merge, so nothing is committed as lfs.
+  $ hg log -r . -T '{join(lfs_files, ", ")}\n'
+  
+
+Replay the last merge, but pick (l)arge this time.  The manifest will show the
+standins.
+
+  $ hg up -Cq 6513aaab9ca0
+
+  $ hg --config ui.interactive=True merge e989d0fa3764 <<EOF
+  > l
+  > l
+  > EOF
+  remote turned local largefile large.bin into a normal file
+  keep (l)argefile or use (n)ormal file? l
+  remote turned local largefile lfs.bin into a normal file
+  keep (l)argefile or use (n)ormal file? l
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'merge largefiles with lfs -> large'
+  created new head
+  $ hg manifest
+  .hglf/large.bin
+  .hglf/lfs.bin
+  lfs.txt
+  normal.txt
+
+--------------------------------------------------------------------------------
+
+When both largefiles and lfs are configured to add by size, the tie goes to
+largefiles since it hooks cmdutil.add() and lfs hooks the filelog write in the
+commit.  By the time the commit occurs, the tracked file is smaller than the
+threshold (assuming it is > 41, so the standins don't become lfs objects).
+
+  $ $PYTHON -c 'import sys ; sys.stdout.write("y\n" * 1048576)' > large_by_size.bin
+  $ hg --config largefiles.minsize=1 ci -Am 'large by size'
+  adding large_by_size.bin as a largefile
+  $ hg manifest
+  .hglf/large.bin
+  .hglf/large_by_size.bin
+  .hglf/lfs.bin
+  lfs.txt
+  normal.txt
+
+  $ hg rm large_by_size.bin
+  $ hg ci -m 'remove large_by_size.bin'
+
+Largefiles doesn't do anything special with diff, so it falls back to diffing
+the standins.  Extdiff also is standin based comparison.  Diff and extdiff both
+work on the original file for lfs objects.
+
+Largefile -> lfs transition
+  $ hg diff -r 1 -r 3
+  diff -r 6513aaab9ca0 -r dcc5ce63e252 .hglf/large.bin
+  --- a/.hglf/large.bin	Thu Jan 01 00:00:00 1970 +0000
+  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +0,0 @@
+  -cef9a458373df9b0743a0d3c14d0c66fb19b8629
+  diff -r 6513aaab9ca0 -r dcc5ce63e252 .hglf/lfs.bin
+  --- a/.hglf/lfs.bin	Thu Jan 01 00:00:00 1970 +0000
+  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +0,0 @@
+  -557fb6309cef935e1ac2c8296508379e4b15a6e6
+  diff -r 6513aaab9ca0 -r dcc5ce63e252 large.bin
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/large.bin	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +below lfs threshold
+  diff -r 6513aaab9ca0 -r dcc5ce63e252 lfs.bin
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/lfs.bin	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +lfs above the lfs threshold for length 0000000000000
+
+lfs -> largefiles transition
+  $ hg diff -r 2 -r 6
+  diff -r e989d0fa3764 -r 95e1e80325c8 .hglf/large.bin
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/.hglf/large.bin	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +cef9a458373df9b0743a0d3c14d0c66fb19b8629
+  diff -r e989d0fa3764 -r 95e1e80325c8 .hglf/lfs.bin
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/.hglf/lfs.bin	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +557fb6309cef935e1ac2c8296508379e4b15a6e6
+  diff -r e989d0fa3764 -r 95e1e80325c8 large.bin
+  --- a/large.bin	Thu Jan 01 00:00:00 1970 +0000
+  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +0,0 @@
+  -below lfs threshold
+  diff -r e989d0fa3764 -r 95e1e80325c8 lfs.bin
+  --- a/lfs.bin	Thu Jan 01 00:00:00 1970 +0000
+  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +0,0 @@
+  -lfs above the lfs threshold for length 0000000000000
+
+A largefiles repo can be converted to lfs.  The lfconvert command uses the
+convert extension under the hood with --to-normal.  So the --config based
+parameters are available, but not --authormap, --branchmap, etc.
+
+  $ cd ..
+  $ hg lfconvert --to-normal largefiles nolargefiles 2>&1
+  initializing destination nolargefiles
+  0 additional largefiles cached
+  scanning source...
+  sorting...
+  converting...
+  8 normal.txt
+  7 add largefiles
+  6 add with lfs extension
+  5 merge lfs with largefiles -> normal
+  4 merge lfs with largefiles -> large
+  3 merge largefiles with lfs -> normal
+  2 merge largefiles with lfs -> large
+  1 large by size
+  0 remove large_by_size.bin
+  $ cd nolargefiles
+
+The requirement is added to the destination repo, and the extension is enabled
+locally.
+
+  $ cat .hg/requires
+  dotencode
+  fncache
+  generaldelta
+  lfs
+  revlogv1
+  store
+  $ hg config --debug extensions | grep lfs
+  $TESTTMP/nolargefiles/.hg/hgrc:*: extensions.lfs= (glob)
+
+  $ hg log -r 'all()' -G -T '{rev} {join(lfs_files, ", ")} ({desc})\n'
+  o  8  (remove large_by_size.bin)
+  |
+  o  7 large_by_size.bin (large by size)
+  |
+  o    6  (merge largefiles with lfs -> large)
+  |\
+  +---o  5  (merge largefiles with lfs -> normal)
+  | |/
+  +---o  4 lfs.bin (merge lfs with largefiles -> large)
+  | |/
+  +---o  3  (merge lfs with largefiles -> normal)
+  | |/
+  | o  2 lfs.bin (add with lfs extension)
+  | |
+  o |  1 lfs.bin (add largefiles)
+  |/
+  o  0 lfs.txt (normal.txt)
+  
+  $ hg debugdata lfs.bin 0
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:2172a5bd492dd41ec533b9bb695f7691b6351719407ac797f0ccad5348c81e62
+  size 53
+  x-is-binary 0
+  $ hg debugdata lfs.bin 1
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:81c7492b2c05e130431f65a87651b54a30c5da72c99ce35a1e9b9872a807312b
+  size 53
+  x-is-binary 0
+  $ hg debugdata lfs.bin 2
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:2172a5bd492dd41ec533b9bb695f7691b6351719407ac797f0ccad5348c81e62
+  size 53
+  x-is-binary 0
+  $ hg debugdata lfs.bin 3
+  abort: invalid revision identifier 3
+  [255]
+
+No diffs when comparing merge and p1 that kept p1's changes.  Diff of lfs to
+largefiles no longer operates in standin files.
+
+  $ hg diff -r 2:3
+  $ hg diff -r 2:6
+  diff -r e989d0fa3764 -r 752e3a0d8488 large.bin
+  --- a/large.bin	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/large.bin	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -below lfs threshold
+  +largefile
+  diff -r e989d0fa3764 -r 752e3a0d8488 lfs.bin
+  --- a/lfs.bin	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/lfs.bin	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -lfs above the lfs threshold for length 0000000000000
+  +largefile above lfs threshold 0000000000000000000000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-lfs-pointer.py	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,41 @@
+from __future__ import absolute_import, print_function
+
+import os
+import sys
+
+# make it runnable using python directly without run-tests.py
+sys.path[0:0] = [os.path.join(os.path.dirname(__file__), '..')]
+
+from hgext.lfs import pointer
+
+def tryparse(text):
+    r = {}
+    try:
+        r = pointer.deserialize(text)
+        print('ok')
+    except Exception as ex:
+        print(ex)
+    if r:
+        text2 = r.serialize()
+        if text2 != text:
+            print('reconstructed text differs')
+    return r
+
+t = ('version https://git-lfs.github.com/spec/v1\n'
+     'oid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1'
+     '258daaa5e2ca24d17e2393\n'
+     'size 12345\n'
+     'x-foo extra-information\n')
+
+tryparse('')
+tryparse(t)
+tryparse(t.replace('git-lfs', 'unknown'))
+tryparse(t.replace('v1\n', 'v1\n\n'))
+tryparse(t.replace('sha256', 'ahs256'))
+tryparse(t.replace('sha256:', ''))
+tryparse(t.replace('12345', '0x12345'))
+tryparse(t.replace('extra-information', 'extra\0information'))
+tryparse(t.replace('extra-information', 'extra\ninformation'))
+tryparse(t.replace('x-foo', 'x_foo'))
+tryparse(t.replace('oid', 'blobid'))
+tryparse(t.replace('size', 'size-bytes').replace('oid', 'object-id'))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-lfs-pointer.py.out	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,12 @@
+missed keys: oid, size
+ok
+unexpected value: version='https://unknown.github.com/spec/v1'
+cannot parse git-lfs text: 'version https://git-lfs.github.com/spec/v1\n\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 12345\nx-foo extra-information\n'
+unexpected value: oid='ahs256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393'
+unexpected value: oid='4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393'
+unexpected value: size='0x12345'
+ok
+cannot parse git-lfs text: 'version https://git-lfs.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 12345\nx-foo extra\ninformation\n'
+unexpected key: x_foo
+missed keys: oid
+missed keys: oid, size
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-lfs-test-server.t	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,138 @@
+#require lfs-test-server
+
+  $ LFS_LISTEN="tcp://:$HGPORT"
+  $ LFS_HOST="localhost:$HGPORT"
+  $ LFS_PUBLIC=1
+  $ export LFS_LISTEN LFS_HOST LFS_PUBLIC
+#if no-windows
+  $ lfs-test-server &> lfs-server.log &
+  $ echo $! >> $DAEMON_PIDS
+#else
+  $ cat >> $TESTTMP/spawn.py <<EOF
+  > import os
+  > import subprocess
+  > import sys
+  > 
+  > for path in os.environ["PATH"].split(os.pathsep):
+  >     exe = os.path.join(path, 'lfs-test-server.exe')
+  >     if os.path.exists(exe):
+  >         with open('lfs-server.log', 'wb') as out:
+  >             p = subprocess.Popen(exe, stdout=out, stderr=out)
+  >             sys.stdout.write('%s\n' % p.pid)
+  >             sys.exit(0)
+  > sys.exit(1)
+  > EOF
+  $ $PYTHON $TESTTMP/spawn.py >> $DAEMON_PIDS
+#endif
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > lfs=
+  > [lfs]
+  > url=http://foo:bar@$LFS_HOST/
+  > threshold=1
+  > EOF
+
+  $ hg init repo1
+  $ cd repo1
+  $ echo THIS-IS-LFS > a
+  $ hg commit -m a -A a
+
+  $ hg init ../repo2
+  $ hg push ../repo2 -v
+  pushing to ../repo2
+  searching for changes
+  lfs: uploading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
+  lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
+  1 changesets found
+  uncompressed size of bundle content:
+       * (changelog) (glob)
+       * (manifests) (glob)
+       *  a (glob)
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+
+Clear the cache to force a download
+  $ rm -rf `hg config lfs.usercache`
+  $ cd ../repo2
+  $ hg update tip -v
+  resolving manifests
+  getting a
+  lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
+  lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+When the server has some blobs already
+
+  $ hg mv a b
+  $ echo ANOTHER-LARGE-FILE > c
+  $ echo ANOTHER-LARGE-FILE2 > d
+  $ hg commit -m b-and-c -A b c d
+  $ hg push ../repo1 -v | grep -v '^  '
+  pushing to ../repo1
+  searching for changes
+  lfs: need to transfer 2 objects (39 bytes)
+  lfs: uploading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
+  lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
+  lfs: uploading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
+  lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
+  1 changesets found
+  uncompressed size of bundle content:
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 3 changes to 3 files
+
+Clear the cache to force a download
+  $ rm -rf `hg config lfs.usercache`
+  $ hg --repo ../repo1 update tip -v
+  resolving manifests
+  getting b
+  getting c
+  lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
+  lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
+  getting d
+  lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
+  lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Check error message when the remote missed a blob:
+
+  $ echo FFFFF > b
+  $ hg commit -m b -A b
+  $ echo FFFFF >> b
+  $ hg commit -m b b
+  $ rm -rf .hg/store/lfs
+  $ rm -rf `hg config lfs.usercache`
+  $ hg update -C '.^'
+  abort: LFS server claims required objects do not exist:
+  8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13!
+  [255]
+
+Check error message when object does not exist:
+
+  $ hg init test && cd test
+  $ echo "[extensions]" >> .hg/hgrc
+  $ echo "lfs=" >> .hg/hgrc
+  $ echo "[lfs]" >> .hg/hgrc
+  $ echo "threshold=1" >> .hg/hgrc
+  $ echo a > a
+  $ hg add a
+  $ hg commit -m 'test'
+  $ echo aaaaa > a
+  $ hg commit -m 'largefile'
+  $ hg debugdata .hg/store/data/a.i 1 # verify this is no the file content but includes "oid", the LFS "pointer".
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a
+  size 6
+  x-is-binary 0
+  $ cd ..
+  $ rm -rf `hg config lfs.usercache`
+  $ hg --config 'lfs.url=https://dewey-lfs.vip.facebook.com/lfs' clone test test2
+  updating to branch default
+  abort: LFS server error. Remote object for file data/a.i not found:(.*)! (re)
+  [255]
+
+  $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-lfs.t	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,691 @@
+# Initial setup
+
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > lfs=
+  > [lfs]
+  > threshold=1000B
+  > EOF
+
+  $ LONG=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+
+# Prepare server and enable extension
+  $ hg init server
+  $ hg clone -q server client
+  $ cd client
+
+# Commit small file
+  $ echo s > smallfile
+  $ hg commit -Aqm "add small file"
+
+# Commit large file
+  $ echo $LONG > largefile
+  $ grep lfs .hg/requires
+  [1]
+  $ hg commit --traceback -Aqm "add large file"
+  $ grep lfs .hg/requires
+  lfs
+
+# Ensure metadata is stored
+  $ hg debugdata largefile 0
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:f11e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
+  size 1501
+  x-is-binary 0
+
+# Check the blobstore is populated
+  $ find .hg/store/lfs/objects | sort
+  .hg/store/lfs/objects
+  .hg/store/lfs/objects/f1
+  .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
+
+# Check the blob stored contains the actual contents of the file
+  $ cat .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
+  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+
+# Push changes to the server
+
+  $ hg push
+  pushing to $TESTTMP/server
+  searching for changes
+  abort: lfs.url needs to be configured
+  [255]
+
+  $ cat >> $HGRCPATH << EOF
+  > [lfs]
+  > url=file:$TESTTMP/dummy-remote/
+  > EOF
+
+  $ hg push -v | egrep -v '^(uncompressed| )'
+  pushing to $TESTTMP/server
+  searching for changes
+  2 changesets found
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+
+# Unknown URL scheme
+
+  $ hg push --config lfs.url=ftp://foobar
+  abort: lfs: unknown url scheme: ftp
+  [255]
+
+  $ cd ../
+
+# Initialize new client (not cloning) and setup extension
+  $ hg init client2
+  $ cd client2
+  $ cat >> .hg/hgrc <<EOF
+  > [paths]
+  > default = $TESTTMP/server
+  > EOF
+
+# Pull from server
+  $ hg pull default
+  pulling from $TESTTMP/server
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  new changesets b29ba743f89d:00c137947d30
+  (run 'hg update' to get a working copy)
+
+# Check the blobstore is not yet populated
+  $ [ -d .hg/store/lfs/objects ]
+  [1]
+
+# Update to the last revision containing the large file
+  $ hg update
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+# Check the blobstore has been populated on update
+  $ find .hg/store/lfs/objects | sort
+  .hg/store/lfs/objects
+  .hg/store/lfs/objects/f1
+  .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
+
+# Check the contents of the file are fetched from blobstore when requested
+  $ hg cat -r . largefile
+  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+
+# Check the file has been copied in the working copy
+  $ cat largefile
+  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+
+  $ cd ..
+
+# Check rename, and switch between large and small files
+
+  $ hg init repo3
+  $ cd repo3
+  $ cat >> .hg/hgrc << EOF
+  > [lfs]
+  > threshold=10B
+  > EOF
+
+  $ echo LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS > large
+  $ echo SHORTER > small
+  $ hg add . -q
+  $ hg commit -m 'commit with lfs content'
+
+  $ hg mv large l
+  $ hg mv small s
+  $ hg commit -m 'renames'
+
+  $ echo SHORT > l
+  $ echo BECOME-LARGER-FROM-SHORTER > s
+  $ hg commit -m 'large to small, small to large'
+
+  $ echo 1 >> l
+  $ echo 2 >> s
+  $ hg commit -m 'random modifications'
+
+  $ echo RESTORE-TO-BE-LARGE > l
+  $ echo SHORTER > s
+  $ hg commit -m 'switch large and small again'
+
+# Test lfs_files template
+
+  $ hg log -r 'all()' -T '{rev} {join(lfs_files, ", ")}\n'
+  0 large
+  1 l
+  2 s
+  3 s
+  4 l
+
+# Push and pull the above repo
+
+  $ hg --cwd .. init repo4
+  $ hg push ../repo4
+  pushing to ../repo4
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 5 changesets with 10 changes to 4 files
+
+  $ hg --cwd .. init repo5
+  $ hg --cwd ../repo5 pull ../repo3
+  pulling from ../repo3
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 5 changesets with 10 changes to 4 files
+  new changesets fd47a419c4f7:5adf850972b9
+  (run 'hg update' to get a working copy)
+
+  $ cd ..
+
+# Test clone
+
+  $ hg init repo6
+  $ cd repo6
+  $ cat >> .hg/hgrc << EOF
+  > [lfs]
+  > threshold=30B
+  > EOF
+
+  $ echo LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES > large
+  $ echo SMALL > small
+  $ hg commit -Aqm 'create a lfs file' large small
+  $ hg debuglfsupload -r 'all()' -v
+
+  $ cd ..
+
+  $ hg clone repo6 repo7
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd repo7
+  $ hg config extensions --debug | grep lfs
+  $TESTTMP/repo7/.hg/hgrc:*: extensions.lfs= (glob)
+  $ cat large
+  LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES
+  $ cat small
+  SMALL
+
+  $ cd ..
+
+  $ hg --config extensions.share= share repo7 sharedrepo
+  updating working directory
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg -R sharedrepo config extensions --debug | grep lfs
+  $TESTTMP/sharedrepo/.hg/hgrc:*: extensions.lfs= (glob)
+
+# Test rename and status
+
+  $ hg init repo8
+  $ cd repo8
+  $ cat >> .hg/hgrc << EOF
+  > [lfs]
+  > threshold=10B
+  > EOF
+
+  $ echo THIS-IS-LFS-BECAUSE-10-BYTES > a1
+  $ echo SMALL > a2
+  $ hg commit -m a -A a1 a2
+  $ hg status
+  $ hg mv a1 b1
+  $ hg mv a2 a1
+  $ hg mv b1 a2
+  $ hg commit -m b
+  $ hg status
+  >>> with open('a2', 'wb') as f:
+  ...     f.write(b'\1\nSTART-WITH-HG-FILELOG-METADATA')
+  >>> with open('a1', 'wb') as f:
+  ...     f.write(b'\1\nMETA\n')
+  $ hg commit -m meta
+  $ hg status
+  $ hg log -T '{rev}: {file_copies} | {file_dels} | {file_adds}\n'
+  2:  |  | 
+  1: a1 (a2)a2 (a1) |  | 
+  0:  |  | a1 a2
+
+  $ for n in a1 a2; do
+  >   for r in 0 1 2; do
+  >     printf '\n%s @ %s\n' $n $r
+  >     hg debugdata $n $r
+  >   done
+  > done
+  
+  a1 @ 0
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
+  size 29
+  x-is-binary 0
+  
+  a1 @ 1
+  \x01 (esc)
+  copy: a2
+  copyrev: 50470ad23cf937b1f4b9f80bfe54df38e65b50d9
+  \x01 (esc)
+  SMALL
+  
+  a1 @ 2
+  \x01 (esc)
+  \x01 (esc)
+  \x01 (esc)
+  META
+  
+  a2 @ 0
+  SMALL
+  
+  a2 @ 1
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
+  size 29
+  x-hg-copy a1
+  x-hg-copyrev be23af27908a582af43e5cda209a5a9b319de8d4
+  x-is-binary 0
+  
+  a2 @ 2
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943
+  size 32
+  x-is-binary 0
+
+# Verify commit hashes include rename metadata
+
+  $ hg log -T '{rev}:{node|short} {desc}\n'
+  2:0fae949de7fa meta
+  1:9cd6bdffdac0 b
+  0:7f96794915f7 a
+
+  $ cd ..
+
+# Test bundle
+
+  $ hg init repo9
+  $ cd repo9
+  $ cat >> .hg/hgrc << EOF
+  > [lfs]
+  > threshold=10B
+  > [diff]
+  > git=1
+  > EOF
+
+  $ for i in 0 single two three 4; do
+  >   echo 'THIS-IS-LFS-'$i > a
+  >   hg commit -m a-$i -A a
+  > done
+
+  $ hg update 2 -q
+  $ echo 'THIS-IS-LFS-2-CHILD' > a
+  $ hg commit -m branching -q
+
+  $ hg bundle --base 1 bundle.hg -v
+  4 changesets found
+  uncompressed size of bundle content:
+       * (changelog) (glob)
+       * (manifests) (glob)
+       *  a (glob)
+  $ hg --config extensions.strip= strip -r 2 --no-backup --force -q
+  $ hg -R bundle.hg log -p -T '{rev} {desc}\n' a
+  5 branching
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -THIS-IS-LFS-two
+  +THIS-IS-LFS-2-CHILD
+  
+  4 a-4
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -THIS-IS-LFS-three
+  +THIS-IS-LFS-4
+  
+  3 a-three
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -THIS-IS-LFS-two
+  +THIS-IS-LFS-three
+  
+  2 a-two
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -THIS-IS-LFS-single
+  +THIS-IS-LFS-two
+  
+  1 a-single
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -THIS-IS-LFS-0
+  +THIS-IS-LFS-single
+  
+  0 a-0
+  diff --git a/a b/a
+  new file mode 100644
+  --- /dev/null
+  +++ b/a
+  @@ -0,0 +1,1 @@
+  +THIS-IS-LFS-0
+  
+  $ hg bundle -R bundle.hg --base 1 bundle-again.hg -q
+  $ hg -R bundle-again.hg log -p -T '{rev} {desc}\n' a
+  5 branching
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -THIS-IS-LFS-two
+  +THIS-IS-LFS-2-CHILD
+  
+  4 a-4
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -THIS-IS-LFS-three
+  +THIS-IS-LFS-4
+  
+  3 a-three
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -THIS-IS-LFS-two
+  +THIS-IS-LFS-three
+  
+  2 a-two
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -THIS-IS-LFS-single
+  +THIS-IS-LFS-two
+  
+  1 a-single
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -THIS-IS-LFS-0
+  +THIS-IS-LFS-single
+  
+  0 a-0
+  diff --git a/a b/a
+  new file mode 100644
+  --- /dev/null
+  +++ b/a
+  @@ -0,0 +1,1 @@
+  +THIS-IS-LFS-0
+  
+  $ cd ..
+
+# Test isbinary
+
+  $ hg init repo10
+  $ cd repo10
+  $ cat >> .hg/hgrc << EOF
+  > [extensions]
+  > lfs=
+  > [lfs]
+  > threshold=1
+  > EOF
+  $ $PYTHON <<'EOF'
+  > def write(path, content):
+  >     with open(path, 'wb') as f:
+  >         f.write(content)
+  > write('a', b'\0\0')
+  > write('b', b'\1\n')
+  > write('c', b'\1\n\0')
+  > write('d', b'xx')
+  > EOF
+  $ hg add a b c d
+  $ hg diff --stat
+   a |  Bin 
+   b |    1 +
+   c |  Bin 
+   d |    1 +
+   4 files changed, 2 insertions(+), 0 deletions(-)
+  $ hg commit -m binarytest
+  $ cat > $TESTTMP/dumpbinary.py << EOF
+  > def reposetup(ui, repo):
+  >     for n in 'abcd':
+  >         ui.write(('%s: binary=%s\n') % (n, repo['.'][n].isbinary()))
+  > EOF
+  $ hg --config extensions.dumpbinary=$TESTTMP/dumpbinary.py id --trace
+  a: binary=True
+  b: binary=False
+  c: binary=True
+  d: binary=False
+  b55353847f02 tip
+
+  $ cd ..
+
+# Test fctx.cmp fastpath - diff without LFS blobs
+
+  $ hg init repo11
+  $ cd repo11
+  $ cat >> .hg/hgrc <<EOF
+  > [lfs]
+  > threshold=1
+  > EOF
+  $ cat > ../patch.diff <<EOF
+  > # HG changeset patch
+  > 2
+  > 
+  > diff --git a/a b/a
+  > old mode 100644
+  > new mode 100755
+  > EOF
+
+  $ for i in 1 2 3; do
+  >     cp ../repo10/a a
+  >     if [ $i = 3 ]; then
+  >         # make a content-only change
+  >         hg import -q --bypass ../patch.diff
+  >         hg update -q
+  >         rm ../patch.diff
+  >     else
+  >         echo $i >> a
+  >         hg commit -m $i -A a
+  >     fi
+  > done
+  $ [ -d .hg/store/lfs/objects ]
+
+  $ cd ..
+
+  $ hg clone repo11 repo12 --noupdate
+  $ cd repo12
+  $ hg log --removed -p a -T '{desc}\n' --config diff.nobinary=1 --git
+  2
+  diff --git a/a b/a
+  old mode 100644
+  new mode 100755
+  
+  2
+  diff --git a/a b/a
+  Binary file a has changed
+  
+  1
+  diff --git a/a b/a
+  new file mode 100644
+  Binary file a has changed
+  
+  $ [ -d .hg/store/lfs/objects ]
+  [1]
+
+  $ cd ..
+
+# Verify the repos
+
+  $ cat > $TESTTMP/dumpflog.py << EOF
+  > # print raw revision sizes, flags, and hashes for certain files
+  > import hashlib
+  > from mercurial import revlog
+  > from mercurial.node import short
+  > def hash(rawtext):
+  >     h = hashlib.sha512()
+  >     h.update(rawtext)
+  >     return h.hexdigest()[:4]
+  > def reposetup(ui, repo):
+  >     # these 2 files are interesting
+  >     for name in ['l', 's']:
+  >         fl = repo.file(name)
+  >         if len(fl) == 0:
+  >             continue
+  >         sizes = [revlog.revlog.rawsize(fl, i) for i in fl]
+  >         texts = [fl.revision(i, raw=True) for i in fl]
+  >         flags = [int(fl.flags(i)) for i in fl]
+  >         hashes = [hash(t) for t in texts]
+  >         print('  %s: rawsizes=%r flags=%r hashes=%r'
+  >               % (name, sizes, flags, hashes))
+  > EOF
+
+  $ for i in client client2 server repo3 repo4 repo5 repo6 repo7 repo8 repo9 \
+  >          repo10; do
+  >   echo 'repo:' $i
+  >   hg --cwd $i verify --config extensions.dumpflog=$TESTTMP/dumpflog.py -q
+  > done
+  repo: client
+  repo: client2
+  repo: server
+  repo: repo3
+    l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
+    s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
+  repo: repo4
+    l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
+    s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
+  repo: repo5
+    l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
+    s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
+  repo: repo6
+  repo: repo7
+  repo: repo8
+  repo: repo9
+  repo: repo10
+
+repo12 doesn't have any cached lfs files and its source never pushed its
+files.  Therefore, the files don't exist in the remote store.  Use the files in
+the user cache.
+
+  $ test -d $TESTTMP/repo12/.hg/store/lfs/objects
+  [1]
+
+  $ hg --config extensions.share= share repo12 repo13
+  updating working directory
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg -R repo13 -q verify
+
+  $ hg clone repo12 repo14
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg -R repo14 -q verify
+
+If the source repo doesn't have the blob (maybe it was pulled or cloned with
+--noupdate), the blob is still accessible via the global cache to send to the
+remote store.
+
+  $ rm -rf $TESTTMP/repo14/.hg/store/lfs
+  $ hg init repo15
+  $ hg -R repo14 push repo15
+  pushing to repo15
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 2 changes to 1 files
+  $ hg -R repo14 -q verify
+
+lfs -> normal -> lfs round trip conversions are possible.  The threshold for the
+lfs destination is specified here because it was originally listed in the local
+.hgrc, and the global one is too high to trigger lfs usage.  For lfs -> normal,
+there's no 'lfs' destination repo requirement.  For normal -> lfs, there is.
+
+XXX: There's not a great way to ensure that the conversion to normal files
+actually converts _everything_ to normal.  The extension needs to be loaded for
+the source, but there's no way to disable it for the destination.  The best that
+can be done is to raise the threshold so that lfs isn't used on the destination.
+It doesn't like using '!' to unset the value on the command line.
+
+  $ hg --config extensions.convert= --config lfs.threshold=1000M \
+  >    convert repo8 convert_normal
+  initializing destination convert_normal repository
+  scanning source...
+  sorting...
+  converting...
+  2 a
+  1 b
+  0 meta
+  $ grep 'lfs' convert_normal/.hg/requires
+  [1]
+  $ hg --cwd convert_normal debugdata a1 0
+  THIS-IS-LFS-BECAUSE-10-BYTES
+
+  $ hg --config extensions.convert= --config lfs.threshold=10B \
+  >    convert convert_normal convert_lfs
+  initializing destination convert_lfs repository
+  scanning source...
+  sorting...
+  converting...
+  2 a
+  1 b
+  0 meta
+  $ hg --cwd convert_lfs debugdata a1 0
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
+  size 29
+  x-is-binary 0
+  $ grep 'lfs' convert_lfs/.hg/requires
+  lfs
+
+This convert is trickier, because it contains deleted files (via `hg mv`)
+
+  $ hg --config extensions.convert= --config lfs.threshold=1000M \
+  >    convert repo3 convert_normal2
+  initializing destination convert_normal2 repository
+  scanning source...
+  sorting...
+  converting...
+  4 commit with lfs content
+  3 renames
+  2 large to small, small to large
+  1 random modifications
+  0 switch large and small again
+  $ grep 'lfs' convert_normal2/.hg/requires
+  [1]
+  $ hg --cwd convert_normal2 debugdata large 0
+  LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS
+
+  $ hg --config extensions.convert= --config lfs.threshold=10B \
+  >    convert convert_normal2 convert_lfs2
+  initializing destination convert_lfs2 repository
+  scanning source...
+  sorting...
+  converting...
+  4 commit with lfs content
+  3 renames
+  2 large to small, small to large
+  1 random modifications
+  0 switch large and small again
+  $ grep 'lfs' convert_lfs2/.hg/requires
+  lfs
+  $ hg --cwd convert_lfs2 debugdata large 0
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
+  size 39
+  x-is-binary 0
+
+  $ hg -R convert_lfs2 config --debug extensions | grep lfs
+  $TESTTMP/convert_lfs2/.hg/hgrc:*: extensions.lfs= (glob)
+
+Committing deleted files works:
+
+  $ hg init $TESTTMP/repo-del
+  $ cd $TESTTMP/repo-del
+  $ echo 1 > A
+  $ hg commit -m 'add A' -A A
+  $ hg rm A
+  $ hg commit -m 'rm A'
--- a/tests/test-locate.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-locate.t	Tue Dec 19 16:27:24 2017 -0500
@@ -90,16 +90,16 @@
   $ hg rm t/b
 
   $ hg locate 't/**'
-  t/b (glob)
-  t/e.h (glob)
-  t/x (glob)
+  t/b
+  t/e.h
+  t/x
 
   $ hg files
   b
-  dir.h/foo (glob)
+  dir.h/foo
   t.h
-  t/e.h (glob)
-  t/x (glob)
+  t/e.h
+  t/x
   $ hg files b
   b
 
@@ -107,48 +107,57 @@
   $ cd otherdir
 
   $ hg files path:
-  ../b (glob)
-  ../dir.h/foo (glob)
-  ../t.h (glob)
-  ../t/e.h (glob)
-  ../t/x (glob)
+  ../b
+  ../dir.h/foo
+  ../t.h
+  ../t/e.h
+  ../t/x
   $ hg files path:.
-  ../b (glob)
-  ../dir.h/foo (glob)
-  ../t.h (glob)
-  ../t/e.h (glob)
-  ../t/x (glob)
+  ../b
+  ../dir.h/foo
+  ../t.h
+  ../t/e.h
+  ../t/x
 
   $ hg locate b
-  ../b (glob)
-  ../t/b (glob)
+  ../b
+  ../t/b
   $ hg locate '*.h'
-  ../t.h (glob)
-  ../t/e.h (glob)
+  ../t.h
+  ../t/e.h
   $ hg locate path:t/x
-  ../t/x (glob)
+  ../t/x
   $ hg locate 're:.*\.h$'
-  ../t.h (glob)
-  ../t/e.h (glob)
+  ../t.h
+  ../t/e.h
   $ hg locate -r 0 b
-  ../b (glob)
-  ../t/b (glob)
+  ../b
+  ../t/b
   $ hg locate -r 0 '*.h'
-  ../t.h (glob)
-  ../t/e.h (glob)
+  ../t.h
+  ../t/e.h
   $ hg locate -r 0 path:t/x
-  ../t/x (glob)
+  ../t/x
   $ hg locate -r 0 're:.*\.h$'
-  ../t.h (glob)
-  ../t/e.h (glob)
+  ../t.h
+  ../t/e.h
 
   $ hg files
-  ../b (glob)
-  ../dir.h/foo (glob)
-  ../t.h (glob)
-  ../t/e.h (glob)
-  ../t/x (glob)
+  ../b
+  ../dir.h/foo
+  ../t.h
+  ../t/e.h
+  ../t/x
   $ hg files .
   [1]
 
+Convert native path separator to slash (issue5572)
+
+  $ hg files -T '{path|slashpath}\n'
+  ../b
+  ../dir.h/foo
+  ../t.h
+  ../t/e.h
+  ../t/x
+
   $ cd ../..
--- a/tests/test-lock-badness.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-lock-badness.t	Tue Dec 19 16:27:24 2017 -0500
@@ -57,14 +57,77 @@
   $ echo b > b/b
   $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
   $ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" \
-  > > preup 2>&1
+  > > preup-stdout 2>preup-stderr
   $ wait
-  $ cat preup
+  $ cat preup-stdout
+  $ cat preup-stderr
   waiting for lock on working directory of b held by process '*' on host '*' (glob)
   got lock after * seconds (glob)
   $ cat stdout
   adding b
 
+On processs waiting on another, warning after a long time.
+
+  $ echo b > b/c
+  $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
+  $ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" \
+  > --config ui.timeout.warn=250 \
+  > > preup-stdout 2>preup-stderr
+  $ wait
+  $ cat preup-stdout
+  $ cat preup-stderr
+  $ cat stdout
+  adding c
+
+On processs waiting on another, warning disabled.
+
+  $ echo b > b/d
+  $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
+  $ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" \
+  > --config ui.timeout.warn=-1 \
+  > > preup-stdout 2>preup-stderr
+  $ wait
+  $ cat preup-stdout
+  $ cat preup-stderr
+  $ cat stdout
+  adding d
+
+check we still print debug output
+
+On processs waiting on another, warning after a long time (debug output on)
+
+  $ echo b > b/e
+  $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
+  $ hg -R b up --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" \
+  > --config ui.timeout.warn=250 --debug\
+  > > preup-stdout 2>preup-stderr
+  $ wait
+  $ cat preup-stdout
+  calling hook pre-update: hghook_pre-update.sleephalf
+  waiting for lock on working directory of b held by process '*' on host '*' (glob)
+  got lock after * seconds (glob)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat preup-stderr
+  $ cat stdout
+  adding e
+
+On processs waiting on another, warning disabled, (debug output on)
+
+  $ echo b > b/f
+  $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
+  $ hg -R b up --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" \
+  > --config ui.timeout.warn=-1 --debug\
+  > > preup-stdout 2>preup-stderr
+  $ wait
+  $ cat preup-stdout
+  calling hook pre-update: hghook_pre-update.sleephalf
+  waiting for lock on working directory of b held by process '*' on host '*' (glob)
+  got lock after * seconds (glob)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat preup-stderr
+  $ cat stdout
+  adding f
+
 Pushing to a local read-only repo that can't be locked
 
   $ chmod 100 a/.hg/store
--- a/tests/test-log.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-log.t	Tue Dec 19 16:27:24 2017 -0500
@@ -732,6 +732,35 @@
   date:        Thu Jan 01 00:00:01 1970 +0000
   summary:     b2
   
+
+follow files starting from multiple revisions:
+
+  $ hg log -T '{rev}: {files}\n' -r "follow('glob:b?', startrev=2+3+4)"
+  3: b1
+  4: b2
+
+follow files starting from empty revision:
+
+  $ hg log -T '{rev}: {files}\n' -r "follow('glob:*', startrev=.-.)"
+
+follow starting from revisions:
+
+  $ hg log -Gq -r "follow(startrev=2+4)"
+  o  4:ddb82e70d1a1
+  |
+  | o  2:60c670bf5b30
+  | |
+  | o  1:3d5bf5654eda
+  |/
+  @  0:67e992f2c4f3
+  
+
+follow the current revision:
+
+  $ hg log -Gq -r "follow()"
+  @  0:67e992f2c4f3
+  
+
   $ hg up -qC 4
 
 log -f -r null
@@ -1009,6 +1038,77 @@
 
   $ cd ..
 
+Multiple copy sources of a file:
+
+  $ hg init follow-multi
+  $ cd follow-multi
+  $ echo 0 >> a
+  $ hg ci -qAm 'a'
+  $ hg cp a b
+  $ hg ci -m 'a->b'
+  $ echo 2 >> a
+  $ hg ci -m 'a'
+  $ echo 3 >> b
+  $ hg ci -m 'b'
+  $ echo 4 >> a
+  $ echo 4 >> b
+  $ hg ci -m 'a,b'
+  $ echo 5 >> a
+  $ hg ci -m 'a0'
+  $ echo 6 >> b
+  $ hg ci -m 'b0'
+  $ hg up -q 4
+  $ echo 7 >> b
+  $ hg ci -m 'b1'
+  created new head
+  $ echo 8 >> a
+  $ hg ci -m 'a1'
+  $ hg rm a
+  $ hg mv b a
+  $ hg ci -m 'b1->a1'
+  $ hg merge -qt :local
+  $ hg ci -m '(a0,b1->a1)->a'
+
+  $ hg log -GT '{rev}: {desc}\n'
+  @    10: (a0,b1->a1)->a
+  |\
+  | o  9: b1->a1
+  | |
+  | o  8: a1
+  | |
+  | o  7: b1
+  | |
+  o |  6: b0
+  | |
+  o |  5: a0
+  |/
+  o  4: a,b
+  |
+  o  3: b
+  |
+  o  2: a
+  |
+  o  1: a->b
+  |
+  o  0: a
+  
+
+ since file 'a' has multiple copy sources at the revision 4, ancestors can't
+ be indexed solely by fctx.linkrev().
+
+  $ hg log -T '{rev}: {desc}\n' -f a
+  10: (a0,b1->a1)->a
+  9: b1->a1
+  7: b1
+  5: a0
+  4: a,b
+  3: b
+  2: a
+  1: a->b
+  0: a
+
+  $ cd ..
+
 Test that log should respect the order of -rREV even if multiple OR conditions
 are specified (issue5100):
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-logexchange.t	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,108 @@
+Testing the functionality to pull remotenames
+=============================================
+
+  $ cat >> $HGRCPATH << EOF
+  > [alias]
+  > glog = log -G -T '{rev}:{node|short}  {desc}'
+  > [experimental]
+  > remotenames = True
+  > EOF
+
+Making a server repo
+--------------------
+
+  $ hg init server
+  $ cd server
+  $ for ch in a b c d e f g h; do
+  >   echo "foo" >> $ch
+  >   hg ci -Aqm "Added "$ch
+  > done
+  $ hg glog
+  @  7:ec2426147f0e  Added h
+  |
+  o  6:87d6d6676308  Added g
+  |
+  o  5:825660c69f0c  Added f
+  |
+  o  4:aa98ab95a928  Added e
+  |
+  o  3:62615734edd5  Added d
+  |
+  o  2:28ad74487de9  Added c
+  |
+  o  1:29becc82797a  Added b
+  |
+  o  0:18d04c59bb5d  Added a
+  
+  $ hg bookmark -r 3 foo
+  $ hg bookmark -r 6 bar
+  $ hg up 4
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ hg branch wat
+  marked working directory as branch wat
+  (branches are permanent and global, did you want a bookmark?)
+  $ echo foo >> bar
+  $ hg ci -Aqm "added bar"
+
+Making a client repo
+--------------------
+
+  $ cd ..
+
+  $ hg clone server client
+  updating to branch default
+  8 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd client
+  $ cat .hg/logexchange/bookmarks
+  0
+  
+  87d6d66763085b629e6d7ed56778c79827273022\x00file:$TESTTMP/server\x00bar (esc)
+  62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00file:$TESTTMP/server\x00foo (esc)
+
+  $ cat .hg/logexchange/branches
+  0
+  
+  ec2426147f0e39dbc9cef599b066be6035ce691d\x00file:$TESTTMP/server\x00default (esc)
+  3e1487808078543b0af6d10dadf5d46943578db0\x00file:$TESTTMP/server\x00wat (esc)
+
+Making a new server
+-------------------
+
+  $ cd ..
+  $ hg init server2
+  $ cd server2
+  $ hg pull ../server/
+  pulling from ../server/
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 9 changesets with 9 changes to 9 files (+1 heads)
+  adding remote bookmark bar
+  adding remote bookmark foo
+  new changesets 18d04c59bb5d:3e1487808078
+  (run 'hg heads' to see heads)
+
+Pulling form the new server
+---------------------------
+  $ cd ../client/
+  $ hg pull ../server2/
+  pulling from ../server2/
+  searching for changes
+  no changes found
+  $ cat .hg/logexchange/bookmarks
+  0
+  
+  62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00file:$TESTTMP/server\x00foo (esc)
+  87d6d66763085b629e6d7ed56778c79827273022\x00file:$TESTTMP/server\x00bar (esc)
+  87d6d66763085b629e6d7ed56778c79827273022\x00file:$TESTTMP/server2\x00bar (esc)
+  62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00file:$TESTTMP/server2\x00foo (esc)
+
+  $ cat .hg/logexchange/branches
+  0
+  
+  3e1487808078543b0af6d10dadf5d46943578db0\x00file:$TESTTMP/server\x00wat (esc)
+  ec2426147f0e39dbc9cef599b066be6035ce691d\x00file:$TESTTMP/server\x00default (esc)
+  ec2426147f0e39dbc9cef599b066be6035ce691d\x00file:$TESTTMP/server2\x00default (esc)
+  3e1487808078543b0af6d10dadf5d46943578db0\x00file:$TESTTMP/server2\x00wat (esc)
--- a/tests/test-manifest.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-manifest.t	Tue Dec 19 16:27:24 2017 -0500
@@ -26,7 +26,7 @@
 
   $ hg files -vr .
            2   a
-           2 x b/a (glob)
+           2 x b/a
            1 l l
   $ hg files -r . -X b
   a
--- a/tests/test-merge-criss-cross.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-merge-criss-cross.t	Tue Dec 19 16:27:24 2017 -0500
@@ -116,11 +116,11 @@
 
   $ f --dump --recurse *
   d2: directory with 2 files
-  d2/f3: (glob)
+  d2/f3:
   >>>
   0 base
   <<<
-  d2/f4: (glob)
+  d2/f4:
   >>>
   0 base
   <<<
@@ -222,11 +222,11 @@
 
   $ f --dump --recurse *
   d2: directory with 2 files
-  d2/f3: (glob)
+  d2/f3:
   >>>
   0 base
   <<<
-  d2/f4: (glob)
+  d2/f4:
   >>>
   0 base
   <<<
@@ -308,11 +308,11 @@
 
   $ f --dump --recurse *
   d2: directory with 2 files
-  d2/f3: (glob)
+  d2/f3:
   >>>
   0 base
   <<<
-  d2/f4: (glob)
+  d2/f4:
   >>>
   0 base
   <<<
--- a/tests/test-merge-subrepos.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-merge-subrepos.t	Tue Dec 19 16:27:24 2017 -0500
@@ -122,7 +122,7 @@
   $ hg files -R subrepo
   [1]
   $ hg files -R subrepo -r '.'
-  subrepo/b (glob)
+  subrepo/b
 
   $ hg bookmark -r tip @other
   $ echo xyz > subrepo/c
--- a/tests/test-mq-header-date.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-mq-header-date.t	Tue Dec 19 16:27:24 2017 -0500
@@ -11,11 +11,11 @@
   > }
   $ catlog() {
   >     catpatch $1
-  >     hg log --template "{rev}: {desc} - {author}\n"
+  >     hg log --template "{rev}: {node|short} {desc} - {author}\n"
   > }
   $ catlogd() {
   >     catpatch $1
-  >     hg log --template "{rev}: {desc} - {author} - {date}\n"
+  >     hg log --template "{rev}: {node|short} {desc} - {author} - {date}\n"
   > }
   $ drop() {
   >     hg qpop
@@ -189,7 +189,7 @@
   >     echo ==== "qpop -a / qpush -a"
   >     hg qpop -a
   >     hg qpush -a
-  >     hg log --template "{rev}: {desc} - {author} - {date}\n"
+  >     hg log --template "{rev}: {node|short} {desc} - {author} - {date}\n"
   > }
 
 ======= plain headers
@@ -202,7 +202,7 @@
   ==== qnew -d
   Date: 3 0
   
-  0: [mq]: 1.patch - test - 3.00
+  0: 758bd2596a39 [mq]: 1.patch - test - 3.00
   ==== qref
   adding 1
   Date: 3 0
@@ -212,7 +212,7 @@
   +++ b/1
   @@ -0,0 +1,1 @@
   +1
-  0: [mq]: 1.patch - test - 3.00
+  0: 8c640e9949a8 [mq]: 1.patch - test - 3.00
   ==== qref -d
   Date: 4 0
   
@@ -221,7 +221,7 @@
   +++ b/1
   @@ -0,0 +1,1 @@
   +1
-  0: [mq]: 1.patch - test - 4.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qnew
   adding 2
   diff -r ... 2
@@ -229,8 +229,8 @@
   +++ b/2
   @@ -0,0 +1,1 @@
   +2
-  1: [mq]: 2.patch - test
-  0: [mq]: 1.patch - test
+  1: fc7e8a2f6499 [mq]: 2.patch - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -d
   Date: 5 0
   
@@ -239,8 +239,8 @@
   +++ b/2
   @@ -0,0 +1,1 @@
   +2
-  1: [mq]: 2.patch - test
-  0: [mq]: 1.patch - test
+  1: 1d9a6a118fd1 [mq]: 2.patch - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   popping 2.patch
   now at: 1.patch
   ==== qnew -d -m
@@ -248,8 +248,8 @@
   
   Three
   
-  1: Three - test - 6.00
-  0: [mq]: 1.patch - test - 4.00
+  1: 2a9ef0bdefba Three - test - 6.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qref
   adding 3
   Date: 6 0
@@ -261,8 +261,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  1: Three - test - 6.00
-  0: [mq]: 1.patch - test - 4.00
+  1: 7f19ad9eea7b Three - test - 6.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qref -m
   Date: 6 0
   
@@ -273,8 +273,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  1: Drei - test - 6.00
-  0: [mq]: 1.patch - test - 4.00
+  1: 7ff7377793e3 Drei - test - 6.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qref -d
   Date: 7 0
   
@@ -285,8 +285,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  1: Drei - test - 7.00
-  0: [mq]: 1.patch - test - 4.00
+  1: d89d3144f518 Drei - test - 7.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qref -d -m
   Date: 8 0
   
@@ -297,8 +297,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qnew -m
   adding 4
   Four
@@ -308,9 +308,9 @@
   +++ b/4
   @@ -0,0 +1,1 @@
   +4
-  2: Four - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  2: 74ded07d166b Four - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -d
   Date: 9 0
   
@@ -321,9 +321,9 @@
   +++ b/4
   @@ -0,0 +1,1 @@
   +4
-  2: Four - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  2: 1a651320cf8e Four - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   popping 4.patch
   now at: 3.patch
   ==== qnew with HG header
@@ -331,9 +331,9 @@
   now at: 3.patch
   # HG changeset patch
   # Date 10 0
-  2: imported patch 5.patch - test - 10.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  2: d16a272220d2 imported patch 5.patch - test - 10.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== hg qref
   adding 5
   # HG changeset patch
@@ -345,9 +345,9 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  2: [mq]: 5.patch - test - 10.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  2: 5dbf69c07df9 [mq]: 5.patch - test - 10.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== hg qref -d
   # HG changeset patch
   # Date 11 0
@@ -358,19 +358,19 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  2: [mq]: 5.patch - test - 11.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  2: 049de6af0c1d [mq]: 5.patch - test - 11.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qnew with plain header
   popping 6.patch
   now at: 5.patch
   now at: 6.patch
   Date: 12 0
   
-  3: imported patch 6.patch - test
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  3: 8ad9ebc22b96 imported patch 6.patch - test
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== hg qref
   adding 6
   Date: 12 0
@@ -380,10 +380,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  3: [mq]: 6.patch - test - 12.00
-  2: [mq]: 5.patch - test - 11.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  3: 038c46b02a56 [mq]: 6.patch - test - 12.00
+  2: 049de6af0c1d [mq]: 5.patch - test - 11.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== hg qref -d
   Date: 13 0
   
@@ -392,10 +392,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  3: [mq]: 6.patch - test - 13.00
-  2: [mq]: 5.patch - test - 11.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  3: 2785642ea4b4 [mq]: 6.patch - test - 13.00
+  2: 049de6af0c1d [mq]: 5.patch - test - 11.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   popping 6.patch
   now at: 5.patch
   ==== qnew -u
@@ -407,10 +407,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  3: [mq]: 6.patch - jane
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  3: a05a33f187ce [mq]: 6.patch - jane
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -d
   From: jane
   Date: 12 0
@@ -420,10 +420,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  3: [mq]: 6.patch - jane
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  3: 5702c529dfe9 [mq]: 6.patch - jane
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   popping 6.patch
   now at: 5.patch
   ==== qnew -d
@@ -435,10 +435,10 @@
   +++ b/7
   @@ -0,0 +1,1 @@
   +7
-  3: [mq]: 7.patch - test
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  3: 8dd1eb8d4132 [mq]: 7.patch - test
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -u
   From: john
   Date: 13 0
@@ -448,10 +448,10 @@
   +++ b/7
   @@ -0,0 +1,1 @@
   +7
-  3: [mq]: 7.patch - john - 13.00
-  2: [mq]: 5.patch - test - 11.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  3: 4f9d07369cc4 [mq]: 7.patch - john - 13.00
+  2: 049de6af0c1d [mq]: 5.patch - test - 11.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qnew
   adding 8
   diff -r ... 8
@@ -459,11 +459,11 @@
   +++ b/8
   @@ -0,0 +1,1 @@
   +8
-  4: [mq]: 8.patch - test
-  3: [mq]: 7.patch - john
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  4: 868b62f09492 [mq]: 8.patch - test
+  3: 4f9d07369cc4 [mq]: 7.patch - john
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -u -d
   From: john
   Date: 14 0
@@ -473,11 +473,11 @@
   +++ b/8
   @@ -0,0 +1,1 @@
   +8
-  4: [mq]: 8.patch - john
-  3: [mq]: 7.patch - john
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  4: b1e878ae55b9 [mq]: 8.patch - john
+  3: 4f9d07369cc4 [mq]: 7.patch - john
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   popping 8.patch
   now at: 7.patch
   ==== qnew -m
@@ -489,11 +489,11 @@
   +++ b/9
   @@ -0,0 +1,1 @@
   +9
-  4: Nine - test
-  3: [mq]: 7.patch - john
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  4: 7251936ac2bf Nine - test
+  3: 4f9d07369cc4 [mq]: 7.patch - john
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -u -d
   From: john
   Date: 15 0
@@ -505,11 +505,11 @@
   +++ b/9
   @@ -0,0 +1,1 @@
   +9
-  4: Nine - john
-  3: [mq]: 7.patch - john
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  4: a0de5bf6e9f7 Nine - john
+  3: 4f9d07369cc4 [mq]: 7.patch - john
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   popping 9.patch
   now at: 7.patch
   ==== qpop -a / qpush -a
@@ -523,10 +523,10 @@
   applying 5.patch
   applying 7.patch
   now at: 7.patch
-  3: imported patch 7.patch - john - 13.00
-  2: imported patch 5.patch - test - 11.00
-  1: Three (again) - test - 8.00
-  0: imported patch 1.patch - test - 4.00
+  3: d26a5b7ffce1 imported patch 7.patch - john - 13.00
+  2: dda6cf77060a imported patch 5.patch - test - 11.00
+  1: 25e32d66c8c7 Three (again) - test - 8.00
+  0: e5011c0211fe imported patch 1.patch - test - 4.00
   $ rm -r sandbox
 
 ======= hg headers
@@ -540,7 +540,7 @@
   # Date 3 0
   # Parent 
   
-  0: [mq]: 1.patch - test - 3.00
+  0: 758bd2596a39 [mq]: 1.patch - test - 3.00
   ==== qref
   adding 1
   # HG changeset patch
@@ -552,7 +552,7 @@
   +++ b/1
   @@ -0,0 +1,1 @@
   +1
-  0: [mq]: 1.patch - test - 3.00
+  0: 8c640e9949a8 [mq]: 1.patch - test - 3.00
   ==== qref -d
   # HG changeset patch
   # Date 4 0
@@ -563,7 +563,7 @@
   +++ b/1
   @@ -0,0 +1,1 @@
   +1
-  0: [mq]: 1.patch - test - 4.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qnew
   adding 2
   # HG changeset patch
@@ -574,8 +574,8 @@
   +++ b/2
   @@ -0,0 +1,1 @@
   +2
-  1: [mq]: 2.patch - test
-  0: [mq]: 1.patch - test
+  1: fc7e8a2f6499 [mq]: 2.patch - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -d
   # HG changeset patch
   # Date 5 0
@@ -586,8 +586,8 @@
   +++ b/2
   @@ -0,0 +1,1 @@
   +2
-  1: [mq]: 2.patch - test
-  0: [mq]: 1.patch - test
+  1: 1d9a6a118fd1 [mq]: 2.patch - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   popping 2.patch
   now at: 1.patch
   ==== qnew -d -m
@@ -596,8 +596,8 @@
   # Parent 
   Three
   
-  1: Three - test - 6.00
-  0: [mq]: 1.patch - test - 4.00
+  1: 2a9ef0bdefba Three - test - 6.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qref
   adding 3
   # HG changeset patch
@@ -610,8 +610,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  1: Three - test - 6.00
-  0: [mq]: 1.patch - test - 4.00
+  1: 7f19ad9eea7b Three - test - 6.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qref -m
   # HG changeset patch
   # Date 6 0
@@ -623,8 +623,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  1: Drei - test - 6.00
-  0: [mq]: 1.patch - test - 4.00
+  1: 7ff7377793e3 Drei - test - 6.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qref -d
   # HG changeset patch
   # Date 7 0
@@ -636,8 +636,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  1: Drei - test - 7.00
-  0: [mq]: 1.patch - test - 4.00
+  1: d89d3144f518 Drei - test - 7.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qref -d -m
   # HG changeset patch
   # Date 8 0
@@ -649,8 +649,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qnew -m
   adding 4
   # HG changeset patch
@@ -662,9 +662,9 @@
   +++ b/4
   @@ -0,0 +1,1 @@
   +4
-  2: Four - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  2: 74ded07d166b Four - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -d
   # HG changeset patch
   # Date 9 0
@@ -676,9 +676,9 @@
   +++ b/4
   @@ -0,0 +1,1 @@
   +4
-  2: Four - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  2: 1a651320cf8e Four - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   popping 4.patch
   now at: 3.patch
   ==== qnew with HG header
@@ -686,9 +686,9 @@
   now at: 3.patch
   # HG changeset patch
   # Date 10 0
-  2: imported patch 5.patch - test - 10.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  2: d16a272220d2 imported patch 5.patch - test - 10.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== hg qref
   adding 5
   # HG changeset patch
@@ -700,9 +700,9 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  2: [mq]: 5.patch - test - 10.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  2: 5dbf69c07df9 [mq]: 5.patch - test - 10.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== hg qref -d
   # HG changeset patch
   # Date 11 0
@@ -713,19 +713,19 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  2: [mq]: 5.patch - test - 11.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  2: 049de6af0c1d [mq]: 5.patch - test - 11.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qnew with plain header
   popping 6.patch
   now at: 5.patch
   now at: 6.patch
   Date: 12 0
   
-  3: imported patch 6.patch - test
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  3: 8ad9ebc22b96 imported patch 6.patch - test
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== hg qref
   adding 6
   Date: 12 0
@@ -735,10 +735,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  3: [mq]: 6.patch - test - 12.00
-  2: [mq]: 5.patch - test - 11.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  3: 038c46b02a56 [mq]: 6.patch - test - 12.00
+  2: 049de6af0c1d [mq]: 5.patch - test - 11.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== hg qref -d
   Date: 13 0
   
@@ -747,10 +747,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  3: [mq]: 6.patch - test - 13.00
-  2: [mq]: 5.patch - test - 11.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  3: 2785642ea4b4 [mq]: 6.patch - test - 13.00
+  2: 049de6af0c1d [mq]: 5.patch - test - 11.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   popping 6.patch
   now at: 5.patch
   ==== qnew -u
@@ -764,10 +764,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  3: [mq]: 6.patch - jane
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  3: a05a33f187ce [mq]: 6.patch - jane
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -d
   # HG changeset patch
   # User jane
@@ -779,10 +779,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  3: [mq]: 6.patch - jane
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  3: 5702c529dfe9 [mq]: 6.patch - jane
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   popping 6.patch
   now at: 5.patch
   ==== qnew -d
@@ -796,10 +796,10 @@
   +++ b/7
   @@ -0,0 +1,1 @@
   +7
-  3: [mq]: 7.patch - test
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  3: 8dd1eb8d4132 [mq]: 7.patch - test
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -u
   # HG changeset patch
   # User john
@@ -811,10 +811,10 @@
   +++ b/7
   @@ -0,0 +1,1 @@
   +7
-  3: [mq]: 7.patch - john - 13.00
-  2: [mq]: 5.patch - test - 11.00
-  1: Three (again) - test - 8.00
-  0: [mq]: 1.patch - test - 4.00
+  3: 4f9d07369cc4 [mq]: 7.patch - john - 13.00
+  2: 049de6af0c1d [mq]: 5.patch - test - 11.00
+  1: b1b6b0fe0e6d Three (again) - test - 8.00
+  0: 4a67dfeea974 [mq]: 1.patch - test - 4.00
   ==== qnew
   adding 8
   # HG changeset patch
@@ -825,11 +825,11 @@
   +++ b/8
   @@ -0,0 +1,1 @@
   +8
-  4: [mq]: 8.patch - test
-  3: [mq]: 7.patch - john
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  4: 868b62f09492 [mq]: 8.patch - test
+  3: 4f9d07369cc4 [mq]: 7.patch - john
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -u -d
   # HG changeset patch
   # User john
@@ -841,11 +841,11 @@
   +++ b/8
   @@ -0,0 +1,1 @@
   +8
-  4: [mq]: 8.patch - john
-  3: [mq]: 7.patch - john
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  4: b1e878ae55b9 [mq]: 8.patch - john
+  3: 4f9d07369cc4 [mq]: 7.patch - john
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   popping 8.patch
   now at: 7.patch
   ==== qnew -m
@@ -859,11 +859,11 @@
   +++ b/9
   @@ -0,0 +1,1 @@
   +9
-  4: Nine - test
-  3: [mq]: 7.patch - john
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  4: 7251936ac2bf Nine - test
+  3: 4f9d07369cc4 [mq]: 7.patch - john
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   ==== qref -u -d
   # HG changeset patch
   # User john
@@ -876,11 +876,11 @@
   +++ b/9
   @@ -0,0 +1,1 @@
   +9
-  4: Nine - john
-  3: [mq]: 7.patch - john
-  2: [mq]: 5.patch - test
-  1: Three (again) - test
-  0: [mq]: 1.patch - test
+  4: a0de5bf6e9f7 Nine - john
+  3: 4f9d07369cc4 [mq]: 7.patch - john
+  2: 049de6af0c1d [mq]: 5.patch - test
+  1: b1b6b0fe0e6d Three (again) - test
+  0: 4a67dfeea974 [mq]: 1.patch - test
   popping 9.patch
   now at: 7.patch
   ==== qpop -a / qpush -a
@@ -894,8 +894,8 @@
   applying 5.patch
   applying 7.patch
   now at: 7.patch
-  3: imported patch 7.patch - john - 13.00
-  2: imported patch 5.patch - test - 11.00
-  1: Three (again) - test - 8.00
-  0: imported patch 1.patch - test - 4.00
+  3: d26a5b7ffce1 imported patch 7.patch - john - 13.00
+  2: dda6cf77060a imported patch 5.patch - test - 11.00
+  1: 25e32d66c8c7 Three (again) - test - 8.00
+  0: e5011c0211fe imported patch 1.patch - test - 4.00
   $ rm -r sandbox
--- a/tests/test-mq-header-from.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-mq-header-from.t	Tue Dec 19 16:27:24 2017 -0500
@@ -6,7 +6,7 @@
   $ catlog() {
   >     cat .hg/patches/$1.patch | sed -e "s/^diff \-r [0-9a-f]* /diff -r ... /" \
   >                                    -e "s/^\(# Parent \).*/\1/"
-  >     hg log --template "{rev}: {desc} - {author}\n"
+  >     hg log --template "{rev}: {node|short} {desc} - {author}\n"
   > }
   $ runtest() {
   >     echo ==== init
@@ -122,7 +122,7 @@
   >     echo ==== "qpop -a / qpush -a"
   >     hg qpop -a
   >     hg qpush -a
-  >     hg log --template "{rev}: {desc} - {author}\n"
+  >     hg log --template "{rev}: {node|short} {desc} - {author}\n"
   > }
 
 ======= plain headers
@@ -135,7 +135,7 @@
   ==== qnew -U
   From: test
   
-  0: [mq]: 1.patch - test
+  0: a054644889e5 [mq]: 1.patch - test
   ==== qref
   adding 1
   From: test
@@ -145,7 +145,7 @@
   +++ b/1
   @@ -0,0 +1,1 @@
   +1
-  0: [mq]: 1.patch - test
+  0: 2905f1e46ee0 [mq]: 1.patch - test
   ==== qref -u
   From: mary
   
@@ -154,7 +154,7 @@
   +++ b/1
   @@ -0,0 +1,1 @@
   +1
-  0: [mq]: 1.patch - mary
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew
   adding 2
   diff -r ... 2
@@ -162,8 +162,8 @@
   +++ b/2
   @@ -0,0 +1,1 @@
   +2
-  1: [mq]: 2.patch - test
-  0: [mq]: 1.patch - mary
+  1: 527f98a12a7a [mq]: 2.patch - test
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u
   From: jane
   
@@ -172,16 +172,16 @@
   +++ b/2
   @@ -0,0 +1,1 @@
   +2
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew -U -m
   From: test
   
   Three
   
-  2: Three - test
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: 0ffa16a9088e Three - test
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref
   adding 3
   From: test
@@ -193,9 +193,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Three - test
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: 83f1290c6086 Three - test
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -m
   From: test
   
@@ -206,9 +206,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Drei - test
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: b0d856328d4d Drei - test
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u
   From: mary
   
@@ -219,9 +219,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Drei - mary
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: bb9d4b28e6a6 Drei - mary
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u -m
   From: maria
   
@@ -232,9 +232,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew -m
   adding 4of
   Four
@@ -244,10 +244,10 @@
   +++ b/4of
   @@ -0,0 +1,1 @@
   +4 t
-  3: Four - test
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  3: b9f922d0da40 Four - test
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u
   From: jane
   
@@ -258,21 +258,21 @@
   +++ b/4of
   @@ -0,0 +1,1 @@
   +4 t
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew with HG header
   popping 5.patch
   now at: 4.patch
   now at: 5.patch
   # HG changeset patch
   # User johndoe
-  4: imported patch 5.patch - johndoe
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: 72bc4a0467ef imported patch 5.patch - johndoe
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref
   adding 5
   # HG changeset patch
@@ -284,11 +284,11 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  4: [mq]: 5.patch - johndoe
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: ff5c06112e5a [mq]: 5.patch - johndoe
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -U
   # HG changeset patch
   # User test
@@ -299,11 +299,11 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  4: [mq]: 5.patch - test
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: c947416c22b1 [mq]: 5.patch - test
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -u
   # HG changeset patch
   # User johndeere
@@ -314,23 +314,23 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew with plain header
   popping 6.patch
   now at: 5.patch
   now at: 6.patch
   From: test
   
-  5: imported patch 6.patch - test
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 7825a18ec839 imported patch 6.patch - test
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref
   adding 6
   From: test
@@ -340,12 +340,12 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  5: [mq]: 6.patch - test
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 09d19592680d [mq]: 6.patch - test
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -U
   From: test
   
@@ -354,12 +354,12 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  5: [mq]: 6.patch - test
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 09d19592680d [mq]: 6.patch - test
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -u
   From: johndeere
   
@@ -368,12 +368,12 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  5: [mq]: 6.patch - johndeere
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 32641ee07196 [mq]: 6.patch - johndeere
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qpop -a / qpush -a
   popping 6.patch
   popping 5.patch
@@ -389,12 +389,12 @@
   applying 5.patch
   applying 6.patch
   now at: 6.patch
-  5: imported patch 6.patch - johndeere
-  4: imported patch 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: imported patch 2.patch - jane
-  0: imported patch 1.patch - mary
+  5: 1fb083c80457 imported patch 6.patch - johndeere
+  4: 7e96e969691d imported patch 5.patch - johndeere
+  3: c7147533d3cd Four - jane
+  2: b383d04401ea Three (again) - maria
+  1: fac2da4efc3c imported patch 2.patch - jane
+  0: b6e237e8771b imported patch 1.patch - mary
   $ rm -r sandbox
 
 ======= hg headers
@@ -408,7 +408,7 @@
   # User test
   # Parent 
   
-  0: [mq]: 1.patch - test
+  0: a054644889e5 [mq]: 1.patch - test
   ==== qref
   adding 1
   # HG changeset patch
@@ -420,7 +420,7 @@
   +++ b/1
   @@ -0,0 +1,1 @@
   +1
-  0: [mq]: 1.patch - test
+  0: 2905f1e46ee0 [mq]: 1.patch - test
   ==== qref -u
   # HG changeset patch
   # User mary
@@ -431,7 +431,7 @@
   +++ b/1
   @@ -0,0 +1,1 @@
   +1
-  0: [mq]: 1.patch - mary
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew
   adding 2
   # HG changeset patch
@@ -442,8 +442,8 @@
   +++ b/2
   @@ -0,0 +1,1 @@
   +2
-  1: [mq]: 2.patch - test
-  0: [mq]: 1.patch - mary
+  1: 527f98a12a7a [mq]: 2.patch - test
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u
   # HG changeset patch
   # User jane
@@ -454,17 +454,17 @@
   +++ b/2
   @@ -0,0 +1,1 @@
   +2
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew -U -m
   # HG changeset patch
   # User test
   # Parent 
   Three
   
-  2: Three - test
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: 0ffa16a9088e Three - test
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref
   adding 3
   # HG changeset patch
@@ -477,9 +477,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Three - test
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: 83f1290c6086 Three - test
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -m
   # HG changeset patch
   # User test
@@ -491,9 +491,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Drei - test
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: b0d856328d4d Drei - test
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u
   # HG changeset patch
   # User mary
@@ -505,9 +505,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Drei - mary
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: bb9d4b28e6a6 Drei - mary
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u -m
   # HG changeset patch
   # User maria
@@ -519,9 +519,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew -m
   adding 4of
   # HG changeset patch
@@ -533,10 +533,10 @@
   +++ b/4of
   @@ -0,0 +1,1 @@
   +4 t
-  3: Four - test
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  3: b9f922d0da40 Four - test
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u
   # HG changeset patch
   # User jane
@@ -548,21 +548,21 @@
   +++ b/4of
   @@ -0,0 +1,1 @@
   +4 t
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew with HG header
   popping 5.patch
   now at: 4.patch
   now at: 5.patch
   # HG changeset patch
   # User johndoe
-  4: imported patch 5.patch - johndoe
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: 72bc4a0467ef imported patch 5.patch - johndoe
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref
   adding 5
   # HG changeset patch
@@ -574,11 +574,11 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  4: [mq]: 5.patch - johndoe
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: ff5c06112e5a [mq]: 5.patch - johndoe
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -U
   # HG changeset patch
   # User test
@@ -589,11 +589,11 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  4: [mq]: 5.patch - test
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: c947416c22b1 [mq]: 5.patch - test
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -u
   # HG changeset patch
   # User johndeere
@@ -604,23 +604,23 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew with plain header
   popping 6.patch
   now at: 5.patch
   now at: 6.patch
   From: test
   
-  5: imported patch 6.patch - test
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 7825a18ec839 imported patch 6.patch - test
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref
   adding 6
   From: test
@@ -630,12 +630,12 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  5: [mq]: 6.patch - test
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 09d19592680d [mq]: 6.patch - test
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -U
   From: test
   
@@ -644,12 +644,12 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  5: [mq]: 6.patch - test
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 09d19592680d [mq]: 6.patch - test
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -u
   From: johndeere
   
@@ -658,12 +658,12 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  5: [mq]: 6.patch - johndeere
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 32641ee07196 [mq]: 6.patch - johndeere
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qpop -a / qpush -a
   popping 6.patch
   popping 5.patch
@@ -679,12 +679,12 @@
   applying 5.patch
   applying 6.patch
   now at: 6.patch
-  5: imported patch 6.patch - johndeere
-  4: imported patch 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: imported patch 2.patch - jane
-  0: imported patch 1.patch - mary
+  5: 1fb083c80457 imported patch 6.patch - johndeere
+  4: 7e96e969691d imported patch 5.patch - johndeere
+  3: c7147533d3cd Four - jane
+  2: b383d04401ea Three (again) - maria
+  1: fac2da4efc3c imported patch 2.patch - jane
+  0: b6e237e8771b imported patch 1.patch - mary
   $ rm -r sandbox
   $ runtest
   ==== init
@@ -693,7 +693,7 @@
   # User test
   # Parent 
   
-  0: [mq]: 1.patch - test
+  0: a054644889e5 [mq]: 1.patch - test
   ==== qref
   adding 1
   # HG changeset patch
@@ -705,7 +705,7 @@
   +++ b/1
   @@ -0,0 +1,1 @@
   +1
-  0: [mq]: 1.patch - test
+  0: 2905f1e46ee0 [mq]: 1.patch - test
   ==== qref -u
   # HG changeset patch
   # User mary
@@ -716,7 +716,7 @@
   +++ b/1
   @@ -0,0 +1,1 @@
   +1
-  0: [mq]: 1.patch - mary
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew
   adding 2
   # HG changeset patch
@@ -727,8 +727,8 @@
   +++ b/2
   @@ -0,0 +1,1 @@
   +2
-  1: [mq]: 2.patch - test
-  0: [mq]: 1.patch - mary
+  1: 527f98a12a7a [mq]: 2.patch - test
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u
   # HG changeset patch
   # User jane
@@ -739,17 +739,17 @@
   +++ b/2
   @@ -0,0 +1,1 @@
   +2
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew -U -m
   # HG changeset patch
   # User test
   # Parent 
   Three
   
-  2: Three - test
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: 0ffa16a9088e Three - test
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref
   adding 3
   # HG changeset patch
@@ -762,9 +762,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Three - test
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: 83f1290c6086 Three - test
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -m
   # HG changeset patch
   # User test
@@ -776,9 +776,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Drei - test
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: b0d856328d4d Drei - test
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u
   # HG changeset patch
   # User mary
@@ -790,9 +790,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Drei - mary
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: bb9d4b28e6a6 Drei - mary
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u -m
   # HG changeset patch
   # User maria
@@ -804,9 +804,9 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew -m
   adding 4of
   # HG changeset patch
@@ -818,10 +818,10 @@
   +++ b/4of
   @@ -0,0 +1,1 @@
   +4 t
-  3: Four - test
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  3: b9f922d0da40 Four - test
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qref -u
   # HG changeset patch
   # User jane
@@ -833,21 +833,21 @@
   +++ b/4of
   @@ -0,0 +1,1 @@
   +4 t
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew with HG header
   popping 5.patch
   now at: 4.patch
   now at: 5.patch
   # HG changeset patch
   # User johndoe
-  4: imported patch 5.patch - johndoe
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: 72bc4a0467ef imported patch 5.patch - johndoe
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref
   adding 5
   # HG changeset patch
@@ -859,11 +859,11 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  4: [mq]: 5.patch - johndoe
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: ff5c06112e5a [mq]: 5.patch - johndoe
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -U
   # HG changeset patch
   # User test
@@ -874,11 +874,11 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  4: [mq]: 5.patch - test
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: c947416c22b1 [mq]: 5.patch - test
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -u
   # HG changeset patch
   # User johndeere
@@ -889,23 +889,23 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qnew with plain header
   popping 6.patch
   now at: 5.patch
   now at: 6.patch
   From: test
   
-  5: imported patch 6.patch - test
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 7825a18ec839 imported patch 6.patch - test
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref
   adding 6
   From: test
@@ -915,12 +915,12 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  5: [mq]: 6.patch - test
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 09d19592680d [mq]: 6.patch - test
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -U
   From: test
   
@@ -929,12 +929,12 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  5: [mq]: 6.patch - test
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 09d19592680d [mq]: 6.patch - test
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== hg qref -u
   From: johndeere
   
@@ -943,12 +943,12 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  5: [mq]: 6.patch - johndeere
-  4: [mq]: 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: [mq]: 2.patch - jane
-  0: [mq]: 1.patch - mary
+  5: 32641ee07196 [mq]: 6.patch - johndeere
+  4: 1d898e201a22 [mq]: 5.patch - johndeere
+  3: 0dfb3111e7ee Four - jane
+  2: a6686ee84fc3 Three (again) - maria
+  1: a425cde5f493 [mq]: 2.patch - jane
+  0: 3682f830e656 [mq]: 1.patch - mary
   ==== qpop -a / qpush -a
   popping 6.patch
   popping 5.patch
@@ -964,11 +964,11 @@
   applying 5.patch
   applying 6.patch
   now at: 6.patch
-  5: imported patch 6.patch - johndeere
-  4: imported patch 5.patch - johndeere
-  3: Four - jane
-  2: Three (again) - maria
-  1: imported patch 2.patch - jane
-  0: imported patch 1.patch - mary
+  5: 1fb083c80457 imported patch 6.patch - johndeere
+  4: 7e96e969691d imported patch 5.patch - johndeere
+  3: c7147533d3cd Four - jane
+  2: b383d04401ea Three (again) - maria
+  1: fac2da4efc3c imported patch 2.patch - jane
+  0: b6e237e8771b imported patch 1.patch - mary
 
   $ cd ..
--- a/tests/test-mq-merge.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-mq-merge.t	Tue Dec 19 16:27:24 2017 -0500
@@ -58,7 +58,7 @@
 Save the patch queue so we can merge it later:
 
   $ hg qsave -c -e
-  copy $TESTTMP/t/.hg/patches to $TESTTMP/t/.hg/patches.1 (glob)
+  copy $TESTTMP/t/.hg/patches to $TESTTMP/t/.hg/patches.1
   $ checkundo
 
 Update b and commit in an "update" changeset:
@@ -78,7 +78,7 @@
   b
 
   $ hg qpush -a -m
-  merging with queue at: $TESTTMP/t/.hg/patches.1 (glob)
+  merging with queue at: $TESTTMP/t/.hg/patches.1
   applying rm_a
   now at: rm_a
 
@@ -117,14 +117,14 @@
 Create the reference queue:
 
   $ hg qsave -c -e -n refqueue
-  copy $TESTTMP/t2/.hg/patches to $TESTTMP/t2/.hg/refqueue (glob)
+  copy $TESTTMP/t2/.hg/patches to $TESTTMP/t2/.hg/refqueue
   $ hg up -C 1
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
 Merge:
 
   $ HGMERGE=internal:other hg qpush -a -m -n refqueue
-  merging with queue at: $TESTTMP/t2/.hg/refqueue (glob)
+  merging with queue at: $TESTTMP/t2/.hg/refqueue
   applying patcha
   patching file a
   Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
--- a/tests/test-mq-pull-from-bundle.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-mq-pull-from-bundle.t	Tue Dec 19 16:27:24 2017 -0500
@@ -2,7 +2,7 @@
   > [extensions]
   > mq=
   > [alias]
-  > tlog = log --template "{rev}: {desc}\\n"
+  > tlog = log --template "{rev}: {node|short} {desc}\\n"
   > theads = heads --template "{rev}: {desc}\\n"
   > tincoming = incoming --template "{rev}: {desc}\\n"
   > EOF
@@ -97,7 +97,7 @@
   0: queue: two.patch added
 
   $ hg -R .hg/patches tlog
-  0: queue: two.patch added
+  0: d7553909353d queue: two.patch added
 
   $ hg qseries
   two.patch
@@ -128,7 +128,7 @@
   0: queue: two.patch added
 
   $ hg -R .hg/patches tlog
-  0: queue: two.patch added
+  0: d7553909353d queue: two.patch added
 
   $ hg qseries
   two.patch
--- a/tests/test-mq-qnew.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-mq-qnew.t	Tue Dec 19 16:27:24 2017 -0500
@@ -117,7 +117,7 @@
   abort: patch name cannot begin or end with whitespace
   abort: patch name cannot begin or end with whitespace
   % qnew with name containing slash
-  abort: path ends in directory separator: foo/ (glob)
+  abort: path ends in directory separator: foo/
   abort: "foo" already exists as a directory
   foo/bar.patch
   popping foo/bar.patch
@@ -187,7 +187,7 @@
   abort: patch name cannot begin or end with whitespace
   abort: patch name cannot begin or end with whitespace
   % qnew with name containing slash
-  abort: path ends in directory separator: foo/ (glob)
+  abort: path ends in directory separator: foo/
   abort: "foo" already exists as a directory
   foo/bar.patch
   popping foo/bar.patch
--- a/tests/test-mq-safety.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-mq-safety.t	Tue Dec 19 16:27:24 2017 -0500
@@ -68,7 +68,7 @@
   abort: popping would remove a revision not managed by this patch queue
   [255]
   $ hg qpop -n patches
-  using patch queue: $TESTTMP/repo/.hg/patches (glob)
+  using patch queue: $TESTTMP/repo/.hg/patches
   abort: popping would remove a revision not managed by this patch queue
   [255]
   $ hg qrefresh
--- a/tests/test-mq-subrepo.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-mq-subrepo.t	Tue Dec 19 16:27:24 2017 -0500
@@ -247,7 +247,7 @@
   [255]
   $ hg revert sub
   reverting subrepo sub
-  adding sub/a (glob)
+  adding sub/a
   $ hg qpop
   popping 1
   now at: 0
@@ -266,7 +266,7 @@
   [255]
   $ hg revert sub
   reverting subrepo sub
-  adding sub/a (glob)
+  adding sub/a
   $ hg qpush
   applying 1
    subrepository sub diverged (local revision: b2fdb12cd82b, remote revision: aa037b301eba)
--- a/tests/test-mq.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-mq.t	Tue Dec 19 16:27:24 2017 -0500
@@ -154,7 +154,7 @@
   guards
   $ cat .hg/patches/series
   $ hg qinit -c
-  abort: repository $TESTTMP/d/.hg/patches already exists! (glob)
+  abort: repository $TESTTMP/d/.hg/patches already exists!
   [255]
   $ cd ..
 
@@ -177,8 +177,8 @@
   $ echo status >> .hg/patches/.hgignore
   $ echo bleh >> .hg/patches/.hgignore
   $ hg qinit -c
-  adding .hg/patches/A (glob)
-  adding .hg/patches/B (glob)
+  adding .hg/patches/A
+  adding .hg/patches/B
   $ hg -R .hg/patches status
   A .hgignore
   A A
@@ -800,7 +800,7 @@
 
   $ hg strip -f tip
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/b/.hg/strip-backup/770eb8fce608-0ddcae0f-backup.hg (glob)
+  saved backup bundle to $TESTTMP/b/.hg/strip-backup/770eb8fce608-0ddcae0f-backup.hg
   $ cd ..
 
 
@@ -1247,7 +1247,7 @@
 
   $ cd qclonesource
   $ hg qinit -c
-  adding .hg/patches/patch1 (glob)
+  adding .hg/patches/patch1
   $ hg qci -m checkpoint
   $ qlog
   main repo:
@@ -1388,8 +1388,8 @@
 
   $ hg qpush -f --verbose --config 'ui.origbackuppath=.hg/origbackups'
   applying empty
-  creating directory: $TESTTMP/forcepush/.hg/origbackups (glob)
-  saving current version of hello.txt as $TESTTMP/forcepush/.hg/origbackups/hello.txt (glob)
+  creating directory: $TESTTMP/forcepush/.hg/origbackups
+  saving current version of hello.txt as $TESTTMP/forcepush/.hg/origbackups/hello.txt
   patching file hello.txt
   committing files:
   hello.txt
--- a/tests/test-mv-cp-st-diff.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-mv-cp-st-diff.t	Tue Dec 19 16:27:24 2017 -0500
@@ -1339,7 +1339,7 @@
   % hg ci -m t0
   created new head
   % hg mv x y
-  moving x/x to y/x (glob)
+  moving x/x to y/x
   % hg ci -m t1
   % add y/x x1
   % hg ci -m t2
--- a/tests/test-nested-repo.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-nested-repo.t	Tue Dec 19 16:27:24 2017 -0500
@@ -14,16 +14,16 @@
 Should fail:
 
   $ hg st b/x
-  abort: path 'b/x' is inside nested repo 'b' (glob)
+  abort: path 'b/x' is inside nested repo 'b'
   [255]
   $ hg add b/x
-  abort: path 'b/x' is inside nested repo 'b' (glob)
+  abort: path 'b/x' is inside nested repo 'b'
   [255]
 
 Should fail:
 
   $ hg add b b/x
-  abort: path 'b/x' is inside nested repo 'b' (glob)
+  abort: path 'b/x' is inside nested repo 'b'
   [255]
   $ hg st
 
@@ -37,7 +37,7 @@
 Should fail:
 
   $ hg mv a b
-  abort: path 'b/a' is inside nested repo 'b' (glob)
+  abort: path 'b/a' is inside nested repo 'b'
   [255]
   $ hg st
 
--- a/tests/test-notify-changegroup.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-notify-changegroup.t	Tue Dec 19 16:27:24 2017 -0500
@@ -56,11 +56,11 @@
   Message-Id: <*> (glob)
   To: baz, foo@bar
   
-  changeset cb9a9f314b8b in $TESTTMP/a (glob)
+  changeset cb9a9f314b8b in $TESTTMP/a
   details: $TESTTMP/a?cmd=changeset;node=cb9a9f314b8b
   summary: a
   
-  changeset ba677d0156c1 in $TESTTMP/a (glob)
+  changeset ba677d0156c1 in $TESTTMP/a
   details: $TESTTMP/a?cmd=changeset;node=ba677d0156c1
   summary: b
   
@@ -109,11 +109,11 @@
   Message-Id: <*> (glob)
   To: baz, foo@bar
   
-  changeset cb9a9f314b8b in $TESTTMP/a (glob)
+  changeset cb9a9f314b8b in $TESTTMP/a
   details: $TESTTMP/a?cmd=changeset;node=cb9a9f314b8b
   summary: a
   
-  changeset ba677d0156c1 in $TESTTMP/a (glob)
+  changeset ba677d0156c1 in $TESTTMP/a
   details: $TESTTMP/a?cmd=changeset;node=ba677d0156c1
   summary: b
   
@@ -186,19 +186,19 @@
   Message-Id: <*> (glob)
   To: baz, foo@bar
   
-  changeset 84e487dddc58 in $TESTTMP/a (glob)
+  changeset 84e487dddc58 in $TESTTMP/a
   details: $TESTTMP/a?cmd=changeset;node=84e487dddc58
   summary: newfile
   
-  changeset b29c7a2b6b0c in $TESTTMP/a (glob)
+  changeset b29c7a2b6b0c in $TESTTMP/a
   details: $TESTTMP/a?cmd=changeset;node=b29c7a2b6b0c
   summary: x
   
-  changeset 0957c7d64886 in $TESTTMP/a (glob)
+  changeset 0957c7d64886 in $TESTTMP/a
   details: $TESTTMP/a?cmd=changeset;node=0957c7d64886
   summary: y
   
-  changeset 485b4e6b0249 in $TESTTMP/a (glob)
+  changeset 485b4e6b0249 in $TESTTMP/a
   details: $TESTTMP/a?cmd=changeset;node=485b4e6b0249
   summary: merged
   
--- a/tests/test-notify.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-notify.t	Tue Dec 19 16:27:24 2017 -0500
@@ -199,7 +199,7 @@
   Message-Id: <*> (glob)
   To: baz, foo@bar
   
-  changeset 0647d048b600 in $TESTTMP/b (glob)
+  changeset 0647d048b600 in $TESTTMP/b
   details: $TESTTMP/b?cmd=changeset;node=0647d048b600
   description: b
   
@@ -563,7 +563,7 @@
   Message-Id: <hg.f5e8ec95bf59.*.*@*> (glob)
   To: baz@test.com, foo@bar
   
-  changeset f5e8ec95bf59 in $TESTTMP/b (glob)
+  changeset f5e8ec95bf59 in $TESTTMP/b
   details: http://test/b?cmd=changeset;node=f5e8ec95bf59
   description: default template
 
--- a/tests/test-obsmarker-template.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-obsmarker-template.t	Tue Dec 19 16:27:24 2017 -0500
@@ -13,7 +13,7 @@
   > evolution=true
   > [templates]
   > obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}"
-  > obsfateverb = "{obsfateverb(successors)}"
+  > obsfateverb = "{obsfateverb(successors, markers)}"
   > obsfateoperations = "{if(obsfateoperations(markers), " using {join(obsfateoperations(markers), ", ")}")}"
   > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}"
   > obsfatedate = "{if(obsfatedate(markers), "{ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), " (at {min(obsfatedate(markers))|isodate})", " (between {min(obsfatedate(markers))|isodate} and {max(obsfatedate(markers))|isodate})")}")}"
@@ -248,9 +248,9 @@
   @  d004c8f274b9
   |
   | x  a468dc9b3633
-  |/     Obsfate: [{"markers": [["a468dc9b36338b14fdb7825f55ce3df4e71517ad", ["d004c8f274b9ec480a47a93c10dac5eee63adb78"], 0, [["operation", "amend"], ["user", "test2"]], [987654321.0, 0], null]], "successors": ["d004c8f274b9ec480a47a93c10dac5eee63adb78"]}]
+  |/     Obsfate: [{"markers": [["a468dc9b36338b14fdb7825f55ce3df4e71517ad", ["d004c8f274b9ec480a47a93c10dac5eee63adb78"], 0, [["ef1", "1"], ["operation", "amend"], ["user", "test2"]], [987654321.0, 0], null]], "successors": ["d004c8f274b9ec480a47a93c10dac5eee63adb78"]}]
   | x  471f378eab4c
-  |/     Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"], 0, [["operation", "amend"], ["user", "test"]], [1234567890.0, 0], null]], "successors": ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]}]
+  |/     Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"], 0, [["ef1", "9"], ["operation", "amend"], ["user", "test"]], [1234567890.0, 0], null]], "successors": ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]}]
   o  ea207398892e
   
 
@@ -975,11 +975,11 @@
   o  019fadeab383
   |
   | x  65b757b745b9
-  |/     Obsfate: [{"markers": [["65b757b745b935093c87a2bccd877521cccffcbd", ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"], 0, [["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]}]
+  |/     Obsfate: [{"markers": [["65b757b745b935093c87a2bccd877521cccffcbd", ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"], 0, [["ef1", "1"], ["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]}]
   | @  fdf9bde5129a
   |/
   | x  471f378eab4c
-  |/     Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], 0, [["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"]}, {"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["65b757b745b935093c87a2bccd877521cccffcbd"], 0, [["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["65b757b745b935093c87a2bccd877521cccffcbd"]}]
+  |/     Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], 0, [["ef1", "1"], ["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"]}, {"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["65b757b745b935093c87a2bccd877521cccffcbd"], 0, [["ef1", "1"], ["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["65b757b745b935093c87a2bccd877521cccffcbd"]}]
   o  ea207398892e
   
 
@@ -1287,7 +1287,7 @@
   | x  b7ea6d14e664
   | |    Obsfate: [{"markers": [["b7ea6d14e664bdc8922221f7992631b50da3fb07", ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]}]
   | | x  0dec01379d3b
-  | |/     Obsfate: [{"markers": [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", ["b7ea6d14e664bdc8922221f7992631b50da3fb07"], 0, [["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["b7ea6d14e664bdc8922221f7992631b50da3fb07"]}]
+  | |/     Obsfate: [{"markers": [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", ["b7ea6d14e664bdc8922221f7992631b50da3fb07"], 0, [["ef1", "1"], ["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["b7ea6d14e664bdc8922221f7992631b50da3fb07"]}]
   | x  471f378eab4c
   |/     Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]}]
   o  ea207398892e
@@ -1419,7 +1419,7 @@
   
   $ cd $TESTTMP/templates-local-remote-markers-2
   $ hg pull
-  pulling from $TESTTMP/templates-local-remote-markers-1 (glob)
+  pulling from $TESTTMP/templates-local-remote-markers-1
   searching for changes
   adding changesets
   adding manifests
@@ -1450,8 +1450,8 @@
   
 
   $ hg debugobsolete
-  471f378eab4c5e25f6c77f785b27c936efb22874 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 7a230b46bf61e50b30308c6cfd7bd1269ef54702 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
+  471f378eab4c5e25f6c77f785b27c936efb22874 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
+  fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 7a230b46bf61e50b30308c6cfd7bd1269ef54702 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
 
 Check templates
 ---------------
@@ -2045,7 +2045,7 @@
   | o  ba2ed02b0c9a
   | |
   | x  4a004186e638
-  |/     Obsfate: [{"markers": [["4a004186e63889f20cb16434fcbd72220bd1eace", ["b18bc8331526a22cbb1801022bd1555bf291c48b"], 0, [["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["b18bc8331526a22cbb1801022bd1555bf291c48b"]}, {"markers": [["4a004186e63889f20cb16434fcbd72220bd1eace", ["0b997eb7ceeee06200a02f8aab185979092d514e"], 0, [["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["0b997eb7ceeee06200a02f8aab185979092d514e"]}]
+  |/     Obsfate: [{"markers": [["4a004186e63889f20cb16434fcbd72220bd1eace", ["b18bc8331526a22cbb1801022bd1555bf291c48b"], 0, [["ef1", "1"], ["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["b18bc8331526a22cbb1801022bd1555bf291c48b"]}, {"markers": [["4a004186e63889f20cb16434fcbd72220bd1eace", ["0b997eb7ceeee06200a02f8aab185979092d514e"], 0, [["ef1", "1"], ["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["0b997eb7ceeee06200a02f8aab185979092d514e"]}]
   o  dd800401bd8c
   |
   | x  9bd10a0775e4
--- a/tests/test-obsolete-bundle-strip.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-obsolete-bundle-strip.t	Tue Dec 19 16:27:24 2017 -0500
@@ -158,7 +158,7 @@
   ### diff <relevant> <bundled> ###
   #################################
   ### Exclusive markers ###
-  # stripping: saved backup bundle to $TESTTMP/simple-chain/.hg/strip-backup/84fcb0dfe17b-6454bbdc-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/simple-chain/.hg/strip-backup/84fcb0dfe17b-6454bbdc-backup.hg
   ### Backup markers ###
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
@@ -189,7 +189,7 @@
   ### Exclusive markers ###
       84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/simple-chain/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/simple-chain/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
   ### Backup markers ###
       84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -229,7 +229,7 @@
       84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/simple-chain/.hg/strip-backup/cf2c22470d67-fce4fc64-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/simple-chain/.hg/strip-backup/cf2c22470d67-fce4fc64-backup.hg
   ### Backup markers ###
       84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -324,7 +324,7 @@
   #################################
   ### Exclusive markers ###
       29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/prune/.hg/strip-backup/29f93b1df87b-7fb32101-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/prune/.hg/strip-backup/29f93b1df87b-7fb32101-backup.hg
   ### Backup markers ###
       29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
@@ -356,7 +356,7 @@
   #################################
   ### Exclusive markers ###
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/prune/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/prune/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
   ### Backup markers ###
       29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -417,7 +417,7 @@
       29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/prune/.hg/strip-backup/cf2c22470d67-884c33b0-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/prune/.hg/strip-backup/cf2c22470d67-884c33b0-backup.hg
   ### Backup markers ###
       29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -489,7 +489,7 @@
   ### diff <relevant> <bundled> ###
   #################################
   ### Exclusive markers ###
-  # stripping: saved backup bundle to $TESTTMP/prune-inline/.hg/strip-backup/84fcb0dfe17b-6454bbdc-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/prune-inline/.hg/strip-backup/84fcb0dfe17b-6454bbdc-backup.hg
   ### Backup markers ###
       84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -520,7 +520,7 @@
   #################################
   ### Exclusive markers ###
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/prune-inline/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/prune-inline/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
   ### Backup markers ###
       84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -558,7 +558,7 @@
       84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/prune-inline/.hg/strip-backup/cf2c22470d67-fce4fc64-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/prune-inline/.hg/strip-backup/cf2c22470d67-fce4fc64-backup.hg
   ### Backup markers ###
       84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -641,7 +641,7 @@
       29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/missing-prune/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/missing-prune/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
   ### Backup markers ###
       29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -721,7 +721,7 @@
       84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/prune-inline-missing/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/prune-inline-missing/.hg/strip-backup/cf2c22470d67-fa0f07b0-backup.hg
   ### Backup markers ###
       84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -820,7 +820,7 @@
   ### diff <relevant> <bundled> ###
   #################################
   ### Exclusive markers ###
-  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/9ac430e15fca-81204eba-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/9ac430e15fca-81204eba-backup.hg
   ### Backup markers ###
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
@@ -847,7 +847,7 @@
   ### diff <relevant> <bundled> ###
   #################################
   ### Exclusive markers ###
-  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/a9b9da38ed96-7465d6e9-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/a9b9da38ed96-7465d6e9-backup.hg
   ### Backup markers ###
       9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -875,7 +875,7 @@
   ### diff <relevant> <bundled> ###
   #################################
   ### Exclusive markers ###
-  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/27ec657ca21d-d5dd1c7c-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/27ec657ca21d-d5dd1c7c-backup.hg
   ### Backup markers ###
       9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -903,7 +903,7 @@
   ### diff <relevant> <bundled> ###
   #################################
   ### Exclusive markers ###
-  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/06dc9da25ef0-9b1c0a91-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/06dc9da25ef0-9b1c0a91-backup.hg
   ### Backup markers ###
       9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -951,7 +951,7 @@
       a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/2f20ff6509f0-8adeb22d-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/2f20ff6509f0-8adeb22d-backup.hg
   ### Backup markers ###
       06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -1000,7 +1000,7 @@
   ### diff <relevant> <bundled> ###
   #################################
   ### Exclusive markers ###
-  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/a9b9da38ed96-0daf625a-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/a9b9da38ed96-0daf625a-backup.hg
   ### Backup markers ###
       9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -1052,7 +1052,7 @@
       a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/2f20ff6509f0-bf1b80f4-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/2f20ff6509f0-bf1b80f4-backup.hg
   ### Backup markers ###
       06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -1120,7 +1120,7 @@
       a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/9ac430e15fca-36b6476a-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/9ac430e15fca-36b6476a-backup.hg
   ### Backup markers ###
       06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -1188,7 +1188,7 @@
       a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/2f20ff6509f0-5fdfcd7d-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/2f20ff6509f0-5fdfcd7d-backup.hg
   ### Backup markers ###
       06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -1262,7 +1262,7 @@
       a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/a9b9da38ed96-eeb4258f-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/split-fold/.hg/strip-backup/a9b9da38ed96-eeb4258f-backup.hg
   ### Backup markers ###
       06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -1352,7 +1352,7 @@
   #################################
   ### Exclusive markers ###
       cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/lonely-prune/.hg/strip-backup/cefb651fc2fd-345c8dfa-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/lonely-prune/.hg/strip-backup/cefb651fc2fd-345c8dfa-backup.hg
   ### Backup markers ###
       cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
@@ -1380,7 +1380,7 @@
   #################################
   ### Exclusive markers ###
       cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  # stripping: saved backup bundle to $TESTTMP/lonely-prune/.hg/strip-backup/9ac430e15fca-b9855b02-backup.hg (glob)
+  # stripping: saved backup bundle to $TESTTMP/lonely-prune/.hg/strip-backup/9ac430e15fca-b9855b02-backup.hg
   ### Backup markers ###
       cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
--- a/tests/test-obsolete-changeset-exchange.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-obsolete-changeset-exchange.t	Tue Dec 19 16:27:24 2017 -0500
@@ -142,7 +142,7 @@
 
   $ cd pull-hidden-common-client
   $ hg pull --debug
-  pulling from $TESTTMP/pull-hidden-common (glob)
+  pulling from $TESTTMP/pull-hidden-common
   query 1; heads
   searching for changes
   taking quick initial sample
--- a/tests/test-obsolete-checkheads.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-obsolete-checkheads.t	Tue Dec 19 16:27:24 2017 -0500
@@ -37,7 +37,7 @@
 
   $ mkcommit old
   $ hg push
-  pushing to $TESTTMP/remote (glob)
+  pushing to $TESTTMP/remote
   searching for changes
   adding changesets
   adding manifests
@@ -61,7 +61,7 @@
 Push should not warn about creating new head
 
   $ hg push
-  pushing to $TESTTMP/remote (glob)
+  pushing to $TESTTMP/remote
   searching for changes
   adding changesets
   adding manifests
@@ -77,7 +77,7 @@
   $ cp -R ../backup1 ../remote
   $ hg -R ../remote phase --public c70b08862e08
   $ hg pull -v
-  pulling from $TESTTMP/remote (glob)
+  pulling from $TESTTMP/remote
   searching for changes
   no changes found
   $ hg log -G --hidden
@@ -91,7 +91,7 @@
 Abort: old will still be an head because it's public.
 
   $ hg push
-  pushing to $TESTTMP/remote (glob)
+  pushing to $TESTTMP/remote
   searching for changes
   abort: push creates new remote head 71e3228bffe1!
   (merge or see 'hg help push' for details about pushing new heads)
@@ -151,7 +151,7 @@
 Push should abort on new head
 
   $ hg push -r 'desc("other")'
-  pushing to $TESTTMP/remote (glob)
+  pushing to $TESTTMP/remote
   searching for changes
   abort: push creates new remote head d7d41ccbd4de!
   (merge or see 'hg help push' for details about pushing new heads)
@@ -178,7 +178,7 @@
   $ mkcommit new
   created new head
   $ hg push -f
-  pushing to $TESTTMP/remote (glob)
+  pushing to $TESTTMP/remote
   searching for changes
   adding changesets
   adding manifests
@@ -214,7 +214,7 @@
 one anyway.
 
   $ hg push
-  pushing to $TESTTMP/remote (glob)
+  pushing to $TESTTMP/remote
   searching for changes
   adding changesets
   adding manifests
@@ -260,7 +260,7 @@
 We do not have enought data to take the right decision, we should fail
 
   $ hg push
-  pushing to $TESTTMP/remote (glob)
+  pushing to $TESTTMP/remote
   searching for changes
   remote has heads on branch 'default' that are not known locally: c70b08862e08
   abort: push creates new remote head 71e3228bffe1!
@@ -270,7 +270,7 @@
 Pulling the missing data makes it work
 
   $ hg pull
-  pulling from $TESTTMP/remote (glob)
+  pulling from $TESTTMP/remote
   searching for changes
   adding changesets
   adding manifests
@@ -278,7 +278,7 @@
   added 1 changesets with 1 changes to 1 files (+1 heads)
   (run 'hg heads' to see heads)
   $ hg push
-  pushing to $TESTTMP/remote (glob)
+  pushing to $TESTTMP/remote
   searching for changes
   adding changesets
   adding manifests
@@ -309,7 +309,7 @@
   
 
   $ hg push
-  pushing to $TESTTMP/remote (glob)
+  pushing to $TESTTMP/remote
   searching for changes
   abort: push creates new remote head 350a93b716be!
   (merge or see 'hg help push' for details about pushing new heads)
--- a/tests/test-obsolete-distributed.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-obsolete-distributed.t	Tue Dec 19 16:27:24 2017 -0500
@@ -136,7 +136,7 @@
   $ hg up 'desc("ROOT")'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg pull
-  pulling from $TESTTMP/distributed-chain-building/server (glob)
+  pulling from $TESTTMP/distributed-chain-building/server
   searching for changes
   adding changesets
   adding manifests
@@ -174,7 +174,7 @@
   $ hg rollback
   repository tip rolled back to revision 3 (undo pull)
   $ hg push -f
-  pushing to $TESTTMP/distributed-chain-building/server (glob)
+  pushing to $TESTTMP/distributed-chain-building/server
   searching for changes
   adding changesets
   adding manifests
@@ -302,9 +302,9 @@
   o  0:e82fb8d02bbf ROOT
   
   $ hg debugobsolete
-  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
-  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'bob'}
-  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
+  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
+  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'bob'}
+  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
   $ cd ..
 
 Celeste pulls from Bob and rewrites them again
@@ -349,12 +349,12 @@
   o  0:e82fb8d02bbf ROOT
   
   $ hg debugobsolete
-  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
-  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
-  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'bob'}
-  5b5708a437f27665db42c5a261a539a1bcb2a8c2 9866d64649a5d9c5991fe119c7b2c33898114e10 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'celeste'}
-  956063ac4557828781733b2d5677a351ce856f59 3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'celeste'}
-  3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 77ae25d99ff07889e181126b1171b94bec8e5227 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'celeste'}
+  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
+  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
+  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'bob'}
+  5b5708a437f27665db42c5a261a539a1bcb2a8c2 9866d64649a5d9c5991fe119c7b2c33898114e10 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'celeste'}
+  956063ac4557828781733b2d5677a351ce856f59 3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'celeste'}
+  3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 77ae25d99ff07889e181126b1171b94bec8e5227 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'celeste'}
 
 Celeste now pushes to the server
 
@@ -362,7 +362,7 @@
 However using a central server seems more common)
 
   $ hg push
-  pushing to $TESTTMP/distributed-chain-building/distributed-chain-building/server (glob)
+  pushing to $TESTTMP/distributed-chain-building/distributed-chain-building/server
   searching for changes
   adding changesets
   adding manifests
@@ -380,7 +380,7 @@
   $ hg up 'desc(ROOT)'
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg pull
-  pulling from $TESTTMP/distributed-chain-building/distributed-chain-building/server (glob)
+  pulling from $TESTTMP/distributed-chain-building/distributed-chain-building/server
   searching for changes
   adding changesets
   adding manifests
@@ -391,12 +391,12 @@
   new changesets 9866d64649a5:77ae25d99ff0
   (run 'hg heads' to see heads)
   $ hg debugobsolete
-  3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 77ae25d99ff07889e181126b1171b94bec8e5227 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'celeste'}
-  5b5708a437f27665db42c5a261a539a1bcb2a8c2 9866d64649a5d9c5991fe119c7b2c33898114e10 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'celeste'}
-  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
-  956063ac4557828781733b2d5677a351ce856f59 3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'celeste'}
-  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
-  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'bob'}
+  3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 77ae25d99ff07889e181126b1171b94bec8e5227 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'celeste'}
+  5b5708a437f27665db42c5a261a539a1bcb2a8c2 9866d64649a5d9c5991fe119c7b2c33898114e10 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'celeste'}
+  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
+  956063ac4557828781733b2d5677a351ce856f59 3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'celeste'}
+  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
+  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'bob'}
 
 Then, she pulls from Bob, pulling predecessors of the changeset she has
 already pulled. The changesets are not obsoleted in the Bob repo yet. Their
@@ -418,12 +418,12 @@
   @  0:e82fb8d02bbf ROOT
   
   $ hg debugobsolete
-  3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 77ae25d99ff07889e181126b1171b94bec8e5227 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'celeste'}
-  5b5708a437f27665db42c5a261a539a1bcb2a8c2 9866d64649a5d9c5991fe119c7b2c33898114e10 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'celeste'}
-  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
-  956063ac4557828781733b2d5677a351ce856f59 3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'celeste'}
-  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
-  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'bob'}
+  3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 77ae25d99ff07889e181126b1171b94bec8e5227 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'celeste'}
+  5b5708a437f27665db42c5a261a539a1bcb2a8c2 9866d64649a5d9c5991fe119c7b2c33898114e10 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'celeste'}
+  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
+  956063ac4557828781733b2d5677a351ce856f59 3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'celeste'}
+  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
+  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'bob'}
 
 Same tests, but change coming from a bundle
 (testing with a bundle is interesting because absolutely no discovery or
@@ -439,12 +439,12 @@
   @  0:e82fb8d02bbf ROOT
   
   $ hg debugobsolete
-  3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 77ae25d99ff07889e181126b1171b94bec8e5227 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'celeste'}
-  5b5708a437f27665db42c5a261a539a1bcb2a8c2 9866d64649a5d9c5991fe119c7b2c33898114e10 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'celeste'}
-  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
-  956063ac4557828781733b2d5677a351ce856f59 3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'celeste'}
-  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
-  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'bob'}
+  3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 77ae25d99ff07889e181126b1171b94bec8e5227 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'celeste'}
+  5b5708a437f27665db42c5a261a539a1bcb2a8c2 9866d64649a5d9c5991fe119c7b2c33898114e10 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'celeste'}
+  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
+  956063ac4557828781733b2d5677a351ce856f59 3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'celeste'}
+  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
+  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'bob'}
   $ hg -R ../repo-Bob bundle ../step-1.hg
   searching for changes
   2 changesets found
@@ -477,11 +477,11 @@
   @  0:e82fb8d02bbf ROOT
   
   $ hg debugobsolete
-  3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 77ae25d99ff07889e181126b1171b94bec8e5227 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'celeste'}
-  5b5708a437f27665db42c5a261a539a1bcb2a8c2 9866d64649a5d9c5991fe119c7b2c33898114e10 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'celeste'}
-  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
-  956063ac4557828781733b2d5677a351ce856f59 3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'celeste'}
-  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'bob'}
-  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'bob'}
+  3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 77ae25d99ff07889e181126b1171b94bec8e5227 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'celeste'}
+  5b5708a437f27665db42c5a261a539a1bcb2a8c2 9866d64649a5d9c5991fe119c7b2c33898114e10 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'celeste'}
+  5ffb9e311b35f6ab6f76f667ca5d6e595645481b 956063ac4557828781733b2d5677a351ce856f59 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
+  956063ac4557828781733b2d5677a351ce856f59 3cf8de21cc2282186857d2266eb6b1f9cb85ecf3 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'celeste'}
+  d33b0a3a64647d79583526be8107802b1f9fedfa 5b5708a437f27665db42c5a261a539a1bcb2a8c2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'bob'}
+  ef908e42ce65ef57f970d799acaddde26f58a4cc 5ffb9e311b35f6ab6f76f667ca5d6e595645481b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'bob'}
 
   $ cd ..
--- a/tests/test-obsolete-divergent.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-obsolete-divergent.t	Tue Dec 19 16:27:24 2017 -0500
@@ -680,6 +680,6 @@
   o  0:426bada5c675 A
   
   $ hg debugobsolete
-  a178212c3433c4e77b573f6011e29affb8aefa33 1a2a9b5b0030632400aa78e00388c20f99d3ec44 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  a178212c3433c4e77b573f6011e29affb8aefa33 ad6478fb94ecec98b86daae98722865d494ac561 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'test', 'user': 'test'}
-  ad6478fb94ecec98b86daae98722865d494ac561 70d5a63ca112acb3764bc1d7320ca90ea688d671 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'test', 'user': 'test'}
+  a178212c3433c4e77b573f6011e29affb8aefa33 1a2a9b5b0030632400aa78e00388c20f99d3ec44 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
+  a178212c3433c4e77b573f6011e29affb8aefa33 ad6478fb94ecec98b86daae98722865d494ac561 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'test', 'user': 'test'}
+  ad6478fb94ecec98b86daae98722865d494ac561 70d5a63ca112acb3764bc1d7320ca90ea688d671 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'test', 'user': 'test'}
--- a/tests/test-obsolete.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-obsolete.t	Tue Dec 19 16:27:24 2017 -0500
@@ -1015,6 +1015,44 @@
   orphan: 2 changesets
   phase-divergent: 1 changesets
 
+#if serve
+
+  $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+check obsolete changeset
+
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=paper' | grep '<span class="obsolete">'
+     <span class="phase">draft</span> <span class="obsolete">obsolete</span> 
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=coal' | grep '<span class="obsolete">'
+     <span class="phase">draft</span> <span class="obsolete">obsolete</span> 
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=gitweb' | grep '<span class="logtags">'
+    <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="obsoletetag" title="obsolete">obsolete</span> </span>
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=monoblue' | grep '<span class="logtags">'
+          <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="obsoletetag" title="obsolete">obsolete</span> </span>
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=spartan' | grep 'class="obsolete"'
+    <th class="obsolete">obsolete:</th>
+    <td class="obsolete">yes</td>
+
+check changeset with instabilities
+
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=paper' | grep '<span class="instability">'
+     <span class="phase">draft</span> <span class="instability">orphan</span> <span class="instability">phase-divergent</span> 
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=coal' | grep '<span class="instability">'
+     <span class="phase">draft</span> <span class="instability">orphan</span> <span class="instability">phase-divergent</span> 
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=gitweb' | grep '<span class="logtags">'
+    <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="instabilitytag" title="orphan">orphan</span> <span class="instabilitytag" title="phase-divergent">phase-divergent</span> </span>
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=monoblue' | grep '<span class="logtags">'
+          <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="instabilitytag" title="orphan">orphan</span> <span class="instabilitytag" title="phase-divergent">phase-divergent</span> </span>
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=spartan' | grep 'class="instabilities"'
+    <th class="instabilities">instabilities:</th>
+    <td class="instabilities">orphan phase-divergent </td>
+
+  $ killdaemons.py
+
+  $ rm hg.pid access.log errors.log
+#endif
+
 Test incoming/outcoming with changesets obsoleted remotely, known locally
 ===============================================================================
 
@@ -1045,15 +1083,15 @@
   o  0:d20a80d4def3 (draft) [ ] base
   
   $ hg incoming
-  comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
+  comparing with $TESTTMP/tmpe/repo-issue3805
   searching for changes
   2:323a9c3ddd91 (draft) [tip ] A
   $ hg incoming --bundle ../issue3805.hg
-  comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
+  comparing with $TESTTMP/tmpe/repo-issue3805
   searching for changes
   2:323a9c3ddd91 (draft) [tip ] A
   $ hg outgoing
-  comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
+  comparing with $TESTTMP/tmpe/repo-issue3805
   searching for changes
   1:29f0c6921ddd (draft) [tip ] A
 
@@ -1331,9 +1369,9 @@
   
 
   $ hg strip --hidden -r 2 --config extensions.strip= --config devel.strip-obsmarkers=no
-  saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e008cf283490-ede36964-backup.hg (glob)
+  saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e008cf283490-ede36964-backup.hg
   $ hg debugobsolete
-  e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
+  e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
   $ hg log -G
   @  2:b0551702f918 (draft) [tip ] 2
   |
@@ -1360,7 +1398,7 @@
   searching for changes
   no changes found
   $ hg debugobsolete
-  e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
+  e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
   $ hg log -G
   @  2:b0551702f918 (draft) [tip ] 2
   |
@@ -1380,7 +1418,7 @@
 
   $ hg strip -r 1 --config extensions.strip=
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e016b03fd86f-65ede734-backup.hg (glob)
+  saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e016b03fd86f-65ede734-backup.hg
   $ hg debugobsolete
   $ hg log -G
   @  0:a78f55e5508c (draft) [tip ] 0
@@ -1394,8 +1432,8 @@
       e016b03fd86fcccc54817d120b90b751aaf367d6
       b0551702f918510f01ae838ab03a463054c67b46
   obsmarkers -- {}
-      version: 1 (86 bytes)
-      e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
+      version: 1 (92 bytes)
+      e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
   phase-heads -- {}
       b0551702f918510f01ae838ab03a463054c67b46 draft
 
@@ -1408,7 +1446,7 @@
   new changesets e016b03fd86f:b0551702f918
   (run 'hg update' to get a working copy)
   $ hg debugobsolete | sort
-  e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
+  e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
   $ hg log -G
   o  2:b0551702f918 (draft) [tip ] 2
   |
@@ -1444,15 +1482,15 @@
   adding d
   $ hg ci --amend -m dd --config experimental.evolution.track-operation=1
   $ hg debugobsolete --index --rev "3+7"
-  1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 \(.*\) {'operation': 'amend', 'user': 'test'} (re)
+  1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
+  3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
   $ hg debugobsolete --index --rev "3+7" -Tjson
   [
    {
     "date": [0.0, 0],
     "flag": 0,
     "index": 1,
-    "metadata": {"operation": "amend", "user": "test"},
+    "metadata": {"ef1": "1", "operation": "amend", "user": "test"},
     "prednode": "6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1",
     "succnodes": ["d27fb9b066076fd921277a4b9e8b9cb48c95bc6a"]
    },
@@ -1460,7 +1498,7 @@
     "date": [0.0, 0],
     "flag": 0,
     "index": 3,
-    "metadata": {"operation": "amend", "user": "test"},
+    "metadata": {"ef1": "1", "operation": "amend", "user": "test"},
     "prednode": "4715cf767440ed891755448016c2b8cf70760c30",
     "succnodes": ["7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d"]
    }
@@ -1468,15 +1506,15 @@
 
 Test the --delete option of debugobsolete command
   $ hg debugobsolete --index
-  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  2 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
+  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
+  1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
+  2 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
+  3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
   $ hg debugobsolete --delete 1 --delete 3
   deleted 2 obsolescence markers
   $ hg debugobsolete
-  cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
-  1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
+  cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
+  1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
 
 Test adding changeset after obsmarkers affecting it
 (eg: during pull, or unbundle)
@@ -1487,7 +1525,7 @@
   $ getid .
   $ hg --config extensions.strip= strip -r .
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/tmpe/issue4845/doindexrev/.hg/strip-backup/9bc153528424-ee80edd4-backup.hg (glob)
+  saved backup bundle to $TESTTMP/tmpe/issue4845/doindexrev/.hg/strip-backup/9bc153528424-ee80edd4-backup.hg
   $ hg debugobsolete 9bc153528424ea266d13e57f9ff0d799dfe61e4b
   $ hg unbundle ../bundle-2.hg
   adding changesets
--- a/tests/test-origbackup-conflict.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-origbackup-conflict.t	Tue Dec 19 16:27:24 2017 -0500
@@ -30,7 +30,7 @@
   resolving manifests
   b/c: replacing untracked file
   getting b/c
-  creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
+  creating directory: $TESTTMP/repo/.hg/origbackups/b
   getting d
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark c1)
@@ -54,7 +54,7 @@
   resolving manifests
   b: replacing untracked file
   getting b
-  removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b (glob)
+  removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b
   getting d
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark b1)
@@ -69,8 +69,8 @@
   resolving manifests
   b/c: replacing untracked file
   getting b/c
-  creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
-  removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob)
+  creating directory: $TESTTMP/repo/.hg/origbackups/b
+  removing conflicting file: $TESTTMP/repo/.hg/origbackups/b
   getting d
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark c1)
@@ -107,8 +107,8 @@
   b/c: replacing untracked file
   d: replacing untracked file
   getting b/c
-  creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
-  removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob)
+  creating directory: $TESTTMP/repo/.hg/origbackups/b
+  removing conflicting file: $TESTTMP/repo/.hg/origbackups/b
   getting d
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark c1)
@@ -128,9 +128,8 @@
   resolving manifests
   b/c: replacing untracked file
   getting b/c
-  creating directory: $TESTTMP/repo/.hg/badorigbackups/b (glob)
-  abort: The system cannot find the path specified: '$TESTTMP/repo/.hg/badorigbackups/b' (glob) (windows !)
-  abort: Not a directory: '$TESTTMP/repo/.hg/badorigbackups/b' (no-windows !)
+  creating directory: $TESTTMP/repo/.hg/badorigbackups/b
+  abort: $ENOTDIR$: '$TESTTMP/repo/.hg/badorigbackups/b'
   [255]
   $ cat .hg/badorigbackups
   data
--- a/tests/test-parents.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-parents.t	Tue Dec 19 16:27:24 2017 -0500
@@ -71,7 +71,7 @@
   
 
   $ hg parents -r 2 ../a
-  abort: ../a not under root '$TESTTMP/repo' (glob)
+  abort: ../a not under root '$TESTTMP/repo'
   [255]
 
 
--- a/tests/test-pathconflicts-merge.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-pathconflicts-merge.t	Tue Dec 19 16:27:24 2017 -0500
@@ -1,3 +1,5 @@
+#require symlink
+
 Path conflict checking is currently disabled by default because of issue5716.
 Turn it on for this test.
 
@@ -48,7 +50,7 @@
   a/b: path conflict - a file or link has the same name as a directory
   the local file has been renamed to a/b~0ed027b96f31
   resolve manually then use 'hg resolve --mark a/b'
-  moving a/b to a/b~0ed027b96f31 (glob)
+  moving a/b to a/b~0ed027b96f31
   getting a/b/c/d
   1 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
--- a/tests/test-paths.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-paths.t	Tue Dec 19 16:27:24 2017 -0500
@@ -20,35 +20,35 @@
   $ echo 'dupe = ../b#tip' >> .hg/hgrc
   $ echo 'expand = $SOMETHING/bar' >> .hg/hgrc
   $ hg in dupe
-  comparing with $TESTTMP/b (glob)
+  comparing with $TESTTMP/b
   no changes found
   [1]
   $ cd ..
   $ hg -R a in dupe
-  comparing with $TESTTMP/b (glob)
+  comparing with $TESTTMP/b
   no changes found
   [1]
   $ cd a
   $ hg paths
-  dupe = $TESTTMP/b#tip (glob)
-  expand = $TESTTMP/a/$SOMETHING/bar (glob)
+  dupe = $TESTTMP/b#tip
+  expand = $TESTTMP/a/$SOMETHING/bar
   $ SOMETHING=foo hg paths
-  dupe = $TESTTMP/b#tip (glob)
-  expand = $TESTTMP/a/foo/bar (glob)
+  dupe = $TESTTMP/b#tip
+  expand = $TESTTMP/a/foo/bar
 #if msys
   $ SOMETHING=//foo hg paths
-  dupe = $TESTTMP/b#tip (glob)
+  dupe = $TESTTMP/b#tip
   expand = /foo/bar
 #else
   $ SOMETHING=/foo hg paths
-  dupe = $TESTTMP/b#tip (glob)
+  dupe = $TESTTMP/b#tip
   expand = /foo/bar
 #endif
   $ hg paths -q
   dupe
   expand
   $ hg paths dupe
-  $TESTTMP/b#tip (glob)
+  $TESTTMP/b#tip
   $ hg paths -q dupe
   $ hg paths unknown
   not found!
@@ -64,11 +64,11 @@
    {
     "name": "dupe",
     "pushurl": "https://example.com/dupe",
-    "url": "$TESTTMP/b#tip" (glob)
+    "url": "$TESTTMP/b#tip"
    },
    {
     "name": "expand",
-    "url": "$TESTTMP/a/$SOMETHING/bar" (glob)
+    "url": "$TESTTMP/a/$SOMETHING/bar"
    }
   ]
   $ hg paths -Tjson dupe | sed 's|\\\\|\\|g'
@@ -76,7 +76,7 @@
    {
     "name": "dupe",
     "pushurl": "https://example.com/dupe",
-    "url": "$TESTTMP/b#tip" (glob)
+    "url": "$TESTTMP/b#tip"
    }
   ]
   $ hg paths -Tjson -q unknown
@@ -89,21 +89,21 @@
  (behaves as a {name: path-string} dict by default)
 
   $ hg log -rnull -T '{peerurls}\n'
-  dupe=$TESTTMP/b#tip expand=$TESTTMP/a/$SOMETHING/bar (glob)
+  dupe=$TESTTMP/b#tip expand=$TESTTMP/a/$SOMETHING/bar
   $ hg log -rnull -T '{join(peerurls, "\n")}\n'
-  dupe=$TESTTMP/b#tip (glob)
-  expand=$TESTTMP/a/$SOMETHING/bar (glob)
+  dupe=$TESTTMP/b#tip
+  expand=$TESTTMP/a/$SOMETHING/bar
   $ hg log -rnull -T '{peerurls % "{name}: {url}\n"}'
-  dupe: $TESTTMP/b#tip (glob)
-  expand: $TESTTMP/a/$SOMETHING/bar (glob)
+  dupe: $TESTTMP/b#tip
+  expand: $TESTTMP/a/$SOMETHING/bar
   $ hg log -rnull -T '{get(peerurls, "dupe")}\n'
-  $TESTTMP/b#tip (glob)
+  $TESTTMP/b#tip
 
  (sub options can be populated by map/dot operation)
 
   $ hg log -rnull \
   > -T '{get(peerurls, "dupe") % "url: {url}\npushurl: {pushurl}\n"}'
-  url: $TESTTMP/b#tip (glob)
+  url: $TESTTMP/b#tip
   pushurl: https://example.com/dupe
   $ hg log -rnull -T '{peerurls.dupe.pushurl}\n'
   https://example.com/dupe
@@ -132,9 +132,9 @@
 zeroconf wraps ui.configitems(), which shouldn't crash at least:
 
   $ hg paths --config extensions.zeroconf=
-  dupe = $TESTTMP/b#tip (glob)
+  dupe = $TESTTMP/b#tip
   dupe:pushurl = https://example.com/dupe
-  expand = $TESTTMP/a/$SOMETHING/bar (glob)
+  expand = $TESTTMP/a/$SOMETHING/bar
   insecure = http://foo:***@example.com/
 
   $ cd ..
--- a/tests/test-profile.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-profile.t	Tue Dec 19 16:27:24 2017 -0500
@@ -143,12 +143,12 @@
   $ hg root
   otherextension: loaded
   fooprof: loaded
-  $TESTTMP/b (glob)
+  $TESTTMP/b
   $ HGPROF=fooprof hg root --profile
   fooprof: loaded
   fooprof: start profile
   otherextension: loaded
-  $TESTTMP/b (glob)
+  $TESTTMP/b
   fooprof: end profile
 
   $ HGPROF=other hg root --profile 2>&1 | head -n 2
--- a/tests/test-pull-r.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-pull-r.t	Tue Dec 19 16:27:24 2017 -0500
@@ -43,7 +43,7 @@
   2:effea6de0384
   1:ed1b79f46b9a
   $ hg pull
-  pulling from $TESTTMP/repo2 (glob)
+  pulling from $TESTTMP/repo2
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-pull-update.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-pull-update.t	Tue Dec 19 16:27:24 2017 -0500
@@ -100,7 +100,7 @@
    * active-before-pull        3:483b76ad4309
 
   $ hg pull -u -r active-after-pull
-  pulling from $TESTTMP/t (glob)
+  pulling from $TESTTMP/t
   searching for changes
   adding changesets
   adding manifests
@@ -129,7 +129,7 @@
    * active-before-pull        3:483b76ad4309
 
   $ hg pull -u $TESTTMP/t#active-after-pull
-  pulling from $TESTTMP/t (glob)
+  pulling from $TESTTMP/t
   searching for changes
   adding changesets
   adding manifests
@@ -168,7 +168,7 @@
    * active-before-pull        3:483b76ad4309
 
   $ hg pull -u -r b5e4babfaaa7
-  pulling from $TESTTMP/t (glob)
+  pulling from $TESTTMP/t
   searching for changes
   adding changesets
   adding manifests
@@ -195,7 +195,7 @@
    * active-before-pull        3:483b76ad4309
 
   $ hg pull -u -b bar
-  pulling from $TESTTMP/t (glob)
+  pulling from $TESTTMP/t
   searching for changes
   adding changesets
   adding manifests
@@ -222,7 +222,7 @@
    * active-before-pull        3:483b76ad4309
 
   $ hg pull -u $TESTTMP/t#bar
-  pulling from $TESTTMP/t (glob)
+  pulling from $TESTTMP/t
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-partial-C1.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-partial-C1.t	Tue Dec 19 16:27:24 2017 -0500
@@ -47,7 +47,7 @@
   $ mkcommit B0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/C1/server (glob)
+  pulling from $TESTTMP/C1/server
   searching for changes
   adding changesets
   adding manifests
@@ -75,7 +75,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/C1/server (glob)
+  pushing to $TESTTMP/C1/server
   searching for changes
   abort: push creates new remote head 25c56d33e4c4!
   (merge or see 'hg help push' for details about pushing new heads)
--- a/tests/test-push-checkheads-partial-C2.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-partial-C2.t	Tue Dec 19 16:27:24 2017 -0500
@@ -47,7 +47,7 @@
   $ mkcommit B0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/C2/server (glob)
+  pulling from $TESTTMP/C2/server
   searching for changes
   adding changesets
   adding manifests
@@ -75,7 +75,7 @@
 --------------
 
   $ hg push --rev 'desc(A1)'
-  pushing to $TESTTMP/C2/server (glob)
+  pushing to $TESTTMP/C2/server
   searching for changes
   abort: push creates new remote head f6082bc4ffef!
   (merge or see 'hg help push' for details about pushing new heads)
--- a/tests/test-push-checkheads-partial-C3.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-partial-C3.t	Tue Dec 19 16:27:24 2017 -0500
@@ -47,7 +47,7 @@
   $ mkcommit B0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/C3/server (glob)
+  pulling from $TESTTMP/C3/server
   searching for changes
   adding changesets
   adding manifests
@@ -75,7 +75,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/C3/server (glob)
+  pushing to $TESTTMP/C3/server
   searching for changes
   abort: push creates new remote head 0f88766e02d6!
   (merge or see 'hg help push' for details about pushing new heads)
--- a/tests/test-push-checkheads-partial-C4.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-partial-C4.t	Tue Dec 19 16:27:24 2017 -0500
@@ -47,7 +47,7 @@
   $ mkcommit B0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/C4/server (glob)
+  pulling from $TESTTMP/C4/server
   searching for changes
   adding changesets
   adding manifests
@@ -75,7 +75,7 @@
 --------------
 
   $ hg push --rev 'desc(C0)'
-  pushing to $TESTTMP/C4/server (glob)
+  pushing to $TESTTMP/C4/server
   searching for changes
   abort: push creates new remote head 0f88766e02d6!
   (merge or see 'hg help push' for details about pushing new heads)
--- a/tests/test-push-checkheads-pruned-B1.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-pruned-B1.t	Tue Dec 19 16:27:24 2017 -0500
@@ -62,7 +62,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/B1/server (glob)
+  pushing to $TESTTMP/B1/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-pruned-B2.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-pruned-B2.t	Tue Dec 19 16:27:24 2017 -0500
@@ -47,7 +47,7 @@
   $ mkcommit B0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/B2/server (glob)
+  pulling from $TESTTMP/B2/server
   searching for changes
   adding changesets
   adding manifests
@@ -77,7 +77,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/B2/server (glob)
+  pushing to $TESTTMP/B2/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-pruned-B3.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-pruned-B3.t	Tue Dec 19 16:27:24 2017 -0500
@@ -47,7 +47,7 @@
   $ mkcommit B0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/B3/server (glob)
+  pulling from $TESTTMP/B3/server
   searching for changes
   adding changesets
   adding manifests
@@ -77,7 +77,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/B3/server (glob)
+  pushing to $TESTTMP/B3/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-pruned-B4.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-pruned-B4.t	Tue Dec 19 16:27:24 2017 -0500
@@ -48,7 +48,7 @@
   $ mkcommit B0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/B4/server (glob)
+  pulling from $TESTTMP/B4/server
   searching for changes
   adding changesets
   adding manifests
@@ -78,7 +78,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/B4/server (glob)
+  pushing to $TESTTMP/B4/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-pruned-B5.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-pruned-B5.t	Tue Dec 19 16:27:24 2017 -0500
@@ -51,7 +51,7 @@
   $ mkcommit C0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/B5/server (glob)
+  pulling from $TESTTMP/B5/server
   searching for changes
   adding changesets
   adding manifests
@@ -85,7 +85,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/B5/server (glob)
+  pushing to $TESTTMP/B5/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-pruned-B6.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-pruned-B6.t	Tue Dec 19 16:27:24 2017 -0500
@@ -69,7 +69,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/B6/server (glob)
+  pushing to $TESTTMP/B6/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-pruned-B7.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-pruned-B7.t	Tue Dec 19 16:27:24 2017 -0500
@@ -68,7 +68,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/B7/server (glob)
+  pushing to $TESTTMP/B7/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-pruned-B8.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-pruned-B8.t	Tue Dec 19 16:27:24 2017 -0500
@@ -49,7 +49,7 @@
   $ mkcommit B0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/B8/server (glob)
+  pulling from $TESTTMP/B8/server
   searching for changes
   adding changesets
   adding manifests
@@ -92,7 +92,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/B8/server (glob)
+  pushing to $TESTTMP/B8/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-superceed-A1.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-superceed-A1.t	Tue Dec 19 16:27:24 2017 -0500
@@ -59,7 +59,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/A1/server (glob)
+  pushing to $TESTTMP/A1/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-superceed-A2.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-superceed-A2.t	Tue Dec 19 16:27:24 2017 -0500
@@ -46,7 +46,7 @@
   $ mkcommit B0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/A2/server (glob)
+  pulling from $TESTTMP/A2/server
   searching for changes
   adding changesets
   adding manifests
@@ -79,7 +79,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/A2/server (glob)
+  pushing to $TESTTMP/A2/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-superceed-A3.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-superceed-A3.t	Tue Dec 19 16:27:24 2017 -0500
@@ -49,7 +49,7 @@
   $ mkcommit B0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/A3/server (glob)
+  pulling from $TESTTMP/A3/server
   searching for changes
   adding changesets
   adding manifests
@@ -82,7 +82,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/A3/server (glob)
+  pushing to $TESTTMP/A3/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-superceed-A4.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-superceed-A4.t	Tue Dec 19 16:27:24 2017 -0500
@@ -64,7 +64,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/A4/server (glob)
+  pushing to $TESTTMP/A4/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-superceed-A5.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-superceed-A5.t	Tue Dec 19 16:27:24 2017 -0500
@@ -64,7 +64,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/A5/server (glob)
+  pushing to $TESTTMP/A5/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-superceed-A6.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-superceed-A6.t	Tue Dec 19 16:27:24 2017 -0500
@@ -53,7 +53,7 @@
   created new head
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/A6/server (glob)
+  pulling from $TESTTMP/A6/server
   searching for changes
   adding changesets
   adding manifests
@@ -90,7 +90,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/A6/server (glob)
+  pushing to $TESTTMP/A6/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-superceed-A7.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-superceed-A7.t	Tue Dec 19 16:27:24 2017 -0500
@@ -53,7 +53,7 @@
   created new head
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/A7/server (glob)
+  pulling from $TESTTMP/A7/server
   searching for changes
   adding changesets
   adding manifests
@@ -90,7 +90,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/A7/server (glob)
+  pushing to $TESTTMP/A7/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-superceed-A8.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-superceed-A8.t	Tue Dec 19 16:27:24 2017 -0500
@@ -70,7 +70,7 @@
 --------------
 
   $ hg push
-  pushing to $TESTTMP/A8/server (glob)
+  pushing to $TESTTMP/A8/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-unpushed-D1.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-unpushed-D1.t	Tue Dec 19 16:27:24 2017 -0500
@@ -68,7 +68,7 @@
 --------------
 
   $ hg push -r 'desc(B0)'
-  pushing to $TESTTMP/D1/server (glob)
+  pushing to $TESTTMP/D1/server
   searching for changes
   abort: push creates new remote head 74ff5441d343!
   (merge or see 'hg help push' for details about pushing new heads)
--- a/tests/test-push-checkheads-unpushed-D2.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-unpushed-D2.t	Tue Dec 19 16:27:24 2017 -0500
@@ -51,7 +51,7 @@
   $ mkcommit B0
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/D2/server (glob)
+  pulling from $TESTTMP/D2/server
   searching for changes
   adding changesets
   adding manifests
@@ -87,7 +87,7 @@
 --------------
 
   $ hg push --rev 'desc(C0)'
-  pushing to $TESTTMP/D2/server (glob)
+  pushing to $TESTTMP/D2/server
   searching for changes
   abort: push creates new remote head 0f88766e02d6!
   (merge or see 'hg help push' for details about pushing new heads)
--- a/tests/test-push-checkheads-unpushed-D3.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-unpushed-D3.t	Tue Dec 19 16:27:24 2017 -0500
@@ -50,7 +50,7 @@
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/D3/server (glob)
+  pulling from $TESTTMP/D3/server
   searching for changes
   adding changesets
   adding manifests
@@ -86,13 +86,13 @@
 --------------
 
   $ hg push --rev 'desc(A1)'
-  pushing to $TESTTMP/D3/server (glob)
+  pushing to $TESTTMP/D3/server
   searching for changes
   abort: push creates new remote head f6082bc4ffef!
   (merge or see 'hg help push' for details about pushing new heads)
   [255]
   $ hg push --rev 'desc(B1)'
-  pushing to $TESTTMP/D3/server (glob)
+  pushing to $TESTTMP/D3/server
   searching for changes
   abort: push creates new remote head 25c56d33e4c4!
   (merge or see 'hg help push' for details about pushing new heads)
@@ -104,7 +104,7 @@
 In this case, even a bare push is creating more heads
 
   $ hg push
-  pushing to $TESTTMP/D3/server (glob)
+  pushing to $TESTTMP/D3/server
   searching for changes
   abort: push creates new remote head 25c56d33e4c4!
   (merge or see 'hg help push' for details about pushing new heads)
--- a/tests/test-push-checkheads-unpushed-D4.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-unpushed-D4.t	Tue Dec 19 16:27:24 2017 -0500
@@ -67,7 +67,7 @@
   created new head
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/D4/server (glob)
+  pulling from $TESTTMP/D4/server
   searching for changes
   adding changesets
   adding manifests
@@ -104,7 +104,7 @@
 --------------------------------
 
   $ hg push --rev 'desc(A1)'
-  pushing to $TESTTMP/D4/server (glob)
+  pushing to $TESTTMP/D4/server
   searching for changes
   abort: push creates new remote head f6082bc4ffef!
   (merge or see 'hg help push' for details about pushing new heads)
@@ -114,7 +114,7 @@
 ------------------------------------
 
   $ hg push --rev 'desc(B1)'
-  pushing to $TESTTMP/D4/server (glob)
+  pushing to $TESTTMP/D4/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-unpushed-D5.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-unpushed-D5.t	Tue Dec 19 16:27:24 2017 -0500
@@ -56,7 +56,7 @@
   created new head
   $ cd ../client
   $ hg pull
-  pulling from $TESTTMP/D5/server (glob)
+  pulling from $TESTTMP/D5/server
   searching for changes
   adding changesets
   adding manifests
@@ -93,13 +93,13 @@
 --------------
 
   $ hg push --rev 'desc(B1)'
-  pushing to $TESTTMP/D5/server (glob)
+  pushing to $TESTTMP/D5/server
   searching for changes
   abort: push creates new remote head 25c56d33e4c4!
   (merge or see 'hg help push' for details about pushing new heads)
   [255]
   $ hg push --rev 'desc(A1)'
-  pushing to $TESTTMP/D5/server (glob)
+  pushing to $TESTTMP/D5/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push-checkheads-unpushed-D6.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-unpushed-D6.t	Tue Dec 19 16:27:24 2017 -0500
@@ -75,7 +75,7 @@
 --------------
 
   $ hg push --rev 'desc(C0)'
-  pushing to $TESTTMP/D6/server (glob)
+  pushing to $TESTTMP/D6/server
   searching for changes
   abort: push creates new remote head 0f88766e02d6!
   (merge or see 'hg help push' for details about pushing new heads)
--- a/tests/test-push-checkheads-unpushed-D7.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push-checkheads-unpushed-D7.t	Tue Dec 19 16:27:24 2017 -0500
@@ -88,7 +88,7 @@
 --------------
 
   $ hg push --rev 'desc(C0)'
-  pushing to $TESTTMP/D7/server (glob)
+  pushing to $TESTTMP/D7/server
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-push.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-push.t	Tue Dec 19 16:27:24 2017 -0500
@@ -199,7 +199,7 @@
   [1]
 
   $ hg push
-  pushing to $TESTTMP/test-validation (glob)
+  pushing to $TESTTMP/test-validation
   searching for changes
   adding changesets
   adding manifests
@@ -234,7 +234,7 @@
   [1]
 
   $ hg push
-  pushing to $TESTTMP/test-validation (glob)
+  pushing to $TESTTMP/test-validation
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-pushvars.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-pushvars.t	Tue Dec 19 16:27:24 2017 -0500
@@ -24,7 +24,7 @@
   $ echo b > a
   $ hg commit -Aqm a
   $ hg push --pushvars "DEBUG=1" --pushvars "BYPASS_REVIEW=true"
-  pushing to $TESTTMP/repo (glob)
+  pushing to $TESTTMP/repo
   searching for changes
   adding changesets
   adding manifests
@@ -38,7 +38,7 @@
   $ echo b >> a
   $ hg commit -Aqm a
   $ hg push --pushvars "DEBUG=1" --pushvars "BYPASS_REVIEW=true"
-  pushing to $TESTTMP/repo (glob)
+  pushing to $TESTTMP/repo
   searching for changes
   adding changesets
   adding manifests
@@ -52,7 +52,7 @@
   $ echo b >> a
   $ hg commit -Aqm a
   $ hg push --pushvars "DEBUG="
-  pushing to $TESTTMP/repo (glob)
+  pushing to $TESTTMP/repo
   searching for changes
   adding changesets
   adding manifests
@@ -65,7 +65,7 @@
   $ echo b >> a
   $ hg commit -Aqm b
   $ hg push --pushvars "DEBUG"
-  pushing to $TESTTMP/repo (glob)
+  pushing to $TESTTMP/repo
   searching for changes
   abort: unable to parse variable 'DEBUG', should follow 'KEY=VALUE' or 'KEY=' format
   [255]
--- a/tests/test-rebase-abort.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-abort.t	Tue Dec 19 16:27:24 2017 -0500
@@ -115,7 +115,7 @@
 Abort (should clear out unsupported merge state):
 
   $ hg rebase --abort
-  saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg (glob)
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg
   rebase aborted
   $ hg debugmergestate
   no merge state found
@@ -377,7 +377,7 @@
   abort: ^C
   [255]
   $ hg rebase --abort
-  saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg (glob)
+  saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg
   rebase aborted
   $ hg log -G --template "{rev} {desc} {bookmarks}"
   o  6 no-a
--- a/tests/test-rebase-base-flag.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-base-flag.t	Tue Dec 19 16:27:24 2017 -0500
@@ -10,7 +10,7 @@
   > publish=False
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: {desc}"
+  > tglog = log -G --template "{rev}: {node|short} {desc}"
   > EOF
 
   $ rebasewithdag() {
@@ -39,19 +39,19 @@
   rebasing 3:d6003a550c2c "C" (C)
   rebasing 5:4526cf523425 "D" (D)
   rebasing 6:b296604d9846 "E" (E tip)
-  o  6: E
+  o  6: 4870f5e7df37 E
   |
-  | o  5: D
+  | o  5: dc999528138a D
   |/
-  o  4: C
+  o  4: 6b3e11729672 C
   |
-  o  3: Z
+  o  3: 57e70bad1ea3 Z
   |
-  | o  2: B
+  | o  2: c1e6b162678d B
   |/
-  o  1: A
+  o  1: 21a6c4502885 A
   |
-  o  0: R
+  o  0: b41ce7760717 R
   
 Multiple branching points caused by selecting a single merge changeset:
 
@@ -69,19 +69,19 @@
   rebasing 2:c1e6b162678d "B" (B)
   rebasing 3:d6003a550c2c "C" (C)
   rebasing 6:54c8f00cb91c "E" (E tip)
-  o    6: E
+  o    6: 00598421b616 E
   |\
-  | o  5: C
+  | o  5: 6b3e11729672 C
   | |
-  o |  4: B
+  o |  4: 85260910e847 B
   |/
-  o  3: Z
+  o  3: 57e70bad1ea3 Z
   |
-  | o  2: D
+  | o  2: 8924700906fe D
   |/
-  o  1: A
+  o  1: 21a6c4502885 A
   |
-  o  0: R
+  o  0: b41ce7760717 R
   
 Rebase should not extend the "--base" revset using "descendants":
 
@@ -96,17 +96,17 @@
   > EOS
   rebasing 2:c1e6b162678d "B" (B)
   rebasing 5:54c8f00cb91c "E" (E tip)
-  o    5: E
+  o    5: e583bf3ff54c E
   |\
-  | o  4: B
+  | o  4: 85260910e847 B
   | |
-  | o  3: Z
+  | o  3: 57e70bad1ea3 Z
   | |
-  o |  2: C
+  o |  2: d6003a550c2c C
   |/
-  o  1: A
+  o  1: 21a6c4502885 A
   |
-  o  0: R
+  o  0: b41ce7760717 R
   
 Rebase should not simplify the "--base" revset using "roots":
 
@@ -122,17 +122,17 @@
   rebasing 2:c1e6b162678d "B" (B)
   rebasing 3:d6003a550c2c "C" (C)
   rebasing 5:54c8f00cb91c "E" (E tip)
-  o    5: E
+  o    5: 00598421b616 E
   |\
-  | o  4: C
+  | o  4: 6b3e11729672 C
   | |
-  o |  3: B
+  o |  3: 85260910e847 B
   |/
-  o  2: Z
+  o  2: 57e70bad1ea3 Z
   |
-  o  1: A
+  o  1: 21a6c4502885 A
   |
-  o  0: R
+  o  0: b41ce7760717 R
   
 The destination is one of the two branching points of a merge:
 
@@ -173,31 +173,31 @@
   rebasing 8:781512f5e33d "C2" (C2)
   rebasing 9:428d8c18f641 "E1" (E1)
   rebasing 11:e1bf82f6b6df "E2" (E2)
-  o  12: E2
+  o  12: e4a37b6fdbd2 E2
   |
-  o  11: E1
+  o  11: 9675bea983df E1
   |
-  | o  10: C2
+  | o  10: 4faf5d4c80dc C2
   | |
-  | o  9: C1
+  | o  9: d4799b1ad57d C1
   |/
-  | o  8: B2
+  | o  8: 772732dc64d6 B2
   | |
-  | o  7: B1
+  | o  7: ad3ac528a49f B1
   |/
-  o  6: Z
+  o  6: 2cbdfca6b9d5 Z
   |
-  o  5: F
+  o  5: fcdb3293ec13 F
   |
-  o  4: E
+  o  4: a4652bb8ac54 E
   |
-  o  3: C
+  o  3: bd5548558fcf C
   |
-  o  2: B
+  o  2: c1e6b162678d B
   |
-  o  1: A
+  o  1: 21a6c4502885 A
   |
-  o  0: R
+  o  0: b41ce7760717 R
   
 Multiple branching points with multiple merges:
 
@@ -223,37 +223,37 @@
   rebasing 11:d1f6d0c3c7e4 "M" (M)
   rebasing 12:7aaec6f81888 "N" (N)
   rebasing 15:325bc8f1760d "P" (P tip)
-  o    15: P
+  o    15: 6ef6a0ea3b18 P
   |\
-  | o    14: N
+  | o    14: 20ba3610a7e5 N
   | |\
-  o \ \    13: M
+  o \ \    13: cd4f6c06d2ab M
   |\ \ \
-  | | | o  12: L
+  | | | o  12: bca872041455 L
   | | | |
-  | | o |  11: K
+  | | o |  11: 7bbb6c8a6ad7 K
   | | |/
-  | o /  10: J
+  | o /  10: de0cbffe893e J
   | |/
-  o /  9: I
+  o /  9: 0e710f176a88 I
   |/
-  | o    8: H
+  | o    8: 52507bab39ca H
   | |\
-  | | | o  7: G
+  | | | o  7: bb5fe4652f0d G
   | | |/|
-  | | | o  6: F
+  | | | o  6: f4ad4b31daf4 F
   | | | |
-  | | o |  5: E
+  | | o |  5: b168f85f2e78 E
   | | |/
-  | o |  4: D
+  | o |  4: 8d09fcdb5594 D
   | |\|
-  +---o  3: C
+  +---o  3: ab70b4c5a9c9 C
   | |
-  o |  2: Z
+  o |  2: 262e37e34f63 Z
   | |
-  | o  1: B
+  | o  1: 112478962961 B
   |/
-  o  0: A
+  o  0: 426bada5c675 A
   
 Slightly more complex merge case (mentioned in https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-November/091074.html):
 
@@ -275,31 +275,31 @@
   rebasing 11:4e449bd1a643 "A3" (A3)
   rebasing 10:0a33b0519128 "B1" (B1)
   rebasing 12:209327807c3a "B3" (B3 tip)
-  o    12: B3
+  o    12: ceb984566332 B3
   |\
-  | o  11: B1
+  | o  11: 19d93caac497 B1
   | |
-  | | o    10: A3
+  | | o    10: 058e73d3916b A3
   | | |\
-  | +---o  9: A2
+  | +---o  9: 0ba13ad72234 A2
   | | |
-  | o |  8: C1
+  | o |  8: c122c2af10c6 C1
   | | |
-  o | |  7: B2
+  o | |  7: 74275896650e B2
   | | |
-  | o |  6: C0
+  | o |  6: 455ba9bd3ea2 C0
   |/ /
-  o |  5: Z
+  o |  5: b3d7d2fda53b Z
   | |
-  o |  4: M3
+  o |  4: 182ab6383dd7 M3
   | |
-  o |  3: M2
+  o |  3: 6c3f73563d5f M2
   | |
-  | o  2: A1
+  | o  2: 88c860fffcc2 A1
   |/
-  o  1: M1
+  o  1: bc852baa85dd M1
   |
-  o  0: M0
+  o  0: dbdfc5c9bcd5 M0
   
 Disconnected graph:
 
@@ -320,15 +320,15 @@
   > EOF
   rebasing 2:112478962961 "B" (B)
   rebasing 3:b70f76719894 "D" (D)
-  o  4: D
+  o  4: 511efad7bf13 D
   |
-  | o  3: B
+  | o  3: 25c4e279af62 B
   |/
-  o    2: Z
+  o    2: 3a49f54d7bb1 Z
   |\
-  | o  1: C
+  | o  1: 96cc3511f894 C
   |
-  o  0: A
+  o  0: 426bada5c675 A
   
 Multiple roots. One root is not an ancestor of dest:
 
@@ -351,17 +351,17 @@
   > EOF
   rebasing 2:f675d5a1c6a4 "B" (B)
   rebasing 5:f68696fe6af8 "E" (E tip)
-  o    5: E
+  o    5: f6e6f5081554 E
   |\
-  | o    4: B
+  | o    4: 30cabcba27be B
   | |\
-  | | o  3: Z
+  | | o  3: 262e37e34f63 Z
   | | |
-  o | |  2: D
+  o | |  2: b70f76719894 D
   |/ /
-  o /  1: C
+  o /  1: 96cc3511f894 C
    /
-  o  0: A
+  o  0: 426bada5c675 A
   
 Multiple roots. Two children share two parents while dest has only one parent:
 
@@ -372,13 +372,13 @@
   > EOF
   rebasing 2:f675d5a1c6a4 "B" (B)
   rebasing 3:c2a779e13b56 "D" (D)
-  o    4: D
+  o    4: 5eecd056b5f8 D
   |\
-  +---o  3: B
+  +---o  3: 30cabcba27be B
   | |/
-  | o  2: Z
+  | o  2: 262e37e34f63 Z
   | |
-  o |  1: C
+  o |  1: 96cc3511f894 C
    /
-  o  0: A
+  o  0: 426bada5c675 A
   
--- a/tests/test-rebase-bookmarks.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-bookmarks.t	Tue Dec 19 16:27:24 2017 -0500
@@ -7,7 +7,7 @@
   > publish=False
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}' bookmarks: {bookmarks}\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
   > EOF
 
 Create a repo with several bookmarks
@@ -39,13 +39,13 @@
   $ hg book W
 
   $ hg tglog
-  @  3: 'D' bookmarks: W
+  @  3: 41acb9dca9eb 'D' bookmarks: W
   |
-  | o  2: 'C' bookmarks: Y Z
+  | o  2: 49cb3485fa0c 'C' bookmarks: Y Z
   | |
-  | o  1: 'B' bookmarks: X
+  | o  1: 6c81ed0049f8 'B' bookmarks: X
   |/
-  o  0: 'A' bookmarks:
+  o  0: 1994f17a630e 'A' bookmarks:
   
 
 Move only rebased bookmarks
@@ -66,26 +66,26 @@
   $ hg book -r 0 Y@diverge
 
   $ hg tglog
-  o  3: 'D' bookmarks: W X@diverge Z@diverge
+  o  3: 41acb9dca9eb 'D' bookmarks: W X@diverge Z@diverge
   |
-  | @  2: 'C' bookmarks: Y Z
+  | @  2: 49cb3485fa0c 'C' bookmarks: Y Z
   | |
-  | o  1: 'B' bookmarks: X
+  | o  1: 6c81ed0049f8 'B' bookmarks: X
   |/
-  o  0: 'A' bookmarks: Y@diverge
+  o  0: 1994f17a630e 'A' bookmarks: Y@diverge
   
   $ hg rebase -s Y -d 3
   rebasing 2:49cb3485fa0c "C" (Y Z)
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/49cb3485fa0c-126f3e97-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/49cb3485fa0c-126f3e97-rebase.hg
 
   $ hg tglog
-  @  3: 'C' bookmarks: Y Z
+  @  3: 17fb3faba63c 'C' bookmarks: Y Z
   |
-  o  2: 'D' bookmarks: W X@diverge
+  o  2: 41acb9dca9eb 'D' bookmarks: W X@diverge
   |
-  | o  1: 'B' bookmarks: X
+  | o  1: 6c81ed0049f8 'B' bookmarks: X
   |/
-  o  0: 'A' bookmarks: Y@diverge
+  o  0: 1994f17a630e 'A' bookmarks: Y@diverge
   
 Do not try to keep active but deleted divergent bookmark
 
@@ -98,7 +98,7 @@
 
   $ hg rebase -s W -d .
   rebasing 3:41acb9dca9eb "D" (W tip)
-  saved backup bundle to $TESTTMP/a4/.hg/strip-backup/41acb9dca9eb-b35a6a63-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a4/.hg/strip-backup/41acb9dca9eb-b35a6a63-rebase.hg
 
   $ hg bookmarks
      W                         3:0d3554f74897
@@ -117,16 +117,16 @@
   $ hg rebase -s 1 -d 3
   rebasing 1:6c81ed0049f8 "B" (X)
   rebasing 2:49cb3485fa0c "C" (Y Z)
-  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/6c81ed0049f8-a687065f-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/6c81ed0049f8-a687065f-rebase.hg
 
   $ hg tglog
-  @  3: 'C' bookmarks: Y Z
+  @  3: 3d5fa227f4b5 'C' bookmarks: Y Z
   |
-  o  2: 'B' bookmarks: X
+  o  2: e926fccfa8ec 'B' bookmarks: X
   |
-  o  1: 'D' bookmarks: W
+  o  1: 41acb9dca9eb 'D' bookmarks: W
   |
-  o  0: 'A' bookmarks:
+  o  0: 1994f17a630e 'A' bookmarks:
   
 
 Keep active bookmark on the correct changeset
@@ -140,16 +140,16 @@
   $ hg rebase -d W
   rebasing 1:6c81ed0049f8 "B" (X)
   rebasing 2:49cb3485fa0c "C" (Y Z)
-  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/6c81ed0049f8-a687065f-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/6c81ed0049f8-a687065f-rebase.hg
 
   $ hg tglog
-  o  3: 'C' bookmarks: Y Z
+  o  3: 3d5fa227f4b5 'C' bookmarks: Y Z
   |
-  @  2: 'B' bookmarks: X
+  @  2: e926fccfa8ec 'B' bookmarks: X
   |
-  o  1: 'D' bookmarks: W
+  o  1: 41acb9dca9eb 'D' bookmarks: W
   |
-  o  0: 'A' bookmarks:
+  o  0: 1994f17a630e 'A' bookmarks:
   
   $ hg bookmarks
      W                         1:41acb9dca9eb
@@ -180,17 +180,17 @@
   continue: hg rebase --continue
   $ hg rebase --continue
   rebasing 3:3d5fa227f4b5 "C" (Y Z)
-  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/3d5fa227f4b5-c6ea2371-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/3d5fa227f4b5-c6ea2371-rebase.hg
   $ hg tglog
-  @  4: 'C' bookmarks: Y Z
+  @  4: 45c0f0ec1203 'C' bookmarks: Y Z
   |
-  o  3: 'other C' bookmarks:
+  o  3: b0e10b7175fd 'other C' bookmarks:
   |
-  o  2: 'B' bookmarks: X
+  o  2: e926fccfa8ec 'B' bookmarks: X
   |
-  o  1: 'D' bookmarks: W
+  o  1: 41acb9dca9eb 'D' bookmarks: W
   |
-  o  0: 'A' bookmarks:
+  o  0: 1994f17a630e 'A' bookmarks:
   
 
 ensure that bookmarks given the names of revset functions can be used
@@ -210,7 +210,7 @@
   rebasing 5:345c90f326a4 "bisect"
   rebasing 6:f677a2907404 "bisect2"
   rebasing 7:325c16001345 "bisect3" (bisect tip)
-  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/345c90f326a4-b4840586-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/345c90f326a4-b4840586-rebase.hg
 
 Bookmark and working parent get moved even if --keep is set (issue5682)
 
@@ -225,21 +225,21 @@
   $ rm .hg/localtags
   $ hg up -q B
   $ hg tglog
-  o  2: 'C' bookmarks: C
+  o  2: dc0947a82db8 'C' bookmarks: C
   |
-  | @  1: 'B' bookmarks: B
+  | @  1: 112478962961 'B' bookmarks: B
   |/
-  o  0: 'A' bookmarks: A
+  o  0: 426bada5c675 'A' bookmarks: A
   
   $ hg rebase -r B -d C --keep
   rebasing 1:112478962961 "B" (B)
   $ hg tglog
-  @  3: 'B' bookmarks: B
+  @  3: 9769fc65c4c5 'B' bookmarks: B
   |
-  o  2: 'C' bookmarks: C
+  o  2: dc0947a82db8 'C' bookmarks: C
   |
-  | o  1: 'B' bookmarks:
+  | o  1: 112478962961 'B' bookmarks:
   |/
-  o  0: 'A' bookmarks: A
+  o  0: 426bada5c675 'A' bookmarks: A
   
 
--- a/tests/test-rebase-cache.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-cache.t	Tue Dec 19 16:27:24 2017 -0500
@@ -104,7 +104,7 @@
   $ hg rebase -s 5 -d 8
   rebasing 5:635859577d0b "D"
   rebasing 6:5097051d331d "E"
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/635859577d0b-89160bff-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/635859577d0b-89160bff-rebase.hg
 
   $ hg branches
   branch3                        8:466cdfb14b62
@@ -166,7 +166,7 @@
   
   $ hg rebase -s 8 -d 6
   rebasing 8:4666b71e8e32 "F" (tip)
-  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/4666b71e8e32-fc1c4e96-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/4666b71e8e32-fc1c4e96-rebase.hg
 
   $ hg branches
   branch2                        8:6b4bdc1b5ac0
@@ -233,7 +233,7 @@
   rebasing 7:653b9feb4616 "branch3"
   note: rebase of 7:653b9feb4616 created no changes to commit
   rebasing 8:4666b71e8e32 "F" (tip)
-  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/653b9feb4616-3c88de16-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/653b9feb4616-3c88de16-rebase.hg
 
   $ hg branches
   branch2                        7:6b4bdc1b5ac0
@@ -270,7 +270,7 @@
 
   $ hg strip 2
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/0a03079c47fd-11b7c407-backup.hg (glob)
+  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/0a03079c47fd-11b7c407-backup.hg
 
   $ hg tglog
   o  3: 'C' branch2
@@ -329,7 +329,7 @@
 
   $ hg strip 2
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/a3/b/.hg/strip-backup/a5b4b27ed7b4-a3b6984e-backup.hg (glob)
+  saved backup bundle to $TESTTMP/a3/b/.hg/strip-backup/a5b4b27ed7b4-a3b6984e-backup.hg
 
   $ hg theads
   1: 'branch2' branch2
@@ -374,14 +374,14 @@
 
   $ hg strip 3 4
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/67a385d4e6f2-b9243789-backup.hg (glob)
+  saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/67a385d4e6f2-b9243789-backup.hg
 
   $ hg theads
   2: 'C' 
 
   $ hg strip 2 1
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/6c81ed0049f8-a687065f-backup.hg (glob)
+  saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/6c81ed0049f8-a687065f-backup.hg
 
   $ hg theads
   0: 'A' 
@@ -480,4 +480,4 @@
   HGEDITFORM=rebase.merge
   rebasing 8:326cfedc031c "I" (tip)
   HGEDITFORM=rebase.normal
-  saved backup bundle to $TESTTMP/a3/c4/.hg/strip-backup/361a99976cc9-35e980d0-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a3/c4/.hg/strip-backup/361a99976cc9-35e980d0-rebase.hg
--- a/tests/test-rebase-check-restore.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-check-restore.t	Tue Dec 19 16:27:24 2017 -0500
@@ -138,7 +138,7 @@
   continue: hg rebase --continue
   $ hg rebase --continue
   rebasing 5:01e6ebbd8272 "F" (tip)
-  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/01e6ebbd8272-6fd3a015-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/01e6ebbd8272-6fd3a015-rebase.hg
 
   $ hg tglog
   @  5:draft 'F' notdefault
--- a/tests/test-rebase-collapse.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-collapse.t	Tue Dec 19 16:27:24 2017 -0500
@@ -7,8 +7,8 @@
   > publish=False
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
-  > tglogp = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
+  > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' {branches}\n"
   > EOF
 
 Create repo a:
@@ -26,21 +26,21 @@
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg tglog
-  @  7: 'H'
+  @  7: 02de42196ebe 'H'
   |
-  | o  6: 'G'
+  | o  6: eea13746799a 'G'
   |/|
-  o |  5: 'F'
+  o |  5: 24b6387c8c8c 'F'
   | |
-  | o  4: 'E'
+  | o  4: 9520eea781bc 'E'
   |/
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -79,25 +79,25 @@
   HG: added C
   HG: added D
   ====
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
 
   $ hg tglogp
-  @  5:secret 'Collapsed revision
+  @  5: 30882080ba93 secret 'Collapsed revision
   |  * B
   |  * C
   |  * D
   |
   |
   |  edited manually'
-  o  4:draft 'H'
+  o  4: 02de42196ebe draft 'H'
   |
-  | o  3:draft 'G'
+  | o  3: eea13746799a draft 'G'
   |/|
-  o |  2:draft 'F'
+  o |  2: 24b6387c8c8c draft 'F'
   | |
-  | o  1:draft 'E'
+  | o  1: 9520eea781bc draft 'E'
   |/
-  o  0:draft 'A'
+  o  0: cd010b8cd998 draft 'A'
   
   $ hg manifest --rev tip
   A
@@ -119,23 +119,23 @@
   $ hg rebase --source 4 --collapse --dest 7
   rebasing 4:9520eea781bc "E"
   rebasing 6:eea13746799a "G"
-  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg
 
   $ hg tglog
-  o  6: 'Collapsed revision
+  o  6: 7dd333a2d1e4 'Collapsed revision
   |  * E
   |  * G'
-  @  5: 'H'
+  @  5: 02de42196ebe 'H'
   |
-  o  4: 'F'
+  o  4: 24b6387c8c8c 'F'
   |
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ hg manifest --rev tip
   A
@@ -162,22 +162,22 @@
   rebasing 4:9520eea781bc "E"
   rebasing 6:eea13746799a "G"
   HGEDITFORM=rebase.collapse
-  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg
 
   $ hg tglog
-  o  6: 'custom message'
+  o  6: 38ed6a6b026b 'custom message'
   |
-  @  5: 'H'
+  @  5: 02de42196ebe 'H'
   |
-  o  4: 'F'
+  o  4: 24b6387c8c8c 'F'
   |
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ hg manifest --rev tip
   A
@@ -238,21 +238,21 @@
   created new head
 
   $ hg tglog
-  @  7: 'H'
+  @  7: c65502d41787 'H'
   |
-  | o    6: 'G'
+  | o    6: c772a8b2dc17 'G'
   | |\
-  | | o  5: 'F'
+  | | o  5: 7f219660301f 'F'
   | | |
-  | | o  4: 'E'
+  | | o  4: 8a5212ebc852 'E'
   | | |
-  | o |  3: 'D'
+  | o |  3: 2870ad076e54 'D'
   | |\|
-  | o |  2: 'C'
+  | o |  2: c5cefa58fd55 'C'
   |/ /
-  | o  1: 'B'
+  | o  1: 27547f69f254 'B'
   |/
-  o  0: 'A'
+  o  0: 4a2df7238c3b 'A'
   
   $ cd ..
 
@@ -272,22 +272,22 @@
   rebasing 4:8a5212ebc852 "E"
   rebasing 5:7f219660301f "F"
   rebasing 6:c772a8b2dc17 "G"
-  saved backup bundle to $TESTTMP/b1/.hg/strip-backup/8a5212ebc852-75046b61-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/b1/.hg/strip-backup/8a5212ebc852-75046b61-rebase.hg
 
   $ hg tglog
-  o    5: 'Collapsed revision
+  o    5: f97c4725bd99 'Collapsed revision
   |\   * E
   | |  * F
   | |  * G'
-  | @  4: 'H'
+  | @  4: c65502d41787 'H'
   | |
-  o |    3: 'D'
+  o |    3: 2870ad076e54 'D'
   |\ \
-  | o |  2: 'C'
+  | o |  2: c5cefa58fd55 'C'
   | |/
-  o /  1: 'B'
+  o /  1: 27547f69f254 'B'
   |/
-  o  0: 'A'
+  o  0: 4a2df7238c3b 'A'
   
   $ hg manifest --rev tip
   A
@@ -321,7 +321,7 @@
   c65502d4178782309ce0574c5ae6ee9485a9bafa o default
 
   $ hg strip 4
-  saved backup bundle to $TESTTMP/b2/.hg/strip-backup/8a5212ebc852-75046b61-backup.hg (glob)
+  saved backup bundle to $TESTTMP/b2/.hg/strip-backup/8a5212ebc852-75046b61-backup.hg
 
   $ cat $TESTTMP/b2/.hg/cache/branch2-served
   c65502d4178782309ce0574c5ae6ee9485a9bafa 4
@@ -393,23 +393,23 @@
   created new head
 
   $ hg tglog
-  @  8: 'I'
+  @  8: 46d6f0e29c20 'I'
   |
-  | o    7: 'H'
+  | o    7: 417d3b648079 'H'
   | |\
-  | | o  6: 'G'
+  | | o  6: 55a44ad28289 'G'
   | | |
-  | | o  5: 'F'
+  | | o  5: dca5924bb570 'F'
   | | |
-  | | o  4: 'E'
+  | | o  4: 8a5212ebc852 'E'
   | | |
-  | o |  3: 'D'
+  | o |  3: 2870ad076e54 'D'
   | |\|
-  | o |  2: 'C'
+  | o |  2: c5cefa58fd55 'C'
   |/ /
-  | o  1: 'B'
+  | o  1: 27547f69f254 'B'
   |/
-  o  0: 'A'
+  o  0: 4a2df7238c3b 'A'
   
   $ cd ..
 
@@ -425,23 +425,23 @@
   merging E
   rebasing 6:55a44ad28289 "G"
   rebasing 7:417d3b648079 "H"
-  saved backup bundle to $TESTTMP/c1/.hg/strip-backup/8a5212ebc852-f95d0879-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/c1/.hg/strip-backup/8a5212ebc852-f95d0879-rebase.hg
 
   $ hg tglog
-  o    5: 'Collapsed revision
+  o    5: 340b34a63b39 'Collapsed revision
   |\   * E
   | |  * F
   | |  * G
   | |  * H'
-  | @  4: 'I'
+  | @  4: 46d6f0e29c20 'I'
   | |
-  o |    3: 'D'
+  o |    3: 2870ad076e54 'D'
   |\ \
-  | o |  2: 'C'
+  | o |  2: c5cefa58fd55 'C'
   | |/
-  o /  1: 'B'
+  o /  1: 27547f69f254 'B'
   |/
-  o  0: 'A'
+  o  0: 4a2df7238c3b 'A'
   
   $ hg manifest --rev tip
   A
@@ -493,17 +493,17 @@
   created new head
 
   $ hg tglog
-  @  5: 'F'
+  @  5: c137c2b8081f 'F'
   |
-  | o    4: 'E'
+  | o    4: 0a42590ed746 'E'
   | |\
-  | | o  3: 'D'
+  | | o  3: 7bbcd6078bcc 'D'
   | | |
-  | o |  2: 'C'
+  | o |  2: f838bfaca5c7 'C'
   | |/
-  | o  1: 'B'
+  | o  1: 27547f69f254 'B'
   |/
-  o  0: 'A'
+  o  0: 4a2df7238c3b 'A'
   
   $ cd ..
 
@@ -518,17 +518,17 @@
   rebasing 2:f838bfaca5c7 "C"
   rebasing 3:7bbcd6078bcc "D"
   rebasing 4:0a42590ed746 "E"
-  saved backup bundle to $TESTTMP/d1/.hg/strip-backup/27547f69f254-9a3f7d92-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/d1/.hg/strip-backup/27547f69f254-9a3f7d92-rebase.hg
 
   $ hg tglog
-  o  2: 'Collapsed revision
+  o  2: b72eaccb283f 'Collapsed revision
   |  * B
   |  * C
   |  * D
   |  * E'
-  @  1: 'F'
+  @  1: c137c2b8081f 'F'
   |
-  o  0: 'A'
+  o  0: 4a2df7238c3b 'A'
   
   $ hg manifest --rev tip
   A
@@ -564,13 +564,13 @@
   adding d
 
   $ hg tglog
-  @  3: 'D'
+  @  3: 41acb9dca9eb 'D'
   |
-  | o  2: 'C' two
+  | o  2: 8ac4a08debf1 'C' two
   | |
-  | o  1: 'B' one
+  | o  1: 1ba175478953 'B' one
   |/
-  o  0: 'A'
+  o  0: 1994f17a630e 'A'
   
   $ hg rebase --keepbranches --collapse -s 1 -d 3
   abort: cannot collapse multiple named branches
@@ -588,32 +588,32 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   created new head
   $ hg tglog
-  @  5: 'E'
+  @  5: fbfb97b1089a 'E'
   |
-  | o  4: 'E'
+  | o  4: f338eb3c2c7c 'E'
   |/
-  o  3: 'D'
+  o  3: 41acb9dca9eb 'D'
   |
-  | o  2: 'C' two
+  | o  2: 8ac4a08debf1 'C' two
   | |
-  | o  1: 'B' one
+  | o  1: 1ba175478953 'B' one
   |/
-  o  0: 'A'
+  o  0: 1994f17a630e 'A'
   
   $ hg rebase -s 5 -d 4
   rebasing 5:fbfb97b1089a "E" (tip)
   note: rebase of 5:fbfb97b1089a created no changes to commit
-  saved backup bundle to $TESTTMP/e/.hg/strip-backup/fbfb97b1089a-553e1d85-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/e/.hg/strip-backup/fbfb97b1089a-553e1d85-rebase.hg
   $ hg tglog
-  @  4: 'E'
+  @  4: f338eb3c2c7c 'E'
   |
-  o  3: 'D'
+  o  3: 41acb9dca9eb 'D'
   |
-  | o  2: 'C' two
+  | o  2: 8ac4a08debf1 'C' two
   | |
-  | o  1: 'B' one
+  | o  1: 1ba175478953 'B' one
   |/
-  o  0: 'A'
+  o  0: 1994f17a630e 'A'
   
   $ hg export tip
   # HG changeset patch
@@ -646,13 +646,13 @@
   (run 'hg heads' to see heads, 'hg merge' to merge)
   $ hg up -q tip
   $ hg tglog
-  @  3: 'move2'
+  @  3: 338e84e2e558 'move2'
   |
-  o  2: 'move1'
+  o  2: 6e7340ee38c0 'move1'
   |
-  | o  1: 'change'
+  | o  1: 1352765a01d4 'change'
   |/
-  o  0: 'add'
+  o  0: f447d5abf5ea 'add'
   
   $ hg rebase --collapse -d 1
   rebasing 2:6e7340ee38c0 "move1"
@@ -662,7 +662,7 @@
   rebasing 3:338e84e2e558 "move2" (tip)
   merging f and c to c
   merging e and g to g
-  saved backup bundle to $TESTTMP/copies/.hg/strip-backup/6e7340ee38c0-ef8ef003-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/copies/.hg/strip-backup/6e7340ee38c0-ef8ef003-rebase.hg
   $ hg st
   $ hg st --copies --change tip
   A d
@@ -686,12 +686,12 @@
 Test collapsing a middle revision in-place
 
   $ hg tglog
-  @  2: 'Collapsed revision
+  @  2: 64b456429f67 'Collapsed revision
   |  * move1
   |  * move2'
-  o  1: 'change'
+  o  1: 1352765a01d4 'change'
   |
-  o  0: 'add'
+  o  0: f447d5abf5ea 'add'
   
   $ hg rebase --collapse -r 1 -d 0
   abort: can't remove original changesets with unrebased descendants
@@ -703,7 +703,7 @@
   $ hg rebase --collapse -b . -d 0
   rebasing 1:1352765a01d4 "change"
   rebasing 2:64b456429f67 "Collapsed revision" (tip)
-  saved backup bundle to $TESTTMP/copies/.hg/strip-backup/1352765a01d4-45a352ea-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/copies/.hg/strip-backup/1352765a01d4-45a352ea-rebase.hg
   $ hg st --change tip --copies
   M a
   M c
@@ -748,11 +748,11 @@
   created new head
 
   $ hg tglog
-  @  2: 'C'
+  @  2: c5cefa58fd55 'C'
   |
-  | o  1: 'B'
+  | o  1: 27547f69f254 'B'
   |/
-  o  0: 'A'
+  o  0: 4a2df7238c3b 'A'
   
 
 
@@ -762,12 +762,12 @@
 
   $ hg strip 2
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/f/.hg/strip-backup/c5cefa58fd55-629429f4-backup.hg (glob)
+  saved backup bundle to $TESTTMP/f/.hg/strip-backup/c5cefa58fd55-629429f4-backup.hg
 
   $ hg tglog
-  o  1: 'B'
+  o  1: 27547f69f254 'B'
   |
-  @  0: 'A'
+  @  0: 4a2df7238c3b 'A'
   
 
 
@@ -795,7 +795,7 @@
   $ hg rebase -d 0 -r "1::2" --collapse -m collapsed
   rebasing 1:6d8d9f24eec3 "a"
   rebasing 2:1cc73eca5ecc "b" (foo tip)
-  saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-rebase.hg
   $ hg log -G --template "{rev}: '{desc}' {bookmarks}"
   @  1: 'collapsed' foo
   |
@@ -836,7 +836,7 @@
   continue: hg rebase --continue
   $ hg rebase --continue
   rebasing 2:b8d8db2b242d "a-dev" (tip)
-  saved backup bundle to $TESTTMP/collapse_remember_message/.hg/strip-backup/b8d8db2b242d-f474c19a-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/collapse_remember_message/.hg/strip-backup/b8d8db2b242d-f474c19a-rebase.hg
   $ hg log
   changeset:   2:45ba1d1a8665
   tag:         tip
--- a/tests/test-rebase-conflicts.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-conflicts.t	Tue Dec 19 16:27:24 2017 -0500
@@ -102,7 +102,7 @@
   already rebased 3:3163e20567cc "L1" as 3e046f2ecedb
   rebasing 4:46f0b057b5c0 "L2"
   rebasing 5:8029388f38dc "L3" (mybook)
-  saved backup bundle to $TESTTMP/a/.hg/strip-backup/3163e20567cc-5ca4656e-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/3163e20567cc-5ca4656e-rebase.hg
 
   $ hg tglog
   @  5:secret 'L3'  mybook
@@ -235,6 +235,7 @@
   
   $ hg rebase -s9 -d2 --debug # use debug to really check merge base used
   rebase onto 4bc80088dc6b starting from e31216eec445
+  rebasing on disk
   rebase status stored
   rebasing 9:e31216eec445 "more changes to f1"
    future parents are 2 and -1
@@ -299,7 +300,7 @@
   bundle2-output-bundle: "HG20", (1 params) 2 parts total
   bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
-  saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg
   3 changesets found
   list of changesets:
   4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c
@@ -412,7 +413,7 @@
   rebasing 1:112478962961 "B" (B)
   rebasing 3:f585351a92f8 "D" (D)
   warning: orphaned descendants detected, not stripping 112478962961
-  saved backup bundle to $TESTTMP/b/.hg/strip-backup/f585351a92f8-e536a9e4-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/b/.hg/strip-backup/f585351a92f8-e536a9e4-rebase.hg
 
   $ rm .hg/localtags
   $ hg tglog
--- a/tests/test-rebase-dest.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-dest.t	Tue Dec 19 16:27:24 2017 -0500
@@ -21,15 +21,15 @@
   [255]
   $ hg rebase -d 1
   rebasing 2:5db65b93a12b "cc" (tip)
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/5db65b93a12b-4fb789ec-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/5db65b93a12b-4fb789ec-rebase.hg
   $ hg rebase -d 0 -r . -q
   $ HGPLAIN=1 hg rebase
   rebasing 2:889b0bc6a730 "cc" (tip)
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/889b0bc6a730-41ec4f81-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/889b0bc6a730-41ec4f81-rebase.hg
   $ hg rebase -d 0 -r . -q
   $ hg --config commands.rebase.requiredest=False rebase
   rebasing 2:279de9495438 "cc" (tip)
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/279de9495438-ab0a5128-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/279de9495438-ab0a5128-rebase.hg
 
 Requiring dest should not break continue or other rebase options
   $ hg up 1 -q
@@ -56,7 +56,7 @@
   continue: hg rebase --continue
   $ hg rebase --continue
   rebasing 3:0537f6b50def "dc" (tip)
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/0537f6b50def-be4c7386-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/0537f6b50def-be4c7386-rebase.hg
 
   $ cd ..
 
@@ -111,11 +111,10 @@
   > [phases]
   > publish=False
   > [alias]
-  > tglog = log -G --template "{rev}: {desc} {instabilities}" -r 'sort(all(), topo)'
+  > tglog = log -G --template "{rev}: {node|short} {desc} {instabilities}" -r 'sort(all(), topo)'
   > [extensions]
   > maprevset=$TESTTMP/maprevset.py
   > [experimental]
-  > rebase.multidest=true
   > evolution=true
   > EOF
 
@@ -175,13 +174,13 @@
   already rebased 0:426bada5c675 "A" (A)
   already rebased 2:dc0947a82db8 "C" (C)
   rebasing 3:004dc1679908 "D" (D tip)
-  o  4: D
+  o  4: d8d8601abd5e D
   
-  o  2: C
+  o  2: dc0947a82db8 C
   |
-  | o  1: B
+  | o  1: fc2b737bb2e5 B
   |
-  o  0: A
+  o  0: 426bada5c675 A
   
 Destination resolves to multiple changesets:
 
@@ -220,17 +219,17 @@
   rebasing 4:26805aba1e60 "C" (C)
   rebasing 3:cd488e83d208 "E" (E)
   rebasing 5:0069ba24938a "F" (F tip)
-  o  9: F
+  o  9: d150ff263fc8 F
   |
-  o  8: E
+  o  8: 66f30a1a2eab E
   |
-  | o  7: C
+  | o  7: 93db94ffae0e C
   | |
-  | o  6: B
+  | o  6: d0071c3b0c88 B
   | |
-  | o  1: D
+  | o  1: 058c1e1fb10a D
   |
-  o  0: A
+  o  0: 426bada5c675 A
   
 Different destinations for merge changesets with a same root:
 
@@ -245,19 +244,19 @@
   > EOS
   rebasing 3:a4256619d830 "B" (B)
   rebasing 6:8e139e245220 "C" (C tip)
-  o    8: C
+  o    8: 51e2ce92e06a C
   |\
-  | o    7: B
+  | o    7: 2ed0c8546285 B
   | |\
-  o | |  5: G
+  o | |  5: 8fdb2c1feb20 G
   | | |
-  | | o  4: E
+  | | o  4: cd488e83d208 E
   | | |
-  o | |  2: F
+  o | |  2: a6661b868de9 F
    / /
-  | o  1: D
+  | o  1: 058c1e1fb10a D
   |
-  o  0: A
+  o  0: 426bada5c675 A
   
 Move to a previous parent:
 
@@ -275,21 +274,21 @@
   rebasing 4:33441538d4aa "F" (F)
   rebasing 6:cf43ad9da869 "G" (G)
   rebasing 7:eef94f3b5f03 "H" (H tip)
-  o  10: H
+  o  10: b3d84c6666cf H
   |
-  | o  5: D
+  | o  5: f585351a92f8 D
   |/
-  o  3: C
+  o  3: 26805aba1e60 C
   |
-  | o  9: G
+  | o  9: f7c28a1a15e2 G
   |/
-  o  1: B
+  o  1: 112478962961 B
   |
-  | o  8: F
+  | o  8: 02aa697facf7 F
   |/
-  | o  2: E
+  | o  2: 7fb047a69f22 E
   |/
-  o  0: A
+  o  0: 426bada5c675 A
   
 Source overlaps with destination:
 
@@ -300,13 +299,13 @@
   > EOS
   rebasing 2:dc0947a82db8 "C" (C)
   rebasing 1:112478962961 "B" (B)
-  o  5: B
+  o  5: 5fe9935d5222 B
   |
-  o  4: C
+  o  4: 12d20731b9e0 C
   |
-  o  3: D
+  o  3: b18e25de2cf5 D
   |
-  o  0: A
+  o  0: 426bada5c675 A
   
 Detect cycles early:
 
@@ -346,17 +345,17 @@
   already rebased 3:b18e25de2cf5 "D" (D)
   already rebased 4:312782b8f06e "E" (E)
   already rebased 5:ad6717a6a58e "F" (F tip)
-  o  5: F
+  o  5: ad6717a6a58e F
   |
-  o  3: D
+  o  3: b18e25de2cf5 D
   |
-  | o    4: E
+  | o    4: 312782b8f06e E
   | |\
-  +---o  2: C
+  +---o  2: dc0947a82db8 C
   | |
-  | o  1: B
+  | o  1: 112478962961 B
   |/
-  o  0: A
+  o  0: 426bada5c675 A
   
 Massively rewrite the DAG:
 
@@ -380,27 +379,27 @@
   rebasing 10:ae41898d7875 "K" (K tip)
   rebasing 9:711f53bbef0b "G" (G)
   rebasing 6:64a8289d2492 "F" (F)
-  o  21: F
+  o  21: 3735afb3713a F
   |
-  o  20: G
+  o  20: 07698142d7a7 G
   |
-  o  19: K
+  o  19: 33aba52e7e72 K
   |
-  o  18: D
+  o  18: 9fdae89dc5a1 D
   |
-  o  17: E
+  o  17: 277dda9a65ee E
   |
-  o  16: B
+  o  16: 9c74fd8657ad B
   |
-  o  15: J
+  o  15: 6527eb0688bb J
   |
-  o  14: C
+  o  14: e94d655b928d C
   |
-  o  13: H
+  o  13: 620d6d349459 H
   |
-  o  12: A
+  o  12: a569a116758f A
   |
-  o  11: I
+  o  11: 2bf1302f5c18 I
   
 Resolve instability:
 
@@ -427,27 +426,27 @@
   rebasing 10:ffebc37c5d0b "E3" (E3)
   rebasing 13:fb184bcfeee8 "F2" (F2)
   rebasing 11:dc838ab4c0da "G" (G)
-  o  22: G
+  o  22: 174f63d574a8 G
   |
-  o  21: F2
+  o  21: c9d9fbe76705 F2
   |
-  o  20: E3
+  o  20: 0a03c2ede755 E3
   |
-  o  19: D
+  o  19: 228d9d2541b1 D
   |
-  o  18: C
+  o  18: cd856b400c95 C
   |
-  o  17: J
+  o  17: 9148200c858c J
   |
-  o  15: I2
+  o  15: eb74780f5094 I2
   |
-  o  12: H
+  o  12: 78309edd643f H
   |
-  o  5: B2
+  o  5: 4b4531bd8e1d B2
   |
-  o  4: N
+  o  4: 337c285c272b N
   |
-  o  2: M
+  o  2: 699bc4b6fa22 M
   |
-  o  0: A
+  o  0: 426bada5c675 A
   
--- a/tests/test-rebase-detach.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-detach.t	Tue Dec 19 16:27:24 2017 -0500
@@ -3,7 +3,7 @@
   > rebase=
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}'\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}'\n"
   > 
   > [extensions]
   > drawdag=$TESTDIR/drawdag.py
@@ -25,7 +25,7 @@
 
   $ hg rebase -s D -d B
   rebasing 3:e7b3f00ed42e "D" (D tip)
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/e7b3f00ed42e-6f368371-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/e7b3f00ed42e-6f368371-rebase.hg
 
   $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
   o  3:secret 'D'
@@ -62,18 +62,18 @@
   $ hg rebase -s D -d B
   rebasing 3:e7b3f00ed42e "D" (D)
   rebasing 4:69a34c08022a "E" (E tip)
-  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/e7b3f00ed42e-a2ec7cea-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/e7b3f00ed42e-a2ec7cea-rebase.hg
 
   $ hg tglog
-  o  4: 'E'
+  o  4: ee79e0744528 'E'
   |
-  o  3: 'D'
+  o  3: 10530e1d72d9 'D'
   |
-  | o  2: 'C'
+  | o  2: dc0947a82db8 'C'
   | |
-  o |  1: 'B'
+  o |  1: 112478962961 'B'
   |/
-  o  0: 'A'
+  o  0: 426bada5c675 'A'
   
   $ hg manifest --rev tip
   A
@@ -99,16 +99,16 @@
   $ hg rebase -s C -d B
   rebasing 2:dc0947a82db8 "C" (C)
   rebasing 3:e7b3f00ed42e "D" (D tip)
-  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/dc0947a82db8-b8481714-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/dc0947a82db8-b8481714-rebase.hg
 
   $ hg tglog
-  o  3: 'D'
+  o  3: 7375f3dbfb0f 'D'
   |
-  o  2: 'C'
+  o  2: bbfdd6cb49aa 'C'
   |
-  o  1: 'B'
+  o  1: 112478962961 'B'
   |
-  o  0: 'A'
+  o  0: 426bada5c675 'A'
   
   $ hg manifest --rev tip
   A
@@ -138,7 +138,7 @@
   $ hg rebase --collapse -s D -d B
   rebasing 3:e7b3f00ed42e "D" (D)
   rebasing 4:69a34c08022a "E" (E tip)
-  saved backup bundle to $TESTTMP/a4/.hg/strip-backup/e7b3f00ed42e-a2ec7cea-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a4/.hg/strip-backup/e7b3f00ed42e-a2ec7cea-rebase.hg
 
   $ hg  log -G --template "{rev}:{phase} '{desc}' {branches}\n"
   o  3:secret 'Collapsed revision
@@ -176,33 +176,33 @@
   rebasing 2:dc0947a82db8 "C" (C)
   rebasing 3:e7b3f00ed42e "D" (D)
   rebasing 4:69a34c08022a "E" (E tip)
-  saved backup bundle to $TESTTMP/a5/.hg/strip-backup/dc0947a82db8-3eefec98-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a5/.hg/strip-backup/dc0947a82db8-3eefec98-rebase.hg
 
   $ hg tglog
-  o  4: 'E'
+  o  4: e3d0c70d606d 'E'
   |
-  o  3: 'D'
+  o  3: e9153d36a1af 'D'
   |
-  o  2: 'C'
+  o  2: a7ac28b870a8 'C'
   |
-  o  1: 'B'
+  o  1: fc2b737bb2e5 'B'
   
-  o  0: 'A'
+  o  0: 426bada5c675 'A'
   
   $ hg rebase -d 1 -s 3
   rebasing 3:e9153d36a1af "D"
   rebasing 4:e3d0c70d606d "E" (tip)
-  saved backup bundle to $TESTTMP/a5/.hg/strip-backup/e9153d36a1af-db7388ed-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a5/.hg/strip-backup/e9153d36a1af-db7388ed-rebase.hg
   $ hg tglog
-  o  4: 'E'
+  o  4: 2c24e540eccd 'E'
   |
-  o  3: 'D'
+  o  3: 73f786ed52ff 'D'
   |
-  | o  2: 'C'
+  | o  2: a7ac28b870a8 'C'
   |/
-  o  1: 'B'
+  o  1: fc2b737bb2e5 'B'
   
-  o  0: 'A'
+  o  0: 426bada5c675 'A'
   
   $ cd ..
 
@@ -231,42 +231,42 @@
   $ echo "J" >> F
   $ hg ci -m "J"
   $ hg tglog
-  @  7: 'J'
+  @  7: c6aaf0d259c0 'J'
   |
-  o    6: 'Merge'
+  o    6: 0cfbc7e8faaf 'Merge'
   |\
-  | o  5: 'I'
+  | o  5: b92d164ad3cb 'I'
   | |
-  o |  4: 'H'
+  o |  4: 4ea5b230dea3 'H'
   | |
-  | o  3: 'G'
+  | o  3: c6001eacfde5 'G'
   |/|
-  o |  2: 'F'
+  o |  2: 8908a377a434 'F'
   | |
-  | o  1: 'E'
+  | o  1: 7fb047a69f22 'E'
   |/
-  o  0: 'A'
+  o  0: 426bada5c675 'A'
   
   $ hg rebase -s I -d H --collapse --config ui.merge=internal:other
   rebasing 5:b92d164ad3cb "I" (I)
   rebasing 6:0cfbc7e8faaf "Merge"
   rebasing 7:c6aaf0d259c0 "J" (tip)
-  saved backup bundle to $TESTTMP/a6/.hg/strip-backup/b92d164ad3cb-88fd7ab7-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a6/.hg/strip-backup/b92d164ad3cb-88fd7ab7-rebase.hg
 
   $ hg tglog
-  @  5: 'Collapsed revision
+  @  5: 65079693dac4 'Collapsed revision
   |  * I
   |  * Merge
   |  * J'
-  o  4: 'H'
+  o  4: 4ea5b230dea3 'H'
   |
-  | o  3: 'G'
+  | o  3: c6001eacfde5 'G'
   |/|
-  o |  2: 'F'
+  o |  2: 8908a377a434 'F'
   | |
-  | o  1: 'E'
+  | o  1: 7fb047a69f22 'E'
   |/
-  o  0: 'A'
+  o  0: 426bada5c675 'A'
   
 
   $ hg log --rev tip
@@ -305,7 +305,7 @@
   $ hg rebase -c
   rebasing 3:17b4880d2402 "B2" (tip)
   note: rebase of 3:17b4880d2402 created no changes to commit
-  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/17b4880d2402-1ae1f6cc-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/17b4880d2402-1ae1f6cc-rebase.hg
   $ hg  log -G --template "{rev}:{phase} '{desc}' {branches}\n"
   o  2:draft 'C'
   |
--- a/tests/test-rebase-emptycommit.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-emptycommit.t	Tue Dec 19 16:27:24 2017 -0500
@@ -88,7 +88,7 @@
   rebasing 4:69a34c08022a "E" (BOOK-E)
   note: rebase of 4:69a34c08022a created no changes to commit
   rebasing 5:6b2aeab91270 "F" (BOOK-F F)
-  saved backup bundle to $TESTTMP/non-merge/.hg/strip-backup/dc0947a82db8-52bb4973-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/non-merge/.hg/strip-backup/dc0947a82db8-52bb4973-rebase.hg
   $ hg log -G -T '{rev} {desc} {bookmarks}'
   o  5 F BOOK-F
   |
@@ -136,7 +136,7 @@
   note: rebase of 3:b18e25de2cf5 created no changes to commit
   rebasing 4:86a1f6686812 "E" (BOOK-E E)
   note: rebase of 4:86a1f6686812 created no changes to commit
-  saved backup bundle to $TESTTMP/merge1/.hg/strip-backup/b18e25de2cf5-1fd0a4ba-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/merge1/.hg/strip-backup/b18e25de2cf5-1fd0a4ba-rebase.hg
 
   $ hg log -G -T '{rev} {desc} {bookmarks}'
   o  4 H BOOK-C BOOK-D BOOK-E
@@ -186,7 +186,7 @@
   rebasing 5:ad6717a6a58e "F" (BOOK-F)
   note: rebase of 5:ad6717a6a58e created no changes to commit
   rebasing 6:c58e8bdac1f4 "G" (BOOK-G G)
-  saved backup bundle to $TESTTMP/merge2/.hg/strip-backup/b18e25de2cf5-2d487005-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/merge2/.hg/strip-backup/b18e25de2cf5-2d487005-rebase.hg
 
   $ hg log -G -T '{rev} {desc} {bookmarks}'
   o    7 G BOOK-G
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-rebase-inmemory.t	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,159 @@
+#require symlink execbit
+  $ cat << EOF >> $HGRCPATH
+  > [extensions]
+  > amend=
+  > rebase=
+  > debugdrawdag=$TESTDIR/drawdag.py
+  > [rebase]
+  > experimental.inmemory=1
+  > [diff]
+  > git=1
+  > [alias]
+  > tglog = log -G --template "{rev}: {node|short} '{desc}'\n"
+  > EOF
+
+Rebase a simple DAG:
+  $ hg init repo1
+  $ cd repo1
+  $ hg debugdrawdag <<'EOS'
+  > c b
+  > |/
+  > d
+  > |
+  > a
+  > EOS
+  $ hg up -C a
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg tglog
+  o  3: 814f6bd05178 'c'
+  |
+  | o  2: db0e82a16a62 'b'
+  |/
+  o  1: 02952614a83d 'd'
+  |
+  @  0: b173517d0057 'a'
+  
+  $ hg cat -r 3 c
+  c (no-eol)
+  $ hg cat -r 2 b
+  b (no-eol)
+  $ hg rebase --debug -r b -d c | grep rebasing
+  rebasing in-memory
+  rebasing 2:db0e82a16a62 "b" (b)
+  $ hg tglog
+  o  3: ca58782ad1e4 'b'
+  |
+  o  2: 814f6bd05178 'c'
+  |
+  o  1: 02952614a83d 'd'
+  |
+  @  0: b173517d0057 'a'
+  
+  $ hg cat -r 3 b
+  b (no-eol)
+  $ hg cat -r 2 c
+  c (no-eol)
+
+Case 2:
+  $ hg init repo2
+  $ cd repo2
+  $ hg debugdrawdag <<'EOS'
+  > c b
+  > |/
+  > d
+  > |
+  > a
+  > EOS
+
+Add a symlink and executable file:
+  $ hg up -C c
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ ln -s somefile e
+  $ echo f > f
+  $ chmod +x f
+  $ hg add e f
+  $ hg amend -q
+  $ hg up -Cq a
+
+Write files to the working copy, and ensure they're still there after the rebase
+  $ echo "abc" > a
+  $ ln -s def b
+  $ echo "ghi" > c
+  $ echo "jkl" > d
+  $ echo "mno" > e
+  $ hg tglog
+  o  3: f56b71190a8f 'c'
+  |
+  | o  2: db0e82a16a62 'b'
+  |/
+  o  1: 02952614a83d 'd'
+  |
+  @  0: b173517d0057 'a'
+  
+  $ hg cat -r 3 c
+  c (no-eol)
+  $ hg cat -r 2 b
+  b (no-eol)
+  $ hg cat -r 3 e
+  somefile (no-eol)
+  $ hg rebase --debug -s b -d a | grep rebasing
+  rebasing in-memory
+  rebasing 2:db0e82a16a62 "b" (b)
+  $ hg tglog
+  o  3: fc055c3b4d33 'b'
+  |
+  | o  2: f56b71190a8f 'c'
+  | |
+  | o  1: 02952614a83d 'd'
+  |/
+  @  0: b173517d0057 'a'
+  
+  $ hg cat -r 2 c
+  c (no-eol)
+  $ hg cat -r 3 b
+  b (no-eol)
+  $ hg rebase --debug -s 1 -d 3 | grep rebasing
+  rebasing in-memory
+  rebasing 1:02952614a83d "d" (d)
+  rebasing 2:f56b71190a8f "c"
+  $ hg tglog
+  o  3: 753feb6fd12a 'c'
+  |
+  o  2: 09c044d2cb43 'd'
+  |
+  o  1: fc055c3b4d33 'b'
+  |
+  @  0: b173517d0057 'a'
+  
+Ensure working copy files are still there:
+  $ cat a
+  abc
+  $ readlink.py b
+  b -> def
+  $ cat e
+  mno
+
+Ensure symlink and executable files were rebased properly:
+  $ hg up -Cq 3
+  $ readlink.py e
+  e -> somefile
+  $ ls -l f | cut -c -10
+  -rwxr-xr-x
+
+Rebase the working copy parent, which should default to an on-disk merge even if
+we requested in-memory.
+  $ hg up -C 3
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg rebase -r 3 -d 0 --debug | grep rebasing
+  rebasing on disk
+  rebasing 3:753feb6fd12a "c" (tip)
+  $ hg tglog
+  @  3: 844a7de3e617 'c'
+  |
+  | o  2: 09c044d2cb43 'd'
+  | |
+  | o  1: fc055c3b4d33 'b'
+  |/
+  o  0: b173517d0057 'a'
+  
+
--- a/tests/test-rebase-interruptions.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-interruptions.t	Tue Dec 19 16:27:24 2017 -0500
@@ -6,8 +6,8 @@
   > publish=False
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
-  > tglogp = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
+  > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' {branches}\n"
   > EOF
 
 
@@ -44,15 +44,15 @@
   $ cd a1
 
   $ hg tglog
-  @  4: 'E'
+  @  4: ae36e8e3dfd7 'E'
   |
-  o  3: 'D'
+  o  3: 46b37eabc604 'D'
   |
-  | o  2: 'C'
+  | o  2: 965c486023db 'C'
   | |
-  | o  1: 'B'
+  | o  1: 27547f69f254 'B'
   |/
-  o  0: 'A'
+  o  0: 4a2df7238c3b 'A'
   
 Rebasing B onto E:
 
@@ -77,19 +77,19 @@
   $ hg phase --force --secret 6
 
   $ hg tglogp
-  @  6:secret 'Extra'
+  @  6: deb5d2f93d8b secret 'Extra'
   |
-  | o  5:draft 'B'
+  | o  5: 45396c49d53b draft 'B'
   | |
-  | o  4:draft 'E'
+  | o  4: ae36e8e3dfd7 draft 'E'
   | |
-  | o  3:draft 'D'
+  | o  3: 46b37eabc604 draft 'D'
   | |
-  o |  2:draft 'C'
+  o |  2: 965c486023db draft 'C'
   | |
-  o |  1:draft 'B'
+  o |  1: 27547f69f254 draft 'B'
   |/
-  o  0:draft 'A'
+  o  0: 4a2df7238c3b draft 'A'
   
 Resume the rebasing:
 
@@ -115,21 +115,21 @@
   warning: orphaned descendants detected, not stripping 27547f69f254, 965c486023db
 
   $ hg tglogp
-  o  7:draft 'C'
+  o  7: d2d25e26288e draft 'C'
   |
-  | o  6:secret 'Extra'
+  | o  6: deb5d2f93d8b secret 'Extra'
   | |
-  o |  5:draft 'B'
+  o |  5: 45396c49d53b draft 'B'
   | |
-  @ |  4:draft 'E'
+  @ |  4: ae36e8e3dfd7 draft 'E'
   | |
-  o |  3:draft 'D'
+  o |  3: 46b37eabc604 draft 'D'
   | |
-  | o  2:draft 'C'
+  | o  2: 965c486023db draft 'C'
   | |
-  | o  1:draft 'B'
+  | o  1: 27547f69f254 draft 'B'
   |/
-  o  0:draft 'A'
+  o  0: 4a2df7238c3b draft 'A'
   
   $ cd ..
 
@@ -140,15 +140,15 @@
   $ cd a2
 
   $ hg tglog
-  @  4: 'E'
+  @  4: ae36e8e3dfd7 'E'
   |
-  o  3: 'D'
+  o  3: 46b37eabc604 'D'
   |
-  | o  2: 'C'
+  | o  2: 965c486023db 'C'
   | |
-  | o  1: 'B'
+  | o  1: 27547f69f254 'B'
   |/
-  o  0: 'A'
+  o  0: 4a2df7238c3b 'A'
   
 Rebasing B onto E:
 
@@ -169,19 +169,19 @@
   $ hg ci -m 'Extra' --config 'extensions.rebase=!'
 
   $ hg tglog
-  @  6: 'Extra'
+  @  6: 402ee3642b59 'Extra'
   |
-  o  5: 'B'
+  o  5: 45396c49d53b 'B'
   |
-  o  4: 'E'
+  o  4: ae36e8e3dfd7 'E'
   |
-  o  3: 'D'
+  o  3: 46b37eabc604 'D'
   |
-  | o  2: 'C'
+  | o  2: 965c486023db 'C'
   | |
-  | o  1: 'B'
+  | o  1: 27547f69f254 'B'
   |/
-  o  0: 'A'
+  o  0: 4a2df7238c3b 'A'
   
 Abort the rebasing:
 
@@ -190,19 +190,19 @@
   rebase aborted
 
   $ hg tglog
-  @  6: 'Extra'
+  @  6: 402ee3642b59 'Extra'
   |
-  o  5: 'B'
+  o  5: 45396c49d53b 'B'
   |
-  o  4: 'E'
+  o  4: ae36e8e3dfd7 'E'
   |
-  o  3: 'D'
+  o  3: 46b37eabc604 'D'
   |
-  | o  2: 'C'
+  | o  2: 965c486023db 'C'
   | |
-  | o  1: 'B'
+  | o  1: 27547f69f254 'B'
   |/
-  o  0: 'A'
+  o  0: 4a2df7238c3b 'A'
   
   $ cd ..
 
@@ -212,15 +212,15 @@
   $ cd a3
 
   $ hg tglogp
-  @  4:draft 'E'
+  @  4: ae36e8e3dfd7 draft 'E'
   |
-  o  3:draft 'D'
+  o  3: 46b37eabc604 draft 'D'
   |
-  | o  2:draft 'C'
+  | o  2: 965c486023db draft 'C'
   | |
-  | o  1:draft 'B'
+  | o  1: 27547f69f254 draft 'B'
   |/
-  o  0:draft 'A'
+  o  0: 4a2df7238c3b draft 'A'
   
 Rebasing B onto E:
 
@@ -240,17 +240,17 @@
   $ hg phase --secret -f 2
 
   $ hg tglogp
-  @  5:public 'B'
+  @  5: 45396c49d53b public 'B'
   |
-  o  4:public 'E'
+  o  4: ae36e8e3dfd7 public 'E'
   |
-  o  3:public 'D'
+  o  3: 46b37eabc604 public 'D'
   |
-  | o  2:secret 'C'
+  | o  2: 965c486023db secret 'C'
   | |
-  | o  1:public 'B'
+  | o  1: 27547f69f254 public 'B'
   |/
-  o  0:public 'A'
+  o  0: 4a2df7238c3b public 'A'
   
 Abort the rebasing:
 
@@ -259,17 +259,17 @@
   rebase aborted
 
   $ hg tglogp
-  @  5:public 'B'
+  @  5: 45396c49d53b public 'B'
   |
-  o  4:public 'E'
+  o  4: ae36e8e3dfd7 public 'E'
   |
-  o  3:public 'D'
+  o  3: 46b37eabc604 public 'D'
   |
-  | o  2:secret 'C'
+  | o  2: 965c486023db secret 'C'
   | |
-  | o  1:public 'B'
+  | o  1: 27547f69f254 public 'B'
   |/
-  o  0:public 'A'
+  o  0: 4a2df7238c3b public 'A'
   
 Test rebase interrupted by hooks
 
@@ -292,40 +292,40 @@
   abort: precommit hook exited with status 1
   [255]
   $ hg tglogp
-  @  7:secret 'C'
+  @  7: 401ccec5e39f secret 'C'
   |
-  | @  6:secret 'F'
+  | @  6: a0b2430ebfb8 secret 'F'
   | |
-  o |  5:public 'B'
+  o |  5: 45396c49d53b public 'B'
   | |
-  o |  4:public 'E'
+  o |  4: ae36e8e3dfd7 public 'E'
   | |
-  o |  3:public 'D'
+  o |  3: 46b37eabc604 public 'D'
   | |
-  | o  2:secret 'C'
+  | o  2: 965c486023db secret 'C'
   | |
-  | o  1:public 'B'
+  | o  1: 27547f69f254 public 'B'
   |/
-  o  0:public 'A'
+  o  0: 4a2df7238c3b public 'A'
   
   $ hg rebase --continue
   already rebased 2:965c486023db "C" as 401ccec5e39f
   rebasing 6:a0b2430ebfb8 "F"
-  saved backup bundle to $TESTTMP/hook-precommit/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/hook-precommit/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg
   $ hg tglogp
-  @  6:secret 'F'
+  @  6: 6e92a149ac6b secret 'F'
   |
-  o  5:secret 'C'
+  o  5: 401ccec5e39f secret 'C'
   |
-  o  4:public 'B'
+  o  4: 45396c49d53b public 'B'
   |
-  o  3:public 'E'
+  o  3: ae36e8e3dfd7 public 'E'
   |
-  o  2:public 'D'
+  o  2: 46b37eabc604 public 'D'
   |
-  | o  1:public 'B'
+  | o  1: 27547f69f254 public 'B'
   |/
-  o  0:public 'A'
+  o  0: 4a2df7238c3b public 'A'
   
   $ cd ..
 
@@ -347,40 +347,40 @@
   abort: pretxncommit hook exited with status 1
   [255]
   $ hg tglogp
-  @  7:secret 'C'
+  @  7: 401ccec5e39f secret 'C'
   |
-  | @  6:secret 'F'
+  | @  6: a0b2430ebfb8 secret 'F'
   | |
-  o |  5:public 'B'
+  o |  5: 45396c49d53b public 'B'
   | |
-  o |  4:public 'E'
+  o |  4: ae36e8e3dfd7 public 'E'
   | |
-  o |  3:public 'D'
+  o |  3: 46b37eabc604 public 'D'
   | |
-  | o  2:secret 'C'
+  | o  2: 965c486023db secret 'C'
   | |
-  | o  1:public 'B'
+  | o  1: 27547f69f254 public 'B'
   |/
-  o  0:public 'A'
+  o  0: 4a2df7238c3b public 'A'
   
   $ hg rebase --continue
   already rebased 2:965c486023db "C" as 401ccec5e39f
   rebasing 6:a0b2430ebfb8 "F"
-  saved backup bundle to $TESTTMP/hook-pretxncommit/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/hook-pretxncommit/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg
   $ hg tglogp
-  @  6:secret 'F'
+  @  6: 6e92a149ac6b secret 'F'
   |
-  o  5:secret 'C'
+  o  5: 401ccec5e39f secret 'C'
   |
-  o  4:public 'B'
+  o  4: 45396c49d53b public 'B'
   |
-  o  3:public 'E'
+  o  3: ae36e8e3dfd7 public 'E'
   |
-  o  2:public 'D'
+  o  2: 46b37eabc604 public 'D'
   |
-  | o  1:public 'B'
+  | o  1: 27547f69f254 public 'B'
   |/
-  o  0:public 'A'
+  o  0: 4a2df7238c3b public 'A'
   
   $ cd ..
 
@@ -397,40 +397,40 @@
   abort: pretxnclose hook exited with status 1
   [255]
   $ hg tglogp
-  @  7:secret 'C'
+  @  7: 401ccec5e39f secret 'C'
   |
-  | @  6:secret 'F'
+  | @  6: a0b2430ebfb8 secret 'F'
   | |
-  o |  5:public 'B'
+  o |  5: 45396c49d53b public 'B'
   | |
-  o |  4:public 'E'
+  o |  4: ae36e8e3dfd7 public 'E'
   | |
-  o |  3:public 'D'
+  o |  3: 46b37eabc604 public 'D'
   | |
-  | o  2:secret 'C'
+  | o  2: 965c486023db secret 'C'
   | |
-  | o  1:public 'B'
+  | o  1: 27547f69f254 public 'B'
   |/
-  o  0:public 'A'
+  o  0: 4a2df7238c3b public 'A'
   
   $ hg rebase --continue
   already rebased 2:965c486023db "C" as 401ccec5e39f
   rebasing 6:a0b2430ebfb8 "F"
-  saved backup bundle to $TESTTMP/hook-pretxnclose/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/hook-pretxnclose/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg
   $ hg tglogp
-  @  6:secret 'F'
+  @  6: 6e92a149ac6b secret 'F'
   |
-  o  5:secret 'C'
+  o  5: 401ccec5e39f secret 'C'
   |
-  o  4:public 'B'
+  o  4: 45396c49d53b public 'B'
   |
-  o  3:public 'E'
+  o  3: ae36e8e3dfd7 public 'E'
   |
-  o  2:public 'D'
+  o  2: 46b37eabc604 public 'D'
   |
-  | o  1:public 'B'
+  | o  1: 27547f69f254 public 'B'
   |/
-  o  0:public 'A'
+  o  0: 4a2df7238c3b public 'A'
   
   $ cd ..
 
@@ -459,7 +459,7 @@
   $ hg rebase --continue
   rebasing 1:fdaca8533b86 "b"
   note: rebase of 1:fdaca8533b86 created no changes to commit
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fdaca8533b86-7fd70513-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fdaca8533b86-7fd70513-rebase.hg
   $ hg resolve --list
   $ test -f .hg/merge
   [1]
--- a/tests/test-rebase-issue-noparam-single-rev.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-issue-noparam-single-rev.t	Tue Dec 19 16:27:24 2017 -0500
@@ -6,7 +6,7 @@
   > publish=False
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
   > EOF
 
 
@@ -37,15 +37,15 @@
   adding r2
 
   $ hg tglog
-  @  4: 'r2'
+  @  4: 225af64d03e6 'r2'
   |
-  o  3: 'r1'
+  o  3: 8d0a8c99b309 'r1'
   |
-  | o  2: 'l1'
+  | o  2: 87c180a611f2 'l1'
   |/
-  o  1: 'c2'
+  o  1: 56daeba07f4b 'c2'
   |
-  o  0: 'c1'
+  o  0: e8faad3d03ff 'c1'
   
 Rebase with no arguments - single revision in source branch:
 
@@ -53,18 +53,18 @@
 
   $ hg rebase
   rebasing 2:87c180a611f2 "l1"
-  saved backup bundle to $TESTTMP/a/.hg/strip-backup/87c180a611f2-a5be192d-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/87c180a611f2-a5be192d-rebase.hg
 
   $ hg tglog
-  @  4: 'l1'
+  @  4: b1152cc99655 'l1'
   |
-  o  3: 'r2'
+  o  3: 225af64d03e6 'r2'
   |
-  o  2: 'r1'
+  o  2: 8d0a8c99b309 'r1'
   |
-  o  1: 'c2'
+  o  1: 56daeba07f4b 'c2'
   |
-  o  0: 'c1'
+  o  0: e8faad3d03ff 'c1'
   
   $ cd ..
 
@@ -96,15 +96,15 @@
   created new head
 
   $ hg tglog
-  @  4: 'r1'
+  @  4: 8d0a8c99b309 'r1'
   |
-  | o  3: 'l2'
+  | o  3: 1ac923b736ef 'l2'
   | |
-  | o  2: 'l1'
+  | o  2: 87c180a611f2 'l1'
   |/
-  o  1: 'c2'
+  o  1: 56daeba07f4b 'c2'
   |
-  o  0: 'c1'
+  o  0: e8faad3d03ff 'c1'
   
 Rebase with no arguments - single revision in target branch:
 
@@ -113,18 +113,18 @@
   $ hg rebase
   rebasing 2:87c180a611f2 "l1"
   rebasing 3:1ac923b736ef "l2"
-  saved backup bundle to $TESTTMP/b/.hg/strip-backup/87c180a611f2-b980535c-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/b/.hg/strip-backup/87c180a611f2-b980535c-rebase.hg
 
   $ hg tglog
-  @  4: 'l2'
+  @  4: 023181307ed0 'l2'
   |
-  o  3: 'l1'
+  o  3: 913ab52b43b4 'l1'
   |
-  o  2: 'r1'
+  o  2: 8d0a8c99b309 'r1'
   |
-  o  1: 'c2'
+  o  1: 56daeba07f4b 'c2'
   |
-  o  0: 'c1'
+  o  0: e8faad3d03ff 'c1'
   
 
   $ cd ..
--- a/tests/test-rebase-legacy.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-legacy.t	Tue Dec 19 16:27:24 2017 -0500
@@ -47,7 +47,7 @@
   rebasing 7:d2fa1c02b240 "G" (G)
   rebasing 9:6582e6951a9c "H" (H tip)
   warning: orphaned descendants detected, not stripping c1e6b162678d, de008c61a447
-  saved backup bundle to $TESTTMP/.hg/strip-backup/6f7a236de685-9880a3dc-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/6f7a236de685-9880a3dc-rebase.hg
 
   $ hg log -G -T '{rev}:{node|short} {desc}\n'
   o  11:721b8da0a708 H
--- a/tests/test-rebase-mq-skip.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-mq-skip.t	Tue Dec 19 16:27:24 2017 -0500
@@ -12,7 +12,7 @@
   > publish=False
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}' tags: {tags}\n"
   > EOF
 
 
@@ -67,14 +67,14 @@
   note: rebase of 3:148775c71080 created no changes to commit
   rebase merging completed
   updating mq patch p0.patch to 5:9ecc820b1737
-  $TESTTMP/a/.hg/patches/p0.patch (glob)
+  $TESTTMP/a/.hg/patches/p0.patch
   2 changesets found
   uncompressed size of bundle content:
        348 (changelog)
        324 (manifests)
        129  p0
        129  p1
-  saved backup bundle to $TESTTMP/a/.hg/strip-backup/13a46ce44f60-5da6ecfb-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/13a46ce44f60-5da6ecfb-rebase.hg
   2 changesets found
   uncompressed size of bundle content:
        403 (changelog)
@@ -90,13 +90,13 @@
   1 revisions have been skipped
 
   $ hg tglog
-  @  3: 'P0' tags: p0.patch qbase qtip tip
+  @  3: 9ecc820b1737 'P0' tags: p0.patch qbase qtip tip
   |
-  o  2: 'P1' tags: qparent
+  o  2: 869d8b134a27 'P1' tags: qparent
   |
-  o  1: 'R1' tags:
+  o  1: da108f2755df 'R1' tags:
   |
-  o  0: 'C1' tags:
+  o  0: cd320d50b341 'C1' tags:
   
   $ cd ..
 
@@ -166,26 +166,26 @@
   rebasing 5:681a378595ba "r5" (r5)
   rebasing 6:512a1f24768b "r6" (qtip r6)
   note: rebase of 6:512a1f24768b created no changes to commit
-  saved backup bundle to $TESTTMP/b/.hg/strip-backup/b4bffa6e4776-b9bfb84d-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/b/.hg/strip-backup/b4bffa6e4776-b9bfb84d-rebase.hg
 
   $ hg tglog
-  @  8: 'r5' tags: qtip r5 tip
+  @  8: 0b9735ce8f0a 'r5' tags: qtip r5 tip
   |
-  o  7: 'r2' tags: qbase r2
+  o  7: 1660ab13ce9a 'r2' tags: qbase r2
   |
-  o  6: 'branch2-r6' tags: qparent
+  o  6: 057f55ff8f44 'branch2-r6' tags: qparent
   |
-  o  5: 'branch2-r4' tags:
+  o  5: 1d7287f8deb1 'branch2-r4' tags:
   |
-  o  4: 'branch2-r8' tags:
+  o  4: 3c10b9db2bd5 'branch2-r8' tags:
   |
-  o  3: 'branch2-r7' tags:
+  o  3: b684023158dc 'branch2-r7' tags:
   |
-  o  2: 'branch2-r3' tags:
+  o  2: d817754b1251 'branch2-r3' tags:
   |
-  o  1: 'branch2-r1' tags:
+  o  1: 0621a206f8a4 'branch2-r1' tags:
   |
-  o  0: 'r0' tags:
+  o  0: 222799e2f90b 'r0' tags:
   
 
   $ cd ..
--- a/tests/test-rebase-mq.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-mq.t	Tue Dec 19 16:27:24 2017 -0500
@@ -7,7 +7,7 @@
   > plain=true
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}' tags: {tags}\n"
   > EOF
 
 
@@ -33,13 +33,13 @@
   $ hg qref -m P1 -d '2 0'
 
   $ hg tglog
-  @  3: 'P1' tags: f2.patch qtip tip
+  @  3: 929394423cd3 'P1' tags: f2.patch qtip tip
   |
-  o  2: 'P0' tags: f.patch qbase
+  o  2: 3504f44bffc0 'P0' tags: f.patch qbase
   |
-  | o  1: 'R1' tags:
+  | o  1: bac9ed9960d8 'R1' tags:
   |/
-  o  0: 'C1' tags: qparent
+  o  0: 36f36ddbca61 'C1' tags: qparent
   
 
 Rebase - try to rebase on an applied mq patch:
@@ -88,16 +88,16 @@
   $ hg rebase -c
   already rebased 2:3504f44bffc0 "P0" (f.patch qbase) as ebe9914c0d1c
   rebasing 3:929394423cd3 "P1" (f2.patch qtip)
-  saved backup bundle to $TESTTMP/a/.hg/strip-backup/3504f44bffc0-30595b40-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/3504f44bffc0-30595b40-rebase.hg
 
   $ hg tglog
-  @  3: 'P1' tags: f2.patch qtip tip
+  @  3: 462012cf340c 'P1' tags: f2.patch qtip tip
   |
-  o  2: 'P0' tags: f.patch qbase
+  o  2: ebe9914c0d1c 'P0' tags: f.patch qbase
   |
-  o  1: 'R1' tags: qparent
+  o  1: bac9ed9960d8 'R1' tags: qparent
   |
-  o  0: 'C1' tags:
+  o  0: 36f36ddbca61 'C1' tags:
   
   $ hg up -q qbase
 
@@ -205,7 +205,7 @@
   $ hg rebase -s 2 -d 1
   rebasing 2:0c587ffcb480 "P0 (git)" (f_git.patch qbase)
   rebasing 3:c7f18665e4bc "P1" (f.patch qtip tip)
-  saved backup bundle to $TESTTMP/a/.hg/strip-backup/0c587ffcb480-0ea5695f-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/0c587ffcb480-0ea5695f-rebase.hg
 
   $ hg qci -m 'save patch state'
 
@@ -298,11 +298,11 @@
   foo: +baz
 
   $ hg tglog
-  @  2: 'imported patch bar' tags: bar qtip tip
+  @  2: 4f44b861d38c 'imported patch bar' tags: bar qtip tip
   |
-  o  1: 'important commit message' tags: empty-important qbase
+  o  1: 0aaf4c3af7eb 'important commit message' tags: empty-important qbase
   |
-  o  0: 'a' tags: qparent
+  o  0: cb9a9f314b8b 'a' tags: qparent
   
 Create new head to rebase bar onto:
 
@@ -318,13 +318,13 @@
   $ hg qref
 
   $ hg tglog
-  @  3: '[mq]: bar' tags: bar qtip tip
+  @  3: d526d4536ed6 '[mq]: bar' tags: bar qtip tip
   |
-  | o  2: 'b' tags:
+  | o  2: d2ae7f538514 'b' tags:
   | |
-  o |  1: 'important commit message' tags: empty-important qbase
+  o |  1: 0aaf4c3af7eb 'important commit message' tags: empty-important qbase
   |/
-  o  0: 'a' tags: qparent
+  o  0: cb9a9f314b8b 'a' tags: qparent
   
 
 Rebase bar (make sure series order is preserved and empty-important also is
@@ -351,10 +351,10 @@
   foo: +baz
 
   $ hg tglog
-  @  2: '[mq]: bar' tags: bar qbase qtip tip
+  @  2: 477d948bb2af '[mq]: bar' tags: bar qbase qtip tip
   |
-  o  1: 'b' tags: qparent
+  o  1: d2ae7f538514 'b' tags: qparent
   |
-  o  0: 'a' tags:
+  o  0: cb9a9f314b8b 'a' tags:
   
   $ cd ..
--- a/tests/test-rebase-named-branches.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-named-branches.t	Tue Dec 19 16:27:24 2017 -0500
@@ -6,7 +6,7 @@
   > publish=False
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
   > EOF
 
   $ hg init a
@@ -45,25 +45,25 @@
   $ hg ci -m 'dev-two named branch'
 
   $ hg tglog
-  @  9: 'dev-two named branch' dev-two
+  @  9: cb039b7cae8e 'dev-two named branch' dev-two
   |
-  | o  8: 'dev-one named branch' dev-one
+  | o  8: 643fc9128048 'dev-one named branch' dev-one
   | |
-  o |  7: 'H'
+  o |  7: 02de42196ebe 'H'
   | |
-  +---o  6: 'G'
+  +---o  6: eea13746799a 'G'
   | | |
-  o | |  5: 'F'
+  o | |  5: 24b6387c8c8c 'F'
   | | |
-  +---o  4: 'E'
+  +---o  4: 9520eea781bc 'E'
   | |
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
 
 Branch name containing a dash (issue3181)
@@ -73,28 +73,28 @@
   rebasing 6:eea13746799a "G"
   rebasing 7:02de42196ebe "H"
   rebasing 9:cb039b7cae8e "dev-two named branch" (tip)
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/24b6387c8c8c-24cb8001-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/24b6387c8c8c-24cb8001-rebase.hg
 
   $ hg tglog
-  @  9: 'dev-two named branch' dev-two
+  @  9: 9e70cd31750f 'dev-two named branch' dev-two
   |
-  o  8: 'H'
+  o  8: 31d0e4ba75e6 'H'
   |
-  | o  7: 'G'
+  | o  7: 4b988a958030 'G'
   |/|
-  o |  6: 'F'
+  o |  6: 24de4aff8e28 'F'
   | |
-  o |  5: 'dev-one named branch' dev-one
+  o |  5: 643fc9128048 'dev-one named branch' dev-one
   | |
-  | o  4: 'E'
+  | o  4: 9520eea781bc 'E'
   | |
-  o |  3: 'D'
+  o |  3: 32af7686d403 'D'
   | |
-  o |  2: 'C'
+  o |  2: 5fddd98957c8 'C'
   | |
-  o |  1: 'B'
+  o |  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ hg rebase -s dev-one -d 0 --keepbranches
   rebasing 5:643fc9128048 "dev-one named branch"
@@ -102,28 +102,28 @@
   rebasing 7:4b988a958030 "G"
   rebasing 8:31d0e4ba75e6 "H"
   rebasing 9:9e70cd31750f "dev-two named branch" (tip)
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-c4ee9ef5-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-c4ee9ef5-rebase.hg
 
   $ hg tglog
-  @  9: 'dev-two named branch' dev-two
+  @  9: 59c2e59309fe 'dev-two named branch' dev-two
   |
-  o  8: 'H'
+  o  8: 904590360559 'H'
   |
-  | o  7: 'G'
+  | o  7: 1a1e6f72ec38 'G'
   |/|
-  o |  6: 'F'
+  o |  6: 42aa3cf0fa7a 'F'
   | |
-  o |  5: 'dev-one named branch' dev-one
+  o |  5: bc8139ee757c 'dev-one named branch' dev-one
   | |
-  | o  4: 'E'
+  | o  4: 9520eea781bc 'E'
   |/
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ hg update 3
   3 files updated, 0 files merged, 3 files removed, 0 files unresolved
@@ -133,27 +133,27 @@
   created new head
 
   $ hg tglog
-  @  10: 'dev-one named branch' dev-one
+  @  10: 643fc9128048 'dev-one named branch' dev-one
   |
-  | o  9: 'dev-two named branch' dev-two
+  | o  9: 59c2e59309fe 'dev-two named branch' dev-two
   | |
-  | o  8: 'H'
+  | o  8: 904590360559 'H'
   | |
-  | | o  7: 'G'
+  | | o  7: 1a1e6f72ec38 'G'
   | |/|
-  | o |  6: 'F'
+  | o |  6: 42aa3cf0fa7a 'F'
   | | |
-  | o |  5: 'dev-one named branch' dev-one
+  | o |  5: bc8139ee757c 'dev-one named branch' dev-one
   | | |
-  | | o  4: 'E'
+  | | o  4: 9520eea781bc 'E'
   | |/
-  o |  3: 'D'
+  o |  3: 32af7686d403 'D'
   | |
-  o |  2: 'C'
+  o |  2: 5fddd98957c8 'C'
   | |
-  o |  1: 'B'
+  o |  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ hg rebase -b 'max(branch("dev-two"))' -d dev-one --keepbranches
   rebasing 5:bc8139ee757c "dev-one named branch"
@@ -162,28 +162,28 @@
   rebasing 7:1a1e6f72ec38 "G"
   rebasing 8:904590360559 "H"
   rebasing 9:59c2e59309fe "dev-two named branch"
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/bc8139ee757c-f11c1080-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/bc8139ee757c-f11c1080-rebase.hg
 
   $ hg tglog
-  o  9: 'dev-two named branch' dev-two
+  o  9: 71325f8bc082 'dev-two named branch' dev-two
   |
-  o  8: 'H'
+  o  8: 12b2bc666e20 'H'
   |
-  | o  7: 'G'
+  | o  7: 549f007a9f5f 'G'
   |/|
-  o |  6: 'F'
+  o |  6: 679f28760620 'F'
   | |
-  @ |  5: 'dev-one named branch' dev-one
+  @ |  5: 643fc9128048 'dev-one named branch' dev-one
   | |
-  | o  4: 'E'
+  | o  4: 9520eea781bc 'E'
   | |
-  o |  3: 'D'
+  o |  3: 32af7686d403 'D'
   | |
-  o |  2: 'C'
+  o |  2: 5fddd98957c8 'C'
   | |
-  o |  1: 'B'
+  o |  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ hg rebase -s 'max(branch("dev-one"))' -d 0 --keepbranches
   rebasing 5:643fc9128048 "dev-one named branch"
@@ -191,28 +191,28 @@
   rebasing 7:549f007a9f5f "G"
   rebasing 8:12b2bc666e20 "H"
   rebasing 9:71325f8bc082 "dev-two named branch" (tip)
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-6cdd1a52-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-6cdd1a52-rebase.hg
 
   $ hg tglog
-  o  9: 'dev-two named branch' dev-two
+  o  9: 3944801ae4ea 'dev-two named branch' dev-two
   |
-  o  8: 'H'
+  o  8: 8e279d293175 'H'
   |
-  | o  7: 'G'
+  | o  7: aeefee77ab01 'G'
   |/|
-  o |  6: 'F'
+  o |  6: e908b85f3729 'F'
   | |
-  @ |  5: 'dev-one named branch' dev-one
+  @ |  5: bc8139ee757c 'dev-one named branch' dev-one
   | |
-  | o  4: 'E'
+  | o  4: 9520eea781bc 'E'
   |/
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ hg up -r 0 > /dev/null
 
@@ -222,28 +222,28 @@
   rebasing 1:42ccdea3bb16 "B"
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
 
   $ hg tglog
-  o  9: 'D'
+  o  9: e9f862ce8bad 'D'
   |
-  o  8: 'C'
+  o  8: a0d543090fa4 'C'
   |
-  o  7: 'B'
+  o  7: 3bdb949809d9 'B'
   |
-  o  6: 'dev-two named branch' dev-two
+  o  6: 3944801ae4ea 'dev-two named branch' dev-two
   |
-  o  5: 'H'
+  o  5: 8e279d293175 'H'
   |
-  | o  4: 'G'
+  | o  4: aeefee77ab01 'G'
   |/|
-  o |  3: 'F'
+  o |  3: e908b85f3729 'F'
   | |
-  o |  2: 'dev-one named branch' dev-one
+  o |  2: bc8139ee757c 'dev-one named branch' dev-one
   | |
-  | o  1: 'E'
+  | o  1: 9520eea781bc 'E'
   |/
-  @  0: 'A'
+  @  0: cd010b8cd998 'A'
   
   $ hg rebase -s 5 -d 6
   abort: source and destination form a cycle
@@ -254,28 +254,28 @@
   rebasing 7:3bdb949809d9 "B"
   rebasing 8:a0d543090fa4 "C"
   rebasing 9:e9f862ce8bad "D" (tip)
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/3944801ae4ea-fb46ed74-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/3944801ae4ea-fb46ed74-rebase.hg
 
   $ hg tglog
-  o  9: 'D'
+  o  9: e522577ccdbd 'D'
   |
-  o  8: 'C'
+  o  8: 810110211f50 'C'
   |
-  o  7: 'B'
+  o  7: 160b0930ccc6 'B'
   |
-  o  6: 'dev-two named branch'
+  o  6: c57724c84928 'dev-two named branch'
   |
-  o  5: 'H'
+  o  5: 8e279d293175 'H'
   |
-  | o  4: 'G'
+  | o  4: aeefee77ab01 'G'
   |/|
-  o |  3: 'F'
+  o |  3: e908b85f3729 'F'
   | |
-  o |  2: 'dev-one named branch' dev-one
+  o |  2: bc8139ee757c 'dev-one named branch' dev-one
   | |
-  | o  1: 'E'
+  | o  1: 9520eea781bc 'E'
   |/
-  @  0: 'A'
+  @  0: cd010b8cd998 'A'
   
 
 Reopen branch by rebase
@@ -291,7 +291,7 @@
   rebasing 7:160b0930ccc6 "B"
   rebasing 8:810110211f50 "C"
   rebasing 9:e522577ccdbd "D"
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/8e279d293175-b023e27c-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/8e279d293175-b023e27c-rebase.hg
 
   $ cd ..
 
@@ -314,13 +314,13 @@
   $ hg ci -m 'c1'
 
   $ hg tglog
-  @  3: 'c1' c
+  @  3: c062e3ecd6c6 'c1' c
   |
-  | o  2: 'b2' b
+  | o  2: 792845bb77ee 'b2' b
   |/
-  | o  1: 'b1' b
+  | o  1: 40039acb7ca5 'b1' b
   |/
-  o  0: '0'
+  o  0: d681519c3ea7 '0'
   
   $ hg clone -q . ../case2
 
@@ -330,13 +330,13 @@
   $ hg rebase
   rebasing 2:792845bb77ee "b2"
   note: rebase of 2:792845bb77ee created no changes to commit
-  saved backup bundle to $TESTTMP/case1/.hg/strip-backup/792845bb77ee-627120ee-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/case1/.hg/strip-backup/792845bb77ee-627120ee-rebase.hg
   $ hg tglog
-  o  2: 'c1' c
+  o  2: c062e3ecd6c6 'c1' c
   |
-  | @  1: 'b1' b
+  | @  1: 40039acb7ca5 'b1' b
   |/
-  o  0: '0'
+  o  0: d681519c3ea7 '0'
   
 
 rebase 'b1' on top of the tip of the branch ('b2') - ignoring the tip branch ('c1')
@@ -345,15 +345,15 @@
   $ hg up -qr 1
   $ hg rebase
   rebasing 1:40039acb7ca5 "b1"
-  saved backup bundle to $TESTTMP/case2/.hg/strip-backup/40039acb7ca5-342b72d1-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/case2/.hg/strip-backup/40039acb7ca5-342b72d1-rebase.hg
   $ hg tglog
-  @  3: 'b1' b
+  @  3: 76abc1c6f8c7 'b1' b
   |
-  | o  2: 'c1' c
+  | o  2: c062e3ecd6c6 'c1' c
   | |
-  o |  1: 'b2' b
+  o |  1: 792845bb77ee 'b2' b
   |/
-  o  0: '0'
+  o  0: d681519c3ea7 '0'
   
 
 rebase 'c1' to the branch head 'c2' that is closed
@@ -362,30 +362,30 @@
   $ hg ci -qm 'c2 closed' --close
   $ hg up -qr 2
   $ hg tglog
-  _  4: 'c2 closed' c
+  _  4: 8427af5d86f2 'c2 closed' c
   |
-  o  3: 'b1' b
+  o  3: 76abc1c6f8c7 'b1' b
   |
-  | @  2: 'c1' c
+  | @  2: c062e3ecd6c6 'c1' c
   | |
-  o |  1: 'b2' b
+  o |  1: 792845bb77ee 'b2' b
   |/
-  o  0: '0'
+  o  0: d681519c3ea7 '0'
   
   $ hg rebase
   abort: branch 'c' has one head - please rebase to an explicit rev
   (run 'hg heads' to see all heads)
   [255]
   $ hg tglog
-  _  4: 'c2 closed' c
+  _  4: 8427af5d86f2 'c2 closed' c
   |
-  o  3: 'b1' b
+  o  3: 76abc1c6f8c7 'b1' b
   |
-  | @  2: 'c1' c
+  | @  2: c062e3ecd6c6 'c1' c
   | |
-  o |  1: 'b2' b
+  o |  1: 792845bb77ee 'b2' b
   |/
-  o  0: '0'
+  o  0: d681519c3ea7 '0'
   
 
   $ hg up -cr 1
@@ -396,15 +396,15 @@
   rebasing 3:76abc1c6f8c7 "b1"
   rebasing 4:8427af5d86f2 "c2 closed" (tip)
   note: rebase of 4:8427af5d86f2 created no changes to commit
-  saved backup bundle to $TESTTMP/case2/.hg/strip-backup/76abc1c6f8c7-cd698d13-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/case2/.hg/strip-backup/76abc1c6f8c7-cd698d13-rebase.hg
   $ hg tglog
-  o  3: 'b1' x
+  o  3: 117b0ed08075 'b1' x
   |
-  | o  2: 'c1' c
+  | o  2: c062e3ecd6c6 'c1' c
   | |
-  @ |  1: 'b2' b
+  @ |  1: 792845bb77ee 'b2' b
   |/
-  o  0: '0'
+  o  0: d681519c3ea7 '0'
   
 
   $ cd ..
--- a/tests/test-rebase-newancestor.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-newancestor.t	Tue Dec 19 16:27:24 2017 -0500
@@ -5,7 +5,7 @@
   > rebase=
   > drawdag=$TESTDIR/drawdag.py
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
   > EOF
 
   $ hg init repo
@@ -31,29 +31,29 @@
   created new head
 
   $ hg tglog
-  @  3: 'AD'
+  @  3: 3878212183bd 'AD'
   |
-  | o  2: 'C'
+  | o  2: 30ae917c0e4f 'C'
   | |
-  | o  1: 'B'
+  | o  1: 0f4f7cb4f549 'B'
   |/
-  o  0: 'A'
+  o  0: 1e635d440a73 'A'
   
   $ hg rebase -s 1 -d 3
   rebasing 1:0f4f7cb4f549 "B"
   merging a
   rebasing 2:30ae917c0e4f "C"
   merging a
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/0f4f7cb4f549-82b3b163-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/0f4f7cb4f549-82b3b163-rebase.hg
 
   $ hg tglog
-  o  3: 'C'
+  o  3: 25773bc4b4b0 'C'
   |
-  o  2: 'B'
+  o  2: c09015405f75 'B'
   |
-  @  1: 'AD'
+  @  1: 3878212183bd 'AD'
   |
-  o  0: 'A'
+  o  0: 1e635d440a73 'A'
   
 
   $ cd ..
@@ -108,21 +108,21 @@
   $ hg ci -Aqm 'default: f-other stuff'
 
   $ hg tglog
-  @  7: 'default: f-other stuff'
+  @  7: e08089805d82 'default: f-other stuff'
   |
-  | o  6: 'dev: merge default' dev
+  | o  6: 9455ee510502 'dev: merge default' dev
   |/|
-  o |  5: 'default: remove f-default'
+  o |  5: 462860db70a1 'default: remove f-default'
   | |
-  | o  4: 'dev: merge default' dev
+  | o  4: 4b019212aaf6 'dev: merge default' dev
   |/|
-  o |  3: 'default: f-default stuff'
+  o |  3: f157ecfd2b6b 'default: f-default stuff'
   | |
-  | o  2: 'dev: f-dev stuff' dev
+  | o  2: ec2c14fb2984 'dev: f-dev stuff' dev
   | |
-  | o  1: 'dev: create branch' dev
+  | o  1: 1d1a643d390e 'dev: create branch' dev
   |/
-  o  0: 'default: create f-default'
+  o  0: e90e8eb90b6f 'default: create f-default'
   
   $ hg clone -qU . ../ancestor-merge-2
 
@@ -138,21 +138,21 @@
   other [source] changed f-default which local [dest] deleted
   use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
   rebasing 6:9455ee510502 "dev: merge default"
-  saved backup bundle to $TESTTMP/ancestor-merge/.hg/strip-backup/1d1a643d390e-43e9e04b-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/ancestor-merge/.hg/strip-backup/1d1a643d390e-43e9e04b-rebase.hg
   $ hg tglog
-  o  6: 'dev: merge default'
+  o  6: fbc098e72227 'dev: merge default'
   |
-  o  5: 'dev: merge default'
+  o  5: eda7b7f46f5d 'dev: merge default'
   |
-  o  4: 'dev: f-dev stuff'
+  o  4: 3e075b1c0a40 'dev: f-dev stuff'
   |
-  @  3: 'default: f-other stuff'
+  @  3: e08089805d82 'default: f-other stuff'
   |
-  o  2: 'default: remove f-default'
+  o  2: 462860db70a1 'default: remove f-default'
   |
-  o  1: 'default: f-default stuff'
+  o  1: f157ecfd2b6b 'default: f-default stuff'
   |
-  o  0: 'default: create f-default'
+  o  0: e90e8eb90b6f 'default: create f-default'
   
 Grafty cherry picking rebasing:
 
@@ -167,23 +167,23 @@
   other [source] changed f-default which local [dest] deleted
   use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
   rebasing 6:9455ee510502 "dev: merge default"
-  saved backup bundle to $TESTTMP/ancestor-merge-2/.hg/strip-backup/ec2c14fb2984-62d0b222-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/ancestor-merge-2/.hg/strip-backup/ec2c14fb2984-62d0b222-rebase.hg
   $ hg tglog
-  o  7: 'dev: merge default'
+  o  7: fbc098e72227 'dev: merge default'
   |
-  o  6: 'dev: merge default'
+  o  6: eda7b7f46f5d 'dev: merge default'
   |
-  o  5: 'dev: f-dev stuff'
+  o  5: 3e075b1c0a40 'dev: f-dev stuff'
   |
-  o  4: 'default: f-other stuff'
+  o  4: e08089805d82 'default: f-other stuff'
   |
-  o  3: 'default: remove f-default'
+  o  3: 462860db70a1 'default: remove f-default'
   |
-  o  2: 'default: f-default stuff'
+  o  2: f157ecfd2b6b 'default: f-default stuff'
   |
-  | o  1: 'dev: create branch' dev
+  | o  1: 1d1a643d390e 'dev: create branch' dev
   |/
-  o  0: 'default: create f-default'
+  o  0: e90e8eb90b6f 'default: create f-default'
   
   $ cd ..
 
@@ -225,21 +225,21 @@
   summary:     merge p1 1=ancestor p2 3=outside
   
   $ hg tglog
-  @    5: 'merge p1 1=ancestor p2 3=outside'
+  @    5: a57575f79074 'merge p1 1=ancestor p2 3=outside'
   |\
-  +---o  4: 'merge p1 3=outside p2 1=ancestor'
+  +---o  4: 6990226659be 'merge p1 3=outside p2 1=ancestor'
   | |/
-  | o  3: 'outside'
+  | o  3: f59da8fc0fcf 'outside'
   | |
-  +---o  2: 'target'
+  +---o  2: a60552eb93fb 'target'
   | |
-  o |  1: 'change'
+  o |  1: dd40c13f7a6f 'change'
   |/
-  o  0: 'common'
+  o  0: 02f0f58d5300 'common'
   
   $ hg rebase -r 4 -d 2
   rebasing 4:6990226659be "merge p1 3=outside p2 1=ancestor"
-  saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/6990226659be-4d67a0d3-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/6990226659be-4d67a0d3-rebase.hg
   $ hg tip
   changeset:   5:cca50676b1c5
   tag:         tip
@@ -251,7 +251,7 @@
   
   $ hg rebase -r 4 -d 2
   rebasing 4:a57575f79074 "merge p1 1=ancestor p2 3=outside"
-  saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/a57575f79074-385426e5-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/a57575f79074-385426e5-rebase.hg
   $ hg tip
   changeset:   5:f9daf77ffe76
   tag:         tip
@@ -262,17 +262,17 @@
   summary:     merge p1 1=ancestor p2 3=outside
   
   $ hg tglog
-  @    5: 'merge p1 1=ancestor p2 3=outside'
+  @    5: f9daf77ffe76 'merge p1 1=ancestor p2 3=outside'
   |\
-  +---o  4: 'merge p1 3=outside p2 1=ancestor'
+  +---o  4: cca50676b1c5 'merge p1 3=outside p2 1=ancestor'
   | |/
-  | o  3: 'outside'
+  | o  3: f59da8fc0fcf 'outside'
   | |
-  o |  2: 'target'
+  o |  2: a60552eb93fb 'target'
   | |
-  o |  1: 'change'
+  o |  1: dd40c13f7a6f 'change'
   |/
-  o  0: 'common'
+  o  0: 02f0f58d5300 'common'
   
 rebase of merge of ancestors
 
@@ -307,7 +307,7 @@
        199 (changelog)
        216 (manifests)
        182  other
-  saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/4c5f12f25ebe-f46990e5-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/4c5f12f25ebe-f46990e5-rebase.hg
   1 changesets found
   uncompressed size of bundle content:
        254 (changelog)
@@ -320,19 +320,19 @@
   added 1 changesets with 1 changes to 1 files
   rebase completed
   $ hg tglog
-  @  6: 'merge rebase ancestors'
+  @  6: 113755df812b 'merge rebase ancestors'
   |
-  o    5: 'merge p1 1=ancestor p2 3=outside'
+  o    5: f9daf77ffe76 'merge p1 1=ancestor p2 3=outside'
   |\
-  +---o  4: 'merge p1 3=outside p2 1=ancestor'
+  +---o  4: cca50676b1c5 'merge p1 3=outside p2 1=ancestor'
   | |/
-  | o  3: 'outside'
+  | o  3: f59da8fc0fcf 'outside'
   | |
-  o |  2: 'target'
+  o |  2: a60552eb93fb 'target'
   | |
-  o |  1: 'change'
+  o |  1: dd40c13f7a6f 'change'
   |/
-  o  0: 'common'
+  o  0: 02f0f58d5300 'common'
   
 Due to the limitation of 3-way merge algorithm (1 merge base), rebasing a merge
 may include unwanted content:
@@ -374,7 +374,7 @@
   rebasing 3:c1e6b162678d "B" (B)
   rebasing 4:d6003a550c2c "C" (C)
   rebasing 5:c8f78076273e "D" (D tip)
-  saved backup bundle to $TESTTMP/dual-merge-base2/.hg/strip-backup/d6003a550c2c-6f1424b6-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/dual-merge-base2/.hg/strip-backup/d6003a550c2c-6f1424b6-rebase.hg
   $ hg manifest -r 'desc(D)'
   B
   C
@@ -395,7 +395,7 @@
   $ hg rebase -r D+F -d Z
   rebasing 3:004dc1679908 "D" (D)
   rebasing 5:4be4cbf6f206 "F" (F tip)
-  saved backup bundle to $TESTTMP/chosen-merge-base1/.hg/strip-backup/004dc1679908-06a66a3c-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/chosen-merge-base1/.hg/strip-backup/004dc1679908-06a66a3c-rebase.hg
   $ hg manifest -r 'desc(F)'
   C
   D
@@ -416,7 +416,7 @@
   $ hg rebase -r E+F -d Z
   rebasing 4:974e4943c210 "E" (E)
   rebasing 5:4be4cbf6f206 "F" (F tip)
-  saved backup bundle to $TESTTMP/chosen-merge-base2/.hg/strip-backup/974e4943c210-b2874da5-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/chosen-merge-base2/.hg/strip-backup/974e4943c210-b2874da5-rebase.hg
   $ hg manifest -r 'desc(F)'
   B
   D
--- a/tests/test-rebase-obsolete.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-obsolete.t	Tue Dec 19 16:27:24 2017 -0500
@@ -6,7 +6,7 @@
 
   $ cat >> $HGRCPATH << EOF
   > [ui]
-  > logtemplate= {rev}:{node|short} {desc|firstline}
+  > logtemplate= {rev}:{node|short} {desc|firstline}{if(obsolete,' ({obsfate})')}
   > [experimental]
   > evolution.createmarkers=True
   > evolution.allowunstable=True
@@ -94,18 +94,18 @@
   | |
   o |  4:9520eea781bc E
   |/
-  | x  3:32af7686d403 D
+  | x  3:32af7686d403 D (rewritten using rebase as 10:8eeb3c33ad33)
   | |
-  | x  2:5fddd98957c8 C
+  | x  2:5fddd98957c8 C (rewritten using rebase as 9:2327fea05063)
   | |
-  | x  1:42ccdea3bb16 B
+  | x  1:42ccdea3bb16 B (rewritten using rebase as 8:e4e5be0395b2)
   |/
   o  0:cd010b8cd998 A
   
   $ hg debugobsolete
-  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
+  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
+  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
+  32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
 
 
   $ cd ..
@@ -164,18 +164,18 @@
   | |
   o |  4:9520eea781bc E
   |/
-  | x  3:32af7686d403 D
+  | x  3:32af7686d403 D (pruned using rebase)
   | |
-  | x  2:5fddd98957c8 C
+  | x  2:5fddd98957c8 C (rewritten using rebase as 10:5ae4c968c6ac)
   | |
-  | x  1:42ccdea3bb16 B
+  | x  1:42ccdea3bb16 B (pruned using rebase)
   |/
   o  0:cd010b8cd998 A
   
   $ hg debugobsolete
-  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
+  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
+  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
+  32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
 
 
 More complex case where part of the rebase set were already rebased
@@ -183,16 +183,16 @@
   $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
   rebasing 9:08483444fef9 "D"
   $ hg debugobsolete
-  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
+  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
+  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
+  32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
+  08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
   $ hg log -G
   @  11:4596109a6a43 D
   |
   | o  10:5ae4c968c6ac C
   | |
-  | x  9:08483444fef9 D
+  | x  9:08483444fef9 D (rewritten using rebase as 11:4596109a6a43)
   | |
   | o  8:8877864f1edb B
   | |
@@ -211,12 +211,12 @@
   note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D" (tip)
   rebasing 10:5ae4c968c6ac "C"
   $ hg debugobsolete
-  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
+  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
+  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
+  32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
+  08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
+  8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
+  5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
   $ hg log --rev 'contentdivergent()'
   $ hg log -G
   o  13:98f6af4ee953 C
@@ -299,7 +299,7 @@
   | |
   o |  4:9520eea781bc E
   |/
-  | @  1:42ccdea3bb16 B
+  | @  1:42ccdea3bb16 B (pruned using rebase)
   |/
   o  0:cd010b8cd998 A
   
@@ -341,36 +341,70 @@
   | |
   o |  4:9520eea781bc E
   |/
-  | x  3:32af7686d403 D
+  | x  3:32af7686d403 D (rewritten using rebase as 8:4dc2197e807b)
   | |
-  | x  2:5fddd98957c8 C
+  | x  2:5fddd98957c8 C (rewritten using rebase as 8:4dc2197e807b)
   | |
-  | x  1:42ccdea3bb16 B
+  | x  1:42ccdea3bb16 B (rewritten using rebase as 8:4dc2197e807b)
   |/
   o  0:cd010b8cd998 A
   
   $ hg id --debug -r tip
   4dc2197e807bae9817f09905b50ab288be2dbbcf tip
   $ hg debugobsolete
-  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
+  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'rebase', 'user': 'test'}
+  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'rebase', 'user': 'test'}
+  32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'rebase', 'user': 'test'}
 
   $ cd ..
 
 Rebase set has hidden descendants
 ---------------------------------
 
-We rebase a changeset which has a hidden changeset. The hidden changeset must
-not be rebased.
+We rebase a changeset which has hidden descendants. Hidden changesets must not
+be rebased.
 
   $ hg clone base hidden
   updating to branch default
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd hidden
+  $ hg log -G
+  @  7:02de42196ebe H
+  |
+  | o  6:eea13746799a G
+  |/|
+  o |  5:24b6387c8c8c F
+  | |
+  | o  4:9520eea781bc E
+  |/
+  | o  3:32af7686d403 D
+  | |
+  | o  2:5fddd98957c8 C
+  | |
+  | o  1:42ccdea3bb16 B
+  |/
+  o  0:cd010b8cd998 A
+  
   $ hg rebase -s 5fddd98957c8 -d eea13746799a
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
+  $ hg log -G
+  o  9:cf44d2f5a9f4 D
+  |
+  o  8:e273c5e7d2d2 C
+  |
+  | @  7:02de42196ebe H
+  | |
+  o |  6:eea13746799a G
+  |\|
+  | o  5:24b6387c8c8c F
+  | |
+  o |  4:9520eea781bc E
+  |/
+  | o  1:42ccdea3bb16 B
+  |/
+  o  0:cd010b8cd998 A
+  
   $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
   rebasing 1:42ccdea3bb16 "B"
   $ hg log -G
@@ -405,18 +439,18 @@
   | |
   | o  4:9520eea781bc E
   |/
-  | x  3:32af7686d403 D
+  | x  3:32af7686d403 D (rewritten using rebase as 9:cf44d2f5a9f4)
   | |
-  | x  2:5fddd98957c8 C
+  | x  2:5fddd98957c8 C (rewritten using rebase as 8:e273c5e7d2d2)
   | |
-  | x  1:42ccdea3bb16 B
+  | x  1:42ccdea3bb16 B (rewritten using rebase as 10:7c6027df6a99)
   |/
   o  0:cd010b8cd998 A
   
   $ hg debugobsolete
-  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
-  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
+  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
+  32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
+  42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
 
 Test that rewriting leaving instability behind is allowed
 ---------------------------------------------------------------------
@@ -432,7 +466,7 @@
   |
   | o  9:cf44d2f5a9f4 D
   | |
-  | x  8:e273c5e7d2d2 C
+  | x  8:e273c5e7d2d2 C (rewritten using rebase as 11:0d8f238b634c)
   | |
   @ |  7:02de42196ebe H
   | |
@@ -462,7 +496,7 @@
   |/
   | o  10:7c6027df6a99 B
   | |
-  | x  7:02de42196ebe H
+  | x  7:02de42196ebe H (rewritten using rebase as 13:bfe264faf697)
   | |
   +---o  6:eea13746799a G
   | |/
@@ -556,7 +590,7 @@
   |/
   | o    8:53a6a128b2b7 M
   | |\
-  | | x  7:02de42196ebe H
+  | | x  7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
   | | |
   o---+  6:eea13746799a G
   | | |
@@ -564,7 +598,7 @@
   | | |
   o---+  4:9520eea781bc E
    / /
-  x |  3:32af7686d403 D
+  x |  3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
   | |
   o |  2:5fddd98957c8 C
   | |
@@ -599,7 +633,7 @@
   |/
   | o    8:53a6a128b2b7 M
   | |\
-  | | x  7:02de42196ebe H
+  | | x  7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
   | | |
   o---+  6:eea13746799a G
   | | |
@@ -607,7 +641,7 @@
   | | |
   o---+  4:9520eea781bc E
    / /
-  x |  3:32af7686d403 D
+  x |  3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
   | |
   o |  2:5fddd98957c8 C
   | |
@@ -633,11 +667,11 @@
   |
   | o  17:97219452e4bd L
   | |
-  | x  16:fc37a630c901 K
+  | x  16:fc37a630c901 K (rewritten using amend as 18:bfaedf8eb73b)
   |/
   | o  15:5ae8a643467b J
   | |
-  | x  14:9ad579b4a5de I
+  | x  14:9ad579b4a5de I (rewritten using amend as 16:fc37a630c901)
   |/
   | o  12:acd174b7ab39 I
   | |
@@ -647,7 +681,7 @@
   |/
   | o    8:53a6a128b2b7 M
   | |\
-  | | x  7:02de42196ebe H
+  | | x  7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
   | | |
   o---+  6:eea13746799a G
   | | |
@@ -655,7 +689,7 @@
   | | |
   o---+  4:9520eea781bc E
    / /
-  x |  3:32af7686d403 D
+  x |  3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
   | |
   o |  2:5fddd98957c8 C
   | |
@@ -695,6 +729,15 @@
   $ echo C > C
   $ hg add C
   $ hg commit -m C
+  $ hg log -G
+  @  4:212cb178bcbb C
+  |
+  | o  3:261e70097290 B2
+  | |
+  x |  1:a8b11f55fb19 B0 (rewritten using amend as 3:261e70097290)
+  |/
+  o  0:4a2df7238c3b A
+  
 
 Rebase finds its way in a chain of marker
 
@@ -710,7 +753,18 @@
   $ hg add D
   $ hg commit -m D
   $ hg --hidden strip -r 'desc(B1)'
-  saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg (glob)
+  saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg
+  $ hg log -G
+  @  5:1a79b7535141 D
+  |
+  | o  4:ff2c4d47b71d C
+  | |
+  | o  2:261e70097290 B2
+  | |
+  x |  1:a8b11f55fb19 B0 (rewritten using amend as 2:261e70097290)
+  |/
+  o  0:4a2df7238c3b A
+  
 
   $ hg rebase -d 'desc(B2)'
   note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
@@ -766,6 +820,19 @@
   created new head
   $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=true
   obsoleted 1 changesets
+  $ hg log -G
+  @  11:f44da1f4954c nonrelevant (pruned)
+  |
+  | o  10:121d9e3bc4c6 P
+  |/
+  o  9:4be60e099a77 C
+  |
+  o  6:9c48361117de D
+  |
+  o  2:261e70097290 B2
+  |
+  o  0:4a2df7238c3b A
+  
   $ hg rebase -r . -d 10
   note: not rebasing 11:f44da1f4954c "nonrelevant" (tip), it has no successor
 
@@ -806,7 +873,7 @@
   | |
   | | o  12:3eb461388009 john doe
   | |/
-  x |  10:121d9e3bc4c6 P
+  x |  10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
   |/
   o  9:4be60e099a77 C
   |
@@ -835,7 +902,7 @@
   | |
   | | o  12:3eb461388009 john doe
   | |/
-  x |  10:121d9e3bc4c6 P
+  x |  10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
   |/
   o  9:4be60e099a77 C
   |
@@ -893,7 +960,7 @@
   $ hg log -G -r 16::
   @  21:7bdc8a87673d dummy change
   |
-  x  20:8b31da3c4919 dummy change
+  x  20:8b31da3c4919 dummy change (rewritten as 18:601db7a18f51)
   |
   o  19:b82fb57ea638 willconflict second version
   |
@@ -920,6 +987,208 @@
   rebasing 21:7bdc8a87673d "dummy change" (tip)
   $ cd ..
 
+Divergence cases due to obsolete changesets
+-------------------------------------------
+
+We should ignore branches with unstable changesets when they are based on an
+obsolete changeset which successor is in rebase set.
+
+  $ hg init divergence
+  $ cd divergence
+  $ cat >> .hg/hgrc << EOF
+  > [extensions]
+  > strip =
+  > [alias]
+  > strip = strip --no-backup --quiet
+  > [templates]
+  > instabilities = '{rev}:{node|short} {desc|firstline}{if(instabilities," ({instabilities})")}\n'
+  > EOF
+
+  $ hg debugdrawdag <<EOF
+  >   e   f
+  >   |   |
+  >   d'  d # replace: d -> d'
+  >    \ /
+  >     c
+  >     |
+  >   x b
+  >    \|
+  >     a
+  > EOF
+  $ hg log -G -r 'a'::
+  o  7:1143e9adc121 f
+  |
+  | o  6:d60ebfa0f1cb e
+  | |
+  | o  5:027ad6c5830d d'
+  | |
+  x |  4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
+  |/
+  o  3:a82ac2b38757 c
+  |
+  | o  2:630d7c95eff7 x
+  | |
+  o |  1:488e1b7e7341 b
+  |/
+  o  0:b173517d0057 a
+  
+
+Changeset d and its descendants are excluded to avoid divergence of d, which
+would occur because the successor of d (d') is also in rebaseset. As a
+consequence f (descendant of d) is left behind.
+
+  $ hg rebase -b 'e' -d 'x'
+  rebasing 1:488e1b7e7341 "b" (b)
+  rebasing 3:a82ac2b38757 "c" (c)
+  rebasing 5:027ad6c5830d "d'" (d')
+  rebasing 6:d60ebfa0f1cb "e" (e)
+  note: not rebasing 4:76be324c128b "d" (d) and its descendants as this would cause divergence
+  $ hg log -G -r 'a'::
+  o  11:eb6d63fc4ed5 e
+  |
+  o  10:44d8c724a70c d'
+  |
+  o  9:d008e6b4d3fd c
+  |
+  o  8:67e8f4a16c49 b
+  |
+  | o  7:1143e9adc121 f
+  | |
+  | | x  6:d60ebfa0f1cb e (rewritten using rebase as 11:eb6d63fc4ed5)
+  | | |
+  | | x  5:027ad6c5830d d' (rewritten using rebase as 10:44d8c724a70c)
+  | | |
+  | x |  4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
+  | |/
+  | x  3:a82ac2b38757 c (rewritten using rebase as 9:d008e6b4d3fd)
+  | |
+  o |  2:630d7c95eff7 x
+  | |
+  | x  1:488e1b7e7341 b (rewritten using rebase as 8:67e8f4a16c49)
+  |/
+  o  0:b173517d0057 a
+  
+  $ hg strip -r 8:
+
+If the rebase set has an obsolete (d) with a successor (d') outside the rebase
+set and none in destination, we still get the divergence warning.
+By allowing divergence, we can perform the rebase.
+
+  $ hg rebase -r 'c'::'f' -d 'x'
+  abort: this rebase will cause divergences from: 76be324c128b
+  (to force the rebase please set experimental.evolution.allowdivergence=True)
+  [255]
+  $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x'
+  rebasing 3:a82ac2b38757 "c" (c)
+  rebasing 4:76be324c128b "d" (d)
+  rebasing 7:1143e9adc121 "f" (f tip)
+  $ hg log -G -r 'a':: -T instabilities
+  o  10:e1744ea07510 f
+  |
+  o  9:e2b36ea9a0a0 d (content-divergent)
+  |
+  o  8:6a0376de376e c
+  |
+  | x  7:1143e9adc121 f
+  | |
+  | | o  6:d60ebfa0f1cb e (orphan)
+  | | |
+  | | o  5:027ad6c5830d d' (orphan content-divergent)
+  | | |
+  | x |  4:76be324c128b d
+  | |/
+  | x  3:a82ac2b38757 c
+  | |
+  o |  2:630d7c95eff7 x
+  | |
+  | o  1:488e1b7e7341 b
+  |/
+  o  0:b173517d0057 a
+  
+  $ hg strip -r 8:
+
+(Not skipping obsoletes means that divergence is allowed.)
+
+  $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x'
+  rebasing 3:a82ac2b38757 "c" (c)
+  rebasing 4:76be324c128b "d" (d)
+  rebasing 7:1143e9adc121 "f" (f tip)
+
+  $ hg strip -r 0:
+
+Similar test on a more complex graph
+
+  $ hg debugdrawdag <<EOF
+  >       g
+  >       |
+  >   f   e
+  >   |   |
+  >   e'  d # replace: e -> e'
+  >    \ /
+  >     c
+  >     |
+  >   x b
+  >    \|
+  >     a
+  > EOF
+  $ hg log -G -r 'a':
+  o  8:2876ce66c6eb g
+  |
+  | o  7:3ffec603ab53 f
+  | |
+  x |  6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
+  | |
+  | o  5:63324dc512ea e'
+  | |
+  o |  4:76be324c128b d
+  |/
+  o  3:a82ac2b38757 c
+  |
+  | o  2:630d7c95eff7 x
+  | |
+  o |  1:488e1b7e7341 b
+  |/
+  o  0:b173517d0057 a
+  
+  $ hg rebase -b 'f' -d 'x'
+  rebasing 1:488e1b7e7341 "b" (b)
+  rebasing 3:a82ac2b38757 "c" (c)
+  rebasing 5:63324dc512ea "e'" (e')
+  rebasing 7:3ffec603ab53 "f" (f)
+  rebasing 4:76be324c128b "d" (d)
+  note: not rebasing 6:e36fae928aec "e" (e) and its descendants as this would cause divergence
+  $ hg log -G -r 'a':
+  o  13:a1707a5b7c2c d
+  |
+  | o  12:ef6251596616 f
+  | |
+  | o  11:b6f172e64af9 e'
+  |/
+  o  10:d008e6b4d3fd c
+  |
+  o  9:67e8f4a16c49 b
+  |
+  | o  8:2876ce66c6eb g
+  | |
+  | | x  7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
+  | | |
+  | x |  6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
+  | | |
+  | | x  5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
+  | | |
+  | x |  4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
+  | |/
+  | x  3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
+  | |
+  o |  2:630d7c95eff7 x
+  | |
+  | x  1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49)
+  |/
+  o  0:b173517d0057 a
+  
+
+  $ cd ..
+
 Rebase merge where successor of one parent is equal to destination (issue5198)
 
   $ hg init p1-succ-is-dest
@@ -939,11 +1208,11 @@
   $ hg log -G
   o    5:50e9d60b99c6 F
   |\
-  | | x  4:66f1a38021c9 F
+  | | x  4:66f1a38021c9 F (rewritten using rebase as 5:50e9d60b99c6)
   | |/|
   | o |  3:7fb047a69f22 E
   | | |
-  | | x  2:b18e25de2cf5 D
+  | | x  2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
   | |/
   o |  1:112478962961 B
   |/
@@ -970,9 +1239,9 @@
   $ hg log -G
   o    5:aae1787dacee F
   |\
-  | | x  4:66f1a38021c9 F
+  | | x  4:66f1a38021c9 F (rewritten using rebase as 5:aae1787dacee)
   | |/|
-  | | x  3:7fb047a69f22 E
+  | | x  3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
   | | |
   | o |  2:b18e25de2cf5 D
   | |/
@@ -1002,13 +1271,13 @@
   $ hg log -G
   o    6:0913febf6439 F
   |\
-  +---x  5:66f1a38021c9 F
+  +---x  5:66f1a38021c9 F (rewritten using rebase as 6:0913febf6439)
   | | |
   | o |  4:26805aba1e60 C
   | | |
   o | |  3:7fb047a69f22 E
   | | |
-  +---x  2:b18e25de2cf5 D
+  +---x  2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
   | |
   | o  1:112478962961 B
   |/
@@ -1035,11 +1304,11 @@
   $ hg log -G
   o    6:c6ab0cc6d220 F
   |\
-  +---x  5:66f1a38021c9 F
+  +---x  5:66f1a38021c9 F (rewritten using rebase as 6:c6ab0cc6d220)
   | | |
   | o |  4:26805aba1e60 C
   | | |
-  | | x  3:7fb047a69f22 E
+  | | x  3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
   | | |
   o---+  2:b18e25de2cf5 D
    / /
@@ -1070,13 +1339,13 @@
   $ hg log -G
   o  6:8f47515dda15 D
   |
-  | x    5:66f1a38021c9 F
+  | x    5:66f1a38021c9 F (pruned using rebase)
   | |\
   o | |  4:26805aba1e60 C
   | | |
-  | | x  3:7fb047a69f22 E
+  | | x  3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
   | | |
-  | x |  2:b18e25de2cf5 D
+  | x |  2:b18e25de2cf5 D (rewritten using rebase as 6:8f47515dda15)
   | |/
   o /  1:112478962961 B
   |/
@@ -1106,13 +1375,13 @@
   $ hg log -G
   o  6:533690786a86 E
   |
-  | x    5:66f1a38021c9 F
+  | x    5:66f1a38021c9 F (pruned using rebase)
   | |\
   o | |  4:26805aba1e60 C
   | | |
-  | | x  3:7fb047a69f22 E
+  | | x  3:7fb047a69f22 E (rewritten using rebase as 6:533690786a86)
   | | |
-  | x |  2:b18e25de2cf5 D
+  | x |  2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
   | |/
   o /  1:112478962961 B
   |/
@@ -1224,7 +1493,7 @@
   $ hg book -r 2 mybook --hidden  # rev 2 has a bookmark on it now
   $ hg up 2 && hg log -r .  # working dir is at rev 2 again
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  2:1e9a3c00cbe9 b (no-eol)
+  2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)
   $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
   note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" (tip)
 Check that working directory and bookmark was updated to rev 3 although rev 2
@@ -1234,7 +1503,7 @@
   $ hg bookmarks
      mybook                    3:be1832deae9a
   $ hg debugobsolete --rev tip
-  1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'}
+  1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
 
 Obsoleted working parent and bookmark could be moved if an ancestor of working
 parent gets moved:
@@ -1338,7 +1607,7 @@
   $ hg log -G
   @  2:b18e25de2cf5 D
   |
-  | @  1:2ec65233581b B
+  | @  1:2ec65233581b B (pruned using prune)
   |/
   o  0:426bada5c675 A
   
--- a/tests/test-rebase-parameters.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-parameters.t	Tue Dec 19 16:27:24 2017 -0500
@@ -6,7 +6,7 @@
   > publish=False
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
   > EOF
 
 
@@ -27,23 +27,23 @@
   adding I
 
   $ hg tglog
-  @  8: 'I'
+  @  8: e7ec4e813ba6 'I'
   |
-  o  7: 'H'
+  o  7: 02de42196ebe 'H'
   |
-  | o  6: 'G'
+  | o  6: eea13746799a 'G'
   |/|
-  o |  5: 'F'
+  o |  5: 24b6387c8c8c 'F'
   | |
-  | o  4: 'E'
+  | o  4: 9520eea781bc 'E'
   |/
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -135,22 +135,22 @@
   rebasing 1:42ccdea3bb16 "B"
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
 
   $ hg tglog
-  @  6: 'D'
+  @  6: ed65089c18f8 'D'
   |
-  o  5: 'C'
+  o  5: 7621bf1a2f17 'C'
   |
-  o  4: 'B'
+  o  4: 9430a62369c6 'B'
   |
-  o  3: 'I'
+  o  3: e7ec4e813ba6 'I'
   |
-  o  2: 'H'
+  o  2: 02de42196ebe 'H'
   |
-  o  1: 'F'
+  o  1: 24b6387c8c8c 'F'
   |
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
 Try to rollback after a rebase (fail):
 
@@ -169,22 +169,22 @@
   rebasing 1:42ccdea3bb16 "B"
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
 
   $ hg tglog
-  @  6: 'D'
+  @  6: ed65089c18f8 'D'
   |
-  o  5: 'C'
+  o  5: 7621bf1a2f17 'C'
   |
-  o  4: 'B'
+  o  4: 9430a62369c6 'B'
   |
-  o  3: 'I'
+  o  3: e7ec4e813ba6 'I'
   |
-  o  2: 'H'
+  o  2: 02de42196ebe 'H'
   |
-  o  1: 'F'
+  o  1: 24b6387c8c8c 'F'
   |
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -198,26 +198,26 @@
   rebasing 1:42ccdea3bb16 "B"
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
 
   $ hg tglog
-  @  8: 'D'
+  @  8: ed65089c18f8 'D'
   |
-  o  7: 'C'
+  o  7: 7621bf1a2f17 'C'
   |
-  o  6: 'B'
+  o  6: 9430a62369c6 'B'
   |
-  o  5: 'I'
+  o  5: e7ec4e813ba6 'I'
   |
-  o  4: 'H'
+  o  4: 02de42196ebe 'H'
   |
-  | o  3: 'G'
+  | o  3: eea13746799a 'G'
   |/|
-  o |  2: 'F'
+  o |  2: 24b6387c8c8c 'F'
   | |
-  | o  1: 'E'
+  | o  1: 9520eea781bc 'E'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -230,22 +230,22 @@
   $ hg rebase --source 'desc("C")'
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a4/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a4/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
 
   $ hg tglog
-  o  6: 'D'
+  o  6: 7726e9fd58f7 'D'
   |
-  o  5: 'C'
+  o  5: 72c8333623d0 'C'
   |
-  @  4: 'I'
+  @  4: e7ec4e813ba6 'I'
   |
-  o  3: 'H'
+  o  3: 02de42196ebe 'H'
   |
-  o  2: 'F'
+  o  2: 24b6387c8c8c 'F'
   |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -259,26 +259,26 @@
   rebasing 1:42ccdea3bb16 "B"
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a5/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a5/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
 
   $ hg tglog
-  @  8: 'D'
+  @  8: 8eeb3c33ad33 'D'
   |
-  o  7: 'C'
+  o  7: 2327fea05063 'C'
   |
-  o  6: 'B'
+  o  6: e4e5be0395b2 'B'
   |
-  | o  5: 'I'
+  | o  5: e7ec4e813ba6 'I'
   | |
-  | o  4: 'H'
+  | o  4: 02de42196ebe 'H'
   | |
-  o |  3: 'G'
+  o |  3: eea13746799a 'G'
   |\|
-  | o  2: 'F'
+  | o  2: 24b6387c8c8c 'F'
   | |
-  o |  1: 'E'
+  o |  1: 9520eea781bc 'E'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -292,22 +292,22 @@
   rebasing 1:42ccdea3bb16 "B"
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a6/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a6/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
 
   $ hg tglog
-  o  6: 'D'
+  o  6: ed65089c18f8 'D'
   |
-  o  5: 'C'
+  o  5: 7621bf1a2f17 'C'
   |
-  o  4: 'B'
+  o  4: 9430a62369c6 'B'
   |
-  @  3: 'I'
+  @  3: e7ec4e813ba6 'I'
   |
-  o  2: 'H'
+  o  2: 02de42196ebe 'H'
   |
-  o  1: 'F'
+  o  1: 24b6387c8c8c 'F'
   |
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -320,26 +320,26 @@
   $ hg rebase --source 2 --dest 7
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
 
   $ hg tglog
-  o  8: 'D'
+  o  8: 668acadedd30 'D'
   |
-  o  7: 'C'
+  o  7: 09eb682ba906 'C'
   |
-  | @  6: 'I'
+  | @  6: e7ec4e813ba6 'I'
   |/
-  o  5: 'H'
+  o  5: 02de42196ebe 'H'
   |
-  | o  4: 'G'
+  | o  4: eea13746799a 'G'
   |/|
-  o |  3: 'F'
+  o |  3: 24b6387c8c8c 'F'
   | |
-  | o  2: 'E'
+  | o  2: 9520eea781bc 'E'
   |/
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -353,26 +353,26 @@
   rebasing 1:42ccdea3bb16 "B"
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a8/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a8/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
 
   $ hg tglog
-  o  8: 'D'
+  o  8: 287cc92ba5a4 'D'
   |
-  o  7: 'C'
+  o  7: 6824f610a250 'C'
   |
-  o  6: 'B'
+  o  6: 7c6027df6a99 'B'
   |
-  | @  5: 'I'
+  | @  5: e7ec4e813ba6 'I'
   |/
-  o  4: 'H'
+  o  4: 02de42196ebe 'H'
   |
-  | o  3: 'G'
+  | o  3: eea13746799a 'G'
   |/|
-  o |  2: 'F'
+  o |  2: 24b6387c8c8c 'F'
   | |
-  | o  1: 'E'
+  | o  1: 9520eea781bc 'E'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -385,22 +385,22 @@
   $ hg rebase --rev 'desc("C")::'
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a9/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a9/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
 
   $ hg tglog
-  o  6: 'D'
+  o  6: 7726e9fd58f7 'D'
   |
-  o  5: 'C'
+  o  5: 72c8333623d0 'C'
   |
-  @  4: 'I'
+  @  4: e7ec4e813ba6 'I'
   |
-  o  3: 'H'
+  o  3: 02de42196ebe 'H'
   |
-  o  2: 'F'
+  o  2: 24b6387c8c8c 'F'
   |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -411,7 +411,7 @@
   $ hg rebase -r 3 -r 6 --dest 8
   rebasing 3:32af7686d403 "D"
   rebasing 6:eea13746799a "G"
-  saved backup bundle to $TESTTMP/aX/.hg/strip-backup/eea13746799a-ad273fd6-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/aX/.hg/strip-backup/eea13746799a-ad273fd6-rebase.hg
   $ cd ..
 
 Test --tool parameter:
@@ -441,7 +441,7 @@
   $ hg rebase -s 2 -d 1 --tool internal:local
   rebasing 2:e4e3f3546619 "c2b" (tip)
   note: rebase of 2:e4e3f3546619 created no changes to commit
-  saved backup bundle to $TESTTMP/b1/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/b1/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
 
   $ hg cat c2
   c2
@@ -454,7 +454,7 @@
 
   $ hg rebase -s 2 -d 1 --tool internal:other
   rebasing 2:e4e3f3546619 "c2b" (tip)
-  saved backup bundle to $TESTTMP/b2/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/b2/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
 
   $ hg cat c2
   c2b
@@ -494,7 +494,7 @@
   $ hg rebase -c --tool internal:fail
   rebasing 2:e4e3f3546619 "c2b" (tip)
   note: rebase of 2:e4e3f3546619 created no changes to commit
-  saved backup bundle to $TESTTMP/b3/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/b3/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
 
   $ hg rebase -i
   abort: interactive history editing is supported by the 'histedit' extension (see "hg --config extensions.histedit= help -e histedit")
--- a/tests/test-rebase-partial.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-partial.t	Tue Dec 19 16:27:24 2017 -0500
@@ -11,7 +11,7 @@
   > evolution.allowunstable=True
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: {desc}"
+  > tglog = log -G --template "{rev}: {node|short} {desc}"
   > EOF
 
   $ rebasewithdag() {
@@ -37,15 +37,15 @@
   > EOF
   rebasing 2:b18e25de2cf5 "D" (D)
   already rebased 3:26805aba1e60 "C" (C tip)
-  o  4: D
+  o  4: fe3b4c6498fa D
   |
-  | o  3: C
+  | o  3: 26805aba1e60 C
   |/
-  | x  2: D
+  | x  2: b18e25de2cf5 D
   | |
-  o |  1: B
+  o |  1: 112478962961 B
   |/
-  o  0: A
+  o  0: 426bada5c675 A
   
 Can collapse commits even if one is already in the right place
 
@@ -58,16 +58,16 @@
   > EOF
   rebasing 2:b18e25de2cf5 "D" (D)
   rebasing 3:26805aba1e60 "C" (C tip)
-  o  4: Collapsed revision
+  o  4: a2493f4ace65 Collapsed revision
   |  * D
   |  * C
-  | x  3: C
+  | x  3: 26805aba1e60 C
   |/
-  | x  2: D
+  | x  2: b18e25de2cf5 D
   | |
-  o |  1: B
+  o |  1: 112478962961 B
   |/
-  o  0: A
+  o  0: 426bada5c675 A
   
 Rebase with "holes". The commits after the hole should end up on the parent of
 the hole (B below), not on top of the destination (A).
@@ -83,13 +83,13 @@
   > EOF
   already rebased 1:112478962961 "B" (B)
   rebasing 3:f585351a92f8 "D" (D tip)
-  o  4: D
+  o  4: 1e6da8103bc7 D
   |
-  | x  3: D
+  | x  3: f585351a92f8 D
   | |
-  | o  2: C
+  | o  2: 26805aba1e60 C
   |/
-  o  1: B
+  o  1: 112478962961 B
   |
-  o  0: A
+  o  0: 426bada5c675 A
   
--- a/tests/test-rebase-pull.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-pull.t	Tue Dec 19 16:27:24 2017 -0500
@@ -4,7 +4,7 @@
   > histedit=
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
   > EOF
 
 
@@ -48,7 +48,7 @@
 Now b has one revision to be pulled from a:
 
   $ hg pull --rebase
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
@@ -56,21 +56,21 @@
   added 1 changesets with 1 changes to 1 files (+1 heads)
   new changesets 77ae9631bcca
   rebasing 2:ff8d69a621f9 "L1"
-  saved backup bundle to $TESTTMP/b/.hg/strip-backup/ff8d69a621f9-160fa373-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/b/.hg/strip-backup/ff8d69a621f9-160fa373-rebase.hg
 
   $ hg tglog
-  @  3: 'L1'
+  @  3: d80cc2da061e 'L1'
   |
-  o  2: 'R1'
+  o  2: 77ae9631bcca 'R1'
   |
-  o  1: 'C2'
+  o  1: 783333faa078 'C2'
   |
-  o  0: 'C1'
+  o  0: 05d58a0c15dd 'C1'
   
 Re-run:
 
   $ hg pull --rebase
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   no changes found
 
@@ -103,9 +103,9 @@
   $ hg clone --noupdate c d
   $ cd d
   $ hg tglog
-  o  1: 'C2'
+  o  1: 783333faa078 'C2'
   |
-  o  0: 'C1'
+  o  0: 05d58a0c15dd 'C1'
   
   $ hg update --quiet 0
   $ echo M1 > M1
@@ -138,7 +138,7 @@
 
   $ hg book norebase
   $ hg pull --rebase
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
@@ -150,14 +150,14 @@
   updating bookmark norebase
 
   $ hg tglog -l 1
-  @  2: 'R1'
+  @  2: 77ae9631bcca 'R1'
   |
   ~
 
 pull --rebase --update should ignore --update:
 
   $ hg pull --rebase --update
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   no changes found
 
@@ -166,12 +166,12 @@
   $ hg up -q 1
 
   $ hg pull --rebase
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   no changes found
 
   $ hg tglog -l 1
-  o  2: 'R1'
+  o  2: 77ae9631bcca 'R1'
   |
   ~
 
@@ -181,11 +181,11 @@
 
   $ cd a
   $ hg tglog
-  @  2: 'R1'
+  @  2: 77ae9631bcca 'R1'
   |
-  o  1: 'C2'
+  o  1: 783333faa078 'C2'
   |
-  o  0: 'C1'
+  o  0: 05d58a0c15dd 'C1'
   
   $ echo R2 > R2
   $ hg ci -Am R2
@@ -195,18 +195,18 @@
   adding R3
   $ cd ../c
   $ hg tglog
-  o  2: 'R1'
+  o  2: 77ae9631bcca 'R1'
   |
-  @  1: 'C2'
+  @  1: 783333faa078 'C2'
   |
-  o  0: 'C1'
+  o  0: 05d58a0c15dd 'C1'
   
   $ echo L1 > L1
   $ hg ci -Am L1
   adding L1
   created new head
   $ hg pull --rev tip --rebase
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
@@ -214,19 +214,19 @@
   added 2 changesets with 2 changes to 2 files
   new changesets 31cd3a05214e:770a61882ace
   rebasing 3:ff8d69a621f9 "L1"
-  saved backup bundle to $TESTTMP/c/.hg/strip-backup/ff8d69a621f9-160fa373-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/c/.hg/strip-backup/ff8d69a621f9-160fa373-rebase.hg
   $ hg tglog
-  @  5: 'L1'
+  @  5: 518d153c0ba3 'L1'
   |
-  o  4: 'R3'
+  o  4: 770a61882ace 'R3'
   |
-  o  3: 'R2'
+  o  3: 31cd3a05214e 'R2'
   |
-  o  2: 'R1'
+  o  2: 77ae9631bcca 'R1'
   |
-  o  1: 'C2'
+  o  1: 783333faa078 'C2'
   |
-  o  0: 'C1'
+  o  0: 05d58a0c15dd 'C1'
   
 pull --rebase works with bundle2 turned on
 
@@ -235,21 +235,21 @@
   $ hg ci -Am R4
   adding R4
   $ hg tglog
-  @  5: 'R4'
+  @  5: 00e3b7781125 'R4'
   |
-  o  4: 'R3'
+  o  4: 770a61882ace 'R3'
   |
-  o  3: 'R2'
+  o  3: 31cd3a05214e 'R2'
   |
-  o  2: 'R1'
+  o  2: 77ae9631bcca 'R1'
   |
-  o  1: 'C2'
+  o  1: 783333faa078 'C2'
   |
-  o  0: 'C1'
+  o  0: 05d58a0c15dd 'C1'
   
   $ cd ../c
   $ hg pull --rebase
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
@@ -257,21 +257,21 @@
   added 1 changesets with 1 changes to 1 files (+1 heads)
   new changesets 00e3b7781125
   rebasing 5:518d153c0ba3 "L1"
-  saved backup bundle to $TESTTMP/c/.hg/strip-backup/518d153c0ba3-73407f14-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/c/.hg/strip-backup/518d153c0ba3-73407f14-rebase.hg
   $ hg tglog
-  @  6: 'L1'
+  @  6: 0d0727eb7ce0 'L1'
   |
-  o  5: 'R4'
+  o  5: 00e3b7781125 'R4'
   |
-  o  4: 'R3'
+  o  4: 770a61882ace 'R3'
   |
-  o  3: 'R2'
+  o  3: 31cd3a05214e 'R2'
   |
-  o  2: 'R1'
+  o  2: 77ae9631bcca 'R1'
   |
-  o  1: 'C2'
+  o  1: 783333faa078 'C2'
   |
-  o  0: 'C1'
+  o  0: 05d58a0c15dd 'C1'
   
 
 pull --rebase only update if there is nothing to rebase
@@ -281,19 +281,19 @@
   $ hg ci -Am R5
   adding R5
   $ hg tglog
-  @  6: 'R5'
+  @  6: 88dd24261747 'R5'
   |
-  o  5: 'R4'
+  o  5: 00e3b7781125 'R4'
   |
-  o  4: 'R3'
+  o  4: 770a61882ace 'R3'
   |
-  o  3: 'R2'
+  o  3: 31cd3a05214e 'R2'
   |
-  o  2: 'R1'
+  o  2: 77ae9631bcca 'R1'
   |
-  o  1: 'C2'
+  o  1: 783333faa078 'C2'
   |
-  o  0: 'C1'
+  o  0: 05d58a0c15dd 'C1'
   
   $ cd ../c
   $ echo L2 > L2
@@ -302,7 +302,7 @@
   $ hg up 'desc(L1)'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg pull --rebase
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
@@ -311,25 +311,25 @@
   new changesets 88dd24261747
   rebasing 6:0d0727eb7ce0 "L1"
   rebasing 7:c1f58876e3bf "L2"
-  saved backup bundle to $TESTTMP/c/.hg/strip-backup/0d0727eb7ce0-ef61ccb2-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/c/.hg/strip-backup/0d0727eb7ce0-ef61ccb2-rebase.hg
   $ hg tglog
-  o  8: 'L2'
+  o  8: 6dc0ea5dcf55 'L2'
   |
-  @  7: 'L1'
+  @  7: 864e0a2d2614 'L1'
   |
-  o  6: 'R5'
+  o  6: 88dd24261747 'R5'
   |
-  o  5: 'R4'
+  o  5: 00e3b7781125 'R4'
   |
-  o  4: 'R3'
+  o  4: 770a61882ace 'R3'
   |
-  o  3: 'R2'
+  o  3: 31cd3a05214e 'R2'
   |
-  o  2: 'R1'
+  o  2: 77ae9631bcca 'R1'
   |
-  o  1: 'C2'
+  o  1: 783333faa078 'C2'
   |
-  o  0: 'C1'
+  o  0: 05d58a0c15dd 'C1'
   
 
 pull --rebase update (no rebase) use proper update:
@@ -344,7 +344,7 @@
   $ hg up 'desc(R5)'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg pull --rebase
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
@@ -356,25 +356,25 @@
   updated to "65bc164c1d9b: R6"
   1 other heads for branch "default"
   $ hg tglog
-  @  9: 'R6'
+  @  9: 65bc164c1d9b 'R6'
   |
-  | o  8: 'L2'
+  | o  8: 6dc0ea5dcf55 'L2'
   | |
-  | o  7: 'L1'
+  | o  7: 864e0a2d2614 'L1'
   |/
-  o  6: 'R5'
+  o  6: 88dd24261747 'R5'
   |
-  o  5: 'R4'
+  o  5: 00e3b7781125 'R4'
   |
-  o  4: 'R3'
+  o  4: 770a61882ace 'R3'
   |
-  o  3: 'R2'
+  o  3: 31cd3a05214e 'R2'
   |
-  o  2: 'R1'
+  o  2: 77ae9631bcca 'R1'
   |
-  o  1: 'C2'
+  o  1: 783333faa078 'C2'
   |
-  o  0: 'C1'
+  o  0: 05d58a0c15dd 'C1'
   
 
 Multiple pre-existing heads on the branch
@@ -394,7 +394,7 @@
   $ hg up 'desc(L2)'
   2 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg pull --rebase
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
@@ -421,7 +421,7 @@
   $ hg up 'desc(L2)'
   2 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg pull --rebase
-  pulling from $TESTTMP/a (glob)
+  pulling from $TESTTMP/a
   searching for changes
   adding changesets
   adding manifests
@@ -430,31 +430,31 @@
   new changesets f7d3e42052f9
   rebasing 7:864e0a2d2614 "L1"
   rebasing 8:6dc0ea5dcf55 "L2"
-  saved backup bundle to $TESTTMP/c/.hg/strip-backup/864e0a2d2614-2f72c89c-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/c/.hg/strip-backup/864e0a2d2614-2f72c89c-rebase.hg
   $ hg tglog
-  @  12: 'L2'
+  @  12: 3603a865eea0 'L2'
   |
-  o  11: 'L1'
+  o  11: bcc8a9cd04bf 'L1'
   |
-  o  10: 'R7'
+  o  10: f7d3e42052f9 'R7'
   |
-  | o  9: 'M1'
+  | o  9: 41fab4eef82f 'M1'
   |/
-  | o  8: 'B1' unrelatedbranch
+  | o  8: 39c381359968 'B1' unrelatedbranch
   |/
-  o  7: 'R6'
+  o  7: 65bc164c1d9b 'R6'
   |
-  o  6: 'R5'
+  o  6: 88dd24261747 'R5'
   |
-  o  5: 'R4'
+  o  5: 00e3b7781125 'R4'
   |
-  o  4: 'R3'
+  o  4: 770a61882ace 'R3'
   |
-  o  3: 'R2'
+  o  3: 31cd3a05214e 'R2'
   |
-  o  2: 'R1'
+  o  2: 77ae9631bcca 'R1'
   |
-  o  1: 'C2'
+  o  1: 783333faa078 'C2'
   |
-  o  0: 'C1'
+  o  0: 05d58a0c15dd 'C1'
   
--- a/tests/test-rebase-rename.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-rename.t	Tue Dec 19 16:27:24 2017 -0500
@@ -3,7 +3,7 @@
   > rebase=
   > 
   > [alias]
-  > tlog  = log  --template "{rev}: '{desc}' {branches}\n"
+  > tlog  = log --template "{rev}: {node|short} '{desc}' {branches}\n"
   > tglog = tlog --graph
   > EOF
 
@@ -21,7 +21,7 @@
   adding d/b
 
   $ hg mv d d-renamed
-  moving d/b to d-renamed/b (glob)
+  moving d/b to d-renamed/b
   $ hg ci -m 'rename B'
 
   $ hg up -q -C 1
@@ -34,19 +34,19 @@
   created new head
 
   $ hg tglog
-  @  3: 'rename A'
+  @  3: 73a3ee40125d 'rename A'
   |
-  | o  2: 'rename B'
+  | o  2: 220d0626d185 'rename B'
   |/
-  o  1: 'B'
+  o  1: 3ab5da9a5c01 'B'
   |
-  o  0: 'A'
+  o  0: 1994f17a630e 'A'
   
 
 Rename is tracked:
 
   $ hg tlog -p --git -r tip
-  3: 'rename A' 
+  3: 73a3ee40125d 'rename A' 
   diff --git a/a b/a-renamed
   rename from a
   rename to a-renamed
@@ -61,22 +61,22 @@
 
   $ hg rebase -s 3 -d 2
   rebasing 3:73a3ee40125d "rename A" (tip)
-  saved backup bundle to $TESTTMP/a/.hg/strip-backup/73a3ee40125d-1d78ebcf-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/73a3ee40125d-1d78ebcf-rebase.hg
 
   $ hg tglog
-  @  3: 'rename A'
+  @  3: 032a9b75e83b 'rename A'
   |
-  o  2: 'rename B'
+  o  2: 220d0626d185 'rename B'
   |
-  o  1: 'B'
+  o  1: 3ab5da9a5c01 'B'
   |
-  o  0: 'A'
+  o  0: 1994f17a630e 'A'
   
 
 Rename is not lost:
 
   $ hg tlog -p --git -r tip
-  3: 'rename A' 
+  3: 032a9b75e83b 'rename A' 
   diff --git a/a b/a-renamed
   rename from a
   rename to a-renamed
@@ -132,18 +132,18 @@
   created new head
 
   $ hg tglog
-  @  3: 'copy A'
+  @  3: 0a8162ff18a8 'copy A'
   |
-  | o  2: 'copy B'
+  | o  2: 39e588434882 'copy B'
   |/
-  o  1: 'B'
+  o  1: 6c81ed0049f8 'B'
   |
-  o  0: 'A'
+  o  0: 1994f17a630e 'A'
   
 Copy is tracked:
 
   $ hg tlog -p --git -r tip
-  3: 'copy A' 
+  3: 0a8162ff18a8 'copy A' 
   diff --git a/a b/a-copied
   copy from a
   copy to a-copied
@@ -152,22 +152,22 @@
 
   $ hg rebase -s 3 -d 2
   rebasing 3:0a8162ff18a8 "copy A" (tip)
-  saved backup bundle to $TESTTMP/b/.hg/strip-backup/0a8162ff18a8-dd06302a-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/b/.hg/strip-backup/0a8162ff18a8-dd06302a-rebase.hg
 
   $ hg tglog
-  @  3: 'copy A'
+  @  3: 98f6e6dbf45a 'copy A'
   |
-  o  2: 'copy B'
+  o  2: 39e588434882 'copy B'
   |
-  o  1: 'B'
+  o  1: 6c81ed0049f8 'B'
   |
-  o  0: 'A'
+  o  0: 1994f17a630e 'A'
   
 
 Copy is not lost:
 
   $ hg tlog -p --git -r tip
-  3: 'copy A' 
+  3: 98f6e6dbf45a 'copy A' 
   diff --git a/a b/a-copied
   copy from a
   copy to a-copied
@@ -223,20 +223,20 @@
   created new head
 
   $ hg tglog
-  @  4: 'Another unrelated change'
+  @  4: b918d683b091 'Another unrelated change'
   |
-  | o  3: 'Rename file2 back to file1'
+  | o  3: 1ac17e43d8aa 'Rename file2 back to file1'
   |/
-  o  2: 'Unrelated change'
+  o  2: 480101d66d8d 'Unrelated change'
   |
-  o  1: 'Rename file1 to file2'
+  o  1: be44c61debd2 'Rename file1 to file2'
   |
-  o  0: 'Adding file1'
+  o  0: 8ce9a346991d 'Adding file1'
   
 
   $ hg rebase -s 4 -d 3
   rebasing 4:b918d683b091 "Another unrelated change" (tip)
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/b918d683b091-3024bc57-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/b918d683b091-3024bc57-rebase.hg
 
   $ hg diff --stat -c .
    unrelated.txt |  1 +
@@ -263,13 +263,13 @@
 
 Note that there are four entries in the log for d
   $ hg tglog --follow d
-  @  3: 'File d created as copy of c and modified'
+  @  3: 421b7e82bb85 'File d created as copy of c and modified'
   |
-  o  2: 'File c created as copy of b and modified'
+  o  2: 327f772bc074 'File c created as copy of b and modified'
   |
-  o  1: 'File b created as copy of a and modified'
+  o  1: 79d255d24ad2 'File b created as copy of a and modified'
   |
-  o  0: 'File a created'
+  o  0: b220cd6d2326 'File a created'
   
 Update back to before we performed copies, and inject an unrelated change.
   $ hg update 0
@@ -287,19 +287,19 @@
   rebasing 1:79d255d24ad2 "File b created as copy of a and modified"
   rebasing 2:327f772bc074 "File c created as copy of b and modified"
   rebasing 3:421b7e82bb85 "File d created as copy of c and modified"
-  saved backup bundle to $TESTTMP/copy-gets-preserved/.hg/strip-backup/79d255d24ad2-a2265555-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/copy-gets-preserved/.hg/strip-backup/79d255d24ad2-a2265555-rebase.hg
   $ hg update 4
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 There should still be four entries in the log for d
   $ hg tglog --follow d
-  @  4: 'File d created as copy of c and modified'
+  @  4: dbb9ba033561 'File d created as copy of c and modified'
   |
-  o  3: 'File c created as copy of b and modified'
+  o  3: af74b229bc02 'File c created as copy of b and modified'
   |
-  o  2: 'File b created as copy of a and modified'
+  o  2: 68bf06433839 'File b created as copy of a and modified'
   :
-  o  0: 'File a created'
+  o  0: b220cd6d2326 'File a created'
   
 Same steps as above, but with --collapse on rebase to make sure the
 copy records collapse correctly.
@@ -314,7 +314,7 @@
   merging b and c to c
   rebasing 4:dbb9ba033561 "File d created as copy of c and modified"
   merging c and d to d
-  saved backup bundle to $TESTTMP/copy-gets-preserved/.hg/strip-backup/68bf06433839-dde37595-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/copy-gets-preserved/.hg/strip-backup/68bf06433839-dde37595-rebase.hg
   $ hg co tip
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
@@ -322,11 +322,11 @@
 copy of 'a'.
 
   $ hg tglog --follow d
-  @  3: 'Collapsed revision
+  @  3: 5a46b94210e5 'Collapsed revision
   :  * File b created as copy of a and modified
   :  * File c created as copy of b and modified
   :  * File d created as copy of c and modified'
-  o  0: 'File a created'
+  o  0: b220cd6d2326 'File a created'
   
 
   $ cd ..
--- a/tests/test-rebase-scenario-global.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-scenario-global.t	Tue Dec 19 16:27:24 2017 -0500
@@ -7,7 +7,7 @@
   > publish=False
   > 
   > [alias]
-  > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
+  > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
   > EOF
 
 
@@ -34,21 +34,21 @@
   $ cd a1
 
   $ hg tglog
-  @  7: 'H'
+  @  7: 02de42196ebe 'H'
   |
-  | o  6: 'G'
+  | o  6: eea13746799a 'G'
   |/|
-  o |  5: 'F'
+  o |  5: 24b6387c8c8c 'F'
   | |
-  | o  4: 'E'
+  | o  4: 9520eea781bc 'E'
   |/
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
 
   $ hg status --rev "3^1" --rev 3
@@ -66,27 +66,27 @@
   HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com>
   HG: branch 'default'
   HG: added D
-  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg
   $ cat D.orig
   collide
   $ rm D.orig
 
   $ hg tglog
-  o  7: 'D'
+  o  7: 1619f02ff7dd 'D'
   |
-  @  6: 'H'
+  @  6: 02de42196ebe 'H'
   |
-  | o  5: 'G'
+  | o  5: eea13746799a 'G'
   |/|
-  o |  4: 'F'
+  o |  4: 24b6387c8c8c 'F'
   | |
-  | o  3: 'E'
+  | o  3: 9520eea781bc 'E'
   |/
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -101,27 +101,27 @@
 
   $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg
   $ cat D.orig
   collide
   $ rm D.orig
 
   $ hg tglog
-  o  7: 'D'
+  o  7: 2107530e74ab 'D'
   |
-  | @  6: 'H'
+  | @  6: 02de42196ebe 'H'
   |/
-  | o  5: 'G'
+  | o  5: eea13746799a 'G'
   |/|
-  o |  4: 'F'
+  o |  4: 24b6387c8c8c 'F'
   | |
-  | o  3: 'E'
+  | o  3: 9520eea781bc 'E'
   |/
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -139,24 +139,24 @@
   rebasing 4:9520eea781bc "E"
   rebasing 6:eea13746799a "G"
   note: rebase of 6:eea13746799a created no changes to commit
-  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg
   $ f E.orig
   E.orig: file not found
 
   $ hg tglog
-  o  6: 'E'
+  o  6: 9f8b8ec77260 'E'
   |
-  @  5: 'H'
+  @  5: 02de42196ebe 'H'
   |
-  o  4: 'F'
+  o  4: 24b6387c8c8c 'F'
   |
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -171,22 +171,22 @@
   rebasing 6:eea13746799a "G"
   note: rebase of 6:eea13746799a created no changes to commit
   rebasing 7:02de42196ebe "H" (tip)
-  saved backup bundle to $TESTTMP/a4/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a4/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg
 
   $ hg tglog
-  @  6: 'H'
+  @  6: e9240aeaa6ad 'H'
   |
-  o  5: 'F'
+  o  5: 5d0ccadb6e3e 'F'
   |
-  o  4: 'E'
+  o  4: 9520eea781bc 'E'
   |
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -198,24 +198,24 @@
 
   $ hg rebase -s 6 -d 7
   rebasing 6:eea13746799a "G"
-  saved backup bundle to $TESTTMP/a5/.hg/strip-backup/eea13746799a-883828ed-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a5/.hg/strip-backup/eea13746799a-883828ed-rebase.hg
 
   $ hg tglog
-  o    7: 'G'
+  o    7: 397834907a90 'G'
   |\
-  | @  6: 'H'
+  | @  6: 02de42196ebe 'H'
   | |
-  | o  5: 'F'
+  | o  5: 24b6387c8c8c 'F'
   | |
-  o |  4: 'E'
+  o |  4: 9520eea781bc 'E'
   |/
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -229,24 +229,24 @@
   rebasing 5:24b6387c8c8c "F"
   rebasing 6:eea13746799a "G"
   rebasing 7:02de42196ebe "H" (tip)
-  saved backup bundle to $TESTTMP/a6/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a6/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg
 
   $ hg tglog
-  @  7: 'H'
+  @  7: c87be72f9641 'H'
   |
-  | o  6: 'G'
+  | o  6: 17badd73d4f1 'G'
   |/|
-  o |  5: 'F'
+  o |  5: 74fb9ed646c4 'F'
   | |
-  | o  4: 'E'
+  | o  4: 9520eea781bc 'E'
   | |
-  | | o  3: 'D'
+  | | o  3: 32af7686d403 'D'
   | | |
-  +---o  2: 'C'
+  +---o  2: 5fddd98957c8 'C'
   | |
-  o |  1: 'B'
+  o |  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
   $ cd ..
 
@@ -302,23 +302,23 @@
   $ hg rebase -d 0 -s 2
   rebasing 2:5fddd98957c8 "C"
   rebasing 3:32af7686d403 "D"
-  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
   $ hg tglog
-  o  7: 'D'
+  o  7: c9659aac0000 'D'
   |
-  o  6: 'C'
+  o  6: e1c4361dd923 'C'
   |
-  | @  5: 'H'
+  | @  5: 02de42196ebe 'H'
   | |
-  | | o  4: 'G'
+  | | o  4: eea13746799a 'G'
   | |/|
-  | o |  3: 'F'
+  | o |  3: 24b6387c8c8c 'F'
   |/ /
-  | o  2: 'E'
+  | o  2: 9520eea781bc 'E'
   |/
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
 
 Check rebasing public changeset
@@ -346,31 +346,31 @@
   5
   $ hg rebase -s9 -d0
   rebasing 9:2b23e52411f4 "D" (tip)
-  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-rebase.hg
   $ hg id -n # check we updated back to parent
   5
   $ hg log --template "{phase}\n" -r 9
   draft
   $ hg rebase -s9 -d1
   rebasing 9:2cb10d0cfc6c "D" (tip)
-  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-rebase.hg
   $ hg log --template "{phase}\n" -r 9
   draft
   $ hg phase --force --secret 9
   $ hg rebase -s9 -d0
   rebasing 9:c5b12b67163a "D" (tip)
-  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-rebase.hg
   $ hg log --template "{phase}\n" -r 9
   secret
   $ hg rebase -s9 -d1
   rebasing 9:2a0524f868ac "D" (tip)
-  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-rebase.hg
   $ hg log --template "{phase}\n" -r 9
   secret
 Source phase lower than destination phase: new changeset get the phase of destination:
   $ hg rebase -s8 -d9
   rebasing 8:6d4f22462821 "C"
-  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-rebase.hg
   $ hg log --template "{phase}\n" -r 'rev(9)'
   secret
 
@@ -399,7 +399,7 @@
   
   $ hg rebase -s 1 -d 2
   rebasing 1:d2ae7f538514 "b"
-  saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/d2ae7f538514-2953539b-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/d2ae7f538514-2953539b-rebase.hg
   $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n'
   o  2:c882 draft b
   |
@@ -424,23 +424,23 @@
   new changesets 9ae2ed22e576:479ddb54a924
   (run 'hg heads' to see heads, 'hg merge' to merge)
   $ hg tglog
-  o  8: 'I'
+  o  8: 479ddb54a924 'I'
   |
-  o  7: 'H'
+  o  7: 72434a4e60b0 'H'
   |
-  o  6: 'G'
+  o  6: 3d8a618087a7 'G'
   |
-  | o  5: 'F'
+  | o  5: 41bfcc75ed73 'F'
   | |
-  | o  4: 'E'
+  | o  4: c01897464e7f 'E'
   |/
-  o  3: 'D'
+  o  3: ffd453c31098 'D'
   |
-  o  2: 'C'
+  o  2: c9e50f6cdc55 'C'
   |
-  | o  1: 'B'
+  | o  1: 8fd0f7e49f53 'B'
   |/
-  o  0: 'A'
+  o  0: 9ae2ed22e576 'A'
   
   $ cd ..
 
@@ -462,33 +462,33 @@
   rebasing 7:72434a4e60b0 "H"
   rebasing 8:479ddb54a924 "I" (tip)
   $ hg tglog
-  o  13: 'I'
+  o  13: 9bf1d9358a90 'I'
   |
-  o  12: 'H'
+  o  12: 274623a778d4 'H'
   |
-  o  11: 'G'
+  o  11: ab8c8617c8e8 'G'
   |
-  o  10: 'D'
+  o  10: c8cbf59f70da 'D'
   |
-  o  9: 'C'
+  o  9: 563e4faab485 'C'
   |
-  | o  8: 'I'
+  | o  8: 479ddb54a924 'I'
   | |
-  | o  7: 'H'
+  | o  7: 72434a4e60b0 'H'
   | |
-  | o  6: 'G'
+  | o  6: 3d8a618087a7 'G'
   | |
-  | | o  5: 'F'
+  | | o  5: 41bfcc75ed73 'F'
   | | |
-  | | o  4: 'E'
+  | | o  4: c01897464e7f 'E'
   | |/
-  | o  3: 'D'
+  | o  3: ffd453c31098 'D'
   | |
-  | o  2: 'C'
+  | o  2: c9e50f6cdc55 'C'
   | |
-  o |  1: 'B'
+  o |  1: 8fd0f7e49f53 'B'
   |/
-  o  0: 'A'
+  o  0: 9ae2ed22e576 'A'
   
 
   $ cd ..
@@ -507,31 +507,31 @@
   rebasing 7:72434a4e60b0 "H"
   rebasing 8:479ddb54a924 "I" (tip)
   $ hg tglog
-  o  12: 'I'
+  o  12: 9d7da0053b1c 'I'
   |
-  o  11: 'H'
+  o  11: 8fbd00952cbc 'H'
   |
-  o  10: 'G'
+  o  10: 51d434a615ee 'G'
   |
-  o  9: 'D'
+  o  9: a9c125634b0b 'D'
   |
-  | o  8: 'I'
+  | o  8: 479ddb54a924 'I'
   | |
-  | o  7: 'H'
+  | o  7: 72434a4e60b0 'H'
   | |
-  | o  6: 'G'
+  | o  6: 3d8a618087a7 'G'
   | |
-  | | o  5: 'F'
+  | | o  5: 41bfcc75ed73 'F'
   | | |
-  | | o  4: 'E'
+  | | o  4: c01897464e7f 'E'
   | |/
-  | o  3: 'D'
+  | o  3: ffd453c31098 'D'
   | |
-  | o  2: 'C'
+  | o  2: c9e50f6cdc55 'C'
   | |
-  o |  1: 'B'
+  o |  1: 8fd0f7e49f53 'B'
   |/
-  o  0: 'A'
+  o  0: 9ae2ed22e576 'A'
   
 
   $ cd ..
@@ -549,29 +549,29 @@
   rebasing 6:3d8a618087a7 "G"
   rebasing 7:72434a4e60b0 "H"
   $ hg tglog
-  o  11: 'H'
+  o  11: 8fbd00952cbc 'H'
   |
-  o  10: 'G'
+  o  10: 51d434a615ee 'G'
   |
-  o  9: 'D'
+  o  9: a9c125634b0b 'D'
   |
-  | o  8: 'I'
+  | o  8: 479ddb54a924 'I'
   | |
-  | o  7: 'H'
+  | o  7: 72434a4e60b0 'H'
   | |
-  | o  6: 'G'
+  | o  6: 3d8a618087a7 'G'
   | |
-  | | o  5: 'F'
+  | | o  5: 41bfcc75ed73 'F'
   | | |
-  | | o  4: 'E'
+  | | o  4: c01897464e7f 'E'
   | |/
-  | o  3: 'D'
+  | o  3: ffd453c31098 'D'
   | |
-  | o  2: 'C'
+  | o  2: c9e50f6cdc55 'C'
   | |
-  o |  1: 'B'
+  o |  1: 8fd0f7e49f53 'B'
   |/
-  o  0: 'A'
+  o  0: 9ae2ed22e576 'A'
   
 
   $ cd ..
@@ -591,33 +591,33 @@
   rebasing 6:3d8a618087a7 "G"
   rebasing 7:72434a4e60b0 "H"
   $ hg tglog
-  o  13: 'H'
+  o  13: 8fbd00952cbc 'H'
   |
-  o  12: 'G'
+  o  12: 51d434a615ee 'G'
   |
-  | o  11: 'F'
+  | o  11: df23d8bda0b7 'F'
   | |
-  | o  10: 'E'
+  | o  10: 47b7889448ff 'E'
   |/
-  o  9: 'D'
+  o  9: a9c125634b0b 'D'
   |
-  | o  8: 'I'
+  | o  8: 479ddb54a924 'I'
   | |
-  | o  7: 'H'
+  | o  7: 72434a4e60b0 'H'
   | |
-  | o  6: 'G'
+  | o  6: 3d8a618087a7 'G'
   | |
-  | | o  5: 'F'
+  | | o  5: 41bfcc75ed73 'F'
   | | |
-  | | o  4: 'E'
+  | | o  4: c01897464e7f 'E'
   | |/
-  | o  3: 'D'
+  | o  3: ffd453c31098 'D'
   | |
-  | o  2: 'C'
+  | o  2: c9e50f6cdc55 'C'
   | |
-  o |  1: 'B'
+  o |  1: 8fd0f7e49f53 'B'
   |/
-  o  0: 'A'
+  o  0: 9ae2ed22e576 'A'
   
 
   $ cd ..
@@ -632,25 +632,25 @@
   rebasing 6:3d8a618087a7 "G"
   rebasing 7:72434a4e60b0 "H"
   rebasing 8:479ddb54a924 "I" (tip)
-  saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-rebase.hg
   $ hg tglog
-  o  8: 'I'
+  o  8: fcb52e68a694 'I'
   |
-  o  7: 'H'
+  o  7: 77bd65cd7600 'H'
   |
-  o  6: 'G'
+  o  6: 12d0e738fb18 'G'
   |
-  | o  5: 'F'
+  | o  5: 41bfcc75ed73 'F'
   | |
-  | o  4: 'E'
+  | o  4: c01897464e7f 'E'
   | |
-  | o  3: 'D'
+  | o  3: ffd453c31098 'D'
   |/
-  o  2: 'C'
+  o  2: c9e50f6cdc55 'C'
   |
-  | o  1: 'B'
+  | o  1: 8fd0f7e49f53 'B'
   |/
-  o  0: 'A'
+  o  0: 9ae2ed22e576 'A'
   
   $ cd ..
 
@@ -667,25 +667,25 @@
   rebasing 6:3d8a618087a7 "G"
   rebasing 7:72434a4e60b0 "H"
   rebasing 8:479ddb54a924 "I" (tip)
-  saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-rebase.hg
   $ hg tglog
-  o  8: 'I'
+  o  8: 9136df9a87cf 'I'
   |
-  o  7: 'H'
+  o  7: 23e8f30da832 'H'
   |
-  o  6: 'G'
+  o  6: b0efe8534e8b 'G'
   |
-  | o  5: 'F'
+  | o  5: 6eb5b496ab79 'F'
   | |
-  | o  4: 'E'
+  | o  4: d15eade9b0b1 'E'
   |/
-  | o  3: 'D'
+  | o  3: ffd453c31098 'D'
   | |
-  | o  2: 'C'
+  | o  2: c9e50f6cdc55 'C'
   | |
-  o |  1: 'B'
+  o |  1: 8fd0f7e49f53 'B'
   |/
-  o  0: 'A'
+  o  0: 9ae2ed22e576 'A'
   
   $ cd ..
 
@@ -709,34 +709,34 @@
   $ hg add K
   $ hg commit -m K
   $ hg tglog
-  @  10: 'K'
+  @  10: 23a4ace37988 'K'
   |
-  o  9: 'J'
+  o  9: 1301922eeb0c 'J'
   |
-  | o  8: 'I'
+  | o  8: e7ec4e813ba6 'I'
   | |
-  | o  7: 'H'
+  | o  7: 02de42196ebe 'H'
   | |
-  +---o  6: 'G'
+  +---o  6: eea13746799a 'G'
   | |/
-  | o  5: 'F'
+  | o  5: 24b6387c8c8c 'F'
   | |
-  o |  4: 'E'
+  o |  4: 9520eea781bc 'E'
   |/
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
 (actual test)
 
   $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)'
   rebasing 8:e7ec4e813ba6 "I"
   rebasing 10:23a4ace37988 "K" (tip)
-  saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-rebase.hg
   $ hg log --rev 'children(desc(G))'
   changeset:   9:adb617877056
   parent:      6:eea13746799a
@@ -752,27 +752,27 @@
   summary:     K
   
   $ hg tglog
-  @  10: 'K'
+  @  10: 882431a34a0e 'K'
   |
-  | o  9: 'I'
+  | o  9: adb617877056 'I'
   |/
-  | o  8: 'J'
+  | o  8: 1301922eeb0c 'J'
   | |
-  | | o  7: 'H'
+  | | o  7: 02de42196ebe 'H'
   | | |
-  o---+  6: 'G'
+  o---+  6: eea13746799a 'G'
   |/ /
-  | o  5: 'F'
+  | o  5: 24b6387c8c8c 'F'
   | |
-  o |  4: 'E'
+  o |  4: 9520eea781bc 'E'
   |/
-  | o  3: 'D'
+  | o  3: 32af7686d403 'D'
   | |
-  | o  2: 'C'
+  | o  2: 5fddd98957c8 'C'
   | |
-  | o  1: 'B'
+  | o  1: 42ccdea3bb16 'B'
   |/
-  o  0: 'A'
+  o  0: cd010b8cd998 'A'
   
 
 Test that rebase is not confused by $CWD disappearing during rebase (issue4121)
@@ -803,7 +803,7 @@
   current directory was removed (rmcwd !)
   (consider changing to repo root: $TESTTMP/cwd-vanish) (rmcwd !)
   rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip)
-  saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-rebase.hg
 
 Get back to the root of cwd-vanish. Note that even though `cd ..`
 works on most systems, it does not work on FreeBSD 10, so we use an
@@ -833,19 +833,19 @@
   created new head
 
   $ hg tglog
-  @  6: 'G'
+  @  6: 124bb27b6f28 'G'
   |
-  | o  5: 'F'
+  | o  5: 412b391de760 'F'
   | |
-  | | o  4: 'E'
+  | | o  4: 82ae8dc7a9b7 'E'
   | | |
-  | o |  3: 'D'
+  | o |  3: ab709c9f7171 'D'
   | | |
-  | | o  2: 'C'
+  | | o  2: d84f5cfaaf14 'C'
   | |/
-  | o  1: 'B'
+  | o  1: 76035bbd54bd 'B'
   |/
-  o  0: 'A'
+  o  0: 216878401574 'A'
   
 
   $ hg rebase -s 1 -d 6
@@ -854,22 +854,22 @@
   rebasing 4:82ae8dc7a9b7 "E"
   rebasing 3:ab709c9f7171 "D"
   rebasing 5:412b391de760 "F"
-  saved backup bundle to $TESTTMP/order/.hg/strip-backup/76035bbd54bd-e341bc99-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/order/.hg/strip-backup/76035bbd54bd-e341bc99-rebase.hg
 
   $ hg tglog
-  o  6: 'F'
+  o  6: 31884cfb735e 'F'
   |
-  o  5: 'D'
+  o  5: 6d89fa5b0909 'D'
   |
-  | o  4: 'E'
+  | o  4: de64d97c697b 'E'
   | |
-  | o  3: 'C'
+  | o  3: b18e4d2d0aa1 'C'
   |/
-  o  2: 'B'
+  o  2: 0983daf9ff6a 'B'
   |
-  @  1: 'G'
+  @  1: 124bb27b6f28 'G'
   |
-  o  0: 'A'
+  o  0: 216878401574 'A'
   
 
 Test experimental revset
--- a/tests/test-rebase-templates.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rebase-templates.t	Tue Dec 19 16:27:24 2017 -0500
@@ -42,3 +42,16 @@
   
   $ hg rebase -s 1 -d 5 -q -T "{nodechanges|json}"
   {"29becc82797a4bc11ec8880b58eaecd2ab3e7760": ["d9d6773efc831c274eace04bc13e8e6412517139"]} (no-eol)
+
+  $ hg log -G -T "{rev}:{node|short} {desc}"
+  o  6:d9d6773efc83 Added b
+  |
+  @  5:df21b32134ba Added d
+  |
+  o  4:849767420fd5 Added c
+  |
+  o  0:18d04c59bb5d Added a
+  
+
+  $ hg rebase -s 6 -d 4 -q -T "{nodechanges % '{oldnode}:{newnodes % ' {node} '}'}"
+  d9d6773efc831c274eace04bc13e8e6412517139: f48cd65c6dc3d2acb55da54402a5b029546e546f  (no-eol)
--- a/tests/test-relink.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-relink.t	Tue Dec 19 16:27:24 2017 -0500
@@ -43,7 +43,7 @@
 don't sit forever trying to double-lock the source repo
 
   $ hg relink .
-  relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store (glob)
+  relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store
   there is nothing to relink
 
 
--- a/tests/test-remove.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-remove.t	Tue Dec 19 16:27:24 2017 -0500
@@ -189,9 +189,9 @@
                                                               \r (no-eol) (esc)
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-21 state clean, options -A
+21 state clean, options -Av
 
-  $ remove -A foo
+  $ remove -Av foo
   \r (no-eol) (esc)
   deleting [===========================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
@@ -205,10 +205,10 @@
   ./foo
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-22 state modified, options -A
+22 state modified, options -Av
 
   $ echo b >> foo
-  $ remove -A foo
+  $ remove -Av foo
   \r (no-eol) (esc)
   deleting [===========================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
@@ -322,8 +322,8 @@
   \r (no-eol) (esc)
   deleting [===========================================>] 2/2\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
-  removing test/bar (glob)
-  removing test/foo (glob)
+  removing test/bar
+  removing test/foo
   exit code: 0
   R test/bar
   R test/foo
@@ -346,8 +346,8 @@
   \r (no-eol) (esc)
   deleting [===========================================>] 2/2\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
-  removing test/bar (glob)
-  removing test/foo (glob)
+  removing test/bar
+  removing test/foo
   exit code: 0
   R test/bar
   R test/foo
@@ -357,9 +357,32 @@
                                                               \r (no-eol) (esc)
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-dir, options -A
+dir, options -Av
 
   $ rm test/bar
+  $ remove -Av test
+  \r (no-eol) (esc)
+  deleting [===========================================>] 1/1\r (no-eol) (esc)
+                                                              \r (no-eol) (esc)
+  \r (no-eol) (esc)
+  skipping [===========================================>] 1/1\r (no-eol) (esc)
+                                                              \r (no-eol) (esc)
+  \r (no-eol) (esc)
+  deleting [===========================================>] 1/1\r (no-eol) (esc)
+                                                              \r (no-eol) (esc)
+  removing test/bar
+  not removing test/foo: file still exists
+  exit code: 1
+  R test/bar
+  ./foo
+  ./test/foo
+  \r (no-eol) (esc)
+  updating [===========================================>] 1/1\r (no-eol) (esc)
+                                                              \r (no-eol) (esc)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+dir, options -A <dir>
+  $ rm test/bar
   $ remove -A test
   \r (no-eol) (esc)
   deleting [===========================================>] 1/1\r (no-eol) (esc)
@@ -370,8 +393,27 @@
   \r (no-eol) (esc)
   deleting [===========================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
-  removing test/bar (glob)
-  not removing test/foo: file still exists (glob)
+  removing test/bar
+  exit code: 1
+  R test/bar
+  ./foo
+  ./test/foo
+  \r (no-eol) (esc)
+  updating [===========================================>] 1/1\r (no-eol) (esc)
+                                                              \r (no-eol) (esc)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+without any files/dirs, options -A
+  $ rm test/bar
+  $ remove -A
+  \r (no-eol) (esc)
+  skipping [=====================>                      ] 1/2\r (no-eol) (esc)
+  skipping [===========================================>] 2/2\r (no-eol) (esc)
+                                                              \r (no-eol) (esc)
+  \r (no-eol) (esc)
+  deleting [===========================================>] 1/1\r (no-eol) (esc)
+                                                              \r (no-eol) (esc)
+  removing test/bar
   exit code: 1
   R test/bar
   ./foo
@@ -394,8 +436,8 @@
   \r (no-eol) (esc)
   deleting [===========================================>] 2/2\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
-  removing test/bar (glob)
-  removing test/foo (glob)
+  removing test/bar
+  removing test/foo
   exit code: 0
   R test/bar
   R test/foo
@@ -421,7 +463,7 @@
   \r (no-eol) (esc)
   deleting [===========================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
-  removing issue1861/b/c/y (glob)
+  removing issue1861/b/c/y
   $ hg ci -m remove
   $ ls issue1861
   x
@@ -455,7 +497,7 @@
   \r (no-eol) (esc)
   deleting [===========================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
-  removing d1/a (glob)
+  removing d1/a
 
   $ hg rm --after nosuch
   nosuch: * (glob)
--- a/tests/test-rename-dir-merge.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rename-dir-merge.t	Tue Dec 19 16:27:24 2017 -0500
@@ -11,8 +11,8 @@
   $ hg co -C 0
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg mv a b
-  moving a/a to b/a (glob)
-  moving a/b to b/b (glob)
+  moving a/a to b/a
+  moving a/b to b/b
   $ hg ci -m "1 mv a/ b/"
 
   $ hg co -C 0
@@ -48,7 +48,7 @@
    b/b: remote created -> g
   getting b/b
    b/c: remote directory rename - move from a/c -> dm
-  moving a/c to b/c (glob)
+  moving a/c to b/c
   3 files updated, 0 files merged, 2 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
 
@@ -65,7 +65,7 @@
   ? a/d
   $ hg ci -m "3 merge 2+1"
   $ hg debugrename b/c
-  b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
+  b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88
 
   $ hg co -C 1
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -100,7 +100,7 @@
   $ hg ci -m "4 merge 1+2"
   created new head
   $ hg debugrename b/c
-  b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
+  b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88
 
 Local directory rename with conflicting file added in remote source directory
 and untracked in local target directory.
@@ -191,7 +191,7 @@
   $ mkdir a
   $ echo foo > a/f
   $ hg add a
-  adding a/f (glob)
+  adding a/f
   $ hg ci -m "a/f == foo"
   $ cd ..
 
@@ -200,7 +200,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd r2
   $ hg mv a b
-  moving a/f to b/f (glob)
+  moving a/f to b/f
   $ echo foo1 > b/f
   $ hg ci -m" a -> b, b/f == foo1"
   $ cd ..
@@ -209,7 +209,7 @@
   $ mkdir a/aa
   $ echo bar > a/aa/g
   $ hg add a/aa
-  adding a/aa/g (glob)
+  adding a/aa/g
   $ hg ci -m "a/aa/g"
   $ hg pull ../r2
   pulling from ../r2
--- a/tests/test-rename.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-rename.t	Tue Dec 19 16:27:24 2017 -0500
@@ -70,7 +70,7 @@
 rename --after a single file to a nonexistent target filename
 
   $ hg rename --after d1/a dummy
-  d1/a: not recording move - dummy does not exist (glob)
+  d1/a: not recording move - dummy does not exist
 
 move a single file to an existing directory
 
@@ -120,10 +120,10 @@
 rename directory d1 as d3
 
   $ hg rename d1/ d3
-  moving d1/a to d3/a (glob)
-  moving d1/b to d3/b (glob)
-  moving d1/ba to d3/ba (glob)
-  moving d1/d11/a1 to d3/d11/a1 (glob)
+  moving d1/a to d3/a
+  moving d1/b to d3/b
+  moving d1/ba to d3/ba
+  moving d1/d11/a1 to d3/d11/a1
   $ hg status -C
   A d3/a
     d1/a
@@ -145,10 +145,10 @@
 
   $ mv d1 d3
   $ hg rename --after d1 d3
-  moving d1/a to d3/a (glob)
-  moving d1/b to d3/b (glob)
-  moving d1/ba to d3/ba (glob)
-  moving d1/d11/a1 to d3/d11/a1 (glob)
+  moving d1/a to d3/a
+  moving d1/b to d3/b
+  moving d1/ba to d3/ba
+  moving d1/d11/a1 to d3/d11/a1
   $ hg status -C
   A d3/a
     d1/a
@@ -169,7 +169,7 @@
 move a directory using a relative path
 
   $ (cd d2; mkdir d3; hg rename ../d1/d11 d3)
-  moving ../d1/d11/a1 to d3/d11/a1 (glob)
+  moving ../d1/d11/a1 to d3/d11/a1
   $ hg status -C
   A d2/d3/d11/a1
     d1/d11/a1
@@ -181,7 +181,7 @@
 move --after a directory using a relative path
 
   $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
-  moving ../d1/d11/a1 to d3/d11/a1 (glob)
+  moving ../d1/d11/a1 to d3/d11/a1
   $ hg status -C
   A d2/d3/d11/a1
     d1/d11/a1
@@ -193,7 +193,7 @@
 move directory d1/d11 to an existing directory d2 (removes empty d1)
 
   $ hg rename d1/d11/ d2
-  moving d1/d11/a1 to d2/d11/a1 (glob)
+  moving d1/d11/a1 to d2/d11/a1
   $ hg status -C
   A d2/d11/a1
     d1/d11/a1
@@ -206,11 +206,11 @@
 
   $ mkdir d3
   $ hg rename d1 d2 d3
-  moving d1/a to d3/d1/a (glob)
-  moving d1/b to d3/d1/b (glob)
-  moving d1/ba to d3/d1/ba (glob)
-  moving d1/d11/a1 to d3/d1/d11/a1 (glob)
-  moving d2/b to d3/d2/b (glob)
+  moving d1/a to d3/d1/a
+  moving d1/b to d3/d1/b
+  moving d1/ba to d3/d1/ba
+  moving d1/d11/a1 to d3/d1/d11/a1
+  moving d2/b to d3/d2/b
   $ hg status -C
   A d3/d1/a
     d1/a
@@ -236,11 +236,11 @@
   $ mkdir d3
   $ mv d1 d2 d3
   $ hg rename --after d1 d2 d3
-  moving d1/a to d3/d1/a (glob)
-  moving d1/b to d3/d1/b (glob)
-  moving d1/ba to d3/d1/ba (glob)
-  moving d1/d11/a1 to d3/d1/d11/a1 (glob)
-  moving d2/b to d3/d2/b (glob)
+  moving d1/a to d3/d1/a
+  moving d1/b to d3/d1/b
+  moving d1/ba to d3/d1/ba
+  moving d1/d11/a1 to d3/d1/d11/a1
+  moving d2/b to d3/d2/b
   $ hg status -C
   A d3/d1/a
     d1/a
@@ -267,7 +267,7 @@
   $ hg rename d1/* d2
   d2/b: not overwriting - file already committed
   (hg rename --force to replace the file by recording a rename)
-  moving d1/d11/a1 to d2/d11/a1 (glob)
+  moving d1/d11/a1 to d2/d11/a1
   $ hg status -C
   A d2/a
     d1/a
@@ -304,14 +304,14 @@
   abort: with multiple sources, destination must be an existing directory
   [255]
 
-move every file under d1 to d2/d21 (glob)
+move every file under d1 to d2/d21
 
   $ mkdir d2/d21
   $ hg rename 'glob:d1/**' d2/d21
-  moving d1/a to d2/d21/a (glob)
-  moving d1/b to d2/d21/b (glob)
-  moving d1/ba to d2/d21/ba (glob)
-  moving d1/d11/a1 to d2/d21/a1 (glob)
+  moving d1/a to d2/d21/a
+  moving d1/b to d2/d21/b
+  moving d1/ba to d2/d21/ba
+  moving d1/d11/a1 to d2/d21/a1
   $ hg status -C
   A d2/d21/a
     d1/a
@@ -329,15 +329,15 @@
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ rm -rf d2/d21
 
-move --after some files under d1 to d2/d21 (glob)
+move --after some files under d1 to d2/d21
 
   $ mkdir d2/d21
   $ mv d1/a d1/d11/a1 d2/d21
   $ hg rename --after 'glob:d1/**' d2/d21
-  moving d1/a to d2/d21/a (glob)
-  d1/b: not recording move - d2/d21/b does not exist (glob)
-  d1/ba: not recording move - d2/d21/ba does not exist (glob)
-  moving d1/d11/a1 to d2/d21/a1 (glob)
+  moving d1/a to d2/d21/a
+  d1/b: not recording move - d2/d21/b does not exist
+  d1/ba: not recording move - d2/d21/ba does not exist
+  moving d1/d11/a1 to d2/d21/a1
   $ hg status -C
   A d2/d21/a
     d1/a
@@ -353,8 +353,8 @@
 
   $ mkdir d2/d21
   $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
-  moving d1/a to d2/d21/a (glob)
-  moving d1/d11/a1 to d2/d21/a1 (glob)
+  moving d1/a to d2/d21/a
+  moving d1/d11/a1 to d2/d21/a1
   $ hg status -C
   A d2/d21/a
     d1/a
@@ -419,7 +419,7 @@
 
   $ mkdir d3
   $ hg rename d1/* d2/* d3
-  moving d1/d11/a1 to d3/d11/a1 (glob)
+  moving d1/d11/a1 to d3/d11/a1
   d3/b: not overwriting - d2/b collides with d1/b
   $ hg status -C
   A d3/a
@@ -445,7 +445,7 @@
   moving a to ../d3/d1/a
   moving b to ../d3/d1/b
   moving ba to ../d3/d1/ba
-  moving d11/a1 to ../d3/d1/d11/a1 (glob)
+  moving d11/a1 to ../d3/d1/d11/a1
   $ hg status -C
   A d3/d1/a
     d1/a
@@ -471,7 +471,7 @@
   moving a to ../d3/a
   moving b to ../d3/b
   moving ba to ../d3/ba
-  moving d11/a1 to ../d3/d11/a1 (glob)
+  moving d11/a1 to ../d3/d11/a1
   $ hg status -C
   A d3/a
     d1/a
@@ -492,9 +492,9 @@
 move the parent tree with "hg rename .."
 
   $ (cd d1/d11; hg rename .. ../../d3)
-  moving ../a to ../../d3/a (glob)
-  moving ../b to ../../d3/b (glob)
-  moving ../ba to ../../d3/ba (glob)
+  moving ../a to ../../d3/a
+  moving ../b to ../../d3/b
+  moving ../ba to ../../d3/ba
   moving a1 to ../../d3/d11/a1
   $ hg status -C
   A d3/a
@@ -517,9 +517,9 @@
 
   $ hg remove d1/b
   $ hg rename d1 d3
-  moving d1/a to d3/a (glob)
-  moving d1/ba to d3/ba (glob)
-  moving d1/d11/a1 to d3/d11/a1 (glob)
+  moving d1/a to d3/a
+  moving d1/ba to d3/ba
+  moving d1/d11/a1 to d3/d11/a1
   $ hg status -C
   A d3/a
     d1/a
@@ -603,7 +603,7 @@
 check illegal path components
 
   $ hg rename d1/d11/a1 .hg/foo
-  abort: path contains illegal component: .hg/foo (glob)
+  abort: path contains illegal component: .hg/foo
   [255]
   $ hg status -C
   $ hg rename d1/d11/a1 ../foo
@@ -613,7 +613,7 @@
 
   $ mv d1/d11/a1 .hg/foo
   $ hg rename --after d1/d11/a1 .hg/foo
-  abort: path contains illegal component: .hg/foo (glob)
+  abort: path contains illegal component: .hg/foo
   [255]
   $ hg status -C
   ! d1/d11/a1
@@ -622,25 +622,25 @@
   $ rm .hg/foo
 
   $ hg rename d1/d11/a1 .hg
-  abort: path contains illegal component: .hg/a1 (glob)
+  abort: path contains illegal component: .hg/a1
   [255]
   $ hg --config extensions.largefiles= rename d1/d11/a1 .hg
   The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
-  abort: path contains illegal component: .hg/a1 (glob)
+  abort: path contains illegal component: .hg/a1
   [255]
   $ hg status -C
   $ hg rename d1/d11/a1 ..
-  abort: ../a1 not under root '$TESTTMP' (glob)
+  abort: ../a1 not under root '$TESTTMP'
   [255]
   $ hg --config extensions.largefiles= rename d1/d11/a1 ..
   The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
-  abort: ../a1 not under root '$TESTTMP' (glob)
+  abort: ../a1 not under root '$TESTTMP'
   [255]
   $ hg status -C
 
   $ mv d1/d11/a1 .hg
   $ hg rename --after d1/d11/a1 .hg
-  abort: path contains illegal component: .hg/a1 (glob)
+  abort: path contains illegal component: .hg/a1
   [255]
   $ hg status -C
   ! d1/d11/a1
@@ -649,7 +649,7 @@
   $ rm .hg/a1
 
   $ (cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
-  abort: path contains illegal component: .hg/foo (glob)
+  abort: path contains illegal component: .hg/foo
   [255]
   $ hg status -C
   $ (cd d1/d11; hg rename ../../d2/b ../../../foo)
--- a/tests/test-resolve.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-resolve.t	Tue Dec 19 16:27:24 2017 -0500
@@ -249,7 +249,7 @@
 .orig files should exists where specified
   $ hg resolve --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
   merging file1
-  creating directory: $TESTTMP/repo/.hg/origbackups (glob)
+  creating directory: $TESTTMP/repo/.hg/origbackups
   merging file2
   warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
   warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
@@ -270,7 +270,7 @@
 test .orig behavior with resolve
 
   $ hg resolve -q file1 --tool "sh -c 'f --dump \"$TESTTMP/repo/file1.orig\"'"
-  $TESTTMP/repo/file1.orig: (glob)
+  $TESTTMP/repo/file1.orig:
   >>>
   foo
   baz
--- a/tests/test-revert-interactive.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-revert-interactive.t	Tue Dec 19 16:27:24 2017 -0500
@@ -52,64 +52,64 @@
   > n
   > EOF
   reverting f
-  reverting folder1/g (glob)
-  removing folder1/i (glob)
-  reverting folder2/h (glob)
+  reverting folder1/g
+  removing folder1/i
+  reverting folder2/h
   remove added file folder1/i (Yn)? y
   diff --git a/f b/f
   2 hunks, 2 lines changed
   examine changes to 'f'? [Ynesfdaq?] y
   
-  @@ -1,5 +1,6 @@
-  +a
+  @@ -1,6 +1,5 @@
+  -a
    1
    2
    3
    4
    5
-  revert change 1/6 to 'f'? [Ynesfdaq?] y
+  apply change 1/6 to 'f'? [Ynesfdaq?] y
   
-  @@ -1,5 +2,6 @@
+  @@ -2,6 +1,5 @@
    1
    2
    3
    4
    5
-  +b
-  revert change 2/6 to 'f'? [Ynesfdaq?] y
+  -b
+  apply change 2/6 to 'f'? [Ynesfdaq?] y
   
   diff --git a/folder1/g b/folder1/g
   2 hunks, 2 lines changed
   examine changes to 'folder1/g'? [Ynesfdaq?] y
   
-  @@ -1,5 +1,6 @@
-  +c
+  @@ -1,6 +1,5 @@
+  -c
    1
    2
    3
    4
    5
-  revert change 3/6 to 'folder1/g'? [Ynesfdaq?] ?
+  apply change 3/6 to 'folder1/g'? [Ynesfdaq?] ?
   
-  y - yes, revert this change
+  y - yes, apply this change
   n - no, skip this change
   e - edit this change manually
   s - skip remaining changes to this file
-  f - revert remaining changes to this file
+  f - apply remaining changes to this file
   d - done, skip remaining changes and files
-  a - revert all changes to all remaining files
-  q - quit, reverting no changes
+  a - apply all changes to all remaining files
+  q - quit, applying no changes
   ? - ? (display help)
-  revert change 3/6 to 'folder1/g'? [Ynesfdaq?] y
+  apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y
   
-  @@ -1,5 +2,6 @@
+  @@ -2,6 +1,5 @@
    1
    2
    3
    4
    5
-  +d
-  revert change 4/6 to 'folder1/g'? [Ynesfdaq?] n
+  -d
+  apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n
   
   diff --git a/folder2/h b/folder2/h
   2 hunks, 2 lines changed
@@ -140,8 +140,8 @@
 Test that --interactive lift the need for --all
 
   $ echo q | hg revert -i -r 2
-  reverting folder1/g (glob)
-  reverting folder2/h (glob)
+  reverting folder1/g
+  reverting folder2/h
   diff --git a/folder1/g b/folder1/g
   1 hunks, 1 lines changed
   examine changes to 'folder1/g'? [Ynesfdaq?] q
@@ -157,12 +157,12 @@
   1 hunks, 1 lines changed
   examine changes to 'folder1/g'? [Ynesfdaq?] y
   
-  @@ -3,3 +3,4 @@
+  @@ -3,4 +3,3 @@
    3
    4
    5
-  +d
-  revert this change to 'folder1/g'? [Ynesfdaq?] n
+  -d
+  apply this change to 'folder1/g'? [Ynesfdaq?] n
   
   $ ls folder1/
   g
@@ -173,12 +173,12 @@
   1 hunks, 1 lines changed
   examine changes to 'folder1/g'? [Ynesfdaq?] y
   
-  @@ -3,3 +3,4 @@
+  @@ -3,4 +3,3 @@
    3
    4
    5
-  +d
-  revert this change to 'folder1/g'? [Ynesfdaq?] y
+  -d
+  apply this change to 'folder1/g'? [Ynesfdaq?] y
   
   $ ls folder1/
   g
@@ -198,53 +198,53 @@
   > n
   > EOF
   reverting f
-  reverting folder1/g (glob)
-  removing folder1/i (glob)
-  reverting folder2/h (glob)
+  reverting folder1/g
+  removing folder1/i
+  reverting folder2/h
   remove added file folder1/i (Yn)? n
   diff --git a/f b/f
   2 hunks, 2 lines changed
   examine changes to 'f'? [Ynesfdaq?] y
   
-  @@ -1,5 +1,6 @@
-  +a
+  @@ -1,6 +1,5 @@
+  -a
    1
    2
    3
    4
    5
-  revert change 1/6 to 'f'? [Ynesfdaq?] y
+  apply change 1/6 to 'f'? [Ynesfdaq?] y
   
-  @@ -1,5 +2,6 @@
+  @@ -2,6 +1,5 @@
    1
    2
    3
    4
    5
-  +b
-  revert change 2/6 to 'f'? [Ynesfdaq?] y
+  -b
+  apply change 2/6 to 'f'? [Ynesfdaq?] y
   
   diff --git a/folder1/g b/folder1/g
   2 hunks, 2 lines changed
   examine changes to 'folder1/g'? [Ynesfdaq?] y
   
-  @@ -1,5 +1,6 @@
-  +c
+  @@ -1,6 +1,5 @@
+  -c
    1
    2
    3
    4
    5
-  revert change 3/6 to 'folder1/g'? [Ynesfdaq?] y
+  apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y
   
-  @@ -1,5 +2,6 @@
+  @@ -2,6 +1,5 @@
    1
    2
    3
    4
    5
-  +d
-  revert change 4/6 to 'folder1/g'? [Ynesfdaq?] n
+  -d
+  apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n
   
   diff --git a/folder2/h b/folder2/h
   2 hunks, 2 lines changed
@@ -368,77 +368,6 @@
   $ cat k
   42
 
-Check the experimental config to invert the selection:
-  $ cat <<EOF >> $HGRCPATH
-  > [experimental]
-  > revertalternateinteractivemode=False
-  > EOF
-
-
-  $ hg up -C .
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ printf 'firstline\nc\n1\n2\n3\n 3\n5\nd\nlastline\n' > folder1/g
-  $ hg diff --nodates
-  diff -r a3d963a027aa folder1/g
-  --- a/folder1/g
-  +++ b/folder1/g
-  @@ -1,7 +1,9 @@
-  +firstline
-   c
-   1
-   2
-   3
-  -4
-  + 3
-   5
-   d
-  +lastline
-  $ hg revert -i <<EOF
-  > y
-  > y
-  > y
-  > n
-  > EOF
-  reverting folder1/g (glob)
-  diff --git a/folder1/g b/folder1/g
-  3 hunks, 3 lines changed
-  examine changes to 'folder1/g'? [Ynesfdaq?] y
-  
-  @@ -1,4 +1,5 @@
-  +firstline
-   c
-   1
-   2
-   3
-  discard change 1/3 to 'folder1/g'? [Ynesfdaq?] y
-  
-  @@ -1,7 +2,7 @@
-   c
-   1
-   2
-   3
-  -4
-  + 3
-   5
-   d
-  discard change 2/3 to 'folder1/g'? [Ynesfdaq?] y
-  
-  @@ -6,2 +7,3 @@
-   5
-   d
-  +lastline
-  discard change 3/3 to 'folder1/g'? [Ynesfdaq?] n
-  
-  $ hg diff --nodates
-  diff -r a3d963a027aa folder1/g
-  --- a/folder1/g
-  +++ b/folder1/g
-  @@ -5,3 +5,4 @@
-   4
-   5
-   d
-  +lastline
-
   $ hg update -C .
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg purge
@@ -463,11 +392,6 @@
 
 When a line without EOL is selected during "revert -i" (issue5651)
 
-  $ cat <<EOF >> $HGRCPATH
-  > [experimental]
-  > %unset revertalternateinteractivemode
-  > EOF
-
   $ hg init $TESTTMP/revert-i-eol
   $ cd $TESTTMP/revert-i-eol
   $ echo 0 > a
@@ -487,11 +411,11 @@
   1 hunks, 1 lines changed
   examine changes to 'a'? [Ynesfdaq?] y
   
-  @@ -1,1 +1,2 @@
+  @@ -1,2 +1,1 @@
    0
-  +1
+  -1
   \ No newline at end of file
-  revert this change to 'a'? [Ynesfdaq?] y
+  apply this change to 'a'? [Ynesfdaq?] y
   
   $ cat a
   0
--- a/tests/test-revert.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-revert.t	Tue Dec 19 16:27:24 2017 -0500
@@ -91,8 +91,8 @@
 
   $ echo z > e
   $ hg revert --all -v --config 'ui.origbackuppath=.hg/origbackups'
-  creating directory: $TESTTMP/repo/.hg/origbackups (glob)
-  saving current version of e as $TESTTMP/repo/.hg/origbackups/e (glob)
+  creating directory: $TESTTMP/repo/.hg/origbackups
+  saving current version of e as $TESTTMP/repo/.hg/origbackups/e
   reverting e
   $ rm -rf .hg/origbackups
 
@@ -283,11 +283,11 @@
   $ echo foo > newdir/newfile
   $ hg add newdir/newfile
   $ hg revert b newdir
-  reverting b/b (glob)
-  forgetting newdir/newfile (glob)
+  reverting b/b
+  forgetting newdir/newfile
   $ echo foobar > b/b
   $ hg revert .
-  reverting b/b (glob)
+  reverting b/b
 
 
 reverting a rename target should revert the source
@@ -336,8 +336,8 @@
 
   $ hg revert -a --no-backup
   reverting ignored
-  reverting ignoreddir/file (glob)
-  undeleting ignoreddir/removed (glob)
+  reverting ignoreddir/file
+  undeleting ignoreddir/removed
   undeleting removed
   $ hg st -mardi
 
--- a/tests/test-revlog-mmapindex.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-revlog-mmapindex.t	Tue Dec 19 16:27:24 2017 -0500
@@ -6,12 +6,13 @@
   > 
   > from mercurial import (
   >     extensions,
+  >     pycompat,
   >     util,
   > )
   > 
   > def extsetup(ui):
   >     def mmapread(orig, fp):
-  >         ui.write("mmapping %s\n" % fp.name)
+  >         ui.write(b"mmapping %s\n" % pycompat.bytestr(fp.name))
   >         ui.flush()
   >         return orig(fp)
   > 
@@ -37,7 +38,7 @@
 
 mmap index which is now more than 4k long
   $ hg log -l 5 -T '{rev}\n' --config experimental.mmapindexthreshold=4k
-  mmapping $TESTTMP/a/.hg/store/00changelog.i (glob)
+  mmapping $TESTTMP/a/.hg/store/00changelog.i
   100
   99
   98
--- a/tests/test-revset-outgoing.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-revset-outgoing.t	Tue Dec 19 16:27:24 2017 -0500
@@ -38,7 +38,7 @@
   $ cat .hg/hgrc
   # example repository config (see 'hg help config' for more info)
   [paths]
-  default = $TESTTMP/a#stable (glob)
+  default = $TESTTMP/a#stable
   
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
@@ -70,7 +70,7 @@
   
 
   $ hg tout
-  comparing with $TESTTMP/a (glob)
+  comparing with $TESTTMP/a
   searching for changes
   2:1d4099801a4e: '3' stable
 
@@ -90,7 +90,7 @@
   $ cat .hg/hgrc
   # example repository config (see 'hg help config' for more info)
   [paths]
-  default = $TESTTMP/a#stable (glob)
+  default = $TESTTMP/a#stable
   
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
@@ -105,12 +105,11 @@
   green = ../a#default
 
   $ hg tout green
-  comparing with green
-  abort: repository green not found!
+  abort: repository green does not exist!
   [255]
 
   $ hg tlog -r 'outgoing("green")'
-  abort: repository green not found!
+  abort: repository green does not exist!
   [255]
 
   $ cd ..
--- a/tests/test-run-tests.py	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-run-tests.py	Tue Dec 19 16:27:24 2017 -0500
@@ -54,6 +54,8 @@
     enable windows matching on any os
         >>> _osaltsep = os.altsep
         >>> os.altsep = True
+        >>> _osname = os.name
+        >>> os.name = 'nt'
 
     valid match on windows
         >>> lm(b'g/a*/d (glob)\n', b'g\\abc/d\n')
@@ -65,10 +67,13 @@
 
     missing glob
         >>> lm(b'/g/c/d/fg\n', b'\\g\\c\\d/fg\n')
-        'special: +glob'
+        True
+        >>> lm(b'/g/c/d/fg\n', b'\\g\\c\\d\\fg\r\n')
+        True
 
     restore os.altsep
         >>> os.altsep = _osaltsep
+        >>> os.name = _osname
     """
     pass
 
@@ -78,6 +83,8 @@
     disable windows matching on any os
         >>> _osaltsep = os.altsep
         >>> os.altsep = False
+        >>> _osname = os.name
+        >>> os.name = 'nt'
 
     backslash does not match slash
         >>> lm(b'h/a* (glob)\n', b'h\\ab\n')
@@ -93,6 +100,7 @@
 
     restore os.altsep
         >>> os.altsep = _osaltsep
+        >>> os.name = _osname
     """
     pass
 
--- a/tests/test-run-tests.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-run-tests.t	Tue Dec 19 16:27:24 2017 -0500
@@ -32,8 +32,7 @@
 #if execbit
   $ touch hg
   $ run-tests.py --with-hg=./hg
-  Usage: run-tests.py [options] [tests]
-  
+  usage: run-tests.py [options] [tests]
   run-tests.py: error: --with-hg must specify an executable hg script
   [2]
   $ rm hg
@@ -98,19 +97,22 @@
 
 test churn with globs
   $ cat > test-failure.t <<EOF
-  >   $ echo "bar-baz"; echo "bar-bad"
+  >   $ echo "bar-baz"; echo "bar-bad"; echo foo
   >   bar*bad (glob)
   >   bar*baz (glob)
+  >   | fo (re)
   > EOF
   $ rt test-failure.t
   
   --- $TESTTMP/test-failure.t
   +++ $TESTTMP/test-failure.t.err
-  @@ -1,3 +1,3 @@
-     $ echo "bar-baz"; echo "bar-bad"
+  @@ -1,4 +1,4 @@
+     $ echo "bar-baz"; echo "bar-bad"; echo foo
   +  bar*baz (glob)
      bar*bad (glob)
   -  bar*baz (glob)
+  -  | fo (re)
+  +  foo
   
   ERROR: test-failure.t output changed
   !
@@ -126,11 +128,13 @@
   
   \x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc)
   \x1b[38;5;34m+++ $TESTTMP/test-failure.t.err\x1b[39m (esc)
-  \x1b[38;5;90;01m@@ -1,3 +1,3 @@\x1b[39;00m (esc)
-     $ echo "bar-baz"; echo "bar-bad"
+  \x1b[38;5;90;01m@@ -1,4 +1,4 @@\x1b[39;00m (esc)
+     $ echo "bar-baz"; echo "bar-bad"; echo foo
   \x1b[38;5;34m+  bar*baz (glob)\x1b[39m (esc)
      bar*bad (glob)
   \x1b[38;5;124m-  bar*baz (glob)\x1b[39m (esc)
+  \x1b[38;5;124m-  | fo (re)\x1b[39m (esc)
+  \x1b[38;5;34m+  foo\x1b[39m (esc)
   
   \x1b[38;5;88mERROR: \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m output changed\x1b[39m (esc)
   !
@@ -145,11 +149,13 @@
   
   --- $TESTTMP/test-failure.t
   +++ $TESTTMP/test-failure.t.err
-  @@ -1,3 +1,3 @@
-     $ echo "bar-baz"; echo "bar-bad"
+  @@ -1,4 +1,4 @@
+     $ echo "bar-baz"; echo "bar-bad"; echo foo
   +  bar*baz (glob)
      bar*bad (glob)
   -  bar*baz (glob)
+  -  | fo (re)
+  +  foo
   
   ERROR: test-failure.t output changed
   !
@@ -674,7 +680,7 @@
 Interactive with custom view
 
   $ echo 'n' | rt -i --view echo
-  $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
+  $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
   Accept this change? [n]* (glob)
   ERROR: test-failure.t output changed
   !.
@@ -686,7 +692,7 @@
 View the fix
 
   $ echo 'y' | rt --view echo
-  $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob)
+  $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
   
   ERROR: test-failure.t output changed
   !.
@@ -697,12 +703,14 @@
 
 Accept the fix
 
-  $ echo "  $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
-  $ echo "  saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
-  $ echo "  $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
-  $ echo "  saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t
-  $ echo "  $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
-  $ echo "  saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
+  $ cat >> test-failure.t <<EOF
+  >   $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
+  >   saved backup bundle to \$TESTTMP/foo.hg
+  >   $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
+  >   saved backup bundle to $TESTTMP\\foo.hg
+  >   $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
+  >   saved backup bundle to \$TESTTMP/*.hg (glob)
+  > EOF
   $ echo 'y' | rt -i 2>&1
   
   --- $TESTTMP/test-failure.t
@@ -714,15 +722,14 @@
    This is a noop statement so that
    this test is still more bytes than success.
    pad pad pad pad............................................................
-  @@ -9,7 +9,7 @@
-   pad pad pad pad............................................................
-   pad pad pad pad............................................................
+  @@ -11,6 +11,6 @@
+     $ echo 'saved backup bundle to $TESTTMP/foo.hg'
+     saved backup bundle to $TESTTMP/foo.hg
      $ echo 'saved backup bundle to $TESTTMP/foo.hg'
-  -  saved backup bundle to $TESTTMP/foo.hg
-  +  saved backup bundle to $TESTTMP/foo.hg* (glob)
+  -  saved backup bundle to $TESTTMP\foo.hg
+  +  saved backup bundle to $TESTTMP/foo.hg
      $ echo 'saved backup bundle to $TESTTMP/foo.hg'
-     saved backup bundle to $TESTTMP/foo.hg* (glob)
-     $ echo 'saved backup bundle to $TESTTMP/foo.hg'
+     saved backup bundle to $TESTTMP/*.hg (glob)
   Accept this change? [n] ..
   # Ran 2 tests, 0 skipped, 0 failed.
 
@@ -738,9 +745,9 @@
   pad pad pad pad............................................................
   pad pad pad pad............................................................
     $ echo 'saved backup bundle to $TESTTMP/foo.hg'
-    saved backup bundle to $TESTTMP/foo.hg (glob)<
+    saved backup bundle to $TESTTMP/foo.hg
     $ echo 'saved backup bundle to $TESTTMP/foo.hg'
-    saved backup bundle to $TESTTMP/foo.hg (glob)<
+    saved backup bundle to $TESTTMP/foo.hg
     $ echo 'saved backup bundle to $TESTTMP/foo.hg'
     saved backup bundle to $TESTTMP/*.hg (glob)<
 
@@ -853,8 +860,8 @@
 test --tmpdir support
   $ rt --tmpdir=$TESTTMP/keep test-success.t
   
-  Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t (glob)
-  Keeping threadtmp dir: $TESTTMP/keep/child1  (glob)
+  Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t
+  Keeping threadtmp dir: $TESTTMP/keep/child1 
   .
   # Ran 1 tests, 0 skipped, 0 failed.
 
@@ -1208,7 +1215,12 @@
   > #else
   >   $ test "\$TESTDIR" = "$TESTTMP"/anothertests
   > #endif
-  >   $ test "\$RUNTESTDIR" = "$TESTDIR"
+  > If this prints a path, that means RUNTESTDIR didn't equal
+  > TESTDIR as it should have.
+  >   $ test "\$RUNTESTDIR" = "$TESTDIR" || echo "\$RUNTESTDIR"
+  > This should print the start of check-code. If this passes but the
+  > previous check failed, that means we found a copy of check-code at whatever
+  > RUNTESTSDIR ended up containing, even though it doesn't match TESTDIR.
   >   $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python@#!USRBINENVPY@'
   >   #!USRBINENVPY
   >   #
@@ -1261,6 +1273,58 @@
   .
   # Ran 1 tests, 0 skipped, 0 failed.
 
+support for automatically discovering test if arg is a folder
+  $ mkdir tmp && cd tmp
+
+  $ cat > test-uno.t << EOF
+  >   $ echo line
+  >   line
+  > EOF
+
+  $ cp test-uno.t test-dos.t
+  $ cd ..
+  $ cp -R tmp tmpp
+  $ cp tmp/test-uno.t test-solo.t
+
+  $ rt tmp/ test-solo.t tmpp
+  .....
+  # Ran 5 tests, 0 skipped, 0 failed.
+  $ rm -rf tmp tmpp
+
+support for running run-tests.py from another directory
+  $ mkdir tmp && cd tmp
+
+  $ cat > useful-file.sh << EOF
+  > important command
+  > EOF
+
+  $ cat > test-folder.t << EOF
+  >   $ cat \$TESTDIR/useful-file.sh
+  >   important command
+  > EOF
+
+  $ cat > test-folder-fail.t << EOF
+  >   $ cat \$TESTDIR/useful-file.sh
+  >   important commando
+  > EOF
+
+  $ cd ..
+  $ rt tmp/test-*.t
+  
+  --- $TESTTMP/anothertests/tmp/test-folder-fail.t
+  +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
+  @@ -1,2 +1,2 @@
+     $ cat $TESTDIR/useful-file.sh
+  -  important commando
+  +  important command
+  
+  ERROR: test-folder-fail.t output changed
+  !.
+  Failed test-folder-fail.t: output changed
+  # Ran 2 tests, 0 skipped, 1 failed.
+  python hash seed: * (glob)
+  [1]
+
 support for bisecting failed tests automatically
   $ hg init bisect
   $ cd bisect
@@ -1324,8 +1388,7 @@
   [1]
 
   $ rt --bisect-repo=../test-bisect test-bisect-dependent.t
-  Usage: run-tests.py [options] [tests]
-  
+  usage: run-tests.py [options] [tests]
   run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
   [2]
 
@@ -1469,3 +1532,54 @@
   # Ran 2 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
+
+Test automatic pattern replacement
+
+  $ cat << EOF >> common-pattern.py
+  > substitutions = [
+  >     (br'foo-(.*)\\b',
+  >      br'\$XXX=\\1\$'),
+  >     (br'bar\\n',
+  >      br'\$YYY$\\n'),
+  > ]
+  > EOF
+
+  $ cat << EOF >> test-substitution.t
+  >   $ echo foo-12
+  >   \$XXX=12$
+  >   $ echo foo-42
+  >   \$XXX=42$
+  >   $ echo bar prior
+  >   bar prior
+  >   $ echo lastbar
+  >   last\$YYY$
+  >   $ echo foo-bar foo-baz
+  > EOF
+
+  $ rt test-substitution.t
+  
+  --- $TESTTMP/anothertests/cases/test-substitution.t
+  +++ $TESTTMP/anothertests/cases/test-substitution.t.err
+  @@ -7,3 +7,4 @@
+     $ echo lastbar
+     last$YYY$
+     $ echo foo-bar foo-baz
+  +  $XXX=bar foo-baz$
+  
+  ERROR: test-substitution.t output changed
+  !
+  Failed test-substitution.t: output changed
+  # Ran 1 tests, 0 skipped, 1 failed.
+  python hash seed: * (glob)
+  [1]
+
+--extra-config-opt works
+
+  $ cat << EOF >> test-config-opt.t
+  >   $ hg init test-config-opt
+  >   $ hg -R test-config-opt purge
+  > EOF
+
+  $ rt --extra-config-opt extensions.purge= test-config-opt.t
+  .
+  # Ran 1 tests, 0 skipped, 0 failed.
--- a/tests/test-setdiscovery.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-setdiscovery.t	Tue Dec 19 16:27:24 2017 -0500
@@ -16,11 +16,17 @@
   >     echo "% -- a -> b set"
   >     hg -R a debugdiscovery b --verbose --debug --config progress.debug=true
   >     echo
+  >     echo "% -- a -> b set (tip only)"
+  >     hg -R a debugdiscovery b --verbose --debug --config progress.debug=true --rev tip
+  >     echo
   >     echo "% -- b -> a tree"
   >     hg -R b debugdiscovery a --verbose --old
   >     echo
   >     echo "% -- b -> a set"
   >     hg -R b debugdiscovery a --verbose --debug --config progress.debug=true
+  >     echo
+  >     echo "% -- b -> a set (tip only)"
+  >     hg -R b debugdiscovery a --verbose --debug --config progress.debug=true --rev tip
   >     cd ..
   > }
 
@@ -48,6 +54,13 @@
   common heads: 01241442b3c2 b5714e113bc0
   local is subset
   
+  % -- a -> b set (tip only)
+  comparing with b
+  query 1; heads
+  searching for changes
+  all local heads known remotely
+  common heads: b5714e113bc0
+  
   % -- b -> a tree
   comparing with a
   searching for changes
@@ -62,6 +75,14 @@
   all remote heads known locally
   common heads: 01241442b3c2 b5714e113bc0
   remote is subset
+  
+  % -- b -> a set (tip only)
+  comparing with a
+  query 1; heads
+  searching for changes
+  all remote heads known locally
+  common heads: 01241442b3c2 b5714e113bc0
+  remote is subset
 
 
 Many new:
@@ -86,6 +107,16 @@
   2 total queries in *.????s (glob)
   common heads: bebd167eb94d
   
+  % -- a -> b set (tip only)
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 31, sample size is: 31
+  2 total queries in *.????s (glob)
+  common heads: 66f7d451a68b
+  
   % -- b -> a tree
   comparing with a
   searching for changes
@@ -101,6 +132,16 @@
   query 2; still undecided: 2, sample size is: 2
   2 total queries in *.????s (glob)
   common heads: bebd167eb94d
+  
+  % -- b -> a set (tip only)
+  comparing with a
+  query 1; heads
+  searching for changes
+  taking initial sample
+  searching: 2 queries
+  query 2; still undecided: 2, sample size is: 2
+  2 total queries in *.????s (glob)
+  common heads: bebd167eb94d
 
 Both sides many new with stub:
 
@@ -124,6 +165,16 @@
   2 total queries in *.????s (glob)
   common heads: 2dc09a01254d
   
+  % -- a -> b set (tip only)
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 31, sample size is: 31
+  2 total queries in *.????s (glob)
+  common heads: 66f7d451a68b
+  
   % -- b -> a tree
   comparing with a
   searching for changes
@@ -139,6 +190,16 @@
   query 2; still undecided: 29, sample size is: 29
   2 total queries in *.????s (glob)
   common heads: 2dc09a01254d
+  
+  % -- b -> a set (tip only)
+  comparing with a
+  query 1; heads
+  searching for changes
+  taking initial sample
+  searching: 2 queries
+  query 2; still undecided: 29, sample size is: 29
+  2 total queries in *.????s (glob)
+  common heads: 2dc09a01254d
 
 
 Both many new:
@@ -163,6 +224,16 @@
   2 total queries in *.????s (glob)
   common heads: 66f7d451a68b
   
+  % -- a -> b set (tip only)
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 31, sample size is: 31
+  2 total queries in *.????s (glob)
+  common heads: 66f7d451a68b
+  
   % -- b -> a tree
   comparing with a
   searching for changes
@@ -178,6 +249,16 @@
   query 2; still undecided: 31, sample size is: 31
   2 total queries in *.????s (glob)
   common heads: 66f7d451a68b
+  
+  % -- b -> a set (tip only)
+  comparing with a
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 31, sample size is: 31
+  2 total queries in *.????s (glob)
+  common heads: 66f7d451a68b
 
 
 Both many new skewed:
@@ -202,6 +283,16 @@
   2 total queries in *.????s (glob)
   common heads: 66f7d451a68b
   
+  % -- a -> b set (tip only)
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 51, sample size is: 51
+  2 total queries in *.????s (glob)
+  common heads: 66f7d451a68b
+  
   % -- b -> a tree
   comparing with a
   searching for changes
@@ -217,6 +308,16 @@
   query 2; still undecided: 31, sample size is: 31
   2 total queries in *.????s (glob)
   common heads: 66f7d451a68b
+  
+  % -- b -> a set (tip only)
+  comparing with a
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 31, sample size is: 31
+  2 total queries in *.????s (glob)
+  common heads: 66f7d451a68b
 
 
 Both many new on top of long history:
@@ -244,6 +345,19 @@
   3 total queries in *.????s (glob)
   common heads: 7ead0cba2838
   
+  % -- a -> b set (tip only)
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 1049, sample size is: 11
+  sampling from both directions
+  searching: 3 queries
+  query 3; still undecided: 31, sample size is: 31
+  3 total queries in *.????s (glob)
+  common heads: 7ead0cba2838
+  
   % -- b -> a tree
   comparing with a
   searching for changes
@@ -262,6 +376,19 @@
   query 3; still undecided: 15, sample size is: 15
   3 total queries in *.????s (glob)
   common heads: 7ead0cba2838
+  
+  % -- b -> a set (tip only)
+  comparing with a
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 1029, sample size is: 11
+  sampling from both directions
+  searching: 3 queries
+  query 3; still undecided: 15, sample size is: 15
+  3 total queries in *.????s (glob)
+  common heads: 7ead0cba2838
 
 
 One with >200 heads, which used to use up all of the sample:
@@ -327,6 +454,18 @@
   query 6; still undecided: \d+, sample size is: \d+ (re)
   6 total queries in *.????s (glob)
   common heads: 3ee37d65064a
+  $ hg -R a debugdiscovery b --debug --verbose --config progress.debug=true --rev tip
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 303, sample size is: 9
+  sampling from both directions
+  searching: 3 queries
+  query 3; still undecided: 3, sample size is: 3
+  3 total queries in *.????s (glob)
+  common heads: 3ee37d65064a
 
 Test actual protocol when pulling one new head in addition to common heads
 
@@ -350,9 +489,9 @@
   $ killdaemons.py
   $ cut -d' ' -f6- access.log | grep -v cmd=known # cmd=known uses random sampling
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D513314ca8b3ae4dac8eec56966265b00fcf866db x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D513314ca8b3ae4dac8eec56966265b00fcf866db x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   $ cat errors.log
 
   $ cd ..
--- a/tests/test-share.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-share.t	Tue Dec 19 16:27:24 2017 -0500
@@ -41,14 +41,14 @@
 Some sed versions appends newline, some don't, and some just fails
 
   $ cat .hg/sharedpath; echo
-  $TESTTMP/repo1/.hg (glob)
+  $TESTTMP/repo1/.hg
 
 trailing newline on .hg/sharedpath is ok
   $ hg tip -q
   0:d3873e73d99e
   $ echo '' >> .hg/sharedpath
   $ cat .hg/sharedpath
-  $TESTTMP/repo1/.hg (glob)
+  $TESTTMP/repo1/.hg
   $ hg tip -q
   0:d3873e73d99e
 
@@ -278,7 +278,7 @@
      bm3                       4:62f4ded848e4
    * bm4                       5:92793bfc8cad
   $ hg push -B bm4
-  pushing to $TESTTMP/repo3 (glob)
+  pushing to $TESTTMP/repo3
   searching for changes
   adding changesets
   adding manifests
@@ -348,7 +348,7 @@
      bm1                       3:b87954705719
      bm4                       5:92793bfc8cad
   $ hg --config "extensions.failpullbookmarks=$TESTTMP/failpullbookmarks.py" pull $TESTTMP/repo4
-  pulling from $TESTTMP/repo4 (glob)
+  pulling from $TESTTMP/repo4
   searching for changes
   no changes found
   adding remote bookmark bm3
@@ -358,7 +358,7 @@
      bm1                       3:b87954705719
      bm4                       5:92793bfc8cad
   $ hg pull $TESTTMP/repo4
-  pulling from $TESTTMP/repo4 (glob)
+  pulling from $TESTTMP/repo4
   searching for changes
   no changes found
   adding remote bookmark bm3
@@ -396,7 +396,7 @@
   $ hg share -U thisdir/orig thisdir/abs
   $ hg share -U --relative thisdir/abs thisdir/rel
   $ cat thisdir/rel/.hg/sharedpath
-  ../../orig/.hg (no-eol) (glob)
+  ../../orig/.hg (no-eol)
   $ grep shared thisdir/*/.hg/requires
   thisdir/abs/.hg/requires:shared
   thisdir/rel/.hg/requires:shared
@@ -406,22 +406,22 @@
 
   $ cd thisdir
   $ hg -R rel root
-  $TESTTMP/thisdir/rel (glob)
+  $TESTTMP/thisdir/rel
   $ cd ..
 
 now test that relative paths really are relative, survive across
 renames and changes of PWD
 
   $ hg -R thisdir/abs root
-  $TESTTMP/thisdir/abs (glob)
+  $TESTTMP/thisdir/abs
   $ hg -R thisdir/rel root
-  $TESTTMP/thisdir/rel (glob)
+  $TESTTMP/thisdir/rel
   $ mv thisdir thatdir
   $ hg -R thatdir/abs root
-  abort: .hg/sharedpath points to nonexistent directory $TESTTMP/thisdir/orig/.hg! (glob)
+  abort: .hg/sharedpath points to nonexistent directory $TESTTMP/thisdir/orig/.hg!
   [255]
   $ hg -R thatdir/rel root
-  $TESTTMP/thatdir/rel (glob)
+  $TESTTMP/thatdir/rel
 
 test unshare relshared repo
 
--- a/tests/test-shelve.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-shelve.t	Tue Dec 19 16:27:24 2017 -0500
@@ -158,7 +158,7 @@
 
   $ echo a >> a/a
   $ hg mv b b.rename
-  moving b/b to b.rename/b (glob)
+  moving b/b to b.rename/b
   $ hg cp c c.copy
   $ hg status -C
   M a/a
@@ -352,7 +352,7 @@
   
   # Unresolved merge conflicts:
   # 
-  #     a/a (glob)
+  #     a/a
   # 
   # To mark files as resolved:  hg resolve --mark FILE
   
@@ -643,7 +643,7 @@
   $ hg rebase -d 1 --config extensions.rebase=
   rebasing 2:323bfa07f744 "xyz" (tip)
   merging x
-  saved backup bundle to $TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-78114325-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-78114325-rebase.hg
   $ hg unshelve
   unshelving change 'default'
   rebasing shelved changes
@@ -899,7 +899,7 @@
 is a no-op), works (issue4398)
 
   $ hg revert -a -r .
-  reverting a/a (glob)
+  reverting a/a
   $ hg resolve -m a/a
   (no more unresolved files)
   continue: hg unshelve --continue
@@ -1271,7 +1271,7 @@
   $ rm .hg/unshelverebasestate
   $ hg unshelve --abort
   unshelve of 'default' aborted
-  abort: (No such file or directory|The system cannot find the file specified) (re)
+  abort: $ENOENT$
   [255]
 Can the user leave the current state?
   $ hg up -C .
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-single-head.t	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,203 @@
+=====================
+Test workflow options
+=====================
+
+  $ . "$TESTDIR/testlib/obsmarker-common.sh"
+
+Test single head enforcing - Setup
+=============================================
+
+  $ cat << EOF >> $HGRCPATH
+  > [experimental]
+  > evolution = all
+  > EOF
+  $ hg init single-head-server
+  $ cd single-head-server
+  $ cat <<EOF >> .hg/hgrc
+  > [phases]
+  > publish = no
+  > [experimental]
+  > single-head-per-branch = yes
+  > EOF
+  $ mkcommit ROOT
+  $ mkcommit c_dA0
+  $ cd ..
+
+  $ hg clone single-head-server client
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Test single head enforcing - with branch only
+---------------------------------------------
+
+  $ cd client
+
+continuing the current defaultbranch
+
+  $ mkcommit c_dB0
+  $ hg push
+  pushing to $TESTTMP/single-head-server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+
+creating a new branch
+
+  $ hg up 'desc("ROOT")'
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ hg branch branch_A
+  marked working directory as branch branch_A
+  (branches are permanent and global, did you want a bookmark?)
+  $ mkcommit c_aC0
+  $ hg push --new-branch
+  pushing to $TESTTMP/single-head-server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+
+Create a new head on the default branch
+
+  $ hg up 'desc("c_dA0")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ mkcommit c_dD0
+  created new head
+  $ hg push -f
+  pushing to $TESTTMP/single-head-server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  transaction abort!
+  rollback completed
+  abort: rejecting multiple heads on branch "default"
+  (2 heads: 286d02a6e2a2 9bf953aa81f6)
+  [255]
+
+remerge them
+
+  $ hg merge
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ mkcommit c_dE0
+  $ hg push
+  pushing to $TESTTMP/single-head-server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+
+Test single head enforcing - after rewrite
+------------------------------------------
+
+  $ mkcommit c_dF0
+  $ hg push
+  pushing to $TESTTMP/single-head-server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  $ hg commit --amend -m c_dF1
+  $ hg push
+  pushing to $TESTTMP/single-head-server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 0 changes to 1 files (+1 heads)
+  1 new obsolescence markers
+  obsoleted 1 changesets
+
+Check it does to interfer with strip
+------------------------------------
+
+setup
+
+  $ hg branch branch_A --force
+  marked working directory as branch branch_A
+  $ mkcommit c_aG0
+  created new head
+  $ hg update 'desc("c_dF1")'
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ mkcommit c_dH0
+  $ hg update 'desc("c_aG0")'
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ mkcommit c_aI0
+  $ hg log -G
+  @    changeset:   10:49003e504178
+  |\   branch:      branch_A
+  | |  tag:         tip
+  | |  parent:      8:a33fb808fb4b
+  | |  parent:      3:840af1c6bc88
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     c_aI0
+  | |
+  | | o  changeset:   9:fe47ea669cea
+  | | |  parent:      7:99a2dc242c5d
+  | | |  user:        test
+  | | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | | |  summary:     c_dH0
+  | | |
+  | o |  changeset:   8:a33fb808fb4b
+  | |/   branch:      branch_A
+  | |    user:        test
+  | |    date:        Thu Jan 01 00:00:00 1970 +0000
+  | |    summary:     c_aG0
+  | |
+  | o  changeset:   7:99a2dc242c5d
+  | |  parent:      5:6ed1df20edb1
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     c_dF1
+  | |
+  | o    changeset:   5:6ed1df20edb1
+  | |\   parent:      4:9bf953aa81f6
+  | | |  parent:      2:286d02a6e2a2
+  | | |  user:        test
+  | | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | | |  summary:     c_dE0
+  | | |
+  | | o  changeset:   4:9bf953aa81f6
+  | | |  parent:      1:134bc3852ad2
+  | | |  user:        test
+  | | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | | |  summary:     c_dD0
+  | | |
+  o | |  changeset:   3:840af1c6bc88
+  | | |  branch:      branch_A
+  | | |  parent:      0:ea207398892e
+  | | |  user:        test
+  | | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | | |  summary:     c_aC0
+  | | |
+  | o |  changeset:   2:286d02a6e2a2
+  | |/   user:        test
+  | |    date:        Thu Jan 01 00:00:00 1970 +0000
+  | |    summary:     c_dB0
+  | |
+  | o  changeset:   1:134bc3852ad2
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     c_dA0
+  |
+  o  changeset:   0:ea207398892e
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     ROOT
+  
+
+actual stripping
+
+  $ hg strip --config extensions.strip= --rev 'desc("c_dH0")'
+  saved backup bundle to $TESTTMP/client/.hg/strip-backup/fe47ea669cea-a41bf5a9-backup.hg
+
--- a/tests/test-sparse.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-sparse.t	Tue Dec 19 16:27:24 2017 -0500
@@ -257,7 +257,7 @@
    4 files changed, 4 insertions(+), 2 deletions(-)
   
   $ hg strip -r . -k
-  saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/39278f7c08a9-ce59e002-backup.hg (glob)
+  saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/39278f7c08a9-ce59e002-backup.hg
   $ hg status
   M show
   ? show2
@@ -267,7 +267,7 @@
   $ hg commit -Aqm "add show2"
   $ hg rebase -d 1 --config extensions.rebase=
   rebasing 2:bdde55290160 "add show2" (tip)
-  saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/bdde55290160-216ed9c6-rebase.hg (glob)
+  saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/bdde55290160-216ed9c6-rebase.hg
 
 Verify log --sparse only shows commits that affect the sparse checkout
 
--- a/tests/test-ssh-bundle1.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-ssh-bundle1.t	Tue Dec 19 16:27:24 2017 -0500
@@ -372,7 +372,7 @@
   73649e48688a
 
   $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
-  remote: Illegal repository "$TESTTMP/a'repo" (glob)
+  remote: Illegal repository "$TESTTMP/a'repo"
   abort: no suitable response from remote hg!
   [255]
 
@@ -467,8 +467,8 @@
   running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
   sending hello command
   sending between command
-  remote: 372
-  remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Aphases%3Dheads%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN
+  remote: 384
+  remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS$ unbundle=HG10GZ,HG10BZ,HG10UN
   remote: 1
   preparing listkeys for "bookmarks"
   sending listkeys command
--- a/tests/test-ssh.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-ssh.t	Tue Dec 19 16:27:24 2017 -0500
@@ -389,7 +389,7 @@
   73649e48688a
 
   $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
-  remote: Illegal repository "$TESTTMP/a'repo" (glob)
+  remote: Illegal repository "$TESTTMP/a'repo"
   abort: no suitable response from remote hg!
   [255]
 
@@ -483,8 +483,8 @@
   running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
   sending hello command
   sending between command
-  remote: 372
-  remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Aphases%3Dheads%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN
+  remote: 384
+  remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS$ unbundle=HG10GZ,HG10BZ,HG10UN
   remote: 1
   query 1; heads
   sending batch command
@@ -493,11 +493,13 @@
   no changes found
   sending getbundle command
   bundle2-input-bundle: with-transaction
+  bundle2-input-part: "bookmarks" supported
+  bundle2-input-part: total payload size 26
   bundle2-input-part: "listkeys" (params: 1 mandatory) supported
   bundle2-input-part: total payload size 45
   bundle2-input-part: "phase-heads" supported
   bundle2-input-part: total payload size 72
-  bundle2-input-bundle: 1 parts total
+  bundle2-input-bundle: 2 parts total
   checking for updated bookmarks
 
   $ cd ..
@@ -578,3 +580,37 @@
   remote: abort: this is an exercise
   abort: pull failed on remote
   [255]
+
+abort with no error hint when there is a ssh problem when pulling
+
+  $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
+  pulling from ssh://brokenrepository/
+  abort: no suitable response from remote hg!
+  [255]
+
+abort with configured error hint when there is a ssh problem when pulling
+
+  $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" \
+  > --config ui.ssherrorhint="Please see http://company/internalwiki/ssh.html"
+  pulling from ssh://brokenrepository/
+  abort: no suitable response from remote hg!
+  (Please see http://company/internalwiki/ssh.html)
+  [255]
+
+test that custom environment is passed down to ssh executable
+  $ cat >>dumpenv <<EOF
+  > #! /bin/sh
+  > echo \$VAR >&2
+  > EOF
+  $ chmod +x dumpenv
+  $ hg pull ssh://something --config ui.ssh="./dumpenv"
+  pulling from ssh://something/
+  remote: 
+  abort: no suitable response from remote hg!
+  [255]
+  $ hg pull ssh://something --config ui.ssh="./dumpenv" --config sshenv.VAR=17
+  pulling from ssh://something/
+  remote: 17
+  abort: no suitable response from remote hg!
+  [255]
+
--- a/tests/test-status-color.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-status-color.t	Tue Dec 19 16:27:24 2017 -0500
@@ -29,6 +29,22 @@
   [status.unknown|? ][status.unknown|b/2/in_b_2]
   [status.unknown|? ][status.unknown|b/in_b]
   [status.unknown|? ][status.unknown|in_root]
+HGPLAIN disables color
+  $ HGPLAIN=1 hg status --color=debug
+  ? a/1/in_a_1 (glob)
+  ? a/in_a (glob)
+  ? b/1/in_b_1 (glob)
+  ? b/2/in_b_2 (glob)
+  ? b/in_b (glob)
+  ? in_root
+HGPLAINEXCEPT=color does not disable color
+  $ HGPLAINEXCEPT=color hg status --color=debug
+  [status.unknown|? ][status.unknown|a/1/in_a_1] (glob)
+  [status.unknown|? ][status.unknown|a/in_a] (glob)
+  [status.unknown|? ][status.unknown|b/1/in_b_1] (glob)
+  [status.unknown|? ][status.unknown|b/2/in_b_2] (glob)
+  [status.unknown|? ][status.unknown|b/in_b] (glob)
+  [status.unknown|? ][status.unknown|in_root]
 
 hg status with template
   $ hg status -T "{label('red', path)}\n" --color=debug
--- a/tests/test-status-rev.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-status-rev.t	Tue Dec 19 16:27:24 2017 -0500
@@ -83,8 +83,7 @@
   ! missing_missing_missing-tracked
 
   $ hg status -A --rev 1 'glob:missing_missing_missing-untracked'
-  missing_missing_missing-untracked: The system cannot find the file specified (windows !)
-  missing_missing_missing-untracked: No such file or directory (no-windows !)
+  missing_missing_missing-untracked: $ENOENT$
 
 Status between first and second commit. Should ignore dirstate status.
 
--- a/tests/test-status.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-status.t	Tue Dec 19 16:27:24 2017 -0500
@@ -572,6 +572,10 @@
   $ hg st --config ui.statuscopies=false
   M a
   R b
+  $ hg st --config ui.tweakdefaults=yes
+  M a
+    b
+  R b
 
 using log status template (issue5155)
   $ hg log -Tstatus -r 'wdir()' -C
--- a/tests/test-strip.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-strip.t	Tue Dec 19 16:27:24 2017 -0500
@@ -203,7 +203,7 @@
 
   $ hg --traceback strip 4
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob)
+  saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg
   $ hg parents
   changeset:   1:ef3a871183d7
   user:        test
@@ -659,7 +659,7 @@
      singlenode1               13:43227190fef8
      singlenode2               13:43227190fef8
   $ hg strip -B multipledelete1 -B multipledelete2
-  saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg (glob)
+  saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg
   bookmark 'multipledelete1' deleted
   bookmark 'multipledelete2' deleted
   $ hg id -ir e46a4836065c
@@ -669,7 +669,7 @@
   abort: unknown revision 'b4594d867745'!
   [255]
   $ hg strip -B singlenode1 -B singlenode2
-  saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg (glob)
+  saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg
   bookmark 'singlenode1' deleted
   bookmark 'singlenode2' deleted
   $ hg id -ir 43227190fef8
@@ -737,12 +737,12 @@
   $ hg commit -Aqm b
   $ hg strip -r 0
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg (glob)
+  saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg
   $ ls .hg/strip-backup
   3903775176ed-e68910bd-backup.hg
   $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg
   $ hg strip -r 0
-  saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg (glob)
+  saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg
   $ ls .hg/strip-backup
   3903775176ed-54390173-backup.hg
   3903775176ed-e68910bd-backup.hg
@@ -846,7 +846,7 @@
   bundle2-output-bundle: "HG20", (1 params) 2 parts total
   bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
-  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg (glob)
+  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg
   updating the branch cache
   invalid branchheads cache (served): tip differs
   truncating cache/rbc-revs-v1 to 24
@@ -917,7 +917,7 @@
   $ hg book -r tip blah
   $ hg strip ".^" --config extensions.crash=$TESTTMP/stripstalephasecache.py
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/8f0b4384875c-4fa10deb-backup.hg (glob)
+  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/8f0b4384875c-4fa10deb-backup.hg
   $ hg up -C 1
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
@@ -937,8 +937,8 @@
   >     repo.__class__ = crashstriprepo
   > EOF
   $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
-  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob)
-  strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob)
+  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg
+  strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg'
   abort: boom
   [255]
 
@@ -1005,7 +1005,7 @@
 
   $ hg strip --force -r 35358f982181
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-50d992d4-backup.hg (glob)
+  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-50d992d4-backup.hg
   $ hg log -G
   @  changeset:   3:f62c6c09b707
   |  branch:      new-branch
@@ -1082,7 +1082,7 @@
 
   $ hg strip -r 35358f982181
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg (glob)
+  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
   $ hg log -G
   @  changeset:   3:f62c6c09b707
   |  branch:      new-branch
@@ -1109,7 +1109,7 @@
   
 
   $ hg pull -u $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
-  pulling from $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg (glob)
+  pulling from $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
   searching for changes
   adding changesets
   adding manifests
@@ -1119,7 +1119,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg strip -k -r 35358f982181
-  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg (glob)
+  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
   $ hg log -G
   @  changeset:   3:f62c6c09b707
   |  branch:      new-branch
@@ -1188,7 +1188,7 @@
   > EOF
   $ hg testdelayedstrip --config extensions.t=$TESTTMP/delayedstrip.py
   warning: orphaned descendants detected, not stripping 08ebfeb61bac, 112478962961, 7fb047a69f22
-  saved backup bundle to $TESTTMP/delayedstrip/.hg/strip-backup/f585351a92f8-17475721-I.hg (glob)
+  saved backup bundle to $TESTTMP/delayedstrip/.hg/strip-backup/f585351a92f8-17475721-I.hg
 
   $ hg log -G -T '{rev}:{node|short} {desc}' -r 'sort(all(), topo)'
   @  6:2f2d51af6205 J
@@ -1242,7 +1242,7 @@
   > EOF
   $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
   warning: orphaned descendants detected, not stripping 112478962961, 1fc8102cda62, 26805aba1e60
-  saved backup bundle to $TESTTMP/scmutilcleanup/.hg/strip-backup/f585351a92f8-73fb7c03-replace.hg (glob)
+  saved backup bundle to $TESTTMP/scmutilcleanup/.hg/strip-backup/f585351a92f8-73fb7c03-replace.hg
 
   $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)'
   o  8:1473d4b996d1 G2 b-F@divergent3 b-G
@@ -1307,13 +1307,13 @@
   o  0:426bada5c675 A b-B b-C b-I
   
   $ hg debugobsolete
-  1fc8102cda6204549f031015641606ccf5513ec3 1473d4b996d1d1b121de6b39fab6a04fbf9d873e 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'replace', 'user': 'test'}
-  64a8289d249234b9886244d379f15e6b650b28e3 d11b3456a873daec7c7bc53e5622e8df6d741bd2 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'replace', 'user': 'test'}
-  f585351a92f85104bff7c284233c338b10eb1df7 7c78f703e465d73102cc8780667ce269c5208a40 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'replace', 'user': 'test'}
-  48b9aae0607f43ff110d84e6883c151942add5ab 0 {0000000000000000000000000000000000000000} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'replace', 'user': 'test'}
-  112478962961147124edd43549aedd1a335e44bf 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'replace', 'user': 'test'}
-  08ebfeb61bac6e3f12079de774d285a0d6689eba 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'replace', 'user': 'test'}
-  26805aba1e600a82e93661149f2313866a221a7b 0 {112478962961147124edd43549aedd1a335e44bf} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'replace', 'user': 'test'}
+  1fc8102cda6204549f031015641606ccf5513ec3 1473d4b996d1d1b121de6b39fab6a04fbf9d873e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
+  64a8289d249234b9886244d379f15e6b650b28e3 d11b3456a873daec7c7bc53e5622e8df6d741bd2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
+  f585351a92f85104bff7c284233c338b10eb1df7 7c78f703e465d73102cc8780667ce269c5208a40 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'replace', 'user': 'test'}
+  48b9aae0607f43ff110d84e6883c151942add5ab 0 {0000000000000000000000000000000000000000} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
+  112478962961147124edd43549aedd1a335e44bf 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
+  08ebfeb61bac6e3f12079de774d285a0d6689eba 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
+  26805aba1e600a82e93661149f2313866a221a7b 0 {112478962961147124edd43549aedd1a335e44bf} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
   $ cd ..
 
 Test that obsmarkers are restored even when not using generaldelta
@@ -1328,11 +1328,11 @@
   $ hg ci -Aqm a
   $ hg ci --amend -m a2
   $ hg debugobsolete
-  cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
+  cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
   $ hg strip .
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/489bac576828-bef27e14-backup.hg (glob)
+  saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/489bac576828-bef27e14-backup.hg
   $ hg unbundle -q .hg/strip-backup/*
   $ hg debugobsolete
-  cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
+  cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
   $ cd ..
--- a/tests/test-subrepo-deep-nested-change.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-subrepo-deep-nested-change.t	Tue Dec 19 16:27:24 2017 -0500
@@ -18,7 +18,7 @@
   $ hg init sub2
   $ echo sub2 > sub2/sub2
   $ hg add -R sub2
-  adding sub2/sub2 (glob)
+  adding sub2/sub2
   $ hg commit -R sub2 -m "sub2 import"
 
 Preparing the 'sub1' repo which depends on the subrepo 'sub2'
@@ -41,8 +41,8 @@
   updating to branch default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg add -R sub1
-  adding sub1/.hgsub (glob)
-  adding sub1/sub1 (glob)
+  adding sub1/.hgsub
+  adding sub1/sub1
   $ hg commit -R sub1 -m "sub1 import"
 
 Preparing the 'main' repo which depends on the subrepo 'sub1'
@@ -77,8 +77,8 @@
   cloning subrepo sub2 from $TESTTMP/sub2
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg add -R main
-  adding main/.hgsub (glob)
-  adding main/main (glob)
+  adding main/.hgsub
+  adding main/main
   $ hg commit -R main -m "main import"
 
 #if serve
@@ -89,13 +89,13 @@
 are also available as siblings of 'main'.
 
   $ hg serve -R main --debug -S -p $HGPORT -d --pid-file=hg1.pid -E error.log -A access.log
-  adding  = $TESTTMP/main (glob)
-  adding sub1 = $TESTTMP/main/sub1 (glob)
-  adding sub1/sub2 = $TESTTMP/main/sub1/sub2 (glob)
+  adding  = $TESTTMP/main
+  adding sub1 = $TESTTMP/main/sub1
+  adding sub1/sub2 = $TESTTMP/main/sub1/sub2
   listening at http://*:$HGPORT/ (bound to *:$HGPORT) (glob) (?)
-  adding  = $TESTTMP/main (glob) (?)
-  adding sub1 = $TESTTMP/main/sub1 (glob) (?)
-  adding sub1/sub2 = $TESTTMP/main/sub1/sub2 (glob) (?)
+  adding  = $TESTTMP/main (?)
+  adding sub1 = $TESTTMP/main/sub1 (?)
+  adding sub1/sub2 = $TESTTMP/main/sub1/sub2 (?)
   $ cat hg1.pid >> $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT httpclone --config progress.disable=True
@@ -186,14 +186,14 @@
                                                               \r (no-eol) (esc)
   updating to branch default
   cloning subrepo sub1 from $TESTTMP/sub1
-  cloning subrepo sub1/sub2 from $TESTTMP/sub2 (glob)
+  cloning subrepo sub1/sub2 from $TESTTMP/sub2
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Largefiles is NOT enabled in the clone if the source repo doesn't require it
   $ cat cloned/.hg/hgrc
   # example repository config (see 'hg help config' for more info)
   [paths]
-  default = $TESTTMP/main (glob)
+  default = $TESTTMP/main
   
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
@@ -231,7 +231,7 @@
   $ echo modified > cloned/sub1/sub2/sub2
   $ hg commit --subrepos -m "deep nested modif should trigger a commit" -R cloned
   committing subrepository sub1
-  committing subrepository sub1/sub2 (glob)
+  committing subrepository sub1/sub2
 
 Checking modified node ids
 
@@ -263,7 +263,7 @@
   $ hg ci -ASm "add test.txt"
   adding sub1/sub2/folder/test.txt
   committing subrepository sub1
-  committing subrepository sub1/sub2 (glob)
+  committing subrepository sub1/sub2
 
   $ rm -r main
   $ hg archive -S -qr 'wdir()' ../wdir
@@ -309,8 +309,8 @@
   \r (no-eol) (esc)
   deleting [===========================================>] 2/2\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
-  removing sub1/sub2/folder/test.txt (glob)
-  removing sub1/sub2/test.txt (glob)
+  removing sub1/sub2/folder/test.txt
+  removing sub1/sub2/test.txt
   $ hg status -S
   R sub1/sub2/folder/test.txt
   R sub1/sub2/test.txt
@@ -368,10 +368,10 @@
   \r (no-eol) (esc)
   searching for exact renames [                         ] 0/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
-  adding ../sub1/sub2/folder/test.txt (glob)
-  removing ../sub1/sub2/test.txt (glob)
-  adding ../sub1/foo (glob)
-  adding bar/abc (glob)
+  adding ../sub1/sub2/folder/test.txt
+  removing ../sub1/sub2/test.txt
+  adding ../sub1/foo
+  adding bar/abc
   $ cd ..
   $ hg status -S
   A foo/bar/abc
@@ -398,9 +398,9 @@
   archiving (sub1) [===================================>] 4/4\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (sub1/sub2) [                               ] 0/2\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============>                ] 1/2\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============================>] 2/2\r (no-eol) (glob) (esc)
+  archiving (sub1/sub2) [                               ] 0/2\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============>                ] 1/2\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============================>] 2/2\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   $ diff -r . ../wdir | egrep -v '\.hg$|^Common subdirectories:'
   Only in ../wdir: .hg_archival.txt
@@ -442,9 +442,9 @@
   archiving (sub1) [===================================>] 3/3\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (sub1/sub2) [                               ] 0/2\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============>                ] 1/2\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============================>] 2/2\r (no-eol) (glob) (esc)
+  archiving (sub1/sub2) [                               ] 0/2\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============>                ] 1/2\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============================>] 2/2\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   $ find ../wdir -type f | sort
   ../wdir/.hg_archival.txt
@@ -474,10 +474,10 @@
   archiving (sub1) [===================================>] 3/3\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (sub1/sub2) [                               ] 0/3\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [=========>                     ] 1/3\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [===================>           ] 2/3\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============================>] 3/3\r (no-eol) (glob) (esc)
+  archiving (sub1/sub2) [                               ] 0/3\r (no-eol) (esc)
+  archiving (sub1/sub2) [=========>                     ] 1/3\r (no-eol) (esc)
+  archiving (sub1/sub2) [===================>           ] 2/3\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============================>] 3/3\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   $ cat ../wdir/.hg_archival.txt
   repo: 7f491f53a367861f47ee64a80eb997d1f341b77a
@@ -489,15 +489,15 @@
 
   $ touch sub1/sub2/folder/bar
   $ hg addremove sub1/sub2
-  adding sub1/sub2/folder/bar (glob)
+  adding sub1/sub2/folder/bar
   $ hg status -S
   A sub1/sub2/folder/bar
   ? foo/bar/abc
   ? sub1/foo
   $ hg update -Cq
   $ hg addremove sub1
-  adding sub1/sub2/folder/bar (glob)
-  adding sub1/foo (glob)
+  adding sub1/sub2/folder/bar
+  adding sub1/foo
   $ hg update -Cq
   $ rm sub1/sub2/folder/test.txt
   $ rm sub1/sub2/test.txt
@@ -508,7 +508,7 @@
   adding sub1/foo
   adding foo/bar/abc
   committing subrepository sub1
-  committing subrepository sub1/sub2 (glob)
+  committing subrepository sub1/sub2
 
   $ hg forget sub1/sub2/sub2
   $ echo x > sub1/sub2/x.txt
@@ -518,75 +518,75 @@
   $ hg files -S
   .hgsub
   .hgsubstate
-  foo/bar/abc (glob)
+  foo/bar/abc
   main
-  sub1/.hgsub (glob)
-  sub1/.hgsubstate (glob)
-  sub1/foo (glob)
-  sub1/sub1 (glob)
-  sub1/sub2/folder/bar (glob)
-  sub1/sub2/x.txt (glob)
+  sub1/.hgsub
+  sub1/.hgsubstate
+  sub1/foo
+  sub1/sub1
+  sub1/sub2/folder/bar
+  sub1/sub2/x.txt
 
   $ hg files -S "set:eol('dos') or eol('unix') or size('<= 0')"
   .hgsub
   .hgsubstate
-  foo/bar/abc (glob)
+  foo/bar/abc
   main
-  sub1/.hgsub (glob)
-  sub1/.hgsubstate (glob)
-  sub1/foo (glob)
-  sub1/sub1 (glob)
-  sub1/sub2/folder/bar (glob)
-  sub1/sub2/x.txt (glob)
+  sub1/.hgsub
+  sub1/.hgsubstate
+  sub1/foo
+  sub1/sub1
+  sub1/sub2/folder/bar
+  sub1/sub2/x.txt
 
   $ hg files -r '.^' -S "set:eol('dos') or eol('unix')"
   .hgsub
   .hgsubstate
   main
-  sub1/.hgsub (glob)
-  sub1/.hgsubstate (glob)
-  sub1/sub1 (glob)
-  sub1/sub2/folder/test.txt (glob)
-  sub1/sub2/sub2 (glob)
-  sub1/sub2/test.txt (glob)
+  sub1/.hgsub
+  sub1/.hgsubstate
+  sub1/sub1
+  sub1/sub2/folder/test.txt
+  sub1/sub2/sub2
+  sub1/sub2/test.txt
 
   $ hg files sub1
-  sub1/.hgsub (glob)
-  sub1/.hgsubstate (glob)
-  sub1/foo (glob)
-  sub1/sub1 (glob)
-  sub1/sub2/folder/bar (glob)
-  sub1/sub2/x.txt (glob)
+  sub1/.hgsub
+  sub1/.hgsubstate
+  sub1/foo
+  sub1/sub1
+  sub1/sub2/folder/bar
+  sub1/sub2/x.txt
 
   $ hg files sub1/sub2
-  sub1/sub2/folder/bar (glob)
-  sub1/sub2/x.txt (glob)
+  sub1/sub2/folder/bar
+  sub1/sub2/x.txt
 
   $ hg files
   .hgsub
   .hgsubstate
-  foo/bar/abc (glob)
+  foo/bar/abc
   main
 
   $ hg files -S -r '.^' sub1/sub2/folder
-  sub1/sub2/folder/test.txt (glob)
+  sub1/sub2/folder/test.txt
 
   $ hg files -S -r '.^' sub1/sub2/missing
-  sub1/sub2/missing: no such file in rev 78026e779ea6 (glob)
+  sub1/sub2/missing: no such file in rev 78026e779ea6
   [1]
 
   $ hg files -r '.^' sub1/
-  sub1/.hgsub (glob)
-  sub1/.hgsubstate (glob)
-  sub1/sub1 (glob)
-  sub1/sub2/folder/test.txt (glob)
-  sub1/sub2/sub2 (glob)
-  sub1/sub2/test.txt (glob)
+  sub1/.hgsub
+  sub1/.hgsubstate
+  sub1/sub1
+  sub1/sub2/folder/test.txt
+  sub1/sub2/sub2
+  sub1/sub2/test.txt
 
   $ hg files -r '.^' sub1/sub2
-  sub1/sub2/folder/test.txt (glob)
-  sub1/sub2/sub2 (glob)
-  sub1/sub2/test.txt (glob)
+  sub1/sub2/folder/test.txt
+  sub1/sub2/sub2
+  sub1/sub2/test.txt
 
   $ hg rollback -q
   $ hg up -Cq
@@ -605,10 +605,10 @@
   archiving (sub1) [===================================>] 3/3\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (sub1/sub2) [                               ] 0/3\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [=========>                     ] 1/3\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [===================>           ] 2/3\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============================>] 3/3\r (no-eol) (glob) (esc)
+  archiving (sub1/sub2) [                               ] 0/3\r (no-eol) (esc)
+  archiving (sub1/sub2) [=========>                     ] 1/3\r (no-eol) (esc)
+  archiving (sub1/sub2) [===================>           ] 2/3\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============================>] 3/3\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   $ find ../archive_all | sort
   ../archive_all
@@ -642,8 +642,8 @@
   archiving (sub1) [===================================>] 3/3\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (sub1/sub2) [                               ] 0/1\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============================>] 1/1\r (no-eol) (glob) (esc)
+  archiving (sub1/sub2) [                               ] 0/1\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   $ find ../archive_exclude | sort
   ../archive_exclude
@@ -663,9 +663,9 @@
   archiving (sub1) [ <=>                                  ] 0\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (sub1/sub2) [                               ] 0/2\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============>                ] 1/2\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============================>] 2/2\r (no-eol) (glob) (esc)
+  archiving (sub1/sub2) [                               ] 0/2\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============>                ] 1/2\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============================>] 2/2\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   $ find ../archive_include | sort
   ../archive_include
@@ -686,7 +686,7 @@
   $ hg --config extensions.largefiles= add --large large.bin
   $ hg --config extensions.largefiles= ci -S -m "add large files"
   committing subrepository sub1
-  committing subrepository sub1/sub2 (glob)
+  committing subrepository sub1/sub2
 
   $ hg --config extensions.largefiles= archive -S ../archive_lf
   $ find ../archive_lf | sort
@@ -785,7 +785,7 @@
   $ cat ../lfclone/.hg/hgrc
   # example repository config (see 'hg help config' for more info)
   [paths]
-  default = $TESTTMP/cloned (glob)
+  default = $TESTTMP/cloned
   
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
@@ -817,16 +817,16 @@
   $ touch sub1/sub2/untracked.txt
   $ touch sub1/sub2/large.dat
   $ hg forget sub1/sub2/large.bin sub1/sub2/test.txt sub1/sub2/untracked.txt
-  not removing sub1/sub2/untracked.txt: file is already untracked (glob)
+  not removing sub1/sub2/untracked.txt: file is already untracked
   [1]
   $ hg add --large --dry-run -v sub1/sub2/untracked.txt
-  adding sub1/sub2/untracked.txt as a largefile (glob)
+  adding sub1/sub2/untracked.txt as a largefile
   $ hg add --large -v sub1/sub2/untracked.txt
-  adding sub1/sub2/untracked.txt as a largefile (glob)
+  adding sub1/sub2/untracked.txt as a largefile
   $ hg add --normal -v sub1/sub2/large.dat
-  adding sub1/sub2/large.dat (glob)
+  adding sub1/sub2/large.dat
   $ hg forget -v sub1/sub2/untracked.txt
-  removing sub1/sub2/untracked.txt (glob)
+  removing sub1/sub2/untracked.txt
   $ hg status -S
   A sub1/sub2/large.dat
   R sub1/sub2/large.bin
@@ -907,7 +907,7 @@
   $ hg add -v foo/bar/abc a.txt a.dat
   adding a.dat as a largefile
   adding a.txt
-  adding foo/bar/abc (glob)
+  adding foo/bar/abc
   $ hg ci -m 'dir commit with only normal file deltas' foo/bar
   $ hg status
   A a.dat
@@ -1040,7 +1040,7 @@
   archiving (sub1) [ <=>                                  ] 0\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (sub1/sub2) [ <=>                             ] 0\r (no-eol) (glob) (esc)
+  archiving (sub1/sub2) [ <=>                             ] 0\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
   archiving (sub3) [ <=>                                  ] 0\r (no-eol) (esc)
@@ -1054,7 +1054,7 @@
   archiving (sub1) [ <=>                                  ] 0\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (sub1/sub2) [ <=>                             ] 0\r (no-eol) (glob) (esc)
+  archiving (sub1/sub2) [ <=>                             ] 0\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   diff -Nru cloned.*/.hgsub cloned/.hgsub (glob)
   --- cloned.*/.hgsub	* (glob)
@@ -1082,8 +1082,8 @@
   archiving (sub1) [===================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (sub1/sub2) [                               ] 0/1\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============================>] 1/1\r (no-eol) (glob) (esc)
+  archiving (sub1/sub2) [                               ] 0/1\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
   archiving [                                           ] 0/8\r (no-eol) (esc)
@@ -1101,10 +1101,10 @@
   archiving (sub1) [===================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (sub1/sub2) [                               ] 0/3\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [=========>                     ] 1/3\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [===================>           ] 2/3\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============================>] 3/3\r (no-eol) (glob) (esc)
+  archiving (sub1/sub2) [                               ] 0/3\r (no-eol) (esc)
+  archiving (sub1/sub2) [=========>                     ] 1/3\r (no-eol) (esc)
+  archiving (sub1/sub2) [===================>           ] 2/3\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============================>] 3/3\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
   archiving (sub3) [                                    ] 0/1\r (no-eol) (esc)
@@ -1179,8 +1179,8 @@
   archiving (sub1) [ <=>                                  ] 0\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (sub1/sub2) [                               ] 0/1\r (no-eol) (glob) (esc)
-  archiving (sub1/sub2) [==============================>] 1/1\r (no-eol) (glob) (esc)
+  archiving (sub1/sub2) [                               ] 0/1\r (no-eol) (esc)
+  archiving (sub1/sub2) [==============================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   --- */cloned.*/sub1/sub2/sub2	* (glob)
   +++ */cloned/sub1/sub2/sub2	* (glob)
--- a/tests/test-subrepo-git.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-subrepo-git.t	Tue Dec 19 16:27:24 2017 -0500
@@ -191,7 +191,7 @@
 user b push changes
 
   $ hg push 2>/dev/null
-  pushing to $TESTTMP/t (glob)
+  pushing to $TESTTMP/t
   pushing branch testing of subrepository "s"
   searching for changes
   adding changesets
@@ -203,7 +203,7 @@
 
   $ cd ../ta
   $ hg pull
-  pulling from $TESTTMP/t (glob)
+  pulling from $TESTTMP/t
   searching for changes
   adding changesets
   adding manifests
@@ -236,7 +236,7 @@
    source   ../gitroot
    revision f47b465e1bce645dbf37232a00574aa1546ca8d3
   $ hg push 2>/dev/null
-  pushing to $TESTTMP/t (glob)
+  pushing to $TESTTMP/t
   pushing branch testing of subrepository "s"
   searching for changes
   adding changesets
@@ -268,7 +268,7 @@
   $ echo aa >> a
   $ hg commit -m aa
   $ hg push
-  pushing to $TESTTMP/t (glob)
+  pushing to $TESTTMP/t
   searching for changes
   adding changesets
   adding manifests
@@ -399,7 +399,7 @@
   M inner/s/f
   $ hg commit --subrepos -m nested
   committing subrepository inner
-  committing subrepository inner/s (glob)
+  committing subrepository inner/s
 
 nested archive
 
@@ -640,9 +640,10 @@
 traceback
 #if no-windows
   $ hg forget 'notafile*'
-  notafile*: No such file or directory
+  notafile*: $ENOENT$
   [1]
 #else
+error: The filename, directory name, or volume label syntax is incorrect
   $ hg forget 'notafile'
   notafile: * (glob)
   [1]
@@ -677,8 +678,8 @@
 
   $ hg -R tc pull -q
   $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort
-  warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
-  warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
+  warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg'
+  warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg'
   $ cd tc
   $ hg parents -q
   8:3473d20bddcf
@@ -724,8 +725,8 @@
   $ cd ..
   $ hg -R tc pull -q
   $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort
-  warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
-  warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
+  warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg'
+  warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg'
   $ cd tc
   $ hg parents -q
   9:ed23f7fe024e
@@ -847,8 +848,8 @@
 the output contains a regex, because git 1.7.10 and 1.7.11
  change the amount of whitespace
   $ hg diff --subrepos --stat
-  \s*barfoo |\s*1 + (re)
-  \s*foobar |\s*2 +- (re)
+  \s*barfoo \|\s+1 \+ (re)
+  \s*foobar \|\s+2 \+- (re)
    2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) (re)
 
 adding an include should ignore the other elements
@@ -923,8 +924,8 @@
   $ echo 'bloop' > s/foobar
   $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
   reverting subrepo ../gitroot
-  creating directory: $TESTTMP/tc/.hg/origbackups (glob)
-  saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar (glob)
+  creating directory: $TESTTMP/tc/.hg/origbackups
+  saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar
   $ ls .hg/origbackups
   foobar
   $ rm -rf .hg/origbackups
@@ -997,7 +998,7 @@
   reverting subrepo ../gitroot
 
   $ hg add --subrepos "glob:**.python"
-  adding s/snake.python (glob)
+  adding s/snake.python
   $ hg st --subrepos s
   A s/snake.python
   ? s/barfoo
@@ -1008,11 +1009,11 @@
   reverting subrepo ../gitroot
 
   $ hg add --subrepos s
-  adding s/barfoo (glob)
-  adding s/c.c (glob)
-  adding s/cpp.cpp (glob)
-  adding s/foobar.orig (glob)
-  adding s/snake.python (glob)
+  adding s/barfoo
+  adding s/c.c
+  adding s/cpp.cpp
+  adding s/foobar.orig
+  adding s/snake.python
   $ hg st --subrepos s
   A s/barfoo
   A s/c.c
@@ -1030,10 +1031,10 @@
   ? s/snake.python
 
   $ hg add --subrepos --exclude "path:s/c.c"
-  adding s/barfoo (glob)
-  adding s/cpp.cpp (glob)
-  adding s/foobar.orig (glob)
-  adding s/snake.python (glob)
+  adding s/barfoo
+  adding s/cpp.cpp
+  adding s/foobar.orig
+  adding s/snake.python
   $ hg st --subrepos s
   A s/barfoo
   A s/cpp.cpp
@@ -1049,7 +1050,7 @@
   > EOF
   $ hg add .hgignore
   $ hg add --subrepos "glob:**.python" s/barfoo
-  adding s/snake.python (glob)
+  adding s/snake.python
   $ hg st --subrepos s
   A s/barfoo
   A s/snake.python
@@ -1098,10 +1099,10 @@
 
 correctly do a dry run
   $ hg add --subrepos s --dry-run
-  adding s/barfoo (glob)
-  adding s/c.c (glob)
-  adding s/cpp.cpp (glob)
-  adding s/foobar.orig (glob)
+  adding s/barfoo
+  adding s/c.c
+  adding s/cpp.cpp
+  adding s/foobar.orig
   $ hg st --subrepos s
   A s/.gitignore
   A s/snake.python
@@ -1195,7 +1196,7 @@
   $ unset GIT_ALLOW_PROTOCOL
   $ PWNED_MSG="your git is too old or mercurial has regressed" hg clone \
   > malicious-subrepository malicious-subrepository-protected
-  Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob)
+  Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'...
   fatal: transport 'ext' not allowed
   updating to branch default
   cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
@@ -1208,7 +1209,7 @@
   $ rm -f pwned.txt
   $ env GIT_ALLOW_PROTOCOL=ext PWNED_MSG="you asked for it" hg clone \
   > malicious-subrepository malicious-subrepository-clone-allowed
-  Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob)
+  Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'...
   fatal: Could not read from remote repository.
   
   Please make sure you have the correct access rights
--- a/tests/test-subrepo-missing.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-subrepo-missing.t	Tue Dec 19 16:27:24 2017 -0500
@@ -130,10 +130,10 @@
   checking files
   2 files, 5 changesets, 5 total revisions
   checking subrepo links
-  0: repository $TESTTMP/repo/subrepo not found (glob)
-  1: repository $TESTTMP/repo/subrepo not found (glob)
-  3: repository $TESTTMP/repo/subrepo not found (glob)
-  4: repository $TESTTMP/repo/subrepo not found (glob)
+  0: repository $TESTTMP/repo/subrepo not found
+  1: repository $TESTTMP/repo/subrepo not found
+  3: repository $TESTTMP/repo/subrepo not found
+  4: repository $TESTTMP/repo/subrepo not found
   $ ls
   b
   $ mv b subrepo
--- a/tests/test-subrepo-paths.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-subrepo-paths.t	Tue Dec 19 16:27:24 2017 -0500
@@ -55,7 +55,7 @@
   > .* = \1
   > EOF
   $ hg debugsub
-  abort: bad subrepository pattern in $TESTTMP/outer/.hg/hgrc:2: invalid group reference (glob)
+  abort: bad subrepository pattern in $TESTTMP/outer/.hg/hgrc:2: invalid group reference
   [255]
 
   $ cd ..
--- a/tests/test-subrepo-recursion.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-subrepo-recursion.t	Tue Dec 19 16:27:24 2017 -0500
@@ -23,10 +23,10 @@
   $ hg add -S .hgsub
   $ hg add -S foo/.hgsub
   $ hg add -S foo/bar
-  adding foo/bar/z.txt (glob)
+  adding foo/bar/z.txt
   $ hg add -S
   adding x.txt
-  adding foo/y.txt (glob)
+  adding foo/y.txt
 
 Test recursive status without committing anything:
 
@@ -67,7 +67,7 @@
 
   $ hg commit -m 0-0-0 --config ui.commitsubrepos=No --subrepos
   committing subrepository foo
-  committing subrepository foo/bar (glob)
+  committing subrepository foo/bar
 
   $ cd foo
   $ echo y2 >> y.txt
@@ -192,7 +192,7 @@
   $ rm -r dir
   $ hg commit --subrepos -m 2-3-2
   committing subrepository foo
-  committing subrepository foo/bar (glob)
+  committing subrepository foo/bar
 
 Test explicit path commands within subrepos: add/forget
   $ echo z1 > foo/bar/z2.txt
@@ -205,7 +205,7 @@
   $ hg status -S
   ? foo/bar/z2.txt
   $ hg forget foo/bar/z2.txt
-  not removing foo/bar/z2.txt: file is already untracked (glob)
+  not removing foo/bar/z2.txt: file is already untracked
   [1]
   $ hg status -S
   ? foo/bar/z2.txt
@@ -254,13 +254,13 @@
 #if serve
   $ cd ..
   $ hg serve -R repo --debug -S -p $HGPORT -d --pid-file=hg1.pid -E error.log -A access.log
-  adding  = $TESTTMP/repo (glob)
-  adding foo = $TESTTMP/repo/foo (glob)
-  adding foo/bar = $TESTTMP/repo/foo/bar (glob)
+  adding  = $TESTTMP/repo
+  adding foo = $TESTTMP/repo/foo
+  adding foo/bar = $TESTTMP/repo/foo/bar
   listening at http://*:$HGPORT/ (bound to *:$HGPORT) (glob) (?)
-  adding  = $TESTTMP/repo (glob) (?)
-  adding foo = $TESTTMP/repo/foo (glob) (?)
-  adding foo/bar = $TESTTMP/repo/foo/bar (glob) (?)
+  adding  = $TESTTMP/repo (?)
+  adding foo = $TESTTMP/repo/foo (?)
+  adding foo/bar = $TESTTMP/repo/foo/bar (?)
   $ cat hg1.pid >> $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT clone  --config progress.disable=True
@@ -278,7 +278,7 @@
   adding file changes
   added 4 changesets with 7 changes to 3 files
   new changesets af048e97ade2:65903cebad86
-  cloning subrepo foo/bar from http://localhost:$HGPORT/foo/bar (glob)
+  cloning subrepo foo/bar from http://localhost:$HGPORT/foo/bar
   requesting all changes
   adding changesets
   adding manifests
@@ -340,8 +340,8 @@
   archiving (foo) [====================================>] 3/3\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (foo/bar) [                                 ] 0/1\r (no-eol) (glob) (esc)
-  archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc)
+  archiving (foo/bar) [                                 ] 0/1\r (no-eol) (esc)
+  archiving (foo/bar) [================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   $ find ../archive | sort
   ../archive
@@ -372,8 +372,8 @@
   archiving (foo) [====================================>] 3/3\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (foo/bar) [                                 ] 0/1\r (no-eol) (glob) (esc)
-  archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc)
+  archiving (foo/bar) [                                 ] 0/1\r (no-eol) (esc)
+  archiving (foo/bar) [================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
 
 (unzip date formating is unstable, we do not care about it and glob it out)
@@ -445,11 +445,11 @@
   linking [      <=>                                      ] 6\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
-  archiving (foo/bar) [                                 ] 0/1\r (no-eol) (glob) (esc)
-  archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc)
+  archiving (foo/bar) [                                 ] 0/1\r (no-eol) (esc)
+  archiving (foo/bar) [================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   cloning subrepo foo from $TESTTMP/repo/foo
-  cloning subrepo foo/bar from $TESTTMP/repo/foo/bar (glob)
+  cloning subrepo foo/bar from $TESTTMP/repo/foo/bar
 #else
 Note there's a slight output glitch on non-hardlink systems: the last
 "linking" progress topic never gets closed, leading to slight output corruption on that platform.
@@ -462,7 +462,7 @@
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
   linking [ <=>                                           ] 1\r (no-eol) (esc)
-  cloning subrepo foo/bar from $TESTTMP/repo/foo/bar (glob)
+  cloning subrepo foo/bar from $TESTTMP/repo/foo/bar
 #endif
 
 Archive + subrepos uses '/' for all component separators
@@ -498,7 +498,7 @@
   $ echo f > foo/f
   $ hg archive --subrepos -r tip archive
   cloning subrepo foo from $TESTTMP/empty/foo
-  abort: destination '$TESTTMP/almost-empty/foo' is not empty (in subrepository "foo") (glob)
+  abort: destination '$TESTTMP/almost-empty/foo' is not empty (in subrepository "foo")
   [255]
 
 Clone and test outgoing:
@@ -507,11 +507,11 @@
   $ hg clone repo repo2
   updating to branch default
   cloning subrepo foo from $TESTTMP/repo/foo
-  cloning subrepo foo/bar from $TESTTMP/repo/foo/bar (glob)
+  cloning subrepo foo/bar from $TESTTMP/repo/foo/bar
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd repo2
   $ hg outgoing -S
-  comparing with $TESTTMP/repo (glob)
+  comparing with $TESTTMP/repo
   searching for changes
   no changes found
   comparing with $TESTTMP/repo/foo
@@ -537,7 +537,7 @@
   $ hg commit --subrepos -m 3-4-2
   committing subrepository foo
   $ hg outgoing -S
-  comparing with $TESTTMP/repo (glob)
+  comparing with $TESTTMP/repo
   searching for changes
   changeset:   3:2655b8ecc4ee
   tag:         tip
@@ -567,7 +567,7 @@
 Test incoming:
 
   $ hg incoming -S
-  comparing with $TESTTMP/repo2 (glob)
+  comparing with $TESTTMP/repo2
   searching for changes
   changeset:   3:2655b8ecc4ee
   tag:         tip
--- a/tests/test-subrepo-relative-path.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-subrepo-relative-path.t	Tue Dec 19 16:27:24 2017 -0500
@@ -5,7 +5,7 @@
   $ hg init sub
   $ echo sub > sub/sub
   $ hg add -R sub
-  adding sub/sub (glob)
+  adding sub/sub
   $ hg commit -R sub -m "sub import"
 
 Preparing the 'main' repo which depends on the subrepo 'sub'
@@ -17,8 +17,8 @@
   updating to branch default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg add -R main
-  adding main/.hgsub (glob)
-  adding main/main (glob)
+  adding main/.hgsub
+  adding main/main
   $ hg commit -R main -m "main import"
 
 Cleaning both repositories, just as a clone -U
--- a/tests/test-subrepo-svn.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-subrepo-svn.t	Tue Dec 19 16:27:24 2017 -0500
@@ -22,12 +22,12 @@
   $ echo alpha > src/alpha
   $ svn add src
   A         src
-  A         src/alpha (glob)
+  A         src/alpha
   $ mkdir externals
   $ echo other > externals/other
   $ svn add externals
   A         externals
-  A         externals/other (glob)
+  A         externals/other
   $ svn ci -qm 'Add alpha'
   $ svn up -q
   $ echo "externals -r1 $SVNREPOURL/externals" > extdef
@@ -91,10 +91,10 @@
 
   $ hg debugsub
   path s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
   path subdir/s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
 
 change file in svn and hg, commit
@@ -117,10 +117,10 @@
   At revision 3.
   $ hg debugsub
   path s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 3
   path subdir/s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
 
 missing svn file, commit should fail
@@ -173,7 +173,7 @@
 this commit fails because of meta changes
 
   $ svn propset svn:mime-type 'text/html' s/alpha
-  property 'svn:mime-type' set on 's/alpha' (glob)
+  property 'svn:mime-type' set on 's/alpha'
   $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
   committing subrepository s
   abort: svn:*Commit failed (details follow): (glob)
@@ -204,7 +204,7 @@
 this commit fails because of externals meta changes
 
   $ svn propset svn:mime-type 'text/html' s/externals/other
-  property 'svn:mime-type' set on 's/externals/other' (glob)
+  property 'svn:mime-type' set on 's/externals/other'
   $ hg ci --subrepos -m 'amend externals from hg'
   committing subrepository s
   abort: cannot commit svn externals (in subrepository "s")
@@ -216,19 +216,19 @@
   $ cd ..
   $ hg clone t tc
   updating to branch default
-  A    tc/s/alpha (glob)
-   U   tc/s (glob)
+  A    tc/s/alpha
+   U   tc/s
   
   Fetching external item into 'tc/s/externals'* (glob)
-  A    tc/s/externals/other (glob)
+  A    tc/s/externals/other
   Checked out external at revision 1.
   
   Checked out revision 3.
-  A    tc/subdir/s/alpha (glob)
-   U   tc/subdir/s (glob)
+  A    tc/subdir/s/alpha
+   U   tc/subdir/s
   
   Fetching external item into 'tc/subdir/s/externals'* (glob)
-  A    tc/subdir/s/externals/other (glob)
+  A    tc/subdir/s/externals/other
   Checked out external at revision 1.
   
   Checked out revision 2.
@@ -239,10 +239,10 @@
 
   $ hg debugsub
   path s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 3
   path subdir/s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
 
 verify subrepo is contained within the repo directory
@@ -430,7 +430,7 @@
   $ echo epsilon.py > dir/epsilon.py
   $ svn add dir
   A         dir
-  A         dir/epsilon.py (glob)
+  A         dir/epsilon.py
   $ svn ci -qm 'Add dir/epsilon.py'
   $ cd ../..
   $ hg init rebaserepo
@@ -495,7 +495,7 @@
 
   $ hg ci --subrepos -m cleanup | filter_svn_output
   committing subrepository obstruct
-  Sending        obstruct/other (glob)
+  Sending        obstruct/other
   Committed revision 7.
   At revision 7.
   $ svn mkdir -qm "baseline" $SVNREPOURL/trunk
@@ -516,7 +516,7 @@
   $ cd ..
   $ rm -rf tempwc
   $ svn co "$SVNREPOURL/branch"@10 recreated
-  A    recreated/somethingold (glob)
+  A    recreated/somethingold
   Checked out revision 10.
   $ echo "recreated =        [svn]       $SVNREPOURL/branch" >> .hgsub
   $ hg ci -m addsub
@@ -571,15 +571,9 @@
 Test forgetting files, not implemented in svn subrepo, used to
 traceback
 
-#if no-windows
   $ hg forget 'notafile*'
-  notafile*: No such file or directory
+  notafile*: $ENOENT$
   [1]
-#else
-  $ hg forget 'notafile'
-  notafile: * (glob)
-  [1]
-#endif
 
 Test a subrepo referencing a just moved svn path. Last commit rev will
 be different from the revision, and the path will be different as
@@ -590,8 +584,8 @@
   $ mkdir trunk/subdir branches
   $ echo a > trunk/subdir/a
   $ svn add trunk/subdir branches
-  A         trunk/subdir (glob)
-  A         trunk/subdir/a (glob)
+  A         trunk/subdir
+  A         trunk/subdir/a
   A         branches
   $ svn ci -qm addsubdir
   $ svn cp -qm branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch
@@ -600,7 +594,7 @@
   $ hg init repo2
   $ cd repo2
   $ svn co $SVNREPOURL/branches/somebranch/subdir
-  A    subdir/a (glob)
+  A    subdir/a
   Checked out revision 15.
   $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub
   $ hg add .hgsub
@@ -624,10 +618,10 @@
   $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc
   $ svn add .hg sub
   A         .hg
-  A         .hg/hgrc (glob)
+  A         .hg/hgrc
   A         sub
-  A         sub/.hg (glob)
-  A         sub/.hg/hgrc (glob)
+  A         sub/.hg
+  A         sub/.hg/hgrc
   $ svn ci -qm 'add .hg/hgrc to be sanitized at hg update'
   $ svn up -q
   $ cd ..
@@ -637,8 +631,8 @@
   $ cd ..
 
   $ hg -R tc pull -u -q 2>&1 | sort
-  warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg' (glob)
-  warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg' (glob)
+  warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg'
+  warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg'
   $ cd tc
   $ grep ' s$' .hgsubstate
   16 s
--- a/tests/test-subrepo.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-subrepo.t	Tue Dec 19 16:27:24 2017 -0500
@@ -29,7 +29,7 @@
   $ hg files -S
   .hgsub
   a
-  s/a (glob)
+  s/a
 
   $ hg -R s ci -Ams0
   $ hg sum
@@ -58,10 +58,10 @@
   $ mkdir snot
   $ touch snot/file
   $ hg remove -S snot/file
-  not removing snot/file: file is untracked (glob)
+  not removing snot/file: file is untracked
   [1]
   $ hg cat snot/filenot
-  snot/filenot: no such file in rev 7cf8cfea66e4 (glob)
+  snot/filenot: no such file in rev 7cf8cfea66e4
   [1]
   $ rm -r snot
 
@@ -70,12 +70,12 @@
   $ echo b > s/a
   $ hg revert --dry-run "set:subrepo('glob:s*')"
   reverting subrepo s
-  reverting s/a (glob)
+  reverting s/a
   $ cat s/a
   b
   $ hg revert "set:subrepo('glob:s*')"
   reverting subrepo s
-  reverting s/a (glob)
+  reverting s/a
   $ cat s/a
   a
   $ rm s/a.orig
@@ -131,7 +131,7 @@
   phases: 2 draft
   $ hg ci -m2
   committing subrepository s
-  committing subrepository s/ss (glob)
+  committing subrepository s/ss
   $ hg sum
   parent: 2:df30734270ae tip
    2
@@ -205,7 +205,7 @@
   $ hg init t
   $ echo t > t/t
   $ hg -R t add t
-  adding t/t (glob)
+  adding t/t
 
 5
 
@@ -473,7 +473,7 @@
   $ hg clone t tc
   updating to branch default
   cloning subrepo s from $TESTTMP/t/s
-  cloning subrepo s/ss from $TESTTMP/t/s/ss (glob)
+  cloning subrepo s/ss from $TESTTMP/t/s/ss
   cloning subrepo t from $TESTTMP/t/t
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd tc
@@ -529,8 +529,8 @@
   $ hg ci -m11
   committing subrepository t
   $ hg push
-  pushing to $TESTTMP/t (glob)
-  no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
+  pushing to $TESTTMP/t
+  no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
   no changes made to subrepo s since last push to $TESTTMP/t/s
   pushing subrepo t to $TESTTMP/t/t
   searching for changes
@@ -550,16 +550,16 @@
   $ hg ci -m12
   committing subrepository s
   $ hg push
-  pushing to $TESTTMP/t (glob)
-  no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
+  pushing to $TESTTMP/t
+  no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
   pushing subrepo s to $TESTTMP/t/s
   searching for changes
   abort: push creates new remote head 12a213df6fa9! (in subrepository "s")
   (merge or see 'hg help push' for details about pushing new heads)
   [255]
   $ hg push -f
-  pushing to $TESTTMP/t (glob)
-  pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
+  pushing to $TESTTMP/t
+  pushing subrepo s/ss to $TESTTMP/t/s/ss
   searching for changes
   no changes found
   pushing subrepo s to $TESTTMP/t/s
@@ -582,7 +582,7 @@
   $ hg clone . ../tcc
   updating to branch default
   cloning subrepo s from $TESTTMP/tc/s
-  cloning subrepo s/ss from $TESTTMP/tc/s/ss (glob)
+  cloning subrepo s/ss from $TESTTMP/tc/s/ss
   cloning subrepo t from $TESTTMP/tc/t
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
@@ -590,7 +590,7 @@
 
   $ hg push -R ../tcc .
   pushing to .
-  no changes made to subrepo s/ss since last push to s/ss (glob)
+  no changes made to subrepo s/ss since last push to s/ss
   no changes made to subrepo s since last push to s
   no changes made to subrepo t since last push to t
   searching for changes
@@ -602,7 +602,7 @@
 
   $ hg push ../tcc
   pushing to ../tcc
-  pushing subrepo s/ss to ../tcc/s/ss (glob)
+  pushing subrepo s/ss to ../tcc/s/ss
   searching for changes
   no changes found
   pushing subrepo s to ../tcc/s
@@ -619,7 +619,7 @@
 
   $ hg push ../tcc
   pushing to ../tcc
-  no changes made to subrepo s/ss since last push to ../tcc/s/ss (glob)
+  no changes made to subrepo s/ss since last push to ../tcc/s/ss
   no changes made to subrepo s since last push to ../tcc/s
   no changes made to subrepo t since last push to ../tcc/t
   searching for changes
@@ -632,8 +632,8 @@
   $ hg -R s update '.^'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg push
-  pushing to $TESTTMP/t (glob)
-  no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
+  pushing to $TESTTMP/t
+  no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
   no changes made to subrepo s since last push to $TESTTMP/t/s
   no changes made to subrepo t since last push to $TESTTMP/t/t
   searching for changes
@@ -641,8 +641,8 @@
   [1]
   $ echo foo >> s/a
   $ hg push
-  pushing to $TESTTMP/t (glob)
-  no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
+  pushing to $TESTTMP/t
+  no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
   no changes made to subrepo s since last push to $TESTTMP/t/s
   no changes made to subrepo t since last push to $TESTTMP/t/t
   searching for changes
@@ -657,7 +657,7 @@
   $ hg -R s/ss commit -m 'test dirty store detection'
 
   $ hg out -S -r `hg log -r tip -T "{node|short}"`
-  comparing with $TESTTMP/t (glob)
+  comparing with $TESTTMP/t
   searching for changes
   no changes found
   comparing with $TESTTMP/t/s
@@ -676,8 +676,8 @@
   no changes found
 
   $ hg push
-  pushing to $TESTTMP/t (glob)
-  pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
+  pushing to $TESTTMP/t
+  pushing subrepo s/ss to $TESTTMP/t/s/ss
   searching for changes
   adding changesets
   adding manifests
@@ -692,8 +692,8 @@
 a subrepo store may be clean versus one repo but not versus another
 
   $ hg push
-  pushing to $TESTTMP/t (glob)
-  no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
+  pushing to $TESTTMP/t
+  no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
   no changes made to subrepo s since last push to $TESTTMP/t/s
   no changes made to subrepo t since last push to $TESTTMP/t/t
   searching for changes
@@ -701,7 +701,7 @@
   [1]
   $ hg push ../tcc
   pushing to ../tcc
-  pushing subrepo s/ss to ../tcc/s/ss (glob)
+  pushing subrepo s/ss to ../tcc/s/ss
   searching for changes
   adding changesets
   adding manifests
@@ -740,7 +740,7 @@
 
   $ cd ../tc
   $ hg pull
-  pulling from $TESTTMP/t (glob)
+  pulling from $TESTTMP/t
   searching for changes
   adding changesets
   adding manifests
@@ -752,7 +752,7 @@
 should pull t
 
   $ hg incoming -S -r `hg log -r tip -T "{node|short}"`
-  comparing with $TESTTMP/t (glob)
+  comparing with $TESTTMP/t
   no changes found
   comparing with $TESTTMP/t/s
   searching for changes
@@ -918,15 +918,15 @@
   $ echo test > testdelete/nested/foo
   $ echo test > testdelete/nested2/foo
   $ hg -R testdelete/nested add
-  adding testdelete/nested/foo (glob)
+  adding testdelete/nested/foo
   $ hg -R testdelete/nested2 add
-  adding testdelete/nested2/foo (glob)
+  adding testdelete/nested2/foo
   $ hg -R testdelete/nested ci -m test
   $ hg -R testdelete/nested2 ci -m test
   $ echo nested = nested > testdelete/.hgsub
   $ echo nested2 = nested2 >> testdelete/.hgsub
   $ hg -R testdelete add
-  adding testdelete/.hgsub (glob)
+  adding testdelete/.hgsub
   $ hg -R testdelete ci -m "nested 1 & 2 added"
   $ echo nested = nested > testdelete/.hgsub
   $ hg -R testdelete ci -m "nested 2 deleted"
@@ -943,19 +943,19 @@
   $ hg init nested_absolute
   $ echo test > nested_absolute/foo
   $ hg -R nested_absolute add
-  adding nested_absolute/foo (glob)
+  adding nested_absolute/foo
   $ hg -R nested_absolute ci -mtest
   $ cd mercurial
   $ hg init nested_relative
   $ echo test2 > nested_relative/foo2
   $ hg -R nested_relative add
-  adding nested_relative/foo2 (glob)
+  adding nested_relative/foo2
   $ hg -R nested_relative ci -mtest2
   $ hg init main
   $ echo "nested_relative = ../nested_relative" > main/.hgsub
   $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
   $ hg -R main add
-  adding main/.hgsub (glob)
+  adding main/.hgsub
   $ hg -R main ci -m "add subrepos"
   $ cd ..
   $ hg clone mercurial/main mercurial2/main
@@ -1035,7 +1035,7 @@
   $ rm repo/s/b
   $ touch -t 200001010000 repo/.hgsubstate
   $ hg -R repo revert --all
-  reverting repo/.hgsubstate (glob)
+  reverting repo/.hgsubstate
   reverting subrepo s
   $ hg -R repo update
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -1056,10 +1056,10 @@
   $ echo sub/repo = sub/repo > .hgsub
   $ hg add .hgsub
   $ hg ci -mtest
-  committing subrepository sub/repo (glob)
+  committing subrepository sub/repo
   $ echo test >> sub/repo/foo
   $ hg ci -mtest
-  committing subrepository sub/repo (glob)
+  committing subrepository sub/repo
   $ hg cat sub/repo/foo
   test
   test
@@ -1077,9 +1077,9 @@
   $ hg cat -T '{path}\n' 'glob:**'
   .hgsub
   .hgsubstate
-  sub/repo/foo (glob)
+  sub/repo/foo
   $ hg cat -T '{path}\n' 're:^sub'
-  sub/repo/foo (glob)
+  sub/repo/foo
 
  missing subrepos in working directory:
 
@@ -1108,7 +1108,7 @@
   new changesets 19487b456929:be5eb94e7215
   (run 'hg update' to get a working copy)
   $ hg -R issue1852b update
-  abort: default path for subrepository not found (in subrepository "sub/repo") (glob)
+  abort: default path for subrepository not found (in subrepository "sub/repo")
   [255]
 
 Ensure a full traceback, not just the SubrepoAbort part
@@ -1133,14 +1133,14 @@
   adding file changes
   added 1 changesets with 2 changes to 2 files
   new changesets 19487b456929
-  cloning subrepo sub/repo from issue1852a/sub/repo (glob)
+  cloning subrepo sub/repo from issue1852a/sub/repo
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Try to push from the other side
 
   $ hg -R issue1852a push `pwd`/issue1852c
-  pushing to $TESTTMP/issue1852c (glob)
-  pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob)
+  pushing to $TESTTMP/issue1852c
+  pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo
   searching for changes
   no changes found
   searching for changes
@@ -1183,12 +1183,12 @@
   $ echo def > issue1852a/sub/repo/foo
   $ hg -R issue1852a ci -SAm 'tweaked subrepo'
   adding tmp/sub/repo/foo_p
-  committing subrepository sub/repo (glob)
+  committing subrepository sub/repo
 
   $ echo 'addedsub = addedsub' >> issue1852d/.hgsub
   $ echo xyz > issue1852d/sub/repo/foo
   $ hg -R issue1852d pull -u
-  pulling from $TESTTMP/issue1852a (glob)
+  pulling from $TESTTMP/issue1852a
   searching for changes
   adding changesets
   adding manifests
@@ -1197,14 +1197,14 @@
   new changesets c82b79fdcc5b
    subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c)
   (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
-  pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo (glob)
+  pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo
   searching for changes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
   new changesets 46cd4aac504c
-   subrepository sources for sub/repo differ (glob)
+   subrepository sources for sub/repo differ
   use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat issue1852d/.hgsubstate
@@ -1541,8 +1541,8 @@
   ? s/f9
   $ hg add -S
   adding f8
-  adding s/f10 (glob)
-  adding s/f9 (glob)
+  adding s/f10
+  adding s/f9
   $ hg st -S
   A f8
   A s/f10
@@ -1583,7 +1583,7 @@
   ? s/fn18
   $ hg add -S 'glob:**fm*'
   adding fm15
-  adding s/fm17 (glob)
+  adding s/fm17
   $ hg st -S
   A fm15
   A s/fm17
@@ -1621,7 +1621,7 @@
   > default=../issue3781-dest/
   > EOF
   $ hg push --config devel.legacy.exchange=bundle1
-  pushing to $TESTTMP/issue3781-dest (glob)
+  pushing to $TESTTMP/issue3781-dest
   pushing subrepo s to $TESTTMP/issue3781-dest/s
   searching for changes
   no changes found
@@ -1631,7 +1631,7 @@
 # clean the push cache
   $ rm s/.hg/cache/storehash/*
   $ hg push # bundle2+
-  pushing to $TESTTMP/issue3781-dest (glob)
+  pushing to $TESTTMP/issue3781-dest
   pushing subrepo s to $TESTTMP/issue3781-dest/s
   searching for changes
   no changes found
@@ -1689,7 +1689,7 @@
   $ echo phasecheck4 >>   t/t
   $ hg commit -S -m phasecheck4
   committing subrepository s
-  committing subrepository s/ss (glob)
+  committing subrepository s/ss
   warning: changes are committed in secret phase from subrepository ss
   committing subrepository t
   warning: changes are committed in secret phase from subrepository s
--- a/tests/test-tag.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-tag.t	Tue Dec 19 16:27:24 2017 -0500
@@ -515,7 +515,7 @@
   $ hg -R repo-tag --config hooks.commit="sh ../issue3344.sh" tag tag
   hook: tag changes detected
   hook: +A be090ea6625635128e90f7d89df8beeb2bcc1653 tag
-  pushing to $TESTTMP/repo-tag-target (glob)
+  pushing to $TESTTMP/repo-tag-target
   searching for changes
   adding changesets
   adding manifests
@@ -619,7 +619,7 @@
 
   $ cd ../repo-automatic-tag-merge-clone
   $ hg pull
-  pulling from $TESTTMP/repo-automatic-tag-merge (glob)
+  pulling from $TESTTMP/repo-automatic-tag-merge
   searching for changes
   adding changesets
   adding manifests
--- a/tests/test-tools.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-tools.t	Tue Dec 19 16:27:24 2017 -0500
@@ -91,10 +91,10 @@
   $ f -qr dir -HB 17
   dir: directory with 3 files (symlink !)
   dir: directory with 2 files (no-symlink !)
-  dir/bar: (glob)
+  dir/bar:
   0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
   0010: 39                                              |9|
-  dir/foo: (glob)
+  dir/foo:
   0000: 66 6f 6f 0a                                     |foo.|
   dir/l: (symlink !)
   0000: 79 61 64 64 61                                  |yadda| (symlink !)
--- a/tests/test-treediscovery.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-treediscovery.t	Tue Dec 19 16:27:24 2017 -0500
@@ -516,65 +516,65 @@
 #if zstd
   $ tstop show
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961+2c8d5d5ec612be65cdfdeac78b7662ab1696324a x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961+2c8d5d5ec612be65cdfdeac78b7662ab1696324a x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "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=zstd,zlib,none,bzip2
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
 #else
   $ tstop show
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961+2c8d5d5ec612be65cdfdeac78b7662ab1696324a x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961+2c8d5d5ec612be65cdfdeac78b7662ab1696324a x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "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=zlib,none,bzip2
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
   "GET /?cmd=capabilities HTTP/1.1" 200 -
-  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zlib,none,bzip2
+  "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
 #endif
--- a/tests/test-treemanifest.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-treemanifest.t	Tue Dec 19 16:27:24 2017 -0500
@@ -54,12 +54,12 @@
   $ hg files -r .
   a
   b
-  dir1/a (glob)
-  dir1/b (glob)
-  dir1/dir1/a (glob)
-  dir1/dir1/b (glob)
-  dir1/dir2/a (glob)
-  dir1/dir2/b (glob)
+  dir1/a
+  dir1/b
+  dir1/dir1/a
+  dir1/dir1/b
+  dir1/dir2/a
+  dir1/dir2/b
   e
 
 The manifest command works
@@ -80,7 +80,7 @@
   $ mkdir dir2
   $ echo 3 > dir2/a
   $ hg add dir2
-  adding dir2/a (glob)
+  adding dir2/a
   $ hg debugindex --dir dir1 > before
   $ hg ci -qm 'add dir2'
   $ hg debugindex --dir dir1 > after
@@ -90,8 +90,8 @@
 Removing directory does not create an revlog entry
 
   $ hg rm dir1/dir1
-  removing dir1/dir1/a (glob)
-  removing dir1/dir1/b (glob)
+  removing dir1/dir1/a
+  removing dir1/dir1/b
   $ hg debugindex --dir dir1/dir1 > before
   $ hg ci -qm 'remove dir1/dir1'
   $ hg debugindex --dir dir1/dir1 > after
@@ -105,12 +105,12 @@
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ mv .hg/store/meta/dir2 .hg/store/meta/dir2-backup
   $ hg files -r . dir1
-  dir1/a (glob)
-  dir1/b (glob)
-  dir1/dir1/a (glob)
-  dir1/dir1/b (glob)
-  dir1/dir2/a (glob)
-  dir1/dir2/b (glob)
+  dir1/a
+  dir1/b
+  dir1/dir1/a
+  dir1/dir1/b
+  dir1/dir2/a
+  dir1/dir2/b
 
 Check that status between revisions works (calls treemanifest.matches())
 without loading all directory revlogs
@@ -161,7 +161,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ hg revert -r 'desc("modify dir2/a")' .
-  reverting dir1/a (glob)
+  reverting dir1/a
   $ hg ci -m 'merge, keeping parent 1'
   $ hg debugindex --dir dir2 > after
   $ diff before after
@@ -177,7 +177,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ hg revert -r 'desc("modify dir1/a")' .
-  reverting dir2/a (glob)
+  reverting dir2/a
   $ hg ci -m 'merge, keeping parent 2'
   created new head
   $ hg debugindex --dir dir1 > after
@@ -322,7 +322,7 @@
   M dir1/a
   $ hg --config extensions.strip= strip tip
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg (glob)
+  saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg
   $ hg debugindex --dir dir1
      rev    offset  length  delta linkrev nodeid       p1           p2
        0         0     127     -1       4 064927a0648a 000000000000 000000000000
@@ -455,31 +455,31 @@
 Test files from the root.
 
   $ hg files -r .
-  .A/one.txt (glob)
-  .A/two.txt (glob)
-  b/bar/fruits.txt (glob)
-  b/bar/orange/fly/gnat.py (glob)
-  b/bar/orange/fly/housefly.txt (glob)
-  b/foo/apple/bees/flower.py (glob)
+  .A/one.txt
+  .A/two.txt
+  b/bar/fruits.txt
+  b/bar/orange/fly/gnat.py
+  b/bar/orange/fly/housefly.txt
+  b/foo/apple/bees/flower.py
   c.txt
   d.py
 
 Excludes with a glob should not exclude everything from the glob's root
 
   $ hg files -r . -X 'b/fo?' b
-  b/bar/fruits.txt (glob)
-  b/bar/orange/fly/gnat.py (glob)
-  b/bar/orange/fly/housefly.txt (glob)
+  b/bar/fruits.txt
+  b/bar/orange/fly/gnat.py
+  b/bar/orange/fly/housefly.txt
   $ cp -R .hg/store .hg/store-copy
 
 Test files for a subdirectory.
 
   $ rm -r .hg/store/meta/~2e_a
   $ hg files -r . b
-  b/bar/fruits.txt (glob)
-  b/bar/orange/fly/gnat.py (glob)
-  b/bar/orange/fly/housefly.txt (glob)
-  b/foo/apple/bees/flower.py (glob)
+  b/bar/fruits.txt
+  b/bar/orange/fly/gnat.py
+  b/bar/orange/fly/housefly.txt
+  b/foo/apple/bees/flower.py
   $ hg diff -r '.^' -r . --stat b
    b/bar/fruits.txt              |  1 +
    b/bar/orange/fly/gnat.py      |  1 +
@@ -494,7 +494,7 @@
   $ rm -r .hg/store/meta/b/bar/orange/fly
   $ rm -r .hg/store/meta/b/foo/apple/bees
   $ hg files -r . -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees
-  b/bar/fruits.txt (glob)
+  b/bar/fruits.txt
   $ hg diff -r '.^' -r . --stat -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees
    b/bar/fruits.txt |  1 +
    1 files changed, 1 insertions(+), 0 deletions(-)
@@ -505,9 +505,9 @@
   $ rm -r .hg/store/meta/~2e_a
   $ rm -r .hg/store/meta/b/foo
   $ hg files -r . -X path:b/foo b
-  b/bar/fruits.txt (glob)
-  b/bar/orange/fly/gnat.py (glob)
-  b/bar/orange/fly/housefly.txt (glob)
+  b/bar/fruits.txt
+  b/bar/orange/fly/gnat.py
+  b/bar/orange/fly/housefly.txt
   $ hg diff -r '.^' -r . --stat -X path:b/foo b
    b/bar/fruits.txt              |  1 +
    b/bar/orange/fly/gnat.py      |  1 +
@@ -521,8 +521,8 @@
   $ rm -r .hg/store/meta/~2e_a
   $ rm -r .hg/store/meta/b/foo
   $ hg files -r . -I path:b/bar/orange -I path:a b
-  b/bar/orange/fly/gnat.py (glob)
-  b/bar/orange/fly/housefly.txt (glob)
+  b/bar/orange/fly/gnat.py
+  b/bar/orange/fly/housefly.txt
   $ hg diff -r '.^' -r . --stat -I path:b/bar/orange -I path:a b
    b/bar/orange/fly/gnat.py      |  1 +
    b/bar/orange/fly/housefly.txt |  1 +
@@ -536,7 +536,7 @@
   $ rm -r .hg/store/meta/b/foo
   $ rm -r .hg/store/meta/b/bar/orange
   $ hg files -r . glob:**.txt -I path:b/bar -X path:b/bar/orange
-  b/bar/fruits.txt (glob)
+  b/bar/fruits.txt
   $ hg diff -r '.^' -r . --stat glob:**.txt -I path:b/bar -X path:b/bar/orange
    b/bar/fruits.txt |  1 +
    1 files changed, 1 insertions(+), 0 deletions(-)
@@ -838,7 +838,7 @@
   $ hg co '.^'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg revert -r tip dir/
-  reverting dir/file (glob)
+  reverting dir/file
   $ echo b > file # to make sure root manifest is sent
   $ hg ci -m grafted
   created new head
@@ -855,7 +855,7 @@
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd grafted-dir-repo-clone
   $ hg pull -r 2
-  pulling from $TESTTMP/grafted-dir-repo (glob)
+  pulling from $TESTTMP/grafted-dir-repo
   searching for changes
   adding changesets
   adding manifests
@@ -869,7 +869,7 @@
   $ hg commit -Aqm 'pre-empty commit'
   $ hg rm z
   $ hg commit --amend -m 'empty commit'
-  saved backup bundle to $TESTTMP/grafted-dir-repo-clone/.hg/strip-backup/cb99d5717cea-9e3b6b02-amend.hg (glob)
+  saved backup bundle to $TESTTMP/grafted-dir-repo-clone/.hg/strip-backup/cb99d5717cea-9e3b6b02-amend.hg
   $ hg log -r 'tip + tip^' -T '{manifest}\n'
   1:678d3574b88c
   1:678d3574b88c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-unamend.t	Tue Dec 19 16:27:24 2017 -0500
@@ -0,0 +1,369 @@
+Test for command `hg unamend` which lives in uncommit extension
+===============================================================
+
+  $ cat >> $HGRCPATH << EOF
+  > [alias]
+  > glog = log -G -T '{rev}:{node|short}  {desc}'
+  > [experimental]
+  > evolution = createmarkers, allowunstable
+  > [extensions]
+  > rebase =
+  > amend =
+  > uncommit =
+  > EOF
+
+Repo Setup
+
+  $ hg init repo
+  $ cd repo
+  $ for ch in a b c d e f g h; do touch $ch; echo "foo" >> $ch; hg ci -Aqm "Added "$ch; done
+
+  $ hg glog
+  @  7:ec2426147f0e  Added h
+  |
+  o  6:87d6d6676308  Added g
+  |
+  o  5:825660c69f0c  Added f
+  |
+  o  4:aa98ab95a928  Added e
+  |
+  o  3:62615734edd5  Added d
+  |
+  o  2:28ad74487de9  Added c
+  |
+  o  1:29becc82797a  Added b
+  |
+  o  0:18d04c59bb5d  Added a
+  
+Trying to unamend when there was no amend done
+
+  $ hg unamend
+  abort: changeset must have one predecessor, found 0 predecessors
+  [255]
+
+Unamend on clean wdir and tip
+
+  $ echo "bar" >> h
+  $ hg amend
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID c9fa1a715c1b7661c0fafb362a9f30bd75878d7d
+  # Parent  87d6d66763085b629e6d7ed56778c79827273022
+  Added h
+  
+  diff -r 87d6d6676308 -r c9fa1a715c1b h
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/h	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,2 @@
+  +foo
+  +bar
+
+  $ hg glog --hidden
+  @  8:c9fa1a715c1b  Added h
+  |
+  | x  7:ec2426147f0e  Added h
+  |/
+  o  6:87d6d6676308  Added g
+  |
+  o  5:825660c69f0c  Added f
+  |
+  o  4:aa98ab95a928  Added e
+  |
+  o  3:62615734edd5  Added d
+  |
+  o  2:28ad74487de9  Added c
+  |
+  o  1:29becc82797a  Added b
+  |
+  o  0:18d04c59bb5d  Added a
+  
+  $ hg unamend
+  $ hg glog --hidden
+  @  9:46d02d47eec6  Added h
+  |
+  | x  8:c9fa1a715c1b  Added h
+  |/
+  | x  7:ec2426147f0e  Added h
+  |/
+  o  6:87d6d6676308  Added g
+  |
+  o  5:825660c69f0c  Added f
+  |
+  o  4:aa98ab95a928  Added e
+  |
+  o  3:62615734edd5  Added d
+  |
+  o  2:28ad74487de9  Added c
+  |
+  o  1:29becc82797a  Added b
+  |
+  o  0:18d04c59bb5d  Added a
+  
+  $ hg diff
+  diff -r 46d02d47eec6 h
+  --- a/h	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/h	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,2 @@
+   foo
+  +bar
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 46d02d47eec6ca096b8dcab3f8f5579c40c3dd9a
+  # Parent  87d6d66763085b629e6d7ed56778c79827273022
+  Added h
+  
+  diff -r 87d6d6676308 -r 46d02d47eec6 h
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/h	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +foo
+
+  $ hg status
+  M h
+
+  $ hg log -r . -T '{extras % "{extra}\n"}' --config alias.log=log
+  branch=default
+  unamend_source=c9fa1a715c1b7661c0fafb362a9f30bd75878d7d
+
+Using unamend to undo an unamed (intentional)
+
+  $ hg unamend
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 850ddfc1bc662997ec6094ada958f01f0cc8070a
+  # Parent  87d6d66763085b629e6d7ed56778c79827273022
+  Added h
+  
+  diff -r 87d6d6676308 -r 850ddfc1bc66 h
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/h	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,2 @@
+  +foo
+  +bar
+  $ hg diff
+
+Unamend on a dirty working directory
+
+  $ echo "bar" >> a
+  $ hg amend
+  $ echo "foobar" >> a
+  $ echo "bar" >> b
+  $ hg status
+  M a
+  M b
+
+  $ hg unamend
+
+  $ hg status
+  M a
+  M b
+
+  $ hg diff
+  diff -r ec338db45d51 a
+  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,3 @@
+   foo
+  +bar
+  +foobar
+  diff -r ec338db45d51 b
+  --- a/b	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,2 @@
+   foo
+  +bar
+
+Unamending an added file
+
+  $ hg ci -m "Added things to a and b"
+  $ echo foo > bar
+  $ hg add bar
+  $ hg amend
+
+  $ hg unamend
+  $ hg status
+  A bar
+
+  $ hg revert --all
+  forgetting bar
+
+Unamending a removed file
+
+  $ hg remove a
+  $ hg amend
+
+  $ hg unamend
+  $ hg status
+  R a
+  ? bar
+
+  $ hg revert --all
+  undeleting a
+
+Unamending an added file with dirty wdir status
+
+  $ hg add bar
+  $ hg amend
+  $ echo bar >> bar
+  $ hg status
+  M bar
+
+  $ hg unamend
+  $ hg status
+  A bar
+  $ hg diff
+  diff -r 7f79409af972 bar
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/bar	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,2 @@
+  +foo
+  +bar
+
+  $ hg revert --all
+  forgetting bar
+
+Unamending in middle of a stack
+
+  $ hg glog
+  @  19:7f79409af972  Added things to a and b
+  |
+  o  12:ec338db45d51  Added h
+  |
+  o  6:87d6d6676308  Added g
+  |
+  o  5:825660c69f0c  Added f
+  |
+  o  4:aa98ab95a928  Added e
+  |
+  o  3:62615734edd5  Added d
+  |
+  o  2:28ad74487de9  Added c
+  |
+  o  1:29becc82797a  Added b
+  |
+  o  0:18d04c59bb5d  Added a
+  
+  $ hg up 5
+  2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo bar >> f
+  $ hg amend
+  $ hg rebase -s 6 -d . -q
+
+  $ hg glog
+  o  23:03ddd6fc5af1  Added things to a and b
+  |
+  o  22:3e7b64ee157b  Added h
+  |
+  o  21:49635b68477e  Added g
+  |
+  @  20:93f0e8ffab32  Added f
+  |
+  o  4:aa98ab95a928  Added e
+  |
+  o  3:62615734edd5  Added d
+  |
+  o  2:28ad74487de9  Added c
+  |
+  o  1:29becc82797a  Added b
+  |
+  o  0:18d04c59bb5d  Added a
+  
+
+  $ hg --config experimental.evolution=createmarkers unamend
+  abort: cannot unamend changeset with children
+  [255]
+
+  $ hg unamend
+
+Trying to unamend a public changeset
+
+  $ hg up -C 23
+  5 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg phase -r . -p
+  $ hg unamend
+  abort: cannot unamend public changesets
+  (see 'hg help phases' for details)
+  [255]
+
+Testing whether unamend retains copies or not
+
+  $ hg status
+  ? bar
+
+  $ hg mv a foo
+
+  $ hg ci -m "Moved a to foo"
+  $ hg exp --git
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID cfef290346fbee5126313d7e1aab51d877679b09
+  # Parent  03ddd6fc5af19e028c44a2fd6d790dd22712f231
+  Moved a to foo
+  
+  diff --git a/a b/foo
+  rename from a
+  rename to foo
+
+  $ hg mv b foobar
+  $ hg diff --git
+  diff --git a/b b/foobar
+  rename from b
+  rename to foobar
+  $ hg amend
+
+  $ hg exp --git
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID eca050985275bb271ce3092b54e56ea5c85d29a3
+  # Parent  03ddd6fc5af19e028c44a2fd6d790dd22712f231
+  Moved a to foo
+  
+  diff --git a/a b/foo
+  rename from a
+  rename to foo
+  diff --git a/b b/foobar
+  rename from b
+  rename to foobar
+
+  $ hg mv c wat
+  $ hg unamend
+
+Retained copies in new prdecessor commit
+
+  $ hg exp --git
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 552e3af4f01f620f88ca27be1f898316235b736a
+  # Parent  03ddd6fc5af19e028c44a2fd6d790dd22712f231
+  Moved a to foo
+  
+  diff --git a/a b/foo
+  rename from a
+  rename to foo
+
+Retained copies in working directoy
+
+  $ hg diff --git
+  diff --git a/b b/foobar
+  rename from b
+  rename to foobar
+  diff --git a/c b/wat
+  rename from c
+  rename to wat
--- a/tests/test-uncommit.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-uncommit.t	Tue Dec 19 16:27:24 2017 -0500
@@ -41,6 +41,7 @@
 
   $ hg uncommit
   abort: cannot uncommit null changeset
+  (no changeset checked out)
   [255]
 
 Create some commits
--- a/tests/test-unified-test.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-unified-test.t	Tue Dec 19 16:27:24 2017 -0500
@@ -81,7 +81,7 @@
   fo?/bar\r (no-eol) (glob) (esc)
 #if windows
   $ printf 'foo\\bar\r'
-  foo/bar\r (no-eol) (glob) (esc)
+  foo/bar\r (no-eol) (esc)
 #endif
   $ printf 'foo/bar\rfoo/bar\r'
   foo.bar\r \(no-eol\) (re) (esc)
--- a/tests/test-unionrepo.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-unionrepo.t	Tue Dec 19 16:27:24 2017 -0500
@@ -167,4 +167,4 @@
 
 "hg files -v" to call fctx.size() -> fctx.iscensored()
   $ hg files -R union:b+a -r2 -v
-           3   b/f (glob)
+           3   b/f
--- a/tests/test-upgrade-repo.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-upgrade-repo.t	Tue Dec 19 16:27:24 2017 -0500
@@ -54,6 +54,67 @@
 
   $ hg init empty
   $ cd empty
+  $ hg debugformat
+  format-variant repo
+  fncache:        yes
+  dotencode:      yes
+  generaldelta:   yes
+  plain-cl-delta: yes
+  compression:    zlib
+  $ hg debugformat --verbose
+  format-variant repo config default
+  fncache:        yes    yes     yes
+  dotencode:      yes    yes     yes
+  generaldelta:   yes    yes     yes
+  plain-cl-delta: yes    yes     yes
+  compression:    zlib   zlib    zlib
+  $ hg debugformat --verbose --config format.usegfncache=no
+  format-variant repo config default
+  fncache:        yes    yes     yes
+  dotencode:      yes    yes     yes
+  generaldelta:   yes    yes     yes
+  plain-cl-delta: yes    yes     yes
+  compression:    zlib   zlib    zlib
+  $ hg debugformat --verbose --config format.usegfncache=no --color=debug
+  format-variant repo config default
+  [formatvariant.name.uptodate|fncache:       ][formatvariant.repo.uptodate| yes][formatvariant.config.default|    yes][formatvariant.default|     yes]
+  [formatvariant.name.uptodate|dotencode:     ][formatvariant.repo.uptodate| yes][formatvariant.config.default|    yes][formatvariant.default|     yes]
+  [formatvariant.name.uptodate|generaldelta:  ][formatvariant.repo.uptodate| yes][formatvariant.config.default|    yes][formatvariant.default|     yes]
+  [formatvariant.name.uptodate|plain-cl-delta:][formatvariant.repo.uptodate| yes][formatvariant.config.default|    yes][formatvariant.default|     yes]
+  [formatvariant.name.uptodate|compression:   ][formatvariant.repo.uptodate| zlib][formatvariant.config.default|   zlib][formatvariant.default|    zlib]
+  $ hg debugformat -Tjson
+  [
+   {
+    "config": true,
+    "default": true,
+    "name": "fncache",
+    "repo": true
+   },
+   {
+    "config": true,
+    "default": true,
+    "name": "dotencode",
+    "repo": true
+   },
+   {
+    "config": true,
+    "default": true,
+    "name": "generaldelta",
+    "repo": true
+   },
+   {
+    "config": true,
+    "default": true,
+    "name": "plain-cl-delta",
+    "repo": true
+   },
+   {
+    "config": "zlib",
+    "default": "zlib",
+    "name": "compression",
+    "repo": "zlib"
+   }
+  ]
   $ hg debugupgraderepo
   (no feature deficiencies found in existing repository)
   performing an upgrade with "--run" will make the following changes:
@@ -72,6 +133,9 @@
   redeltaall
      deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
   
+  redeltafulladd
+     every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "redeltaall" but even slower since more logic is involved.
+  
 
 --optimize can be used to add optimizations
 
@@ -93,6 +157,9 @@
   redeltaall
      deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
   
+  redeltafulladd
+     every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "redeltaall" but even slower since more logic is involved.
+  
 
 Various sub-optimal detections work
 
@@ -101,6 +168,34 @@
   > store
   > EOF
 
+  $ hg debugformat
+  format-variant repo
+  fncache:         no
+  dotencode:       no
+  generaldelta:    no
+  plain-cl-delta: yes
+  compression:    zlib
+  $ hg debugformat --verbose
+  format-variant repo config default
+  fncache:         no    yes     yes
+  dotencode:       no    yes     yes
+  generaldelta:    no    yes     yes
+  plain-cl-delta: yes    yes     yes
+  compression:    zlib   zlib    zlib
+  $ hg debugformat --verbose --config format.usegeneraldelta=no
+  format-variant repo config default
+  fncache:         no    yes     yes
+  dotencode:       no    yes     yes
+  generaldelta:    no     no     yes
+  plain-cl-delta: yes    yes     yes
+  compression:    zlib   zlib    zlib
+  $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
+  format-variant repo config default
+  [formatvariant.name.mismatchconfig|fncache:       ][formatvariant.repo.mismatchconfig|  no][formatvariant.config.default|    yes][formatvariant.default|     yes]
+  [formatvariant.name.mismatchconfig|dotencode:     ][formatvariant.repo.mismatchconfig|  no][formatvariant.config.default|    yes][formatvariant.default|     yes]
+  [formatvariant.name.mismatchdefault|generaldelta:  ][formatvariant.repo.mismatchdefault|  no][formatvariant.config.special|     no][formatvariant.default|     yes]
+  [formatvariant.name.uptodate|plain-cl-delta:][formatvariant.repo.uptodate| yes][formatvariant.config.default|    yes][formatvariant.default|     yes]
+  [formatvariant.name.uptodate|compression:   ][formatvariant.repo.uptodate| zlib][formatvariant.config.default|   zlib][formatvariant.default|    zlib]
   $ hg debugupgraderepo
   repository lacks features recommended by current config options:
   
@@ -140,6 +235,9 @@
   redeltaall
      deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
   
+  redeltafulladd
+     every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "redeltaall" but even slower since more logic is involved.
+  
 
   $ hg --config format.dotencode=false debugupgraderepo
   repository lacks features recommended by current config options:
@@ -179,6 +277,9 @@
   redeltaall
      deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
   
+  redeltafulladd
+     every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "redeltaall" but even slower since more logic is involved.
+  
 
   $ cd ..
 
@@ -350,5 +451,252 @@
   removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
   copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
   the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
+  $ hg debugupgraderepo --run --optimize redeltafulladd
+  upgrade will perform the following actions:
+  
+  requirements
+     preserved: dotencode, fncache, generaldelta, revlogv1, store
+  
+  redeltafulladd
+     each revision will be added as new content to the internal storage; this will likely drastically slow down execution time, but some extensions might need it
+  
+  beginning upgrade...
+  repository locked and read-only
+  creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
+  (it is safe to interrupt this process any time before data migration completes)
+  migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
+  migrating 109 bytes in store; 107 bytes tracked data
+  migrating 1 filelogs containing 1 revisions (0 bytes in store; 0 bytes tracked data)
+  finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
+  migrating 1 manifests containing 1 revisions (46 bytes in store; 45 bytes tracked data)
+  finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
+  migrating changelog containing 1 revisions (63 bytes in store; 62 bytes tracked data)
+  finished migrating 1 changelog revisions; change in size: 0 bytes
+  finished migrating 3 total revisions; total change in store size: 0 bytes
+  copying .XX_special_filename
+  copying phaseroots
+  data fully migrated to temporary repository
+  marking source repository as being upgraded; clients will be unable to read from repository
+  starting in-place swap of repository data
+  replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
+  replacing store...
+  store replacement complete; repository was inconsistent for *s (glob)
+  finalizing requirements file and making repository readable again
+  removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
+  copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
+  the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
 
   $ cd ..
+
+Check upgrading a large file repository
+---------------------------------------
+
+  $ hg init largefilesrepo
+  $ cat << EOF >> largefilesrepo/.hg/hgrc
+  > [extensions]
+  > largefiles =
+  > EOF
+
+  $ cd largefilesrepo
+  $ touch foo
+  $ hg add --large foo
+  $ hg -q commit -m initial
+  $ cat .hg/requires
+  dotencode
+  fncache
+  generaldelta
+  largefiles
+  revlogv1
+  store
+
+  $ hg debugupgraderepo --run
+  upgrade will perform the following actions:
+  
+  requirements
+     preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, store
+  
+  beginning upgrade...
+  repository locked and read-only
+  creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
+  (it is safe to interrupt this process any time before data migration completes)
+  migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
+  migrating 163 bytes in store; 160 bytes tracked data
+  migrating 1 filelogs containing 1 revisions (42 bytes in store; 41 bytes tracked data)
+  finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
+  migrating 1 manifests containing 1 revisions (52 bytes in store; 51 bytes tracked data)
+  finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
+  migrating changelog containing 1 revisions (69 bytes in store; 68 bytes tracked data)
+  finished migrating 1 changelog revisions; change in size: 0 bytes
+  finished migrating 3 total revisions; total change in store size: 0 bytes
+  copying phaseroots
+  data fully migrated to temporary repository
+  marking source repository as being upgraded; clients will be unable to read from repository
+  starting in-place swap of repository data
+  replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
+  replacing store...
+  store replacement complete; repository was inconsistent for *s (glob)
+  finalizing requirements file and making repository readable again
+  removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
+  copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
+  the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
+  $ cat .hg/requires
+  dotencode
+  fncache
+  generaldelta
+  largefiles
+  revlogv1
+  store
+
+  $ cat << EOF >> .hg/hgrc
+  > [extensions]
+  > lfs =
+  > [lfs]
+  > threshold = 10
+  > EOF
+  $ echo '123456789012345' > lfs.bin
+  $ hg ci -Am 'lfs.bin'
+  adding lfs.bin
+  $ grep lfs .hg/requires
+  lfs
+  $ find .hg/store/lfs -type f
+  .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
+
+  $ hg debugupgraderepo --run
+  upgrade will perform the following actions:
+  
+  requirements
+     preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, store
+  
+  beginning upgrade...
+  repository locked and read-only
+  creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
+  (it is safe to interrupt this process any time before data migration completes)
+  migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
+  migrating 417 bytes in store; 467 bytes tracked data
+  migrating 2 filelogs containing 2 revisions (168 bytes in store; 182 bytes tracked data)
+  finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
+  migrating 1 manifests containing 2 revisions (113 bytes in store; 151 bytes tracked data)
+  finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
+  migrating changelog containing 2 revisions (136 bytes in store; 134 bytes tracked data)
+  finished migrating 2 changelog revisions; change in size: 0 bytes
+  finished migrating 6 total revisions; total change in store size: 0 bytes
+  copying phaseroots
+  copying lfs blob d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
+  data fully migrated to temporary repository
+  marking source repository as being upgraded; clients will be unable to read from repository
+  starting in-place swap of repository data
+  replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
+  replacing store...
+  store replacement complete; repository was inconsistent for *s (glob)
+  finalizing requirements file and making repository readable again
+  removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
+  copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
+  the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
+
+  $ grep lfs .hg/requires
+  lfs
+  $ find .hg/store/lfs -type f
+  .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  2 files, 2 changesets, 2 total revisions
+  $ hg debugdata lfs.bin 0
+  version https://git-lfs.github.com/spec/v1
+  oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
+  size 16
+  x-is-binary 0
+
+  $ cd ..
+
+repository config is taken in account
+-------------------------------------
+
+  $ cat << EOF >> $HGRCPATH
+  > [format]
+  > maxchainlen = 1
+  > EOF
+
+  $ hg init localconfig
+  $ cd localconfig
+  $ cat << EOF > file
+  > some content
+  > with some length
+  > to make sure we get a delta
+  > after changes
+  > very long
+  > very long
+  > very long
+  > very long
+  > very long
+  > very long
+  > very long
+  > very long
+  > very long
+  > very long
+  > very long
+  > EOF
+  $ hg -q commit -A -m A
+  $ echo "new line" >> file
+  $ hg -q commit -m B
+  $ echo "new line" >> file
+  $ hg -q commit -m C
+
+  $ cat << EOF >> .hg/hgrc
+  > [format]
+  > maxchainlen = 9001
+  > EOF
+  $ hg config format
+  format.maxchainlen=9001
+  $ hg debugindex file
+     rev    offset  length  delta linkrev nodeid       p1           p2
+       0         0      77     -1       0 bcc1d3df78b2 000000000000 000000000000
+       1        77      21      0       1 af3e29f7a72e bcc1d3df78b2 000000000000
+       2        98      84     -1       2 8daf79c5522b af3e29f7a72e 000000000000
+
+  $ hg debugupgraderepo --run --optimize redeltaall
+  upgrade will perform the following actions:
+  
+  requirements
+     preserved: dotencode, fncache, generaldelta, revlogv1, store
+  
+  redeltaall
+     deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
+  
+  beginning upgrade...
+  repository locked and read-only
+  creating temporary repository to stage migrated data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
+  (it is safe to interrupt this process any time before data migration completes)
+  migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
+  migrating 497 bytes in store; 882 bytes tracked data
+  migrating 1 filelogs containing 3 revisions (182 bytes in store; 573 bytes tracked data)
+  finished migrating 3 filelog revisions across 1 filelogs; change in size: -63 bytes
+  migrating 1 manifests containing 3 revisions (141 bytes in store; 138 bytes tracked data)
+  finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
+  migrating changelog containing 3 revisions (174 bytes in store; 171 bytes tracked data)
+  finished migrating 3 changelog revisions; change in size: 0 bytes
+  finished migrating 9 total revisions; total change in store size: -63 bytes
+  copying phaseroots
+  data fully migrated to temporary repository
+  marking source repository as being upgraded; clients will be unable to read from repository
+  starting in-place swap of repository data
+  replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
+  replacing store...
+  store replacement complete; repository was inconsistent for *s (glob)
+  finalizing requirements file and making repository readable again
+  removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
+  copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
+  the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
+  $ hg debugindex file
+     rev    offset  length  delta linkrev nodeid       p1           p2
+       0         0      77     -1       0 bcc1d3df78b2 000000000000 000000000000
+       1        77      21      0       1 af3e29f7a72e bcc1d3df78b2 000000000000
+       2        98      21      1       2 8daf79c5522b af3e29f7a72e 000000000000
+  $ cd ..
+
+  $ cat << EOF >> $HGRCPATH
+  > [format]
+  > maxchainlen = 9001
+  > EOF
--- a/tests/test-url-rev.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-url-rev.t	Tue Dec 19 16:27:24 2017 -0500
@@ -44,7 +44,7 @@
   $ cat clone/.hg/hgrc
   # example repository config (see 'hg help config' for more info)
   [paths]
-  default = $TESTTMP/repo#foo (glob)
+  default = $TESTTMP/repo#foo
   
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
@@ -329,4 +329,4 @@
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg root -R '#foo'
-  $TESTTMP/#foo (glob)
+  $TESTTMP/#foo
--- a/tests/test-walk.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-walk.t	Tue Dec 19 16:27:24 2017 -0500
@@ -255,7 +255,7 @@
   f  mammals/Procyonidae/raccoon     Procyonidae/raccoon
   f  mammals/skunk                   skunk
   $ hg debugwalk .hg
-  abort: path 'mammals/.hg' is inside nested repo 'mammals' (glob)
+  abort: path 'mammals/.hg' is inside nested repo 'mammals'
   [255]
   $ hg debugwalk ../.hg
   abort: path contains illegal component: .hg
@@ -326,10 +326,10 @@
   f  mammals/Procyonidae/raccoon     mammals/Procyonidae/raccoon
   f  mammals/skunk                   mammals/skunk
   $ hg debugwalk ..
-  abort: .. not under root '$TESTTMP/t' (glob)
+  abort: .. not under root '$TESTTMP/t'
   [255]
   $ hg debugwalk beans/../..
-  abort: beans/../.. not under root '$TESTTMP/t' (glob)
+  abort: beans/../.. not under root '$TESTTMP/t'
   [255]
   $ hg debugwalk .hg
   abort: path contains illegal component: .hg
@@ -338,10 +338,10 @@
   abort: path contains illegal component: .hg
   [255]
   $ hg debugwalk beans/../.hg/data
-  abort: path contains illegal component: .hg/data (glob)
+  abort: path contains illegal component: .hg/data
   [255]
   $ hg debugwalk beans/.hg
-  abort: path 'beans/.hg' is inside nested repo 'beans' (glob)
+  abort: path 'beans/.hg' is inside nested repo 'beans'
   [255]
 
 Test absolute paths:
@@ -355,7 +355,7 @@
   f  beans/pinto     beans/pinto
   f  beans/turtle    beans/turtle
   $ hg debugwalk `pwd`/..
-  abort: $TESTTMP/t/.. not under root '$TESTTMP/t' (glob)
+  abort: $TESTTMP/t/.. not under root '$TESTTMP/t'
   [255]
 
 Test patterns:
@@ -378,7 +378,7 @@
   f  glob:glob   glob:glob
   $ hg debugwalk glob:glob
   matcher: <patternmatcher patterns='(?:glob$)'>
-  glob: No such file or directory
+  glob: $ENOENT$
   $ hg debugwalk glob:glob:glob
   matcher: <patternmatcher patterns='(?:glob\\:glob$)'>
   f  glob:glob  glob:glob  exact
--- a/tests/test-win32text.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-win32text.t	Tue Dec 19 16:27:24 2017 -0500
@@ -112,7 +112,7 @@
   abort: pretxncommit.crlf hook failed
   [255]
   $ hg revert -a
-  forgetting d/f2 (glob)
+  forgetting d/f2
   $ rm d/f2
 
   $ hg rem f
@@ -177,10 +177,10 @@
 
   $ for x in a b c d; do echo content > dupe/$x; done
   $ hg -R dupe add
-  adding dupe/a (glob)
-  adding dupe/b (glob)
-  adding dupe/c (glob)
-  adding dupe/d (glob)
+  adding dupe/a
+  adding dupe/b
+  adding dupe/c
+  adding dupe/d
   $ $PYTHON unix2dos.py dupe/b dupe/c dupe/d
   $ hg -R dupe ci -m a dupe/a
   $ hg -R dupe ci -m b/c dupe/[bc]
@@ -385,7 +385,7 @@
   WARNING: f4.bat already has CRLF line endings
   and does not need EOL conversion by the win32text plugin.
   Before your next commit, please reconsider your encode/decode settings in 
-  Mercurial.ini or $TESTTMP/t/.hg/hgrc. (glob)
+  Mercurial.ini or $TESTTMP/t/.hg/hgrc.
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat bin
   hello\x00\r (esc)
--- a/tests/test-wireproto.t	Sun Dec 17 18:43:05 2017 +0900
+++ b/tests/test-wireproto.t	Tue Dec 19 16:27:24 2017 -0500
@@ -94,23 +94,23 @@
   * - - [*] "POST /?cmd=debugwireargs HTTP/1.1" 200 - x-hgargs-post:1033* (glob)
   * - - [*] "POST /?cmd=debugwireargs HTTP/1.1" 200 - x-hgargs-post:1033* (glob)
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=quatre&one=un&three=trois&two=deux x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=quatre&one=un&three=trois&two=deux x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=quatre&one=un&three=trois&two=deux x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=quatre&one=un&three=trois&two=deux x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=qu++atre&one=+un&three=trois+&two=deux x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=qu++atre&one=+un&three=trois+&two=deux x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=qu++atre&one=+un&three=trois+&two=deux x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=qu++atre&one=+un&three=trois+&two=deux x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=vier&one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=vier&one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=vier&one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=vier&one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=onethousandcharactersxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&one x-hgarg-2:=un&three=trois&two=deux x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=onethousandcharactersxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&one x-hgarg-2:=un&three=trois&two=deux x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=onethousandcharactersxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&one x-hgarg-2:=un&three=trois&two=deux x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=onethousandcharactersxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&one x-hgarg-2:=un&three=trois&two=deux x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
 
 HTTP without the httpheader capability:
 
@@ -133,17 +133,17 @@
   $ cat error2.log
   $ cat access2.log
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=debugwireargs&four=vier&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=debugwireargs&four=vier&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs&four=vier&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs&four=vier&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
 
 SSH (try to exercise the ssh functionality with a dummy script):