merge with stable
authorAugie Fackler <augie@google.com>
Thu, 01 Aug 2019 12:23:07 -0400
changeset 42671 e77be7e2109f
parent 42670 a7f1a0b3f461 (current diff)
parent 42665 39b98107773a (diff)
child 42672 51a2e3102db2
merge with stable
--- a/.hgsigs	Tue Jul 23 11:12:36 2019 +0200
+++ b/.hgsigs	Thu Aug 01 12:23:07 2019 -0400
@@ -181,3 +181,5 @@
 07e479ef7c9639be0029f00e6a722b96dcc05fee 0 iQJEBAABCAAuFiEEK8zhT1xnJaouqK63ucncgkqlvdUFAlzJ5QYQHHJhZkBkdXJpbjQyLmNvbQAKCRC5ydyCSqW91U0QD/4xQ00Suo+XNM/2v01NEALJA8pFxSaUcz1fBVQDwIQbApAHbjVDgIShuFlAXu7Jf582+C5wJu0J8L5Rb+Q9WJuM9sM+6cxUWclT3D3gB326LuQg86y5MYbzmwsSCOnBdRn/MY18on2XTa8t4Mxf0jAaHPUXEadmuwkOw4ds62eUD81lkakGoxgXrD1GUhAlGItNPOb0rp2XFj7i+LvazMX2mWOEXMXA5KPQrOvLsKnoESiPfONXumBfZNVSxVA7fJ3Vl1+PldBax+w9LQMgVGo+BkqPt7i+lPTcnlh2Nbf8y3zERTcItFBzrBxmuG6pINfNpZY/fi+9VL7mpMYlzlxs7VcLF8bVnpYpxpHfDR4hPjP0sq6+/nSSGUfzQXmfGHq0ZdoVGSzrDEv8UzYE9ehWUhHNE+sIU3MpwjC+WiW2YhYzPYN2KOlfSog3LuWLAcn3ZghWg1S4crsPt9CeE0vKxkNWNz9dzvhbniW7VGorXJKFCJzMu6pGaP/UjwpHxR+C6J1MGUW2TQwdIUyhPA8HfHJSVbifFJV+1CYEDcqRcFETpxm4YNrLJNL/Ns7zoWmdmEUXT1NEnK1r3Pe2Xi1o56FHGPffOWASmqFnF/coZCq6b4vmBWK/n8mI/JF1yxltfwacaY+1pEor92ztK34Lme1A+R7zyObGYNDcWiGZgA==
 c3484ddbdb9621256d597ed86b90d229c59c2af9 0 iQJEBAABCAAuF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ue Jul 23 11:12:36 2019 +0200
+++ b/.hgtags	Thu Aug 01 12:23:07 2019 -0400
@@ -194,3 +194,5 @@
 07e479ef7c9639be0029f00e6a722b96dcc05fee 5.0
 c3484ddbdb9621256d597ed86b90d229c59c2af9 5.0.1
 97ada9b8d51bef24c5cb4cdca4243f0db694ab6e 5.0.2
+e386b5f4f8360dbb43a576dd9b1368e386fefa5b 5.1rc0
+e91930d712e8507d1bc1b2dffd96c83edc4cbed3 5.1
--- a/contrib/automation/hgautomation/aws.py	Tue Jul 23 11:12:36 2019 +0200
+++ b/contrib/automation/hgautomation/aws.py	Thu Aug 01 12:23:07 2019 -0400
@@ -52,10 +52,14 @@
 }
 
 
+AMAZON_ACCOUNT_ID = '801119661308'
 DEBIAN_ACCOUNT_ID = '379101102735'
 UBUNTU_ACCOUNT_ID = '099720109477'
 
 
+WINDOWS_BASE_IMAGE_NAME = 'Windows_Server-2019-English-Full-Base-2019.07.12'
+
+
 KEY_PAIRS = {
     'automation',
 }
@@ -1028,7 +1032,8 @@
                 instance.ssh_client.close()
 
 
