changeset 6347:82a0f49e01b3 mercurial-5.8

test-compat: merge mercurial-5.9 into mercurial-5.8
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 08 Dec 2022 19:49:09 +0400
parents a159b6195fe3 (diff) 9befdde455e7 (current diff)
children 71e2408b77d0 75e11a0b9558
files
diffstat 15 files changed, 237 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Jul 12 18:15:00 2022 +0400
+++ b/.hgtags	Thu Dec 08 19:49:09 2022 +0400
@@ -100,3 +100,4 @@
 64bb9c4a13d388233d4d6d9b761ece9c6ce77fb3 10.4.1
 0d53a8d4170b32d03e4fd8582b32fe2790d5e34f 10.5.0
 62f31db544594837a71cb91a7c1e8e515c5a52e9 10.5.1
+7a7da643a6e302f524e3c96c084e16db371dea90 10.5.2
--- a/CHANGELOG	Tue Jul 12 18:15:00 2022 +0400
+++ b/CHANGELOG	Thu Dec 08 19:49:09 2022 +0400
@@ -1,7 +1,26 @@
 Changelog
 =========
 
-10.5.2 - in progress
+10.5.3 -- 2022-12-09
+--------------------
+
+  * compatibility with Mercurial 6.3
+
+  * evolve: make obs-hash-range cache and stable-range cache (that both use
+    SQLite databases) slightly more tolerant to FS issues (issue6246)
+  * evolve: adapt to Python 3.11 BC breakage with `random.sample()`
+
+topic (0.24.2)
+
+  * compatibility with Mercurial 6.3
+
+  * topic: invalidate the topic cache when branchcache is invalidated, to fix
+    an issue in TortoiseHg where stale topic labels appear in certain cases
+
+  * next: properly handle cases when user selects an aspiring child, making
+    sure that the destination is evolved when needed
+
+10.5.2 -- 2022-07-13
 --------------------
 
   * compatibility with Mercurial 6.2
--- a/debian/changelog	Tue Jul 12 18:15:00 2022 +0400
+++ b/debian/changelog	Thu Dec 08 19:49:09 2022 +0400
@@ -1,8 +1,14 @@
+mercurial-evolve (10.5.3-1) unstable; urgency=medium
+
+  * new upstream release
+
+ -- Anton Shestakov <av6@dwimlabs.net>  Fri, 09 Dec 2022 18:58:03 +0400
+
 mercurial-evolve (10.5.2-1) unstable; urgency=medium
 
   * new upstream release
 
- -- Anton Shestakov <av6@dwimlabs.net>  Tue, 12 Jul 2022 16:41:35 +0400
+ -- Anton Shestakov <av6@dwimlabs.net>  Wed, 13 Jul 2022 16:00:25 +0400
 
 mercurial-evolve (10.5.1-1) unstable; urgency=medium
 
--- a/hgext3rd/evolve/__init__.py	Tue Jul 12 18:15:00 2022 +0400
+++ b/hgext3rd/evolve/__init__.py	Thu Dec 08 19:49:09 2022 +0400
@@ -929,6 +929,8 @@
                 ui.warn(_(b"explicitly update to one of them\n"))
                 return 1
             else:
+                if selectedrev in aspchildren:
+                    return _nextevolve(ui, repo, selectedrev, opts)
                 return _updatetonext(ui, repo, repo[selectedrev], display, opts)
         else:
             if not opts['evolve'] or not aspchildren:
--- a/hgext3rd/evolve/metadata.py	Tue Jul 12 18:15:00 2022 +0400
+++ b/hgext3rd/evolve/metadata.py	Thu Dec 08 19:49:09 2022 +0400
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-__version__ = b'10.5.2'
-testedwith = b'4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2'
+__version__ = b'10.5.3'
+testedwith = b'4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3'
 minimumhgversion = b'4.8'
 buglink = b'https://bz.mercurial-scm.org/'
--- a/hgext3rd/evolve/obsdiscovery.py	Tue Jul 12 18:15:00 2022 +0400
+++ b/hgext3rd/evolve/obsdiscovery.py	Thu Dec 08 19:49:09 2022 +0400
@@ -485,6 +485,7 @@
         if self._con is None:
             self._cachekey = self.emptykey
             self._ondiskcachekey = self.emptykey
+            repo.ui.debug(b'obshashrange cache: unable to load, regenerating\n')
         assert self._cachekey is not None
 
     def _db(self):
@@ -494,8 +495,11 @@
             return None
         if self._createmode is not None:
             pre_existed = os.access(self._path, os.R_OK)
-        con = sqlite3.connect(encoding.strfromlocal(self._path), timeout=30,
-                              isolation_level=r"IMMEDIATE")
+        try:
+            con = sqlite3.connect(encoding.strfromlocal(self._path),
+                                  timeout=30, isolation_level=r"IMMEDIATE")
+        except sqlite3.OperationalError:
+            return None
         con.text_factory = bytes
         if self._createmode is not None and not pre_existed:
             try:
--- a/hgext3rd/evolve/stablerangecache.py	Tue Jul 12 18:15:00 2022 +0400
+++ b/hgext3rd/evolve/stablerangecache.py	Thu Dec 08 19:49:09 2022 +0400
@@ -200,7 +200,7 @@
             if len(new) < 300:
                 sample = new
             else:
-                sample = random.sample(new, 300)
+                sample = random.sample(list(new), 300)
             known.update(sample)
             query = _make_querysuperranges(sample)
             ranges = set(con.execute(query).fetchall())
@@ -246,8 +246,11 @@
             return None
         if self._createmode is not None:
             pre_existed = os.access(self._path, os.R_OK)
-        con = sqlite3.connect(encoding.strfromlocal(self._path), timeout=30,
-                              isolation_level=r"IMMEDIATE")
+        try:
+            con = sqlite3.connect(encoding.strfromlocal(self._path),
+                                  timeout=30, isolation_level=r"IMMEDIATE")
+        except sqlite3.OperationalError:
+            return None
         con.text_factory = bytes
         if self._createmode is not None and not pre_existed:
             try:
@@ -398,6 +401,8 @@
 
         if self._con is not None:
             self._cachekey = (self._ondisktiprev, self._ondisktipnode)
+        else:
+            repo.ui.debug(b'stable-range cache: unable to load, regenerating\n')
         self._ondiskkey = self._cachekey
 
     def save(self, repo):
--- a/hgext3rd/topic/__init__.py	Tue Jul 12 18:15:00 2022 +0400
+++ b/hgext3rd/topic/__init__.py	Thu Dec 08 19:49:09 2022 +0400
@@ -231,9 +231,9 @@
               b'log.topic': b'green_background',
               }
 
-__version__ = b'0.24.1'
+__version__ = b'0.24.2'
 
-testedwith = b'4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2'
+testedwith = b'4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3'
 minimumhgversion = b'4.8'
 buglink = b'https://bz.mercurial-scm.org/'
 
@@ -541,13 +541,17 @@
                                                       start=start,
                                                       closed=closed)
 
+        def invalidatecaches(self):
+            self._topiccache.clear()
+            super(topicrepo, self).invalidatecaches()
+
         def invalidatevolatilesets(self):
             # XXX we might be able to move this to something invalidated less often
             super(topicrepo, self).invalidatevolatilesets()
             self._topics = None
 
-        def peer(self):
-            peer = super(topicrepo, self).peer()
+        def peer(self, *args, **kwargs):
+            peer = super(topicrepo, self).peer(*args, **kwargs)
             if getattr(peer, '_repo', None) is not None: # localpeer
                 class topicpeer(peer.__class__):
                     def branchmap(self):
--- a/tests/test-check-sdist.t	Tue Jul 12 18:15:00 2022 +0400
+++ b/tests/test-check-sdist.t	Thu Dec 08 19:49:09 2022 +0400
@@ -35,7 +35,7 @@
 
   $ tar -tzf hg-evolve-*.tar.gz | sed 's|^hg-evolve-[^/]*/||' | sort > files
   $ wc -l files
-  357 files
+  359 files
   $ fgrep debian files
   tests/test-check-debian.t
   $ fgrep __init__.py files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-cmdserver.t	Thu Dec 08 19:49:09 2022 +0400
@@ -0,0 +1,116 @@
+#require no-rhg no-chg
+
+XXX-RHG this test hangs if `hg` is really `rhg`. This was hidden by the use of
+`alias hg=rhg` by run-tests.py. With such alias removed, this test is revealed
+buggy. This need to be resolved sooner than later.
+
+XXX-CHG this test hangs if `hg` is really `chg`. This was hidden by the use of
+`alias hg=chg` by run-tests.py. With such alias removed, this test is revealed
+buggy. This need to be resolved sooner than later.
+
+  $ . "$TESTDIR/testlib/topic_setup.sh"
+
+#if windows
+  $ PYTHONPATH="$RUNTESTDIR/../contrib;$PYTHONPATH"
+#else
+  $ PYTHONPATH="$RUNTESTDIR/../contrib:$PYTHONPATH"
+#endif
+  $ export PYTHONPATH
+
+typical client does not want echo-back messages, so test without it:
+
+  $ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new
+  $ mv $HGRCPATH.new $HGRCPATH
+
+  $ hg init repo
+  $ cd repo
+
+  $ touch a
+  $ hg ci -Am 'a'
+  adding a
+  $ touch b
+  $ hg ci -Am 'b'
+  adding b
+  $ touch c
+  $ hg ci -Am 'c'
+  adding c
+  $ touch d
+  $ hg ci -Am 'd'
+  adding d
+
+Ensure that topics are not left around for stale revisions.
+
+  >>> from hgclient import check, readchannel, runcommand
+  >>> @check
+  ... def checkruncommand(server):
+  ...     # hello block
+  ...     readchannel(server)
+  ... 
+  ...     # Initial case
+  ...     runcommand(server, [b'log', b'-T', b'{rev} {desc} ({topic})\n'])
+  ... 
+  ...     # first topic
+  ...     runcommand(server, [b'topic', b'topic1', b'-r', b'.'])
+  ... 
+  ...     # Current state
+  ...     runcommand(server, [b'log', b'-T', b'{rev} {desc} ({topic})\n'])
+  ... 
+  ...     # status quo ante
+  ...     runcommand(server, [b'rollback', b'--config', b'ui.rollback=True'])
+  ... 
+  ...     # Current state
+  ...     runcommand(server, [b'log', b'-T', b'{rev} {desc} ({topic})\n'])
+  ... 
+  ...     # second topic
+  ...     runcommand(server, [b'topic', b'topic2', b'-r', b'(.^^)::'])
+  ... 
+  ...     # Current state
+  ...     runcommand(server, [b'log', b'-T', b'{rev} {desc} ({topic})\n'])
+  ... 
+  ...     # status quo ante
+  ...     runcommand(server, [b'rollback', b'--config', b'ui.rollback=True'])
+  ... 
+  ...     # Current state
+  ...     runcommand(server, [b'log', b'-T', b'{rev} {desc} ({topic})\n'])
+  *** runcommand log -T {rev} {desc} ({topic})
+  
+  3 d ()
+  2 c ()
+  1 b ()
+  0 a ()
+  *** runcommand topic topic1 -r .
+  switching to topic topic1
+  changed topic on 1 changesets to "topic1"
+  *** runcommand log -T {rev} {desc} ({topic})
+  
+  4 d (topic1)
+  2 c ()
+  1 b ()
+  0 a ()
+  *** runcommand rollback --config ui.rollback=True
+  repository tip rolled back to revision 3 (undo rewrite-topics)
+  working directory now based on revision 3
+  *** runcommand log -T {rev} {desc} ({topic})
+  
+  3 d ()
+  2 c ()
+  1 b ()
+  0 a ()
+  *** runcommand topic topic2 -r (.^^)::
+  switching to topic topic2
+  changed topic on 3 changesets to "topic2"
+  *** runcommand log -T {rev} {desc} ({topic})
+  
+  6 d (topic2)
+  5 c (topic2)
+  4 b (topic2)
+  0 a ()
+  *** runcommand rollback --config ui.rollback=True
+  repository tip rolled back to revision 3 (undo rewrite-topics)
+  working directory now based on revision 3
+  *** runcommand log -T {rev} {desc} ({topic})
+  
+  3 d ()
+  2 c ()
+  1 b ()
+  0 a ()
--- a/tests/test-discovery-obshashrange-cache.t	Tue Jul 12 18:15:00 2022 +0400
+++ b/tests/test-discovery-obshashrange-cache.t	Thu Dec 08 19:49:09 2022 +0400
@@ -156,6 +156,21 @@
   no changes found
   [1]
 
+suddenly cache is inaccessible, check that the push still succeeds (issue6246)
+
+  $ chmod 0000 server/.hg/cache/*.sqlite
+
+  $ hg -R main push ssh://user@dummy/server
+  pushing to ssh://user@dummy/server
+  searching for changes
+  OBSEXC: computing relevant nodes
+  OBSEXC: looking for common markers in 8 nodes
+  OBSEXC: markers already in sync
+  no changes found
+  [1]
+
+  $ chmod 0644 server/.hg/cache/*.sqlite
+
 client cache is warm
 
   $ f -s main/.hg/cache/evoext*
--- a/tests/test-discovery-obshashrange.t	Tue Jul 12 18:15:00 2022 +0400
+++ b/tests/test-discovery-obshashrange.t	Thu Dec 08 19:49:09 2022 +0400
@@ -198,6 +198,8 @@
   received listkey for "namespaces": 40 bytes
   OBSEXC: computing relevant nodes
   OBSEXC: looking for common markers in 6 nodes
+  stable-range cache: unable to load, regenerating
+  obshashrange cache: unable to load, regenerating
   query 0; add more sample (target 100, current 1)
   query 0; sample size is 9, largest range 5
   sending evoext_obshashrange_v1 command
@@ -321,8 +323,10 @@
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> preparing listkeys for "namespaces" (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> sending listkeys command (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> received listkey for "namespaces": 40 bytes (glob)
+  * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> stable-range cache: unable to load, regenerating (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> updated evo-ext-depthcache in *.???? seconds (6r) (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> updated evo-ext-stablerange-mergepoint in *.???? seconds (6r) (glob)
+  * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> obshashrange cache: unable to load, regenerating (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> updated evo-ext-obshashrange in *.???? seconds (6r, 4o) (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> query 0; add more sample (target 100, current 1) (glob)
   * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> query 0; sample size is 9, largest range 5 (glob)
@@ -1112,6 +1116,8 @@
   $ ls -1 .hg/cache/ | grep evoext
   [1]
   $ hg debugupdatecache --debug
+  stable-range cache: unable to load, regenerating
+  obshashrange cache: unable to load, regenerating
   updating the branch cache
   $ f -s .hg/cache/evoext*
   .hg/cache/evoext-depthcache-00: size=96
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-issue6246.t	Thu Dec 08 19:49:09 2022 +0400
@@ -0,0 +1,32 @@
+Failure to open evoext_stablerange_v2.sqlite shouldn't affect operations (issue6246)
+https://bz.mercurial-scm.org/show_bug.cgi?id=6246
+
+  $ . $TESTDIR/testlib/common.sh
+
+  $ cat << EOF >> $HGRCPATH
+  > [extensions]
+  > evolve =
+  > EOF
+
+  $ hg init issue6246
+  $ cd issue6246
+  $ hg debugbuilddag '.+6'
+
+making a cache file that sqlite cannot open shouldn't break stablerange cache
+
+  $ touch .hg/cache/evoext_stablerange_v2.sqlite
+  $ chmod 0000 .hg/cache/evoext_stablerange_v2.sqlite
+
+  $ hg debugstablerange --method default --verify --subranges --rev 1 --debug
+  stable-range cache: unable to load, regenerating
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+
+  $ hg debugobshashrange --rev tip --debug
+  stable-range cache: unable to load, regenerating
+           rev         node        index         size        depth      obshash
+  obshashrange cache: unable to load, regenerating
+             6 f69452c5b1af            0            7            7 000000000000
+
+  $ cd ..
--- a/tests/test-prev-next.t	Tue Jul 12 18:15:00 2022 +0400
+++ b/tests/test-prev-next.t	Thu Dec 08 19:49:09 2022 +0400
@@ -259,7 +259,17 @@
   o  0:a154386e50d1 added a
   
 
-  $ hg evolve -r 5 --update
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [6] added b (3)
+  $ hg next --evolve <<EOF
+  > 2
+  > EOF
+  ambiguous next changeset, choose one to update:
+  1: [5ce67c2407b0] added c
+  2: [9df671ccd2c7] added d
+  q: quit the prompt
+  enter the index of the revision you want to select: 2
   move:[5] added d
   atop:[6] added b (3)
   working directory is now at 47ea25be8aea
--- a/tests/test-pullbundle.t	Tue Jul 12 18:15:00 2022 +0400
+++ b/tests/test-pullbundle.t	Thu Dec 08 19:49:09 2022 +0400
@@ -186,6 +186,8 @@
   bundle2-input: end of bundle2 stream
   bundle2-input-bundle: 7 parts total
   checking for updated bookmarks
+  stable-range cache: unable to load, regenerating
+  obshashrange cache: unable to load, regenerating
   updating the branch cache
   added 1235 changesets with 0 changes to 0 files
   new changesets 1ea73414a91b:f864bc82f6a2