changeset 6850:6d22e9a596c4

topic: compatibility for revbranchcache being in a separate module now The newer revbranchcache defaults to v2, so the name of the cache file is different. Let's glob and hide it, since its actual contents look the same (at least for the moment).
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 28 Sep 2024 16:09:03 +0400
parents 9638dd0fb4ea
children d892efaa3615
files hgext3rd/topic/discovery.py tests/test-topic-issue6841.t
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/discovery.py	Mon Sep 09 16:51:00 2024 +0400
+++ b/hgext3rd/topic/discovery.py	Sat Sep 28 16:09:03 2024 +0400
@@ -6,7 +6,6 @@
 
 from mercurial.i18n import _
 from mercurial import (
-    branchmap,
     bundle2,
     discovery,
     encoding,
@@ -24,6 +23,12 @@
     compat,
 )
 
+try:
+    from mercurial.branching.rev_cache import revbranchcache
+except ImportError:
+    # hg <= 6.8 (f0e07efc199f)
+    from mercurial.branchmap import revbranchcache
+
 urlreq = util.urlreq
 
 @contextlib.contextmanager
@@ -373,10 +378,10 @@
     extensions.wrapfunction(wireprotov1server, '_capabilities', wireprotocaps)
     wirepeer.branchmaptns = wirepeer.branchmap
     wireprotov1server.wireprotocommand(b'branchmaptns', permission=b'pull')(wireprotobranchmaptns)
-    extensions.wrapfunction(branchmap.revbranchcache, 'branchinfo', wrapbranchinfo)
+    extensions.wrapfunction(revbranchcache, 'branchinfo', wrapbranchinfo)
     # branchinfo method can get replaced by _branchinfo method directly when
     # on-disk revbranchcache is not available, see revbranchcache.__init__()
-    extensions.wrapfunction(branchmap.revbranchcache, '_branchinfo', wrapslowbranchinfo)
+    extensions.wrapfunction(revbranchcache, '_branchinfo', wrapslowbranchinfo)
     # we need a proper wrap b2 part stuff
     extensions.wrapfunction(bundle2, 'handlecheckheads', handlecheckheads)
     bundle2.handlecheckheads.params = frozenset()
--- a/tests/test-topic-issue6841.t	Mon Sep 09 16:51:00 2024 +0400
+++ b/tests/test-topic-issue6841.t	Sat Sep 28 16:09:03 2024 +0400
@@ -43,8 +43,7 @@
 
 on-disk caches are using bare branch names only
 
-  $ f -H .hg/cache/rbc-names-v1
-  .hg/cache/rbc-names-v1:
+  $ f -Hq .hg/cache/rbc-names-v?
   0000: 64 65 66 61 75 6c 74                            |default|
   $ grep topic-foo .hg/cache/*
   [1]