changeset 40460:4fe63b573791

merge with stable
author Augie Fackler <augie@google.com>
date Fri, 02 Nov 2018 14:24:29 -0400
parents c2a0bc6412db (current diff) 5eaa5eb0db4e (diff)
children c7618901584d
files hgext/sqlitestore.py mercurial/cext/revlog.c mercurial/configitems.py mercurial/help.py mercurial/revlog.py mercurial/utils/storageutil.py
diffstat 29 files changed, 359 insertions(+), 195 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsigs	Sat Oct 13 01:55:40 2018 -0700
+++ b/.hgsigs	Fri Nov 02 14:24:29 2018 -0400
@@ -170,3 +170,5 @@
 33ac6a72308a215e6086fbced347ec10aa963b0a 0 iQJEBAABCAAuFiEEK8zhT1xnJaouqK63ucncgkqlvdUFAlthwaIQHHJhZkBkdXJpbjQyLmNvbQAKCRC5ydyCSqW91atOD/0de4nA55WJpiQzAqTg4xWIRZB6y0pkQ8D4cKNQkNiwPQAdDEPf85RuYmoPusNxhM40qfJlmHOw8sbRaqqabhVBPEzL1DpKe4GBucagLZqoL3pycyMzhkhzMka2RJT6nekCchTKJTIs2gx4FOA/QwaFYNkXFfguAEvi01isVdMo0GFLQ7pf7wU8UO1PPdkYphH0xPUvsreQ3pR3+6WwMLovk4JYW4cSaM4YkLlqJQPSO2YAlyXAwiQRvu2A227ydVqHOgLeV5zMQPy2v2zTgl2AoMdWp8+g2lJrYwclkNR+LAk5OlGYamyZwlmsTO7OX3n7xJYtfjbqdoqEKhO1igMi3ZSjqwkaBxxkXxArrteD19bpUyInTjbwTRO3mSe5aNkEDGoOYWn8UOn5ZkeEo7NyhP4OTXqyxQs9rwjD79xZk+6fGB777vuZDUdLZYRQFOPEximpmCGJDrZWj5PeIALWkrRGWBl2eFJ5sl6/pFlUJDjDEstnrsfosp6NJ3VFiD9EunFWsTlV2qXaueh9+TfaSRmGHVuwFCDt7nATVEzTt8l74xsL3xUPS4u9EcNPuEhCRu1zLojCGjemEA29R9tJS8oWd6SwXKryzjo8SyN7yQVSM/yl212IOiOHTQF8vVZuJnailt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UAB6qTHiose56llf6bzl66A==
--- a/.hgtags	Sat Oct 13 01:55:40 2018 -0700
+++ b/.hgtags	Fri Nov 02 14:24:29 2018 -0400
@@ -183,3 +183,5 @@
 33ac6a72308a215e6086fbced347ec10aa963b0a 4.7
 ede3bf31fe63677fdf5bd8db687977d4e3d792ed 4.7.1
 5405cb1a79010ac50c58cd84e6f50c4556bf2a4c 4.7.2
+956ec6f1320df26f3133ec40f3de866ea0695fd7 4.8rc0
+a91a2837150bdcb27ae76b3646e6c93cd6a15904 4.8
--- a/contrib/relnotes	Sat Oct 13 01:55:40 2018 -0700
+++ b/contrib/relnotes	Fri Nov 02 14:24:29 2018 -0400
@@ -9,11 +9,6 @@
 import re
 import subprocess
 
-# Regenerate this list with
-#   hg export 'grep("\.\. [a-z]+::")' | grep '^\.\.' | \
-#     sed 's/.. //;s/::.*//' | sort -u
-rnsections = ["api", "bc", "container", "feature", "fix", "note", "perf"]
-
 rules = {
     # keep
     r"\(issue": 100,
@@ -26,27 +21,37 @@
     r"(mq|shelve|rebase):": 20,
     # newsy
     r": deprecate": 20,
-    r"(option|feature|command|support)": 10,
+    r"( ability|command|feature|option|support)": 10,
+    # experimental
+    r"hg-experimental": 20,
+    r"(from|graduate).*experimental": 15,
+    r"(hide|mark).*experimental": -10,
     # bug-like?
     r"(fix|don't break|improve)": 7,
+    r"(not|n't|avoid|fix|prevent).*crash": 10,
     # boring stuff, bump down
     r"^contrib": -5,
     r"debug": -5,
     r"help": -5,
-    r"(doc|bundle2|obsolete|obsmarker|rpm|setup|debug\S+:)": -15,
-    r"(check-code|check-commit|import-checker)": -20,
+    r"(doc|metavar|bundle2|obsolete|obsmarker|rpm|setup|debug\S+:)": -15,
+    r"(check-code|check-commit|check-config|import-checker)": -20,
+    r"(flake8|lintian|pyflakes|pylint)": -20,
     # cleanups and refactoring
-    r"(cleanup|whitespace|nesting|indent|spelling|comment)": -20,
-    r"(typo|hint|note|style:|correct doc)": -20,
+    r"(cleanup|white ?space|spelling|quoting)": -20,
+    r"(flatten|dedent|indent|nesting|unnest)": -20,
+    r"(typo|hint|note|comment|TODO|FIXME)": -20,
+    r"(style:|convention|one-?liner)": -20,
     r"_": -10,
     r"(argument|absolute_import|attribute|assignment|mutable)": -15,
-    r"(unused|useless|unnecessary|duplicate|deprecated|scope|True|False)": -10,
+    r"(scope|True|False)": -10,
+    r"(unused|useless|unnecessary|superfluous|duplicate|deprecated)": -10,
     r"(redundant|pointless|confusing|uninitialized|meaningless|dead)": -10,
-    r": (drop|remove|inherit|rename|simplify|naming|inline)": -10,
-    r"(docstring|document .* method)": -20,
-    r"(factor|extract|prepare|split|replace| import)": -20,
-    r": add.*(function|method|implementation|test|example)": -10,
-    r": (move|extract) .* (to|into|from)": -20,
+    r": (drop|remove|delete|rip out)": -10,
+    r": (inherit|rename|simplify|naming|inline)": -10,
+    r"(correct doc|docstring|document .* method)": -20,
+    r"(abstract|factor|extract|prepare|split|replace| import)": -20,
+    r": add.*(function|method|implementation|example)": -10,
+    r": (move|extract) .* (to|into|from|out of)": -20,
     r": implement ": -5,
     r": use .* implementation": -20,
     r"\S\S\S+\.\S\S\S\S+": -5,
@@ -55,15 +60,20 @@
     # dumb keywords
     r"\S+/\S+:": -10,
     r"\S+\.\S+:": -10,
+    # python compatibility
+    r"[Pp]y(|thon) ?[23]": -20,
+    r"pycompat": -20,
+    r"(coerce|convert|encode) .*to (byte|sys|)(s|str|string)": -20,
+    # tests
+    r"^test(|s|ing|runner|-\S+):": -20,
+    r"^(f|hghave|run-tests):": -20,
+    r"add.* tests?": -20,
+    r"(buildbot|fuzz|mock|ratchet)": -10,
     # drop
     r"^i18n-": -50,
     r"^i18n:.*(hint|comment)": -50,
     r"perf:": -50,
-    r"check-code:": -50,
     r"Added.*for changeset": -50,
-    r"tests?:": -50,
-    r"test-": -50,
-    r"add.* tests": -50,
     r"^_": -50,
 }
 
