changeset 48438:715e4e81e39a

branching: merge stable into default
author Raphaël Gomès <rgomes@octobus.net>
date Wed, 08 Dec 2021 10:14:37 +0100
parents 0994125a31e5 (current diff) 6e4999cb085e (diff)
children 9cf5ac8c7109
files
diffstat 11 files changed, 110 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsigs	Mon Dec 06 12:30:54 2021 -0800
+++ b/.hgsigs	Wed Dec 08 10:14:37 2021 +0100
@@ -219,3 +219,4 @@
 750920b18aaaddd654756be40dec59d90f2643be 0 iQJJBAABCgAzFiEEgY2HzRrBgMOUyG5jOjPeRg2ew58FAmFcc4wVHDc4OTVwdWxraXRAZ21haWwuY29tAAoJEDoz3kYNnsOfatIP+wXnpFitqScNjqnBK6+DaTj+rmBlKoZGB1IQJW5ziDN59gJmT/axemrc3O8BJ/OFO+gDFTX6mk1/L+1Ul4BAF8Yo8XrPd/V7+M02ZUgKTbHmOqTosa9sLeSEojdQQRfSPTHgtA3CLm6VB91fCCfpS9yfCWO3+T8owNelHl8beSqcSlmAzPjqeF1EmalBO4YjSeOCfSdNpVvUGYG8OL/LwYWJqbea7LpN/Sq0piNMqYbc9GYeB9tnf0338WlGEaLTTDk8V3iES+EZxTNeN8NnpGvU0RN50CUfFVyadtbdXUzRDjF4mpdEnsQBkje3hGotyrzDZs1IjKGCANiNBb6dyn/wgv4APOLFw/BLat1Y7z2ZJ6sqUkBbfOs6H2KfufwFZl1sggG1NNXYrwjdS8dHuwi7FRzWMgcYi8Rle8qX8xK/3+We1rwbHfYxhmlEvC8VEC9PZl/K13aIuKmCQ36Es8C/qAtnNfSKZNkYoi/ueAvGFvJo2win1/wIa/6GvBfCxS3ExR1dH+tAUHj2HgMuQXMI6p9OuEloI/mJbdLmU9vnn06EcIyiIPd3dn4H2k0h2WNzyIoVE6YjD5T86jumrUxIj6hp+C9XYYkoj4KR17Pk7U4i3GixDpupLc/KoxiQRGSQTogPjD5O5RCg41tFaGav/TcyW/pb9gTI+v3ALjbZ
 6ee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I7bprlBdBBM3dkCAg+O0h8kdN007jjoLIiTw7K+XZ1A41zqGqXMQ2R/0xTltX9NXAe9xNhAEQhwSCH2TsB5IKI6+EHE6ZaNsyuwvlPhaQXfmOU22JBlUGE9IdEU5whd9760xJYTx3WEnbuED0UltAt3vgyvq+li1/Z7HDuzUyNha8YsaPw2QeHFUFwzxqoxo501/eDs9bXjBt7E4vsYVQC51sb3uS9kRbBB9GOiyx/HICZcbEQjy5TxVW5Bp0uD6Fu3nRytL0DDDIDF
--- a/.hgtags	Mon Dec 06 12:30:54 2021 -0800
+++ b/.hgtags	Wed Dec 08 10:14:37 2021 +0100
@@ -232,3 +232,4 @@
 750920b18aaaddd654756be40dec59d90f2643be 5.9.2
 6ee0244fc1cf889ae543d2ce0ec45201ae0be6e1 5.9.3
 a44bb185f6bdbecc754996d8386722e2f0123b0a 6.0rc0
+5d08b289e2e526259d7d5ea32b70fe76d5b327d7 6.0
--- a/contrib/packaging/dockerrpm	Mon Dec 06 12:30:54 2021 -0800
+++ b/contrib/packaging/dockerrpm	Wed Dec 08 10:14:37 2021 +0100
@@ -18,13 +18,8 @@
 
 CONTAINER=hg-docker-$PLATFORM
 
-if [[ -z "${HG_DOCKER_OWN_USER}" ]]; then
-    DOCKERUID=1000
-    DOCKERGID=1000
-else
-    DOCKERUID=$(id -u)
-    DOCKERGID=$(id -g)
-fi
+DOCKERUID=$(id -u)
+DOCKERGID=$(id -g)
 
 $BUILDDIR/hg-docker build \
     --build-arg UID=$DOCKERUID \
--- a/contrib/packaging/mercurial.spec	Mon Dec 06 12:30:54 2021 -0800
+++ b/contrib/packaging/mercurial.spec	Wed Dec 08 10:14:37 2021 +0100
@@ -27,6 +27,7 @@
 Version: snapshot
 Release: 0
 License: GPLv2+
+Prefix: /
 Group: Development/Tools
 URL: https://mercurial-scm.org/
 Source0: %{name}-%{version}-%{release}.tar.gz
--- a/hgext/fsmonitor/__init__.py	Mon Dec 06 12:30:54 2021 -0800
+++ b/hgext/fsmonitor/__init__.py	Wed Dec 08 10:14:37 2021 +0100
@@ -336,7 +336,7 @@
     nonnormalset = {
         f
         for f, e in self._map.items()
-        if e.v1_state() != "n" or e.v1_mtime() == -1
+        if e.v1_state() != b"n" or e.v1_mtime() == -1
     }
 
     copymap = self._map.copymap
--- a/hgext/fsmonitor/pywatchman/bser.c	Mon Dec 06 12:30:54 2021 -0800
+++ b/hgext/fsmonitor/pywatchman/bser.c	Wed Dec 08 10:14:37 2021 +0100
@@ -28,6 +28,7 @@
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <bytesobject.h>
 #ifdef _MSC_VER
