merge: with stable
authorAugie Fackler <augie@google.com>
Tue, 04 Jan 2022 14:21:22 -0500
changeset 48524 6bd42f9bc97e
parent 48523 823e906d879d (current diff)
parent 48522 b52cf5063865 (diff)
child 48525 d6c53b40b078
merge: with stable
contrib/heptapod-ci.yml
--- a/contrib/heptapod-ci.yml	Fri Feb 15 17:20:32 2019 -0500
+++ b/contrib/heptapod-ci.yml	Tue Jan 04 14:21:22 2022 -0500
@@ -152,6 +152,7 @@
 # that satisfies the various shebang lines and delegates to `py -3`.
 .window_runtests_template: &windows_runtests
     <<: *all
+    when: manual  # we don't have any Windows runners anymore at the moment
     stage: tests
     before_script:
       - C:/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && ls -1 tests/test-check-*.* > C:/Temp/check-tests.txt'
--- a/mercurial/hg.py	Fri Feb 15 17:20:32 2019 -0500
+++ b/mercurial/hg.py	Tue Jan 04 14:21:22 2022 -0500
@@ -12,6 +12,7 @@
 import os
 import shutil
 import stat
+import weakref
 
 from .i18n import _
 from .node import (
@@ -677,7 +678,7 @@
         srcpeer = source.peer()  # in case we were called with a localrepo
         branches = (None, branch or [])
         origsource = source = srcpeer.url()
-    srclock = destlock = cleandir = None
+    srclock = destlock = destwlock = cleandir = None
     destpeer = None
     try:
         revs, checkout = addbranchrevs(srcpeer, srcpeer, branches, revs)
@@ -865,6 +866,8 @@
                 requirements=dest_reqs,
             )
             destrepo = localrepo.makelocalrepository(ui, destrootpath)
+
+            destwlock = destrepo.wlock()
             destlock = destrepo.lock()
             from . import streamclone  # avoid cycle
 
@@ -873,6 +876,18 @@
             # we need to re-init the repo after manually copying the data
             # into it
             destpeer = peer(srcrepo, peeropts, dest)
+
+            # make the peer aware that is it already locked
+            #
+            # important:
+            #
+            #    We still need to release that lock at the end of the function
+            destpeer.local()._lockref = weakref.ref(destlock)
+            destpeer.local()._wlockref = weakref.ref(destwlock)
+            # dirstate also needs to be copied because `_wlockref` has a reference
+            # to it: this dirstate is saved to disk when the wlock is released
+            destpeer.local().dirstate = destrepo.dirstate
+
             srcrepo.hook(
                 b'outgoing', source=b'clone', node=srcrepo.nodeconstants.nullhex
             )
@@ -1040,6 +1055,8 @@
                     bookmarks.activate(destrepo, update)
             if destlock is not None:
                 release(destlock)
+            if destwlock is not None:
+                release(destlock)
             # here is a tiny windows were someone could end up writing the
             # repository before the cache are sure to be warm. This is "fine"
             # as the only "bad" outcome would be some slowness. That potential
@@ -1047,7 +1064,7 @@
             with destrepo.lock():
                 destrepo.updatecaches(caches=repositorymod.CACHES_POST_CLONE)
     finally:
-        release(srclock, destlock)
+        release(srclock, destlock, destwlock)
         if cleandir is not None:
             shutil.rmtree(cleandir, True)
         if srcpeer is not None:
--- a/mercurial/sparse.py	Fri Feb 15 17:20:32 2019 -0500
+++ b/mercurial/sparse.py	Tue Jan 04 14:21:22 2022 -0500
@@ -718,7 +718,7 @@
 
     The new config is written out and a working directory refresh is performed.
     """
-    with repo.wlock(), repo.dirstate.parentchange():
+    with repo.wlock(), repo.lock(), repo.dirstate.parentchange():
         raw = repo.vfs.tryread(b'sparse')
         oldinclude, oldexclude, oldprofiles = parseconfig(
             repo.ui, raw, b'sparse'
--- a/tests/hghave.py	Fri Feb 15 17:20:32 2019 -0500
+++ b/tests/hghave.py	Tue Jan 04 14:21:22 2022 -0500
@@ -1149,3 +1149,8 @@
 @check("bash", "bash shell")
 def has_bash():
     return matchoutput("bash -c 'echo hi'", b'^hi$')
+
+
+@check("bigendian", "big-endian CPU")
+def has_bigendian():
+    return sys.byteorder == 'big'
--- a/tests/test-clone-stream.t	Fri Feb 15 17:20:32 2019 -0500
+++ b/tests/test-clone-stream.t	Tue Jan 04 14:21:22 2022 -0500
@@ -404,11 +404,13 @@
 #endif
 #if zstd no-rust
   $ f --size --hex --bytes 256 body
-  body: size=116340
+  body: size=116340 (no-bigendian !)
+  body: size=116335 (bigendian !)
   0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
   0010: 9a 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
   0020: 06 09 04 0c 5e 62 79 74 65 63 6f 75 6e 74 31 30 |....^bytecount10|
-  0030: 31 32 37 36 66 69 6c 65 63 6f 75 6e 74 31 30 39 |1276filecount109|
+  0030: 31 32 37 36 66 69 6c 65 63 6f 75 6e 74 31 30 39 |1276filecount109| (no-bigendian !)
+  0030: 31 32 37 31 66 69 6c 65 63 6f 75 6e 74 31 30 39 |1271filecount109| (bigendian !)
   0040: 33 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 |3requirementsdot|
   0050: 65 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 |encode%2Cfncache|
   0060: 25 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 |%2Cgeneraldelta%|
@@ -533,7 +535,8 @@
   transferred 102 KB in * seconds (* */sec) (glob) (no-zstd !)
   bundle2-input-part: total payload size 118984 (no-zstd !)
   transferred 98.9 KB in * seconds (* */sec) (glob) (zstd !)
-  bundle2-input-part: total payload size 116145 (zstd !)
+  bundle2-input-part: total payload size 116145 (zstd no-bigendian !)
+  bundle2-input-part: total payload size 116140 (zstd bigendian !)
   bundle2-input-part: "listkeys" (params: 1 mandatory) supported
   bundle2-input-bundle: 2 parts total
   checking for updated bookmarks
--- a/tests/test-generaldelta.t	Fri Feb 15 17:20:32 2019 -0500
+++ b/tests/test-generaldelta.t	Tue Jan 04 14:21:22 2022 -0500
@@ -290,11 +290,14 @@
        52       4        4       51      p1         58        640        669   1.04531       669         0    0.00000 (no-zstd !)
        49       4        1       -1    base        205        316        205   0.64873       205         0    0.00000 (zstd !)
        50       4        2       49      p1         58        362        263   0.72652       263         0    0.00000 (zstd !)
-       51       4        3       50    prev        366        594        629   1.05892       629         0    0.00000 (zstd !)
-       52       4        4       51      p1         58        640        687   1.07344       687         0    0.00000 (zstd !)
+       51       4        3       50    prev        366        594        629   1.05892       629         0    0.00000 (zstd no-bigendian !)
+       52       4        4       51      p1         58        640        687   1.07344       687         0    0.00000 (zstd no-bigendian !)
+       51       4        3       50    prev        367        594        630   1.06061       630         0    0.00000 (zstd bigendian !)
+       52       4        4       51      p1         58        640        688   1.07500       688         0    0.00000 (zstd bigendian !)
        53       5        1       -1    base          0          0          0   0.00000         0         0    0.00000
        54       6        1       -1    base        369        640        369   0.57656       369         0    0.00000 (no-zstd !)
-       54       6        1       -1    base        375        640        375   0.58594       375         0    0.00000 (zstd !)
+       54       6        1       -1    base        375        640        375   0.58594       375         0    0.00000 (zstd no-bigendian !)
+       54       6        1       -1    base        376        640        376   0.58750       376         0    0.00000 (zstd bigendian !)
   $ hg clone --pull source-repo --config experimental.maxdeltachainspan=2800 relax-chain --config format.generaldelta=yes
   requesting all changes
   adding changesets
@@ -362,10 +365,12 @@
        49       4        1       -1    base        205        316        205   0.64873       205         0    0.00000 (zstd !)
        50       4        2       49      p1         58        362        263   0.72652       263         0    0.00000 (zstd !)
        51       2       13       17      p1         58        594        739   1.24411      2789      2050    2.77402 (zstd !)
-       52       5        1       -1    base        375        640        375   0.58594       375         0    0.00000 (zstd !)
+       52       5        1       -1    base        375        640        375   0.58594       375         0    0.00000 (zstd no-bigendian !)
+       52       5        1       -1    base        376        640        376   0.58750       376         0    0.00000 (zstd bigendian !)
        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 (no-zstd !)
-       54       7        1       -1    base        375        640        375   0.58594       375         0    0.00000 (zstd !)
+       54       7        1       -1    base        375        640        375   0.58594       375         0    0.00000 (zstd no-bigendian !)
+       54       7        1       -1    base        376        640        376   0.58750       376         0    0.00000 (zstd bigendian !)
   $ hg clone --pull source-repo --config experimental.maxdeltachainspan=0 noconst-chain --config format.usegeneraldelta=yes --config storage.revlog.reuse-external-delta-parent=no
   requesting all changes
   adding changesets
@@ -432,4 +437,5 @@
        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 (no-zstd !)
-       54       5        1       -1    base        375        640        375   0.58594       375         0    0.00000 (zstd !)
+       54       5        1       -1    base        375        640        375   0.58594       375         0    0.00000 (zstd no-bigendian !)
+       54       5        1       -1    base        376        640        376   0.58750       376         0    0.00000 (zstd bigendian !)
--- a/tests/test-persistent-nodemap.t	Fri Feb 15 17:20:32 2019 -0500
+++ b/tests/test-persistent-nodemap.t	Tue Jan 04 14:21:22 2022 -0500
@@ -1023,7 +1023,8 @@
   adding [s] 00changelog.n (62 bytes)
   adding [s] 00changelog-*.nd (118 KB) (glob)
   adding [s] 00manifest.d (452 KB) (no-zstd !)
-  adding [s] 00manifest.d (491 KB) (zstd !)
+  adding [s] 00manifest.d (491 KB) (zstd no-bigendian !)
+  adding [s] 00manifest.d (492 KB) (zstd bigendian !)
   adding [s] 00changelog.d (360 KB) (no-zstd !)
   adding [s] 00changelog.d (368 KB) (zstd !)
   adding [s] 00manifest.i (313 KB)
@@ -1063,7 +1064,8 @@
 
   $ f --size test-repo/.hg/store/00changelog*
   test-repo/.hg/store/00changelog-*.nd: size=121088 (glob)
-  test-repo/.hg/store/00changelog.d: size=376891 (zstd !)
+  test-repo/.hg/store/00changelog.d: size=376891 (zstd no-bigendian !)
+  test-repo/.hg/store/00changelog.d: size=376889 (zstd bigendian !)
   test-repo/.hg/store/00changelog.d: size=368890 (no-zstd !)
   test-repo/.hg/store/00changelog.i: size=320384
   test-repo/.hg/store/00changelog.n: size=62
@@ -1093,7 +1095,8 @@
   adding [s] 00changelog.n (62 bytes)
   adding [s] 00changelog-*.nd (118 KB) (glob)
   adding [s] 00manifest.d (452 KB) (no-zstd !)
-  adding [s] 00manifest.d (491 KB) (zstd !)
+  adding [s] 00manifest.d (491 KB) (zstd no-bigendian !)
+  adding [s] 00manifest.d (492 KB) (zstd bigendian !)
   adding [s] 00changelog.d (360 KB) (no-zstd !)
   adding [s] 00changelog.d (368 KB) (zstd !)
   adding [s] 00manifest.i (313 KB)
@@ -1104,7 +1107,8 @@
   $ f --size stream-clone-race-1/.hg/store/00changelog*
   stream-clone-race-1/.hg/store/00changelog-*.nd: size=121088 (glob)
   stream-clone-race-1/.hg/store/00changelog.d: size=368890 (no-zstd !)
-  stream-clone-race-1/.hg/store/00changelog.d: size=376891 (zstd !)
+  stream-clone-race-1/.hg/store/00changelog.d: size=376891 (zstd no-bigendian !)
+  stream-clone-race-1/.hg/store/00changelog.d: size=376889 (zstd bigendian !)
   stream-clone-race-1/.hg/store/00changelog.i: size=320384
   stream-clone-race-1/.hg/store/00changelog.n: size=62
 
@@ -1158,7 +1162,8 @@
   test-repo/.hg/store/00changelog-*.nd: size=121344 (glob) (rust !)
   test-repo/.hg/store/00changelog-*.nd: size=121344 (glob) (pure !)
   test-repo/.hg/store/00changelog-*.nd: size=121152 (glob) (no-rust no-pure !)
-  test-repo/.hg/store/00changelog.d: size=376950 (zstd !)
+  test-repo/.hg/store/00changelog.d: size=376950 (zstd no-bigendian !)
+  test-repo/.hg/store/00changelog.d: size=376948 (zstd bigendian !)
   test-repo/.hg/store/00changelog.d: size=368949 (no-zstd !)
   test-repo/.hg/store/00changelog.i: size=320448
   test-repo/.hg/store/00changelog.n: size=62
@@ -1209,7 +1214,8 @@
   stream-clone-race-2/.hg/store/00changelog-*.nd: size=121344 (glob) (rust !)
   stream-clone-race-2/.hg/store/00changelog-*.nd: size=121344 (glob) (pure !)
   stream-clone-race-2/.hg/store/00changelog-*.nd: size=121152 (glob) (no-rust no-pure !)
-  stream-clone-race-2/.hg/store/00changelog.d: size=376950 (zstd !)
+  stream-clone-race-2/.hg/store/00changelog.d: size=376950 (zstd no-bigendian !)
+  stream-clone-race-2/.hg/store/00changelog.d: size=376948 (zstd bigendian !)
   stream-clone-race-2/.hg/store/00changelog.d: size=368949 (no-zstd !)
   stream-clone-race-2/.hg/store/00changelog.i: size=320448
   stream-clone-race-2/.hg/store/00changelog.n: size=62
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-sparse-with-safe-share.t	Tue Jan 04 14:21:22 2022 -0500
@@ -0,0 +1,23 @@
+Same with share-safe
+
+  $ echo "[format]"         >> $HGRCPATH
+  $ echo "use-share-safe = True" >> $HGRCPATH
+
+  $ cd $TESTTMP
+
+  $ hg init myrepo
+  $ cd myrepo
+  $ cat > .hg/hgrc <<EOF
+  > [extensions]
+  > sparse=
+  > EOF
+
+  $ echo a > show
+  $ echo x > hide
+  $ hg ci -Aqm 'initial'
+
+Regression test: checks that this command correctly locks the store
+before updating the store [requirements] config.
+
+  $ hg up -q 0
+  $ hg debugsparse --include 'hide'