@@ -72,9 +82,9 @@
 
 groupings = [
     (r"util|parsers|repo|ctx|context|revlog|filelog|alias|cmdutil", "core"),
-    (r"revset|templater|ui|dirstate|hook|i18n|transaction|wire", "core"),
-    (r"color|pager", "core"),
-    (r"hgweb|paper|coal|gitweb", "hgweb"),
+    (r"revset|template|ui|dirstate|hook|i18n|transaction|wire|vfs", "core"),
+    (r"dispatch|exchange|localrepo|streamclone|color|pager", "core"),
+    (r"hgweb|paper|coal|gitweb|monoblue|spartan", "hgweb"),
     (r"pull|push|revert|resolve|annotate|bookmark|branch|clone", "commands"),
     (r"commands|commit|config|files|graft|import|log|merge|patch", "commands"),
     (r"phases|status|summary|amend|tag|help|verify", "commands"),
@@ -83,12 +93,12 @@
 ]
 
 def main():
-    ap = argparse.ArgumentParser()
+    desc = "example: %(prog)s 4.7.2 --stoprev 4.8rc0"
+    ap = argparse.ArgumentParser(description=desc)
     ap.add_argument(
         "startrev",
         metavar="REV",
         type=str,
-        nargs=1,
         help=(
             "Starting revision for the release notes. This revision "
             "won't be included, but later revisions will."
@@ -99,7 +109,6 @@
         metavar="REV",
         type=str,
         default="@",
-        nargs=1,
         help=(
             "Stop revision for release notes. This revision will be included,"
             " but no later revisions will. This revision needs to be "
@@ -114,7 +123,7 @@
             "extensions.releasenotes=",
             "releasenotes",
             "-r",
-            "%s::%s" % (args.startrev[0], args.stoprev[0]),
+            "only(%s, %s)" % (args.stoprev, args.startrev),
         ]
     ).decode("utf-8")
     # Find all release notes from un-relnotes-flagged commits.
@@ -124,8 +133,7 @@
                 "hg",
                 "log",
                 "-r",
-                r'%s::%s - merge() - grep("\n\.\. (%s)::")'
-                % (args.startrev[0], args.stoprev[0], "|".join(rnsections)),
+                "only(%s, %s) - merge()" % (args.stoprev, args.startrev),
                 "-T",
                 r"{desc|firstline}\n",
             ]
@@ -167,12 +175,14 @@
         for d in sorted(groups[g]):
             print(" * %s" % d)
 
-    print("\n=== BC ===\n")
+    if bcs:
+        print("\n=== Behavior Changes ===\n")
 
     for d in sorted(bcs):
         print(" * %s" % d)
 
-    print("\n=== API Changes ===\n")
+    if apis:
+        print("\n=== Internal API Changes ===\n")
 
     for d in sorted(apis):
         print(" * %s" % d)
--- a/hgext/fix.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/hgext/fix.py	Fri Nov 02 14:24:29 2018 -0400
@@ -157,7 +157,8 @@
                 # Don't waste memory/time passing unchanged content back, but
                 # produce one result per item either way.
                 yield (rev, path, newdata if newdata != olddata else None)
-        results = worker.worker(ui, 1.0, getfixes, tuple(), workqueue)
+        results = worker.worker(ui, 1.0, getfixes, tuple(), workqueue,
+                                threadsafe=False)
 
         # We have to hold on to the data for each successor revision in memory
         # until all its parents are committed. We ensure this by committing and
--- a/hgext/sqlitestore.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/hgext/sqlitestore.py	Fri Nov 02 14:24:29 2018 -0400
@@ -561,7 +561,7 @@
     def emitrevisions(self, nodes, nodesorder=None, revisiondata=False,
                       assumehaveparentrevisions=False,
                       deltamode=repository.CG_DELTAMODE_STD):
-        if nodesorder not in ('nodes', 'storage', None):
+        if nodesorder not in ('nodes', 'storage', 'linear', None):
             raise error.ProgrammingError('unhandled value for nodesorder: %s' %
                                          nodesorder)
 
--- a/mercurial/bundle2.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/bundle2.py	Fri Nov 02 14:24:29 2018 -0400
@@ -1691,8 +1691,8 @@
     includepats = kwargs.get(r'includepats')
     excludepats = kwargs.get(r'excludepats')
 
-    narrowstream = repo.ui.configbool('experimental.server',
-                                      'stream-narrow-clones')
+    narrowstream = repo.ui.configbool('experimental',
+                                      'server.stream-narrow-clones')
 
     if (includepats or excludepats) and not narrowstream:
         raise error.Abort(_('server does not support narrow stream clones'))
--- a/mercurial/cext/revlog.c	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/cext/revlog.c	Fri Nov 02 14:24:29 2018 -0400
@@ -2317,7 +2317,7 @@
 	/* to pass index_get_parents() */
 	int (*)(indexObject *, Py_ssize_t, int*, int),
 	/* intrevs vector */
-	int initrevslen, long *initrevs,
+	Py_ssize_t initrevslen, long *initrevs,
 	long stoprev,
 	int inclusive);
 void rustlazyancestors_drop(rustlazyancestorsObject *self);
--- a/mercurial/configitems.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/configitems.py	Fri Nov 02 14:24:29 2018 -0400
@@ -613,7 +613,7 @@
 coreconfigitem('experimental', 'server.manifestdata.recommended-batch-size',
     default=100000,
 )