@@ -1052,7 +1053,7 @@
     int64_t* total_len_out) {
   const char* start = NULL;
   const char* data = NULL;
-  int datalen = 0;
+  Py_ssize_t datalen = 0;
   const char* end;
   int64_t expected_len;
   off_t position;
@@ -1101,7 +1102,7 @@
 
 static PyObject* bser_loads(PyObject* self, PyObject* args, PyObject* kw) {
   const char* data = NULL;
-  int datalen = 0;
+  Py_ssize_t datalen = 0;
   const char* start;
   const char* end;
   int64_t expected_len;
--- a/mercurial/cext/pathencode.c	Mon Dec 06 12:30:54 2021 -0800
+++ b/mercurial/cext/pathencode.c	Wed Dec 08 10:14:37 2021 +0100
@@ -176,7 +176,7 @@
 
 	if (newobj) {
 		assert(PyBytes_Check(newobj));
-		Py_SIZE(newobj)--;
+		Py_SET_SIZE(newobj, Py_SIZE(newobj) - 1);
 		_encodedir(PyBytes_AS_STRING(newobj), newlen, path, len + 1);
 	}
 
@@ -791,7 +791,7 @@
 
 		if (newobj) {
 			assert(PyBytes_Check(newobj));
-			Py_SIZE(newobj)--;
+			Py_SET_SIZE(newobj, Py_SIZE(newobj) - 1);
 			basicencode(PyBytes_AS_STRING(newobj), newlen, path,
 			            len + 1);
 		}
--- a/mercurial/revlogutils/nodemap.py	Mon Dec 06 12:30:54 2021 -0800
+++ b/mercurial/revlogutils/nodemap.py	Wed Dec 08 10:14:37 2021 +0100
@@ -147,7 +147,7 @@
     if revlog._nodemap_file is None:
         msg = "calling persist nodemap on a revlog without the feature enabled"
         raise error.ProgrammingError(msg)
-    repo.svfs.unlink(revlog._nodemap_file)
+    repo.svfs.tryunlink(revlog._nodemap_file)
 
 
 def persist_nodemap(tr, revlog, pending=False, force=False):
--- a/mercurial/upgrade_utils/engine.py	Mon Dec 06 12:30:54 2021 -0800
+++ b/mercurial/upgrade_utils/engine.py	Wed Dec 08 10:14:37 2021 +0100
@@ -7,6 +7,7 @@
 
 from __future__ import absolute_import
 
+import errno
 import stat
 
 from ..i18n import _
@@ -633,16 +634,29 @@
         util.copyfile(
             srcrepo.vfs.join(b'requires'), backupvfs.join(b'requires')
         )
-        util.copyfile(
-            srcrepo.vfs.join(b'dirstate'), backupvfs.join(b'dirstate')
-        )
+        try:
+            util.copyfile(
+                srcrepo.vfs.join(b'dirstate'), backupvfs.join(b'dirstate')
+            )
+        except (IOError, OSError) as e:
+            # The dirstate does not exist on an empty repo or a repo with no
+            # revision checked out
+            if e.errno != errno.ENOENT:
+                raise
 
     assert srcrepo.dirstate._use_dirstate_v2 == (old == b'v2')
     srcrepo.dirstate._map.preload()
     srcrepo.dirstate._use_dirstate_v2 = new == b'v2'
     srcrepo.dirstate._map._use_dirstate_v2 = srcrepo.dirstate._use_dirstate_v2
     srcrepo.dirstate._dirty = True
-    srcrepo.vfs.unlink(b'dirstate')
+    try:
+        srcrepo.vfs.unlink(b'dirstate')
+    except (IOError, OSError) as e:
+        # The dirstate does not exist on an empty repo or a repo with no
+        # revision checked out
+        if e.errno != errno.ENOENT:
+            raise
+
     srcrepo.dirstate.write(None)
 
     scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
--- a/tests/test-fix.t	Mon Dec 06 12:30:54 2021 -0800
+++ b/tests/test-fix.t	Wed Dec 08 10:14:37 2021 +0100
@@ -1795,10 +1795,10 @@
   >        --config "fix.log:pattern=glob:**.log"
 
   $ cat $LOGFILE | sort | uniq -c
-        4 bar.log
-        4 baz.log
-        3 foo.log
-        2 qux.log
+  \s*4 bar.log (re)
+  \s*4 baz.log (re)
+  \s*3 foo.log (re)
+  \s*2 qux.log (re)
 
   $ cd ..
 
--- a/tests/test-upgrade-repo.t	Mon Dec 06 12:30:54 2021 -0800
+++ b/tests/test-upgrade-repo.t	Wed Dec 08 10:14:37 2021 +0100
@@ -1634,30 +1634,24 @@
   $ hg debugupgraderepo --run
   nothing to do
 
-#if rust
+#if no-rust
+
+  $ cat << EOF >> $HGRCPATH
+  > [storage]
+  > dirstate-v2.slow-path = allow
+  > EOF
+
+#endif
 
 Upgrade to dirstate-v2
 
-  $ hg debugformat -v --config format.exp-rc-dirstate-v2=1
-  format-variant     repo config default
-  fncache:            yes    yes     yes
+  $ hg debugformat -v --config format.exp-rc-dirstate-v2=1 | grep dirstate-v2
   dirstate-v2:         no    yes      no
-  dotencode:          yes    yes     yes
-  generaldelta:       yes    yes     yes
-  share-safe:          no     no      no
-  sparserevlog:       yes    yes     yes
-  persistent-nodemap: yes    yes      no
-  copies-sdc:          no     no      no
-  revlog-v2:          yes    yes      no
-  changelog-v2:        no     no      no
-  plain-cl-delta:     yes    yes     yes
-  compression:        zstd   zstd    zstd
-  compression-level:  default default default
   $ hg debugupgraderepo --config format.exp-rc-dirstate-v2=1 --run
   upgrade will perform the following actions:
   
   requirements
-     preserved: dotencode, exp-revlogv2.2, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, sparserevlog, store
+     preserved: * (glob)
      added: dirstate-v2
   
   dirstate-v2
@@ -1677,23 +1671,10 @@
   removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
   $ ls .hg/upgradebackup.*/dirstate
   .hg/upgradebackup.*/dirstate (glob)
-  $ hg debugformat -v
-  format-variant     repo config default
-  fncache:            yes    yes     yes
+  $ hg debugformat -v | grep dirstate-v2
   dirstate-v2:        yes     no      no
-  dotencode:          yes    yes     yes
-  generaldelta:       yes    yes     yes
-  share-safe:          no     no      no
-  sparserevlog:       yes    yes     yes
-  persistent-nodemap: yes    yes      no
-  copies-sdc:          no     no      no
-  revlog-v2:          yes    yes      no
-  changelog-v2:        no     no      no
-  plain-cl-delta:     yes    yes     yes
-  compression:        zstd   zstd    zstd
-  compression-level:  default default default
   $ hg status
-  $ dd status=none bs=12 count=1 if=.hg/dirstate
+  $ dd bs=12 count=1 if=.hg/dirstate 2> /dev/null
   dirstate-v2
 
 Downgrade from dirstate-v2
@@ -1702,7 +1683,7 @@
   upgrade will perform the following actions:
   
   requirements
-     preserved: dotencode, exp-revlogv2.2, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, sparserevlog, store
+     preserved: * (glob)
      removed: dirstate-v2
   
   processed revlogs:
@@ -1717,21 +1698,69 @@
   downgrading from dirstate-v2 to v1
   replaced files will be backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
   removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
-  $ hg debugformat -v
-  format-variant     repo config default
-  fncache:            yes    yes     yes
+  $ hg debugformat -v | grep dirstate-v2
   dirstate-v2:         no     no      no
-  dotencode:          yes    yes     yes
-  generaldelta:       yes    yes     yes
-  share-safe:          no     no      no
-  sparserevlog:       yes    yes     yes
-  persistent-nodemap: yes    yes      no
-  copies-sdc:          no     no      no
-  revlog-v2:          yes    yes      no
-  changelog-v2:        no     no      no
-  plain-cl-delta:     yes    yes     yes
-  compression:        zstd   zstd    zstd
-  compression-level:  default default default
   $ hg status
 
-#endif
+  $ cd ..
+
+dirstate-v2: upgrade and downgrade from and empty repository:
+-------------------------------------------------------------
+
+  $ hg init --config format.exp-rc-dirstate-v2=no dirstate-v2-empty
+  $ cd dirstate-v2-empty
+  $ hg debugformat | grep dirstate-v2
+  dirstate-v2:         no
+
+upgrade
+
+  $ hg debugupgraderepo --run --config format.exp-rc-dirstate-v2=yes
+  upgrade will perform the following actions:
+  
+  requirements
+     preserved: * (glob)
+     added: dirstate-v2
+  
+  dirstate-v2
+     "hg status" will be faster
+  
+  processed revlogs:
+    - all-filelogs
+    - changelog
+    - manifest
+  
+  beginning upgrade...
+  repository locked and read-only
+  creating temporary repository to stage upgraded data: $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
+  (it is safe to interrupt this process any time before data migration completes)
+  upgrading to dirstate-v2 from v1
+  replaced files will be backed up at $TESTTMP/dirstate-v2-empty/.hg/upgradebackup.* (glob)
+  removing temporary repository $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
+  $ hg debugformat | grep dirstate-v2
+  dirstate-v2:        yes
+
+downgrade
+
+  $ hg debugupgraderepo --run --config format.exp-rc-dirstate-v2=no
+  upgrade will perform the following actions:
+  
+  requirements
+     preserved: * (glob)
+     removed: dirstate-v2
+  
+  processed revlogs:
+    - all-filelogs
+    - changelog
+    - manifest
+  
+  beginning upgrade...
+  repository locked and read-only
+  creating temporary repository to stage upgraded data: $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
+  (it is safe to interrupt this process any time before data migration completes)
+  downgrading from dirstate-v2 to v1
+  replaced files will be backed up at $TESTTMP/dirstate-v2-empty/.hg/upgradebackup.* (glob)
+  removing temporary repository $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
+  $ hg debugformat | grep dirstate-v2
+  dirstate-v2:         no
+
+  $ cd ..