branching: merge stable into default
authorRaphaël Gomès <rgomes@octobus.net>
Mon, 24 Oct 2022 17:35:30 +0200
changeset 49531 f68d285158b2
parent 49522 52dd7a43ad5c (current diff)
parent 49527 a3356ab610fc (diff)
child 49532 250d9c8aaf10
branching: merge stable into default
--- a/hgext/lfs/blobstore.py	Wed Oct 19 16:16:47 2022 -0400
+++ b/hgext/lfs/blobstore.py	Mon Oct 24 17:35:30 2022 +0200
@@ -170,7 +170,7 @@
             # the localstore, because it's not going to match the expected.
             if content_length is not None and int(content_length) != size:
                 msg = (
-                    b"Response length (%s) does not match Content-Length "
+                    b"Response length (%d) does not match Content-Length "
                     b"header (%d): likely server-side crash"
                 )
                 raise LfsRemoteError(_(msg) % (size, int(content_length)))
--- a/mercurial/configitems.py	Wed Oct 19 16:16:47 2022 -0400
+++ b/mercurial/configitems.py	Mon Oct 24 17:35:30 2022 +0200
@@ -2569,7 +2569,7 @@
 coreconfigitem(
     b'verify',
     b'skipflags',
-    default=None,
+    default=0,
 )
 coreconfigitem(
     b'web',
--- a/mercurial/shelve.py	Wed Oct 19 16:16:47 2022 -0400
+++ b/mercurial/shelve.py	Mon Oct 24 17:35:30 2022 +0200
@@ -425,7 +425,7 @@
 def _aborttransaction(repo, tr):
     """Abort current transaction for shelve/unshelve, but keep dirstate"""
     dirstatebackupname = b'dirstate.shelve'
-    repo.dirstate.savebackup(tr, dirstatebackupname)
+    repo.dirstate.savebackup(None, dirstatebackupname)
     tr.abort()
     repo.dirstate.restorebackup(None, dirstatebackupname)
 
--- a/mercurial/windows.py	Wed Oct 19 16:16:47 2022 -0400
+++ b/mercurial/windows.py	Mon Oct 24 17:35:30 2022 +0200
@@ -581,7 +581,13 @@
 
     If uid is None, return the name of the current user."""
     if not uid:
-        return pycompat.fsencode(getpass.getuser())
+        try:
+            return pycompat.fsencode(getpass.getuser())
+        except ModuleNotFoundError:
+            # getpass.getuser() checks for a few environment variables first,
+            # but if those aren't set, imports pwd and calls getpwuid(), none of
+            # which exists on Windows.
+            pass
     return None
 
 
--- a/tests/common-pattern.py	Wed Oct 19 16:16:47 2022 -0400
+++ b/tests/common-pattern.py	Mon Oct 24 17:35:30 2022 +0200
@@ -158,6 +158,7 @@
     br'$EADDRNOTAVAIL$': (
         # strerror()
         br'Cannot assign requested address',
+        br'Can\'t assign requested address',
         # FormatMessage(WSAEADDRNOTAVAIL)
     ),
 }
--- a/tests/test-https.t	Wed Oct 19 16:16:47 2022 -0400
+++ b/tests/test-https.t	Mon Oct 24 17:35:30 2022 +0200
@@ -495,7 +495,7 @@
 
   $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull --insecure https://localhost:0/
   pulling from https://localhost:0/
-  abort: error: Tunnel connection failed: 404 Connection refused
+  abort: error: Tunnel connection failed: 404 (Connection refused|\$EADDRNOTAVAIL\$) (re)
   [100]
 
 
--- a/tests/test-issue1102.t	Wed Oct 19 16:16:47 2022 -0400
+++ b/tests/test-issue1102.t	Mon Oct 24 17:35:30 2022 +0200
@@ -14,4 +14,18 @@
   tip                                3:a49829c4fc11
   t1                                 0:f7b1eb17ad24
 
+Ensure that the username access fails gracefully if assumptions about the
+environment made by python do not hold.
+
+#if windows
+  >>> import os
+  >>> from mercurial import util
+  >>> os.environ.pop('LOGNAME', None) and None
+  >>> os.environ.pop('USER', None) and None
+  >>> os.environ.pop('LNAME', None) and None
+  >>> os.environ.pop('USERNAME', None) and None
+  >>> print(util.username())
+  None
+#endif
+
   $ cd ..
--- a/tests/test-shelve.t	Wed Oct 19 16:16:47 2022 -0400
+++ b/tests/test-shelve.t	Mon Oct 24 17:35:30 2022 +0200
@@ -1,4 +1,14 @@
 #testcases stripbased phasebased
+#testcases dirstate-v1 dirstate-v2
+
+#if dirstate-v2
+  $ cat >> $HGRCPATH << EOF
+  > [format]
+  > use-dirstate-v2=1
+  > [storage]
+  > dirstate-v2.slow-path=allow
+  > EOF
+#endif
 
   $ cat <<EOF >> $HGRCPATH
   > [extensions]
--- a/tests/test-shelve2.t	Wed Oct 19 16:16:47 2022 -0400
+++ b/tests/test-shelve2.t	Mon Oct 24 17:35:30 2022 +0200
@@ -1,6 +1,16 @@
 #testcases stripbased phasebased
 #testcases abortflag abortcommand
 #testcases continueflag continuecommand
+#testcases dirstate-v1 dirstate-v2
+
+#if dirstate-v2
+  $ cat >> $HGRCPATH << EOF
+  > [format]
+  > use-dirstate-v2=1
+  > [storage]
+  > dirstate-v2.slow-path=allow
+  > EOF
+#endif
 
   $ cat <<EOF >> $HGRCPATH
   > [extensions]