-def ensure_windows_dev_ami(c: AWSConnection, prefix='hg-'):
+def ensure_windows_dev_ami(c: AWSConnection, prefix='hg-',
+                           base_image_name=WINDOWS_BASE_IMAGE_NAME):
     """Ensure Windows Development AMI is available and up-to-date.
 
     If necessary, a modern AMI will be built by starting a temporary EC2
@@ -1046,9 +1051,7 @@
 
     name = '%s%s' % (prefix, 'windows-dev')
 
-    image = find_image(ec2resource,
-                       '801119661308',
-                       'Windows_Server-2019-English-Full-Base-2019.02.13')
+    image = find_image(ec2resource, AMAZON_ACCOUNT_ID, base_image_name)
 
     config = {
         'BlockDeviceMappings': [
@@ -1101,6 +1104,7 @@
         'user_data': WINDOWS_USER_DATA,
         'initial_bootstrap': WINDOWS_BOOTSTRAP_POWERSHELL,
         'bootstrap_commands': commands,
+        'base_image_name': base_image_name,
     })
 
     existing_image = find_and_reconcile_image(ec2resource, name, fingerprint)
--- a/contrib/automation/hgautomation/cli.py	Tue Jul 23 11:12:36 2019 +0200
+++ b/contrib/automation/hgautomation/cli.py	Thu Aug 01 12:23:07 2019 -0400
@@ -52,15 +52,16 @@
             aws.ensure_linux_dev_ami(c, distro=distro)
 
 
-def bootstrap_windows_dev(hga: HGAutomation, aws_region):
+def bootstrap_windows_dev(hga: HGAutomation, aws_region, base_image_name):
     c = hga.aws_connection(aws_region)
-    image = aws.ensure_windows_dev_ami(c)
+    image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name)
     print('Windows development AMI available as %s' % image.id)
 
 
-def build_inno(hga: HGAutomation, aws_region, arch, revision, version):
+def build_inno(hga: HGAutomation, aws_region, arch, revision, version,
+               base_image_name):
     c = hga.aws_connection(aws_region)
-    image = aws.ensure_windows_dev_ami(c)
+    image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name)
     DIST_PATH.mkdir(exist_ok=True)
 
     with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts:
@@ -74,9 +75,10 @@
                                          version=version)
 
 
-def build_wix(hga: HGAutomation, aws_region, arch, revision, version):
+def build_wix(hga: HGAutomation, aws_region, arch, revision, version,
+              base_image_name):
     c = hga.aws_connection(aws_region)
-    image = aws.ensure_windows_dev_ami(c)
+    image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name)
     DIST_PATH.mkdir(exist_ok=True)
 
     with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts:
@@ -89,9 +91,10 @@
                                         DIST_PATH, version=version)
 
 
-def build_windows_wheel(hga: HGAutomation, aws_region, arch, revision):
+def build_windows_wheel(hga: HGAutomation, aws_region, arch, revision,
+                        base_image_name):
     c = hga.aws_connection(aws_region)
-    image = aws.ensure_windows_dev_ami(c)
+    image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name)
     DIST_PATH.mkdir(exist_ok=True)
 
     with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts:
@@ -104,9 +107,9 @@
 
 
 def build_all_windows_packages(hga: HGAutomation, aws_region, revision,
-                               version):
+                               version, base_image_name):
     c = hga.aws_connection(aws_region)
-    image = aws.ensure_windows_dev_ami(c)
+    image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name)
     DIST_PATH.mkdir(exist_ok=True)
 
     with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts:
@@ -169,9 +172,9 @@
 
 
 def run_tests_windows(hga: HGAutomation, aws_region, instance_type,
-                      python_version, arch, test_flags):
+                      python_version, arch, test_flags, base_image_name):
     c = hga.aws_connection(aws_region)
-    image = aws.ensure_windows_dev_ami(c)
+    image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name)
 
     with aws.temporary_windows_dev_instances(c, image, instance_type,
                                              disable_antivirus=True) as insts:
@@ -217,6 +220,11 @@
         'bootstrap-windows-dev',
         help='Bootstrap the Windows development environment',
     )
+    sp.add_argument(
+        '--base-image-name',
+        help='AMI name of base image',
+        default=aws.WINDOWS_BASE_IMAGE_NAME,
+    )
     sp.set_defaults(func=bootstrap_windows_dev)
 
     sp = subparsers.add_parser(
@@ -232,6 +240,11 @@
         '--version',
         help='Mercurial version string to use',
     )
+    sp.add_argument(
+        '--base-image-name',
+        help='AMI name of base image',
+        default=aws.WINDOWS_BASE_IMAGE_NAME,
+    )
     sp.set_defaults(func=build_all_windows_packages)
 
     sp = subparsers.add_parser(
@@ -254,6 +267,11 @@
         '--version',
         help='Mercurial version string to use in installer',
     )
+    sp.add_argument(
+        '--base-image-name',
+        help='AMI name of base image',
+        default=aws.WINDOWS_BASE_IMAGE_NAME,
+    )
     sp.set_defaults(func=build_inno)
 
     sp = subparsers.add_parser(
@@ -272,6 +290,11 @@
         help='Mercurial revision to build',
         default='.',
     )
+    sp.add_argument(
+        '--base-image-name',
+        help='AMI name of base image',
+        default=aws.WINDOWS_BASE_IMAGE_NAME,
+    )
     sp.set_defaults(func=build_windows_wheel)
 
     sp = subparsers.add_parser(
@@ -294,6 +317,11 @@
         '--version',
         help='Mercurial version string to use in installer',
     )
+    sp.add_argument(
+        '--base-image-name',
+        help='AMI name of base image',
+        default=aws.WINDOWS_BASE_IMAGE_NAME,
+    )
     sp.set_defaults(func=build_wix)
 
     sp = subparsers.add_parser(
@@ -368,6 +396,11 @@
         '--test-flags',
         help='Extra command line flags to pass to run-tests.py',
     )
+    sp.add_argument(
+        '--base-image-name',
+        help='AMI name of base image',
+        default=aws.WINDOWS_BASE_IMAGE_NAME,
+    )
     sp.set_defaults(func=run_tests_windows)
 
     return parser
--- a/contrib/automation/hgautomation/linux.py	Tue Jul 23 11:12:36 2019 +0200
+++ b/contrib/automation/hgautomation/linux.py	Thu Aug 01 12:23:07 2019 -0400
@@ -489,7 +489,11 @@
             'ssh://%s//hgwork/src' % public_ip,
         ]
 
-        subprocess.run(args, cwd=str(source_path), env=env, check=True)
+        res = subprocess.run(args, cwd=str(source_path), env=env)
+
+        # Allow 1 (no-op) to not trigger error.
+        if res.returncode not in (0, 1):
+            res.check_returncode()
 
         # TODO support synchronizing dirty working directory.
 
--- a/contrib/automation/hgautomation/windows.py	Tue Jul 23 11:12:36 2019 +0200
+++ b/contrib/automation/hgautomation/windows.py	Thu Aug 01 12:23:07 2019 -0400
@@ -180,7 +180,11 @@
             'ssh://%s/c:/hgdev/src' % public_ip,
         ]
 
-        subprocess.run(args, cwd=str(hg_repo), env=env, check=True)
+        res = subprocess.run(args, cwd=str(hg_repo), env=env)
+
+        # Allow 1 (no-op) to not trigger error.
+        if res.returncode not in (0, 1):
+            res.check_returncode()
 
         run_powershell(winrm_client,
                        HG_UPDATE_CLEAN.format(revision=full_revision))
--- a/contrib/automation/hgautomation/winrm.py	Tue Jul 23 11:12:36 2019 +0200
+++ b/contrib/automation/hgautomation/winrm.py	Thu Aug 01 12:23:07 2019 -0400
@@ -37,7 +37,7 @@
         try:
             client = Client(host, username=username, password=password,
                             ssl=ssl, connection_timeout=5)
-            client.execute_cmd('echo "hello world"')
+            client.execute_ps("Write-Host 'Hello, World!'")
             return client
         except requests.exceptions.ConnectionError:
             if time.time() >= end_time:
--- a/contrib/install-windows-dependencies.ps1	Tue Jul 23 11:12:36 2019 +0200
+++ b/contrib/install-windows-dependencies.ps1	Thu Aug 01 12:23:07 2019 -0400
@@ -42,10 +42,10 @@
 $PYTHON37_x64_URL = "https://www.python.org/ftp/python/3.7.2/python-3.7.2-amd64.exe"
 $PYTHON37_x64_SHA256 = "0FE2A696F5A3E481FED795EF6896ED99157BCEF273EF3C4A96F2905CBDB3AA13"
 
-$PYTHON38_x86_URL = "https://www.python.org/ftp/python/3.8.0/python-3.8.0a2.exe"
-$PYTHON38_x86_SHA256 = "013A7DDD317679FE51223DE627688CFCB2F0F1128FD25A987F846AEB476D3FEF"
-$PYTHON38_x64_URL = "https://www.python.org/ftp/python/3.8.0/python-3.8.0a2-amd64.exe"
-$PYTHON38_X64_SHA256 = "560BC6D1A76BCD6D544AC650709F3892956890753CDCF9CE67E3D7302D76FB41"
+$PYTHON38_x86_URL = "https://www.python.org/ftp/python/3.8.0/python-3.8.0b2.exe"
+$PYTHON38_x86_SHA256 = "efa37ff7a239332bd5cf8b6e6ff15e3f183da942fd8c8d3e4b6bd11fa5e07e23"
+$PYTHON38_x64_URL = "https://www.python.org/ftp/python/3.8.0/python-3.8.0b2-amd64.exe"
+$PYTHON38_x64_SHA256 = "4e151f7dfa3605e6f400a3b01acfc2517468d71afb1e20f9299149356b79d8e9"
 
 # PIP 19.0.3.
 $PIP_URL = "https://github.com/pypa/get-pip/raw/fee32c376da1ff6496a798986d7939cd51e1644f/get-pip.py"
--- a/hgext/histedit.py	Tue Jul 23 11:12:36 2019 +0200
+++ b/hgext/histedit.py	Thu Aug 01 12:23:07 2019 -0400
@@ -201,6 +201,7 @@
     termios = None
 
 import functools
+import locale
 import os
 import struct
 
@@ -947,12 +948,6 @@
 # Curses Support
 try:
     import curses
-
-    # Curses requires setting the locale or it will default to the C
-    # locale. This sets the locale to the user's default system
-    # locale.
-    import locale
-    locale.setlocale(locale.LC_ALL, r'')
 except ImportError:
     curses = None
 
@@ -1538,6 +1533,10 @@
         ctxs = []
         for i, r in enumerate(revs):
             ctxs.append(histeditrule(repo[r], i))
+        # Curses requires setting the locale or it will default to the C
+        # locale. This sets the locale to the user's default system
+        # locale.
+        locale.setlocale(locale.LC_ALL, r'')
         rc = curses.wrapper(functools.partial(_chisteditmain, repo, ctxs))
         curses.echo()
         curses.endwin()
@@ -2323,4 +2322,3 @@
     cmdutil.summaryhooks.add('histedit', summaryhook)
     statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True,
                             continueflag=True, abortfunc=hgaborthistedit)
-
--- a/mercurial/cmdutil.py	Tue Jul 23 11:12:36 2019 +0200
+++ b/mercurial/cmdutil.py	Thu Aug 01 12:23:07 2019 -0400
@@ -2505,8 +2505,8 @@
             # was removed, it's no longer relevant. If X is missing (aka
             # deleted), old X must be preserved.
             files.update(filestoamend)
-            files = [f for f in files if (not samefile(f, wctx, base)
-                                          or f in wctx.deleted())]
+            files = [f for f in files if (f not in filestoamend
+                                          or not samefile(f, wctx, base))]
 
             def filectxfn(repo, ctx_, path):
                 try:
--- a/mercurial/commands.py	Tue Jul 23 11:12:36 2019 +0200
+++ b/mercurial/commands.py	Thu Aug 01 12:23:07 2019 -0400
@@ -6210,6 +6210,14 @@
        Timestamp in seconds is used to decide order of backups. More
        than ``maxbackups`` backups are kept, if same timestamp
        prevents from deciding exact order of them, for safety.
+
+       Selected changes can be unshelved with ``--interactive`` flag.
+       The working directory is updated with the selected changes, and
+       only the unselected changes remain shelved.
+       Note: The whole shelve is applied to working directory first before
+       running interactively. So, this will bring up all the conflicts between
+       working directory and the shelve, irrespective of which changes will be
+       unshelved.
     """
     with repo.wlock():
         return shelvemod.dounshelve(ui, repo, *shelved, **opts)
