[Updated] D11766: sparse: demonstrate a bug when used with safe-share

aalekseyev (Arseniy Alekseyev) phabricator at mercurial-scm.org
Fri Nov 26 18:58:04 UTC 2021


aalekseyev updated this revision to Diff 31168.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11766?vs=31086&id=31168

BRANCH
  stable

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11766/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11766

AFFECTED FILES
  mercurial/sparse.py
  tests/test-sparse-with-safe-share.t

CHANGE DETAILS

diff --git a/tests/test-sparse-with-safe-share.t b/tests/test-sparse-with-safe-share.t
new file mode 100644
--- /dev/null
+++ b/tests/test-sparse-with-safe-share.t
@@ -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'
diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -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'



To: aalekseyev, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211126/28afba98/attachment-0002.html>


More information about the Mercurial-patches mailing list