-coreconfigitem('experimental.server', 'stream-narrow-clones',
+coreconfigitem('experimental', 'server.stream-narrow-clones',
     default=False,
 )
 coreconfigitem('experimental', 'single-head-per-branch',
@@ -934,7 +934,7 @@
     default='hotpath',
 )
 coreconfigitem('profiling', 'time-track',
-    default='real',
+    default=dynamicdefault,
 )
 coreconfigitem('profiling', 'type',
     default='stat',
--- a/mercurial/copies.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/copies.py	Fri Nov 02 14:24:29 2018 -0400
@@ -219,6 +219,7 @@
 def _forwardcopies(a, b, match=None):
     """find {dst@b: src@a} copy mapping where a is an ancestor of b"""
 
+    match = a.repo().narrowmatch(match)
     # check for working copy
     if b.rev() is None:
         if a == b.p1():
@@ -510,8 +511,9 @@
         # unmatched file from topological common ancestors (no DAG rotation)
         # need to recompute this for directory move handling when grafting
         mta = tca.manifest()
-        u1u, u2u = _computenonoverlap(repo, c1, c2, m1.filesnotin(mta),
-                                                    m2.filesnotin(mta),
+        u1u, u2u = _computenonoverlap(repo, c1, c2,
+                                      m1.filesnotin(mta, repo.narrowmatch()),
+                                      m2.filesnotin(mta, repo.narrowmatch()),
                                       baselabel='topological common ancestor')
 
     for f in u1u:
--- a/mercurial/crecord.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/crecord.py	Fri Nov 02 14:24:29 2018 -0400
@@ -725,7 +725,7 @@
             nextitem = currentitem
         else:
             parent = nextitem.parentitem()
-            if parent.folded:
+            if parent is not None and parent.folded:
                 self.togglefolded(parent)
 
         self.currentselecteditem = nextitem
--- a/mercurial/exewrapper.c	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/exewrapper.c	Fri Nov 02 14:24:29 2018 -0400
@@ -25,7 +25,7 @@
 
 #define _tcscpy_s strcpy_s
 #define _tcscat_s strcat_s
-#define _countof(array) (sizeof(array)/sizeof(array[0]))
+#define _countof(array) (sizeof(array) / sizeof(array[0]))
 #endif
 
 static TCHAR pyscript[MAX_PATH + 10];
@@ -43,7 +43,7 @@
 	HANDLE hfind;
 	const char *err;
 	HMODULE pydll;
-	void(__cdecl * Py_SetPythonHome)(TCHAR *home);
+	void(__cdecl * Py_SetPythonHome)(TCHAR * home);
 	int(__cdecl * Py_Main)(int argc, TCHAR *argv[]);
 
 	if (GetModuleFileName(NULL, pyscript, _countof(pyscript)) == 0) {
@@ -86,11 +86,12 @@
 		scenario, so let's load python dll from this dir. */
 		FindClose(hfind);
 		_tcscpy_s(pydllfile, _countof(pydllfile), pyhome);
-		_tcscat_s(pydllfile, _countof(pydllfile), _T("\\") _T(HGPYTHONLIB)
-					_T(".dll"));
+		_tcscat_s(pydllfile, _countof(pydllfile),
+		          _T("\\") _T(HGPYTHONLIB) _T(".dll"));
 		pydll = LoadLibrary(pydllfile);
 		if (pydll == NULL) {
-			err = "failed to load private Python DLL " HGPYTHONLIB ".dll";
+			err = "failed to load private Python DLL " HGPYTHONLIB
+			      ".dll";
 			goto bail;
 		}
 		Py_SetPythonHome =
--- a/mercurial/help.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/help.py	Fri Nov 02 14:24:29 2018 -0400
@@ -9,6 +9,7 @@
 
 import itertools
 import os
+import re
 import textwrap
 
 from .i18n import (
@@ -30,6 +31,7 @@
     templatefilters,
     templatefuncs,
     templatekw,
+    ui as uimod,
     util,
 )
 from .hgweb import (
@@ -431,6 +433,16 @@
 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
                 dedent=True)
 
+def inserttweakrc(ui, topic, doc):
+    marker = '.. tweakdefaultsmarker'
+    repl = uimod.tweakrc
+    def sub(m):
+        lines = [m.group(1) + s for s in repl.splitlines()]
+        return '\n'.join(lines)
+    return re.sub(br'( *)%s' % re.escape(marker), sub, doc)
+
+addtopichook('config', inserttweakrc)
+
 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
           **opts):
     '''
--- a/mercurial/help/config.txt	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/help/config.txt	Fri Nov 02 14:24:29 2018 -0400
@@ -1715,7 +1715,7 @@
 
 ``time-track``
     Control if the stat profiler track ``cpu`` or ``real`` time.
-    (default: ``cpu``)
+    (default: ``cpu`` on Windows, otherwise ``real``)
 
 ``limit``
     Number of lines to show. Specific to the ``ls`` instrumenting profiler.
@@ -2370,6 +2370,10 @@
     effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
     not include ``tweakdefaults``. (default: False)
 
+    It currently means::
+
+      .. tweakdefaultsmarker
+
 ``username``
     The committer of a changeset created when running "commit".
     Typically a person's name and email address, e.g. ``Fred Widget
--- a/mercurial/httppeer.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/httppeer.py	Fri Nov 02 14:24:29 2018 -0400
@@ -405,11 +405,15 @@
         return True
 
     def close(self):
+        try:
+            reqs, sent, recv = (self._urlopener.requestscount,
+                                self._urlopener.sentbytescount,
+                                self._urlopener.receivedbytescount)
+        except AttributeError:
+            return
         self.ui.note(_('(sent %d HTTP requests and %d bytes; '
                        'received %d bytes in responses)\n') %
-                     (self._urlopener.requestscount,
-                      self._urlopener.sentbytescount,
-                      self._urlopener.receivedbytescount))
+                     (reqs, sent, recv))
 
     # End of ipeerconnection interface.
 
--- a/mercurial/keepalive.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/keepalive.py	Fri Nov 02 14:24:29 2018 -0400
@@ -442,7 +442,10 @@
         data = self._raw_read(amt)
 
         self.receivedbytescount += len(data)
-        self._connection.receivedbytescount += len(data)
+        try:
+            self._connection.receivedbytescount += len(data)
+        except AttributeError:
+            pass
         try:
             self._handler.parent.receivedbytescount += len(data)
         except AttributeError:
--- a/mercurial/logexchange.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/logexchange.py	Fri Nov 02 14:24:29 2018 -0400
@@ -105,7 +105,7 @@
     # use the string given to us
     rpath = remote
     if local:
-        rpath = remote._repo.root
+        rpath = util.pconvert(remote._repo.root)
     elif not isinstance(remote, bytes):
         rpath = remote._url
 
@@ -113,6 +113,11 @@
     for path, url in repo.ui.configitems('paths'):
         # remove auth info from user defined url
         noauthurl = util.removeauth(url)
+
+        # Standardize on unix style paths, otherwise some {remotenames} end up
+        # being an absolute path on Windows.
+        url = util.pconvert(bytes(url))
+        noauthurl = util.pconvert(noauthurl)
         if url == rpath or noauthurl == rpath:
             rpath = path
             break
--- a/mercurial/phases.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/phases.py	Fri Nov 02 14:24:29 2018 -0400
@@ -129,11 +129,13 @@
 # record phase index
 public, draft, secret = range(3)
 internal = INTERNAL_FLAG | HIDEABLE_FLAG
+archived = HIDEABLE_FLAG
 allphases = range(internal + 1)
 trackedphases = allphases[1:]
 # record phase names
 phasenames = [None] * len(allphases)
 phasenames[:3] = ['public', 'draft', 'secret']
+phasenames[archived] = 'archived'
 phasenames[internal] = 'internal'
 # record phase property
 mutablephases = tuple(allphases[1:])
@@ -446,8 +448,9 @@
     def _retractboundary(self, repo, tr, targetphase, nodes):
         # Be careful to preserve shallow-copied values: do not update
         # phaseroots values, replace them.
-        if targetphase == internal and not supportinternal(repo):
-            msg = 'this repository does not support the internal phase'
+        if targetphase in (archived, internal) and not supportinternal(repo):
+            name = phasenames[targetphase]
+            msg = 'this repository does not support the %s phase' % name
             raise error.ProgrammingError(msg)
 
         repo = repo.unfiltered()
--- a/mercurial/profiling.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/profiling.py	Fri Nov 02 14:24:29 2018 -0400
@@ -101,7 +101,8 @@
     else:
         ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
 
-    track = ui.config('profiling', 'time-track')
+    track = ui.config('profiling', 'time-track',
+                      pycompat.iswindows and 'cpu' or 'real')
     statprof.start(mechanism='thread', track=track)
 
     try:
--- a/mercurial/revlog.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/revlog.py	Fri Nov 02 14:24:29 2018 -0400
@@ -2207,7 +2207,7 @@
     def emitrevisions(self, nodes, nodesorder=None, revisiondata=False,
                       assumehaveparentrevisions=False,
                       deltamode=repository.CG_DELTAMODE_STD):
-        if nodesorder not in ('nodes', 'storage', None):
+        if nodesorder not in ('nodes', 'storage', 'linear', None):
             raise error.ProgrammingError('unhandled value for nodesorder: %s' %
                                          nodesorder)
 
--- a/mercurial/revlogutils/deltas.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/revlogutils/deltas.py	Fri Nov 02 14:24:29 2018 -0400
@@ -593,7 +593,10 @@
         group = []
         for rev in temptative:
             # skip over empty delta (no need to include them in a chain)
-            while not (rev == nullrev or rev in tested or deltalength(rev)):
+            while (revlog._generaldelta
+                   and not (rev == nullrev
+                            or rev in tested
+                            or deltalength(rev))):
                 tested.add(rev)
                 rev = deltaparent(rev)
             # filter out revision we tested already
@@ -646,6 +649,11 @@
         if good is not None:
             break
 
+    # If sparse revlog is enabled, we can try to refine the available deltas
+    if not revlog._sparserevlog:
+        yield None
+        return
+
     # if we have a refinable value, try to refine it
     if good is not None and good not in (p1, p2) and revlog.issnapshot(good):
         # refine snapshot down
--- a/mercurial/utils/storageutil.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/utils/storageutil.py	Fri Nov 02 14:24:29 2018 -0400
@@ -340,11 +340,11 @@
 
     if nodesorder == 'nodes':
         revs = [frev(n) for n in nodes]
-    elif nodesorder == 'storage':
-        revs = sorted(frev(n) for n in nodes)
-    else:
+    elif nodesorder == 'linear':
         revs = set(frev(n) for n in nodes)
         revs = dagop.linearize(revs, store.parentrevs)
+    else: # storage and default
+        revs = sorted(frev(n) for n in nodes)
 
     prevrev = None
 
--- a/rust/hg-direct-ffi/src/ancestors.rs	Sat Oct 13 01:55:40 2018 -0700
+++ b/rust/hg-direct-ffi/src/ancestors.rs	Fri Nov 02 14:24:29 2018 -0400
@@ -60,15 +60,16 @@
 pub extern "C" fn rustlazyancestors_init(
     index: IndexPtr,
     parents: IndexParentsFn,
-    initrevslen: usize,
+    initrevslen: ssize_t,
     initrevs: *mut c_long,
     stoprev: c_long,
     inclusive: c_int,
 ) -> *mut AncestorsIterator<Index> {
+    assert!(initrevslen >= 0);
     unsafe {
         raw_init(
             Index::new(index, parents),
-            initrevslen,
+            initrevslen as usize,
             initrevs,
             stoprev,
             inclusive,
--- a/setup.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/setup.py	Fri Nov 02 14:24:29 2018 -0400
@@ -168,6 +168,9 @@
 from distutils.sysconfig import get_python_inc, get_config_var
 from distutils.version import StrictVersion
 
+# Explain to distutils.StrictVersion how our release candidates are versionned
+StrictVersion.version_re = re.compile(r'^(\d+)\.(\d+)(\.(\d+))?-?(rc(\d+))?$')
+
 def write_if_changed(path, content):
     """Write content to a file iff the content hasn't changed."""
     if os.path.exists(path):
--- a/tests/hghave.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/tests/hghave.py	Fri Nov 02 14:24:29 2018 -0400
@@ -791,10 +791,14 @@
 def has_sqlite():
     try:
         import sqlite3
-        sqlite3.sqlite_version
+        version = sqlite3.sqlite_version_info
     except ImportError:
         return False
 
+    if version < (3, 8, 3):
+        # WITH clause not supported
+        return False
+
     return matchoutput('sqlite3 -version', b'^3\.\d+')
 
 @check('vcr', 'vcr http mocking library')
--- a/tests/test-contrib-relnotes.t	Sat Oct 13 01:55:40 2018 -0700
+++ b/tests/test-contrib-relnotes.t	Fri Nov 02 14:24:29 2018 -0400
@@ -132,28 +132,34 @@
    * bookmark: introduce a 'bookmarks' part
    * bookmark: introduce in advance a variant of the exchange test
    * bookmark: run 'pushkey' hooks after bookmark move, not 'prepushkey'
+   * bookmark: use the 'bookmarks' bundle2 part to push bookmark update (Bts:issue5165)
    * bookmarks: add bookmarks to hidden revs if directaccess config is set
    * bookmarks: calculate visibility exceptions only once
    * bookmarks: display the obsfate of hidden revision we create a bookmark on
    * bookmarks: fix pushkey compatibility mode (Bts:issue5777)
    * bookmarks: use context managers for lock and transaction in update()
    * bookmarks: use context managers for locks and transaction in pushbookmark()
+   * branch: add a --rev flag to change branch name of given revisions
    * branch: allow changing branch name to existing name if possible
    * clone: add support for storing remotenames while cloning
    * clone: use utility function to write hgrc
    * clonebundle: make it possible to retrieve the initial bundle through largefile
+   * commands: use the new API to access hidden changesets in various commands
    * commandserver: restore cwd in case of exception
    * commandserver: unblock SIGCHLD
+   * fileset: do not crash by unary negate operation
    * help: deprecate ui.slash in favor of slashpath template filter (Bts:issue5572)
    * log: allow matchfn to be non-null even if both --patch/--stat are off
    * log: build follow-log filematcher at once
    * log: don't expand aliases in revset built from command options
+   * log: follow file history across copies even with -rREV (BC) (Bts:issue4959)
    * log: make "slowpath" condition slightly more readable
    * log: make opt2revset table a module constant
    * log: merge getlogrevs() and getgraphlogrevs()
    * log: remove temporary variable 'date' used only once
    * log: resolve --follow thoroughly in getlogrevs()
    * log: resolve --follow with -rREV in cmdutil.getlogrevs()
+   * log: rewrite --follow-first -rREV like --follow for consistency (BC)
    * log: simplify 'x or ancestors(x)' expression
    * log: translate column labels at once (Bts:issue5750)
    * log: use revsetlang.formatspec() thoroughly
@@ -172,10 +178,23 @@
    * pull: store binary node in pullop.remotebookmarks
    * push: include a 'check:bookmarks' part when possible
    * push: restrict common discovery to the pushed set
+   * revert: do not reverse hunks in interactive when REV is not parent (Bts:issue5096)
    * revert: support reverting to hidden cset if directaccess config is set
   
   === core ===
+   * color: respect HGPLAINEXCEPT=color to allow colors while scripting (Bts:issue5749)
+   * dirstate: add explicit methods for querying directories (API)
+   * dispatch: abort if early boolean options can't be parsed
+   * dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
+   * dispatch: add option to not strip command args parsed by _earlygetopt()
+   * dispatch: alias --repo to --repository while parsing early options
+   * dispatch: fix early parsing of short option with value like -R=foo
+   * dispatch: handle IOError when writing to stderr
+   * dispatch: stop parsing of early boolean option at "--"
+   * dispatch: verify result of early command parsing
+   * exchange: return bundle info from getbundlechunks() (API)
    * filelog: add the ability to report the user facing name
+   * localrepo: specify optional callback parameter to pathauditor as a keyword
    * revlog: choose between ifh and dfh once for all
    * revlog: don't use slicing to return parents
    * revlog: group delta computation methods under _deltacomputer object
@@ -185,9 +204,21 @@
    * revlog: separate diff computation from the collection of other info
    * revset: evaluate filesets against each revision for 'file()' (Bts:issue5778)
    * revset: parse x^:: as (x^):: (Bts:issue5764)
+   * streamclone: add support for bundle2 based stream clone
+   * streamclone: add support for cloning non append-only file
+   * streamclone: also stream caches to the client
+   * streamclone: define first iteration of version 2 of stream format
+   * streamclone: move wire protocol status code from wireproto command
+   * streamclone: rework canperformstreamclone
+   * streamclone: tests phase exchange during stream clone
+   * streamclone: use readexactly when reading stream v2
+   * templater: fix crash by empty group expression
+   * templater: keep default resources per template engine (API)
    * templater: look up symbols/resources as if they were separated (Bts:issue5699)
    * transaction: register summary callbacks only at start of transaction (BC)
    * util: whitelist NTFS for hardlink creation (Bts:issue4580)
+   * vfs: drop text mode flag (API)
+   * wireproto: drop support for reader interface from streamres (API)
   
   === extensions ===
    * convert: restore the ability to use bzr < 2.6.0 (Bts:issue5733)
@@ -195,7 +226,6 @@
    * largefiles: add a 'debuglfput' command to put largefile into the store
    * largefiles: add support for 'largefiles://' url scheme
    * largefiles: allow to run 'debugupgraderepo' on repo with largefiles
-   * largefiles: convert EOL of hgrc before appending to bytes IO
    * largefiles: explicitly set the source and sink types to 'hg' for lfconvert
    * largefiles: modernize how capabilities are added to the wire protocol
    * largefiles: pay attention to dropped standin files when updating largefiles
@@ -208,6 +238,8 @@
    * rebase: don't run IMM if running rebase in a transaction
    * rebase: don't take out a dirstate guard for in-memory rebase
    * rebase: drop --style option
+   * rebase: enable multidest by default
+   * rebase: exclude descendants of obsoletes w/o a successor in dest (Bts:issue5300)
    * rebase: fix for hgsubversion
    * rebase: pass the wctx object (IMM or on-disk) to merge.update
    * rebase: pass wctx to rebasenode()
@@ -224,21 +256,14 @@
   === unsorted ===
    * archive: add support to specify hidden revs if directaccess config is set
    * atomicupdate: add an experimental option to use atomictemp when updating
+   * bundle2: don't use seekable bundle2 parts by default (Bts:issue5691)
    * bundle: allow bundlerepo to support alternative manifest implementations
    * changelog: introduce a 'tiprev' method
    * changelog: use 'tiprev()' in 'tip()'
    * completion: add support for new "amend" command
+   * crecord: fix revert -ir '.^' crash caused by 3649c3f2cd
    * debugssl: convert port number to int (Bts:issue5757)
    * diff: disable diff.noprefix option for diffstat (Bts:issue5759)
-   * dispatch: abort if early boolean options can't be parsed
-   * dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
-   * dispatch: add option to not strip command args parsed by _earlygetopt()
-   * dispatch: alias --repo to --repository while parsing early options
-   * dispatch: convert non-list option parsed by _earlygetopt() to string
-   * dispatch: fix early parsing of short option with value like -R=foo
-   * dispatch: handle IOError when writing to stderr
-   * dispatch: stop parsing of early boolean option at "--"
-   * dispatch: verify result of early command parsing
    * evolution: make reporting of new unstable changesets optional
    * extdata: abort if external command exits with non-zero status (BC)
    * fancyopts: add early-options parser compatible with getopt()
@@ -247,7 +272,6 @@
    * httppeer: add support for tracing all http request made by the peer
    * identify: document -r. explicitly how to disable wdir scanning (Bts:issue5622)
    * lfs: register config options
-   * localrepo: specify optional callback parameter to pathauditor as a keyword
    * match: do not weirdly include explicit files excluded by -X option
    * memfilectx: make changectx argument mandatory in constructor (API)
    * morestatus: don't crash with different drive letters for repo.root and CWD
@@ -256,36 +280,38 @@
    * rewriteutil: use precheck() in uncommit and amend commands
    * scmutil: don't try to delete origbackup symlinks to directories (Bts:issue5731)
    * sshpeer: add support for request tracing
-   * streamclone: add support for bundle2 based stream clone
-   * streamclone: add support for cloning non append-only file
-   * streamclone: also stream caches to the client
-   * streamclone: define first iteration of version 2 of stream format
-   * streamclone: move wire protocol status code from wireproto command
-   * streamclone: rework canperformstreamclone
-   * streamclone: tests phase exchange during stream clone
-   * streamclone: use readexactly when reading stream v2
    * subrepo: add config option to reject any subrepo operations (SEC)
    * subrepo: disable git and svn subrepos by default (BC) (SEC)
    * subrepo: extend config option to disable subrepos by type (SEC)
    * subrepo: handle 'C:' style paths on the command line (Bts:issue5770)
    * subrepo: use per-type config options to enable subrepos
    * svnsubrepo: check if subrepo is missing when checking dirty state (Bts:issue5657)
+   * test-bookmarks-pushpull: stabilize for Windows
+   * test-run-tests: stabilize the test (Bts:issue5735)
    * tr-summary: keep a weakref to the unfiltered repository
    * unamend: fix command summary line
    * uncommit: unify functions _uncommitdirstate and _unamenddirstate to one
+   * update: fix crash on bare update when directaccess is enabled
    * update: support updating to hidden cset if directaccess config is set
   
-  === BC ===
+  === Behavior Changes ===
   
    * extdata: abort if external command exits with non-zero status (BC)
    * graphlog: add another graph node type, unstable, using character "*" (BC)
    * hgweb: drop support of browsers that don't understand <canvas> (BC)
    * hgweb: only include graph-related data in jsdata variable on /graph pages (BC)
    * hgweb: stop adding strings to innerHTML of #graphnodes and #nodebgs (BC)
+   * log: follow file history across copies even with -rREV (BC) (Bts:issue4959)
+   * log: rewrite --follow-first -rREV like --follow for consistency (BC)
    * remove: print message for each file in verbose mode only while using '-A' (BC)
    * subrepo: disable git and svn subrepos by default (BC) (SEC)
    * transaction: register summary callbacks only at start of transaction (BC)
   
-  === API Changes ===
+  === Internal API Changes ===
   
+   * dirstate: add explicit methods for querying directories (API)
+   * exchange: return bundle info from getbundlechunks() (API)
    * memfilectx: make changectx argument mandatory in constructor (API)
+   * templater: keep default resources per template engine (API)
+   * vfs: drop text mode flag (API)
+   * wireproto: drop support for reader interface from streamres (API)
--- a/tests/test-generaldelta.t	Sat Oct 13 01:55:40 2018 -0700
+++ b/tests/test-generaldelta.t	Fri Nov 02 14:24:29 2018 -0400
@@ -279,61 +279,61 @@
   14 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg -R relax-chain debugdeltachain -m
       rev  chain# chainlen     prev   delta       size    rawsize  chainsize     ratio   lindist extradist extraratio
-        0       1        1       -1    base         47         46         47   1.02174        47         0    0.00000
-        1       1        2        0      p1         58         92        105   1.14130       105         0    0.00000
-        2       1        3        1      p1         58        138        163   1.18116       163         0    0.00000
-        3       1        4        2      p1         58        184        221   1.20109       221         0    0.00000
-        4       1        5        3      p1         58        230        279   1.21304       279         0    0.00000
-        5       1        6        4      p1         58        276        337   1.22101       337         0    0.00000
-        6       1        7        5      p1         58        322        395   1.22671       395         0    0.00000
-        7       1        8        6      p1         58        368        453   1.23098       453         0    0.00000
-        8       1        9        7      p1         58        414        511   1.23430       511         0    0.00000
-        9       1       10        8      p1         58        460        569   1.23696       569         0    0.00000
-       10       1       11        9      p1         58        506        627   1.23913       627         0    0.00000
-       11       1       12       10      p1         58        552        685   1.24094       685         0    0.00000
-       12       1       13       11      p1         58        598        743   1.24247       743         0    0.00000
-       13       1       14       12      p1         58        644        801   1.24379       801         0    0.00000
-       14       1       15       13      p1         58        690        859   1.24493       859         0    0.00000
-       15       1       16       14      p1         58        736        917   1.24592       917         0    0.00000
-       16       1       17       15      p1         58        782        975   1.24680       975         0    0.00000
-       17       1       18       16      p1         58        828       1033   1.24758      1033         0    0.00000
-       18       1       19       17      p1         58        874       1091   1.24828      1091         0    0.00000
-       19       1       20       18      p1         58        920       1149   1.24891      1149         0    0.00000
-       20       1       21       19      p1         58        966       1207   1.24948      1207         0    0.00000
-       21       1       22       20      p1         58       1012       1265   1.25000      1265         0    0.00000
-       22       1       23       21      p1         58       1058       1323   1.25047      1323         0    0.00000
-       23       1       24       22      p1         58       1104       1381   1.25091      1381         0    0.00000
-       24       1       25       23      p1         58       1150       1439   1.25130      1439         0    0.00000
-       25       1       26       24      p1         58       1196       1497   1.25167      1497         0    0.00000
-       26       1       27       25      p1         58       1242       1555   1.25201      1555         0    0.00000
-       27       1       28       26      p1         58       1288       1613   1.25233      1613         0    0.00000
-       28       1       29       27      p1         58       1334       1671   1.25262      1671         0    0.00000
-       29       1       30       28      p1         58       1380       1729   1.25290      1729         0    0.00000
-       30       1       31       29      p1         58       1426       1787   1.25316      1787         0    0.00000
-       31       2        1       -1    base         46         45         46   1.02222        46         0    0.00000
-       32       2        2       31      p1         57         90        103   1.14444       103         0    0.00000
-       33       2        3       32      p1         57        135        160   1.18519       160         0    0.00000
-       34       2        4       33      p1         57        180        217   1.20556       217         0    0.00000
-       35       2        5       34      p1         57        225        274   1.21778       274         0    0.00000
-       36       2        6       35      p1         57        270        331   1.22593       331         0    0.00000
-       37       2        7       36      p1         58        316        389   1.23101       389         0    0.00000
-       38       2        8       37      p1         58        362        447   1.23481       447         0    0.00000
-       39       3        1       -1    base         46         45         46   1.02222        46         0    0.00000
-       40       3        2       39      p1         57         90        103   1.14444       103         0    0.00000
-       41       3        3       40      p1         57        135        160   1.18519       160         0    0.00000
-       42       3        4       41      p1         57        180        217   1.20556       217         0    0.00000
-       43       3        5       42      p1         58        226        275   1.21681       275         0    0.00000
-       44       3        6       43      p1         58        272        333   1.22426       333         0    0.00000
-       45       3        7       44      p1         58        318        391   1.22956       391         0    0.00000
-       46       3        8       45      p1         58        364        449   1.23352       449         0    0.00000
-       47       3        9       46      p1         58        410        507   1.23659       507         0    0.00000
-       48       3       10       47      p1         58        456        565   1.23904       565         0    0.00000
-       49       3       11       48      p1         58        502        623   1.24104       623         0    0.00000
-       50       3       12       49      p1         58        548        681   1.24270       681         0    0.00000
-       51       3       13       50      p1         58        594        739   1.24411       739         0    0.00000
-       52       3       14       51      p1         58        640        797   1.24531       797         0    0.00000
-       53       4        1       -1    base          0          0          0   0.00000         0         0    0.00000
-       54       5        1       -1    base        369        640        369   0.57656       369         0    0.00000
+        0       1        1       -1    base         46         45         46   1.02222        46         0    0.00000
+        1       1        2        0      p1         57         90        103   1.14444       103         0    0.00000
+        2       1        3        1      p1         57        135        160   1.18519       160         0    0.00000
+        3       1        4        2      p1         57        180        217   1.20556       217         0    0.00000
+        4       1        5        3      p1         57        225        274   1.21778       274         0    0.00000
+        5       1        6        4      p1         57        270        331   1.22593       331         0    0.00000
+        6       2        1       -1    base         46         45         46   1.02222        46         0    0.00000
+        7       2        2        6      p1         57         90        103   1.14444       103         0    0.00000
+        8       2        3        7      p1         57        135        160   1.18519       160         0    0.00000
+        9       2        4        8      p1         57        180        217   1.20556       217         0    0.00000
+       10       2        5        9      p1         58        226        275   1.21681       275         0    0.00000
+       11       2        6       10      p1         58        272        333   1.22426       333         0    0.00000
+       12       2        7       11      p1         58        318        391   1.22956       391         0    0.00000
+       13       2        8       12      p1         58        364        449   1.23352       449         0    0.00000
+       14       2        9       13      p1         58        410        507   1.23659       507         0    0.00000
+       15       2       10       14      p1         58        456        565   1.23904       565         0    0.00000
+       16       2       11       15      p1         58        502        623   1.24104       623         0    0.00000
+       17       2       12       16      p1         58        548        681   1.24270       681         0    0.00000
+       18       3        1       -1    base         47         46         47   1.02174        47         0    0.00000
+       19       3        2       18      p1         58         92        105   1.14130       105         0    0.00000
+       20       3        3       19      p1         58        138        163   1.18116       163         0    0.00000
+       21       3        4       20      p1         58        184        221   1.20109       221         0    0.00000
+       22       3        5       21      p1         58        230        279   1.21304       279         0    0.00000
+       23       3        6       22      p1         58        276        337   1.22101       337         0    0.00000
+       24       3        7       23      p1         58        322        395   1.22671       395         0    0.00000
+       25       3        8       24      p1         58        368        453   1.23098       453         0    0.00000
+       26       3        9       25      p1         58        414        511   1.23430       511         0    0.00000
+       27       3       10       26      p1         58        460        569   1.23696       569         0    0.00000
+       28       3       11       27      p1         58        506        627   1.23913       627         0    0.00000
+       29       3       12       28      p1         58        552        685   1.24094       685         0    0.00000
+       30       3       13       29      p1         58        598        743   1.24247       743         0    0.00000
+       31       3       14       30      p1         58        644        801   1.24379       801         0    0.00000
+       32       3       15       31      p1         58        690        859   1.24493       859         0    0.00000
+       33       3       16       32      p1         58        736        917   1.24592       917         0    0.00000
+       34       3       17       33      p1         58        782        975   1.24680       975         0    0.00000
+       35       3       18       34      p1         58        828       1033   1.24758      1033         0    0.00000
+       36       3       19       35      p1         58        874       1091   1.24828      1091         0    0.00000
+       37       3       20       36      p1         58        920       1149   1.24891      1149         0    0.00000
+       38       3       21       37      p1         58        966       1207   1.24948      1207         0    0.00000
+       39       3       22       38      p1         58       1012       1265   1.25000      1265         0    0.00000
+       40       3       23       39      p1         58       1058       1323   1.25047      1323         0    0.00000
+       41       3       24       40      p1         58       1104       1381   1.25091      1381         0    0.00000
+       42       3       25       41      p1         58       1150       1439   1.25130      1439         0    0.00000
+       43       3       26       42      p1         58       1196       1497   1.25167      1497         0    0.00000
+       44       3       27       43      p1         58       1242       1555   1.25201      1555         0    0.00000
+       45       3       28       44      p1         58       1288       1613   1.25233      1613         0    0.00000
+       46       3       29       45      p1         58       1334       1671   1.25262      1671         0    0.00000
+       47       3       30       46      p1         58       1380       1729   1.25290      1729         0    0.00000
+       48       3       31       47      p1         58       1426       1787   1.25316      1787         0    0.00000
+       49       4        1       -1    base        197        316        197   0.62342       197         0    0.00000
+       50       4        2       49      p1         58        362        255   0.70442       255         0    0.00000
+       51       2       13       17      p1         58        594        739   1.24411      2781      2042    2.76319
+       52       5        1       -1    base        369        640        369   0.57656       369         0    0.00000
+       53       6        1       -1    base          0          0          0   0.00000         0         0    0.00000
+       54       7        1       -1    base        369        640        369   0.57656       369         0    0.00000
   $ hg clone --pull source-repo --config experimental.maxdeltachainspan=0 noconst-chain --config format.generaldelta=yes
   requesting all changes
   adding changesets
@@ -345,58 +345,58 @@
   14 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg -R noconst-chain debugdeltachain -m
       rev  chain# chainlen     prev   delta       size    rawsize  chainsize     ratio   lindist extradist extraratio
-        0       1        1       -1    base         47         46         47   1.02174        47         0    0.00000
-        1       1        2        0      p1         58         92        105   1.14130       105         0    0.00000
-        2       1        3        1      p1         58        138        163   1.18116       163         0    0.00000
-        3       1        4        2      p1         58        184        221   1.20109       221         0    0.00000
-        4       1        5        3      p1         58        230        279   1.21304       279         0    0.00000
-        5       1        6        4      p1         58        276        337   1.22101       337         0    0.00000
-        6       1        7        5      p1         58        322        395   1.22671       395         0    0.00000
-        7       1        8        6      p1         58        368        453   1.23098       453         0    0.00000
-        8       1        9        7      p1         58        414        511   1.23430       511         0    0.00000
-        9       1       10        8      p1         58        460        569   1.23696       569         0    0.00000
-       10       1       11        9      p1         58        506        627   1.23913       627         0    0.00000
-       11       1       12       10      p1         58        552        685   1.24094       685         0    0.00000
-       12       1       13       11      p1         58        598        743   1.24247       743         0    0.00000
-       13       1       14       12      p1         58        644        801   1.24379       801         0    0.00000
-       14       1       15       13      p1         58        690        859   1.24493       859         0    0.00000
-       15       1       16       14      p1         58        736        917   1.24592       917         0    0.00000
-       16       1       17       15      p1         58        782        975   1.24680       975         0    0.00000
-       17       1       18       16      p1         58        828       1033   1.24758      1033         0    0.00000
-       18       1       19       17      p1         58        874       1091   1.24828      1091         0    0.00000
-       19       1       20       18      p1         58        920       1149   1.24891      1149         0    0.00000
-       20       1       21       19      p1         58        966       1207   1.24948      1207         0    0.00000
-       21       1       22       20      p1         58       1012       1265   1.25000      1265         0    0.00000
-       22       1       23       21      p1         58       1058       1323   1.25047      1323         0    0.00000
-       23       1       24       22      p1         58       1104       1381   1.25091      1381         0    0.00000
-       24       1       25       23      p1         58       1150       1439   1.25130      1439         0    0.00000
-       25       1       26       24      p1         58       1196       1497   1.25167      1497         0    0.00000
-       26       1       27       25      p1         58       1242       1555   1.25201      1555         0    0.00000
-       27       1       28       26      p1         58       1288       1613   1.25233      1613         0    0.00000
-       28       1       29       27      p1         58       1334       1671   1.25262      1671         0    0.00000
-       29       1       30       28      p1         58       1380       1729   1.25290      1729         0    0.00000
-       30       1       31       29      p1         58       1426       1787   1.25316      1787         0    0.00000
-       31       2        1       -1    base         46         45         46   1.02222        46         0    0.00000
-       32       2        2       31      p1         57         90        103   1.14444       103         0    0.00000
-       33       2        3       32      p1         57        135        160   1.18519       160         0    0.00000
-       34       2        4       33      p1         57        180        217   1.20556       217         0    0.00000
-       35       2        5       34      p1         57        225        274   1.21778       274         0    0.00000
-       36       2        6       35      p1         57        270        331   1.22593       331         0    0.00000
-       37       2        7       36      p1         58        316        389   1.23101       389         0    0.00000
-       38       2        8       37      p1         58        362        447   1.23481       447         0    0.00000
-       39       3        1       -1    base         46         45         46   1.02222        46         0    0.00000
-       40       3        2       39      p1         57         90        103   1.14444       103         0    0.00000
-       41       3        3       40      p1         57        135        160   1.18519       160         0    0.00000
-       42       3        4       41      p1         57        180        217   1.20556       217         0    0.00000
-       43       3        5       42      p1         58        226        275   1.21681       275         0    0.00000
-       44       3        6       43      p1         58        272        333   1.22426       333         0    0.00000
-       45       3        7       44      p1         58        318        391   1.22956       391         0    0.00000
-       46       3        8       45      p1         58        364        449   1.23352       449         0    0.00000
-       47       3        9       46      p1         58        410        507   1.23659       507         0    0.00000
-       48       3       10       47      p1         58        456        565   1.23904       565         0    0.00000
-       49       3       11       48      p1         58        502        623   1.24104       623         0    0.00000
-       50       3       12       49      p1         58        548        681   1.24270       681         0    0.00000
-       51       3       13       50      p1         58        594        739   1.24411       739         0    0.00000
-       52       3       14       51      p1         58        640        797   1.24531       797         0    0.00000
+        0       1        1       -1    base         46         45         46   1.02222        46         0    0.00000
+        1       1        2        0      p1         57         90        103   1.14444       103         0    0.00000
+        2       1        3        1      p1         57        135        160   1.18519       160         0    0.00000
+        3       1        4        2      p1         57        180        217   1.20556       217         0    0.00000
+        4       1        5        3      p1         57        225        274   1.21778       274         0    0.00000
+        5       1        6        4      p1         57        270        331   1.22593       331         0    0.00000
+        6       2        1       -1    base         46         45         46   1.02222        46         0    0.00000
+        7       2        2        6      p1         57         90        103   1.14444       103         0    0.00000
+        8       2        3        7      p1         57        135        160   1.18519       160         0    0.00000
+        9       2        4        8      p1         57        180        217   1.20556       217         0    0.00000
+       10       2        5        9      p1         58        226        275   1.21681       275         0    0.00000
+       11       2        6       10      p1         58        272        333   1.22426       333         0    0.00000
+       12       2        7       11      p1         58        318        391   1.22956       391         0    0.00000
+       13       2        8       12      p1         58        364        449   1.23352       449         0    0.00000
+       14       2        9       13      p1         58        410        507   1.23659       507         0    0.00000
+       15       2       10       14      p1         58        456        565   1.23904       565         0    0.00000
+       16       2       11       15      p1         58        502        623   1.24104       623         0    0.00000
+       17       2       12       16      p1         58        548        681   1.24270       681         0    0.00000
+       18       3        1       -1    base         47         46         47   1.02174        47         0    0.00000
+       19       3        2       18      p1         58         92        105   1.14130       105         0    0.00000
+       20       3        3       19      p1         58        138        163   1.18116       163         0    0.00000
+       21       3        4       20      p1         58        184        221   1.20109       221         0    0.00000
+       22       3        5       21      p1         58        230        279   1.21304       279         0    0.00000
+       23       3        6       22      p1         58        276        337   1.22101       337         0    0.00000
+       24       3        7       23      p1         58        322        395   1.22671       395         0    0.00000
+       25       3        8       24      p1         58        368        453   1.23098       453         0    0.00000
+       26       3        9       25      p1         58        414        511   1.23430       511         0    0.00000
+       27       3       10       26      p1         58        460        569   1.23696       569         0    0.00000
+       28       3       11       27      p1         58        506        627   1.23913       627         0    0.00000
+       29       3       12       28      p1         58        552        685   1.24094       685         0    0.00000
+       30       3       13       29      p1         58        598        743   1.24247       743         0    0.00000
+       31       3       14       30      p1         58        644        801   1.24379       801         0    0.00000
+       32       3       15       31      p1         58        690        859   1.24493       859         0    0.00000
+       33       3       16       32      p1         58        736        917   1.24592       917         0    0.00000
+       34       3       17       33      p1         58        782        975   1.24680       975         0    0.00000
+       35       3       18       34      p1         58        828       1033   1.24758      1033         0    0.00000
+       36       3       19       35      p1         58        874       1091   1.24828      1091         0    0.00000
+       37       3       20       36      p1         58        920       1149   1.24891      1149         0    0.00000
+       38       3       21       37      p1         58        966       1207   1.24948      1207         0    0.00000
+       39       3       22       38      p1         58       1012       1265   1.25000      1265         0    0.00000
+       40       3       23       39      p1         58       1058       1323   1.25047      1323         0    0.00000
+       41       3       24       40      p1         58       1104       1381   1.25091      1381         0    0.00000
+       42       3       25       41      p1         58       1150       1439   1.25130      1439         0    0.00000
+       43       3       26       42      p1         58       1196       1497   1.25167      1497         0    0.00000
+       44       3       27       43      p1         58       1242       1555   1.25201      1555         0    0.00000
+       45       3       28       44      p1         58       1288       1613   1.25233      1613         0    0.00000
+       46       3       29       45      p1         58       1334       1671   1.25262      1671         0    0.00000
+       47       3       30       46      p1         58       1380       1729   1.25290      1729         0    0.00000
+       48       3       31       47      p1         58       1426       1787   1.25316      1787         0    0.00000
+       49       1        7        5      p1         58        316        389   1.23101      2857      2468    6.34447
+       50       1        8       49      p1         58        362        447   1.23481      2915      2468    5.52125
+       51       2       13       17      p1         58        594        739   1.24411      2642      1903    2.57510
+       52       2       14       51      p1         58        640        797   1.24531      2700      1903    2.38770
        53       4        1       -1    base          0          0          0   0.00000         0         0    0.00000
        54       5        1       -1    base        369        640        369   0.57656       369         0    0.00000
--- a/tests/test-narrow-copies.t	Sat Oct 13 01:55:40 2018 -0700
+++ b/tests/test-narrow-copies.t	Fri Nov 02 14:24:29 2018 -0400
@@ -18,10 +18,12 @@
   $ echo modified > inside/f2
   $ hg ci -qm 'modify inside/f2'
 
+  $ mkdir outside
+  $ echo new > outside/f3
+  $ hg ci -Aqm 'add outside/f3'
   $ cd ..
 
-  $ hg clone --narrow ssh://user@dummy/master narrow --include inside
-  requesting all changes
+  $ hg clone --narrow ssh://user@dummy/master narrow --include inside -r 2
   adding changesets
   adding manifests
   adding file changes
@@ -55,3 +57,18 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     move f2 from outside
   
+  $ echo new > inside/f4
+  $ hg ci -Aqm 'add inside/f4'
+  $ hg pull -q
+  $ hg --config extensions.rebase= rebase -d tip
+  rebasing 3:4f84b666728c "add inside/f4"
+  saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/4f84b666728c-4269b76e-rebase.hg
+
+  $ hg co -q 0
+  $ echo modified > inside/f1
+  $ hg ci -qm 'modify inside/f1'
+  $ echo new > inside/f5
+  $ hg ci -Aqm 'add inside/f5'
+  $ hg --config extensions.rebase= rebase -d 'public()' -r .
+  rebasing 6:610b60178c28 "add inside/f5" (tip)
+  saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/610b60178c28-65716a78-rebase.hg
--- a/tests/test-phases.t	Sat Oct 13 01:55:40 2018 -0700
+++ b/tests/test-phases.t	Fri Nov 02 14:24:29 2018 -0400
@@ -850,6 +850,10 @@
   ** ProgrammingError: this repository does not support the internal phase
       raise error.ProgrammingError(msg)
   mercurial.error.ProgrammingError: this repository does not support the internal phase
+  $ hg --config "phases.new-commit=archived" commit -m "my test archived commit" 2>&1 | grep ProgrammingError
+  ** ProgrammingError: this repository does not support the archived phase
+      raise error.ProgrammingError(msg)
+  mercurial.error.ProgrammingError: this repository does not support the archived phase
 
   $ cd ..
 
@@ -878,7 +882,8 @@
   test-debug-phase: new rev 1:  x -> 96
   test-hook-close-phase: c01c42dffc7f81223397e99652a0703f83e1c5ea:   -> internal
 
-Usual visibility rules apply when working directory parents
+The changeset is a working parent descendant.
+Per the usual visibility rules, it is made visible.
 
   $ hg log -G -l 3
   @  changeset:   1:c01c42dffc7f
@@ -904,3 +909,45 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     A
   
+
+Test for archived phase
+-----------------------
+
+Commit an archived changesets
+
+  $ echo B > B
+  $ hg add B
+  $ hg status
+  A B
+  $ hg --config "phases.new-commit=archived" commit -m "my test archived commit"
+  test-debug-phase: new rev 2:  x -> 32
+  test-hook-close-phase: 8df5997c3361518f733d1ae67cd3adb9b0eaf125:   -> archived
+
+The changeset is a working parent descendant.
+Per the usual visibility rules, it is made visible.
+
+  $ hg log -G -l 3
+  @  changeset:   2:8df5997c3361
+  |  tag:         tip
+  |  parent:      0:4a2df7238c3b
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     my test archived commit
+  |
+  o  changeset:   0:4a2df7238c3b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     A
+  
+
+Commit is hidden as expected
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg log -G
+  @  changeset:   0:4a2df7238c3b
+     tag:         tip
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     A
+  
--- a/tests/test-storage.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/tests/test-storage.py	Fri Nov 02 14:24:29 2018 -0400
@@ -25,6 +25,14 @@
     sqlitestore = None
 
 try:
+    import sqlite3
+    if sqlite3.sqlite_version_info < (3, 8, 3):
+        # WITH clause not supported
+        sqlitestore = None
+except ImportError:
+    pass
+
+try:
     from mercurial import zstd
     zstd.__version__
 except ImportError: