diff hgext3rd/topic/discovery.py @ 6910:038df334d51a mercurial-6.0

test-compat: merge mercurial-6.1 into mercurial-6.0
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 25 Oct 2024 15:50:15 +0400
parents 7ec9f4b04519
children 361dcfcb3f08
line wrap: on
line diff
--- a/hgext3rd/topic/discovery.py	Wed Jun 26 15:39:36 2024 +0400
+++ b/hgext3rd/topic/discovery.py	Fri Oct 25 15:50:15 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
@@ -391,10 +396,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()