--- a/mercurial/copies.py	Tue Jul 23 11:12:36 2019 +0200
+++ b/mercurial/copies.py	Thu Aug 01 12:23:07 2019 -0400
@@ -246,7 +246,7 @@
     return cm
 
 def _changesetforwardcopies(a, b, match):
-    if a.rev() == node.nullrev:
+    if a.rev() in (node.nullrev, b.rev()):
         return {}
 
     repo = a.repo()
--- a/mercurial/crecord.py	Tue Jul 23 11:12:36 2019 +0200
+++ b/mercurial/crecord.py	Thu Aug 01 12:23:07 2019 -0400
@@ -29,10 +29,6 @@
 )
 stringio = util.stringio
 
-# This is required for ncurses to display non-ASCII characters in default user
-# locale encoding correctly.  --immerrr
-locale.setlocale(locale.LC_ALL, r'')
-
 # patch comments based on the git one
 diffhelptext = _("""# To remove '-' lines, make them ' ' lines (context).
 # To remove '+' lines, delete them.
@@ -530,6 +526,9 @@
     """
     ui.write(_('starting interactive selection\n'))
     chunkselector = curseschunkselector(headerlist, ui, operation)
+    # This is required for ncurses to display non-ASCII characters in
+    # default user locale encoding correctly.  --immerrr
+    locale.setlocale(locale.LC_ALL, r'')
     origsigtstp = sentinel = object()
     if util.safehasattr(signal, 'SIGTSTP'):
         origsigtstp = signal.getsignal(signal.SIGTSTP)
--- a/mercurial/util.py	Tue Jul 23 11:12:36 2019 +0200
+++ b/mercurial/util.py	Thu Aug 01 12:23:07 2019 -0400
@@ -3173,10 +3173,13 @@
     def __init__(self, map, skip=None):
         self._dirs = {}
         addpath = self.addpath
-        if safehasattr(map, 'iteritems') and skip is not None:
+        if isinstance(map, dict) and skip is not None:
             for f, s in map.iteritems():
                 if s[0] != skip:
                     addpath(f)
+        elif skip is not None:
+            raise error.ProgrammingError("skip character is only supported "
+                                         "with a dict source")
         else:
             for f in map:
                 addpath(f)
--- a/tests/test-amend.t	Tue Jul 23 11:12:36 2019 +0200
+++ b/tests/test-amend.t	Thu Aug 01 12:23:07 2019 -0400
@@ -451,3 +451,21 @@
   [255]
 
   $ cd ..
+
+Corner case of amend from issue6157:
+- working copy parent has a change to file `a`
+- working copy has the inverse change
+- we amend the working copy parent for files other than `a`
+hg used to include the changes to `a` anyway.
+
+  $ hg init 6157; cd 6157
+  $ echo a > a; echo b > b; hg commit -qAm_
+  $ echo a2 > a; hg commit -qm_
+  $ hg diff --stat -c .
+   a |  2 +-
+   1 files changed, 1 insertions(+), 1 deletions(-)
+  $ echo a > a; echo b2 > b; hg amend -q b
+  $ hg diff --stat -c .
+   a |  2 +-
+   b |  2 +-
+   2 files changed, 2 insertions(+), 2 deletions(-)
--- a/tests/test-copies.t	Tue Jul 23 11:12:36 2019 +0200
+++ b/tests/test-copies.t	Thu Aug 01 12:23:07 2019 -0400
@@ -58,6 +58,17 @@
   x -> y
   $ hg debugpathcopies 1 0 y
 
+Copies not including commit changes
+  $ newrepo
+  $ echo x > x
+  $ hg ci -Aqm 'add x'
+  $ hg mv x y
+  $ hg debugpathcopies . .
+  $ hg debugpathcopies . 'wdir()'
+  x -> y
+  $ hg debugpathcopies 'wdir()' .
+  y -> x
+
 Copy a file onto another file
   $ newrepo
   $ echo x > x
--- a/tests/test-setdiscovery.t	Tue Jul 23 11:12:36 2019 +0200
+++ b/tests/test-setdiscovery.t	Thu Aug 01 12:23:07 2019 -0400
@@ -985,7 +985,7 @@
   sampling from both directions
   searching: 5 queries
   query 5; still undecided: 185, sample size is: 185 (no-py3 !)
-  query 5; still undecided: 187, sample size is: 185 (py3 !)
+  query 5; still undecided: 187, sample size is: 187 (py3 !)
   5 total queries in *.????s (glob)
   elapsed time:  * seconds (glob)
   heads summary: