branching: merge stable into default
authorRaphaël Gomès <rgomes@octobus.net>
Mon, 17 May 2021 15:05:24 +0200
changeset 47233 bcafcd779d2e
parent 47232 33096e77598c (current diff)
parent 47183 8be95673eb8a (diff)
child 47234 616b8f412676
branching: merge stable into default
mercurial/hg.py
mercurial/localrepo.py
mercurial/ui.py
mercurial/util.py
tests/run-tests.py
--- a/contrib/heptapod-ci.yml	Mon May 03 12:34:01 2021 +0200
+++ b/contrib/heptapod-ci.yml	Mon May 17 15:05:24 2021 +0200
@@ -125,3 +125,17 @@
         PYTHON: python3
         RUNTEST_ARGS: "--blacklist /tmp/check-tests.txt --chg"
         TEST_HGMODULEPOLICY: "c"
+
+check-pytype-py3:
+    extends: .runtests_template
+    when: manual
+    before_script:
+      - hg clone . /tmp/mercurial-ci/ --noupdate --config phases.publish=no
+      - hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
+      - cd /tmp/mercurial-ci/
+      - make local PYTHON=$PYTHON
+      - $PYTHON -m pip install --user -U pytype==2021.04.15
+    variables:
+        RUNTEST_ARGS: " --allow-slow-tests tests/test-check-pytype.t"
+        PYTHON: python3
+        TEST_HGMODULEPOLICY: "c"
--- a/hgext/convert/p4.py	Mon May 03 12:34:01 2021 +0200
+++ b/hgext/convert/p4.py	Mon May 17 15:05:24 2021 +0200
@@ -151,12 +151,10 @@
                     views[sview] = cview
 
         # list of changes that affect our source files
-        p4changes = p4changes.keys()
-        p4changes.sort(key=int)
+        p4changes = sorted(p4changes.keys(), key=int)
 
         # list with depot pathnames, longest first
-        vieworder = views.keys()
-        vieworder.sort(key=len, reverse=True)
+        vieworder = sorted(views.keys(), key=len, reverse=True)
 
         # handle revision limiting
         startrev = self.ui.config(b'convert', b'p4.startrev')
@@ -188,7 +186,7 @@
             else:
                 shortdesc = b'**empty changelist description**'
 
-            t = b'%s %s' % (c.rev, repr(shortdesc)[1:-1])
+            t = b'%s %s' % (c.rev, shortdesc)
             ui.status(stringutil.ellipsis(t, 80) + b'\n')
 
             files = []
--- a/mercurial/hg.py	Mon May 03 12:34:01 2021 +0200
+++ b/mercurial/hg.py	Mon May 17 15:05:24 2021 +0200
@@ -1054,7 +1054,7 @@
             # as the only "bad" outcome would be some slowness. That potential
             # slowness already affect reader.
             with destrepo.lock():
-                destrepo.updatecaches(full=True)
+                destrepo.updatecaches(full=b"post-clone")
     finally:
         release(srclock, destlock)
         if cleandir is not None:
--- a/mercurial/localrepo.py	Mon May 03 12:34:01 2021 +0200
+++ b/mercurial/localrepo.py	Mon May 17 15:05:24 2021 +0200
@@ -2727,6 +2727,11 @@
 
         If 'full' is set, make sure all caches the function knows about have
         up-to-date data. Even the ones usually loaded more lazily.
+
+        The `full` argument can take a special "post-clone" value. In this case
+        the cache warming is made after a clone and of the slower cache might
+        be skipped, namely the `.fnodetags` one. This argument is 5.8 specific
+        as we plan for a cleaner way to deal with this for 5.9.
         """
         if tr is not None and tr.hookargs.get(b'source') == b'strip':
             # During strip, many caches are invalid but
@@ -2754,8 +2759,9 @@
             for ctx in self[b'.'].parents():
                 ctx.manifest()  # accessing the manifest is enough
 
-            # accessing fnode cache warms the cache
-            tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs())
+            if not full == b"post-clone":
+                # accessing fnode cache warms the cache
+                tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs())
             # accessing tags warm the cache
             self.tags()
             self.filtered(b'served').tags()
--- a/mercurial/posix.py	Mon May 03 12:34:01 2021 +0200
+++ b/mercurial/posix.py	Mon May 17 15:05:24 2021 +0200
@@ -381,6 +381,10 @@
     return getattr(osutil, 'getfstype', lambda x: None)(dirpath)
 
 
+def get_password():
+    return encoding.strtolocal(getpass.getpass(''))
+
+
 def setbinary(fd):
     pass
 
--- a/mercurial/ui.py	Mon May 03 12:34:01 2021 +0200
+++ b/mercurial/ui.py	Mon May 17 15:05:24 2021 +0200
@@ -11,7 +11,6 @@
 import contextlib
 import datetime
 import errno
-import getpass
 import inspect
 import os
 import re
@@ -1781,7 +1780,7 @@
                         raise EOFError
                     return l.rstrip(b'\n')
                 else:
-                    return encoding.strtolocal(getpass.getpass(''))
+                    return util.get_password()
         except EOFError:
             raise error.ResponseExpected()
 
--- a/mercurial/util.py	Mon May 03 12:34:01 2021 +0200
+++ b/mercurial/util.py	Mon May 17 15:05:24 2021 +0200
@@ -107,6 +107,7 @@
 expandglobs = platform.expandglobs
 getfsmountpoint = platform.getfsmountpoint
 getfstype = platform.getfstype
+get_password = platform.get_password
 groupmembers = platform.groupmembers
 groupname = platform.groupname
 isexec = platform.isexec
--- a/mercurial/windows.py	Mon May 03 12:34:01 2021 +0200
+++ b/mercurial/windows.py	Mon May 17 15:05:24 2021 +0200
@@ -194,6 +194,28 @@
         return False
 
 
+def get_password():
+    """Prompt for password with echo off, using Windows getch().
+
+    This shouldn't be called directly- use ``ui.getpass()`` instead, which
+    checks if the session is interactive first.
+    """
+    pw = ""
+    while True:
+        c = msvcrt.getwch()
+        if c == '\r' or c == '\n':
+            break
+        if c == '\003':
+            raise KeyboardInterrupt
+        if c == '\b':
+            pw = pw[:-1]
+        else:
+            pw = pw + c
+    msvcrt.putwch('\r')
+    msvcrt.putwch('\n')
+    return encoding.strtolocal(pw)
+
+
 class winstdout(object):
     """Some files on Windows misbehave.
 
--- a/tests/hghave.py	Mon May 03 12:34:01 2021 +0200
+++ b/tests/hghave.py	Mon May 17 15:05:24 2021 +0200
@@ -863,7 +863,10 @@
 
 @check("py3exe", "a Python 3.x interpreter is available")
 def has_python3exe():
-    return matchoutput('python3 -V', br'^Python 3.(5|6|7|8|9)')
+    py = 'python3'
+    if os.name == 'nt':
+        py = 'py -3'
+    return matchoutput('%s -V' % py, br'^Python 3.(5|6|7|8|9)')
 
 
 @check("pure", "running with pure Python code")
--- a/tests/run-tests.py	Mon May 03 12:34:01 2021 +0200
+++ b/tests/run-tests.py	Mon May 17 15:05:24 2021 +0200
@@ -262,7 +262,13 @@
     except socket.error as exc:
         if os.name == 'nt' and exc.errno == errno.WSAEACCES:
             return False
-        elif exc.errno not in (
+        elif PYTHON3:
+            # TODO: make a proper exception handler after dropping py2.  This
+            #       works because socket.error is an alias for OSError on py3,
+            #       which is also the baseclass of PermissionError.
+            if isinstance(exc, PermissionError):
+                return False
+        if exc.errno not in (
             errno.EADDRINUSE,
             errno.EADDRNOTAVAIL,
             errno.EPROTONOSUPPORT,
@@ -355,7 +361,8 @@
         for line in f.readlines():
             line = line.split(b'#', 1)[0].strip()
             if line:
-                entries[line] = filename
+                # Ensure path entries are compatible with os.path.relpath()
+                entries[os.path.normpath(line)] = filename
 
         f.close()
     return entries
--- a/tests/test-check-pyflakes.t	Mon May 03 12:34:01 2021 +0200
+++ b/tests/test-check-pyflakes.t	Mon May 17 15:05:24 2021 +0200
@@ -23,4 +23,5 @@
   mercurial/hgweb/server.py:*:* undefined name 'reload' (glob) (?)
   mercurial/util.py:*:* undefined name 'file' (glob) (?)
   mercurial/encoding.py:*:* undefined name 'localstr' (glob) (?)
+  tests/run-tests.py:*:* undefined name 'PermissionError' (glob) (?)
   
--- a/tests/test-clone-uncompressed.t	Mon May 03 12:34:01 2021 +0200
+++ b/tests/test-clone-uncompressed.t	Mon May 17 15:05:24 2021 +0200
@@ -201,7 +201,6 @@
   branch2-served.hidden
   branch2-visible
   branch2-visible-hidden
-  hgtagsfnodes1
   rbc-names-v1
   rbc-revs-v1
   tags2
--- a/tests/test-clone.t	Mon May 03 12:34:01 2021 +0200
+++ b/tests/test-clone.t	Mon May 17 15:05:24 2021 +0200
@@ -62,7 +62,6 @@
   branch2-served.hidden
   branch2-visible
   branch2-visible-hidden
-  hgtagsfnodes1
   rbc-names-v1
   rbc-revs-v1
   tags2
@@ -142,7 +141,6 @@
   branch2-served.hidden
   branch2-visible
   branch2-visible-hidden
-  hgtagsfnodes1
   rbc-names-v1
   rbc-revs-v1
   tags2
--- a/tests/test-hardlinks.t	Mon May 03 12:34:01 2021 +0200
+++ b/tests/test-hardlinks.t	Mon May 17 15:05:24 2021 +0200
@@ -244,7 +244,6 @@
   2 r4/.hg/cache/branch2-served.hidden
   2 r4/.hg/cache/branch2-visible
   2 r4/.hg/cache/branch2-visible-hidden
-  2 r4/.hg/cache/hgtagsfnodes1
   2 r4/.hg/cache/rbc-names-v1
   2 r4/.hg/cache/rbc-revs-v1
   2 r4/.hg/cache/tags2
@@ -302,7 +301,6 @@
   2 r4/.hg/cache/branch2-served.hidden
   2 r4/.hg/cache/branch2-visible
   2 r4/.hg/cache/branch2-visible-hidden
-  2 r4/.hg/cache/hgtagsfnodes1
   2 r4/.hg/cache/rbc-names-v1
   2 r4/.hg/cache/rbc-revs-v1
   2 r4/.hg/cache/tags2
--- a/tests/test-run-tests.t	Mon May 03 12:34:01 2021 +0200
+++ b/tests/test-run-tests.t	Mon May 17 15:05:24 2021 +0200
@@ -1116,15 +1116,17 @@
   </testsuite>
 
 Missing skips or blacklisted skips don't count as executed:
-  $ echo test-failure.t > blacklist
+  $ mkdir tests
+  $ echo tests/test-failure.t > blacklist
+  $ cp test-failure.t tests
   $ rt --blacklist=blacklist --json\
-  >   test-failure.t test-bogus.t
+  >   tests/test-failure.t tests/test-bogus.t
   running 2 tests using 1 parallel processes 
   ss
   Skipped test-bogus.t: Doesn't exist
   Skipped test-failure.t: blacklisted
   # Ran 0 tests, 2 skipped, 0 failed.
-  $ cat report.json
+  $ cat tests/report.json
   testreport ={
       "test-bogus.t": {
           "result": "skip"
@@ -1133,6 +1135,8 @@
           "result": "skip"
       }
   } (no-eol)
+  $ rm -r tests
+  $ echo test-failure.t > blacklist
 
 Whitelist trumps blacklist
   $ echo test-failure.t > whitelist
--- a/tests/test-share.t	Mon May 03 12:34:01 2021 +0200
+++ b/tests/test-share.t	Mon May 17 15:05:24 2021 +0200
@@ -68,7 +68,6 @@
   branch2-served.hidden
   branch2-visible
   branch2-visible-hidden
-  hgtagsfnodes1
   rbc-names-v1
   rbc-revs-v1
   tags2
--- a/tests/test-ssh.t	Mon May 03 12:34:01 2021 +0200
+++ b/tests/test-ssh.t	Mon May 17 15:05:24 2021 +0200
@@ -86,7 +86,7 @@
   $ hg -R local-stream book mybook
   $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
   streaming all changes
-  16 files to transfer, * of data (glob)
+  15 files to transfer, * of data (glob)
   transferred * in * seconds (*) (glob)
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-tags.t	Mon May 03 12:34:01 2021 +0200
+++ b/tests/test-tags.t	Mon May 17 15:05:24 2021 +0200
@@ -807,11 +807,11 @@
 
   $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
   tagsclient/.hg/cache/hgtagsfnodes1: size=96
-  0000: 96 ee 1d 73 00 00 00 00 00 00 00 00 00 00 00 00 |...s............|
-  0010: 00 00 00 00 00 00 00 00 c4 da b0 c2 94 65 e1 c6 |.............e..|
-  0020: 0d f7 f0 dd 32 04 ea 57 78 c8 97 97 79 fc d5 95 |....2..Wx...y...|
-  0030: f6 3c c8 fe 94 65 e1 c6 0d f7 f0 dd 32 04 ea 57 |.<...e......2..W|
-  0040: 78 c8 97 97 79 fc d5 95 40 f0 35 8c 19 e0 a7 d3 |x...y...@.5.....|
+  0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
+  0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
+  0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
+  0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
+  0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
   0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
 
 Running hg tags should produce tags2* file and not change cache
@@ -837,11 +837,11 @@
 
   $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
   tagsclient/.hg/cache/hgtagsfnodes1: size=96
-  0000: 96 ee 1d 73 00 00 00 00 00 00 00 00 00 00 00 00 |...s............|
-  0010: 00 00 00 00 00 00 00 00 c4 da b0 c2 94 65 e1 c6 |.............e..|
-  0020: 0d f7 f0 dd 32 04 ea 57 78 c8 97 97 79 fc d5 95 |....2..Wx...y...|
-  0030: f6 3c c8 fe 94 65 e1 c6 0d f7 f0 dd 32 04 ea 57 |.<...e......2..W|
-  0040: 78 c8 97 97 79 fc d5 95 40 f0 35 8c 19 e0 a7 d3 |x...y...@.5.....|
+  0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
+  0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
+  0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
+  0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
+  0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
   0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
 
 Check that the bundle includes cache data
--- a/tests/test-treemanifest.t	Mon May 03 12:34:01 2021 +0200
+++ b/tests/test-treemanifest.t	Mon May 17 15:05:24 2021 +0200
@@ -792,7 +792,7 @@
   $ hg clone --config experimental.changegroup3=True --stream -U \
   >   http://localhost:$HGPORT1 stream-clone-basicstore
   streaming all changes
-  29 files to transfer, * of data (glob)
+  28 files to transfer, * of data (glob)
   transferred * in * seconds (*) (glob)
   $ hg -R stream-clone-basicstore verify
   checking changesets
@@ -806,7 +806,7 @@
   $ hg clone --config experimental.changegroup3=True --stream -U \
   >   http://localhost:$HGPORT2 stream-clone-encodedstore
   streaming all changes
-  29 files to transfer, * of data (glob)
+  28 files to transfer, * of data (glob)
   transferred * in * seconds (*) (glob)
   $ hg -R stream-clone-encodedstore verify
   checking changesets