comparison hgext3rd/topic/discovery.py @ 6919:6859ed744625 mercurial-5.1

test-compat: merge mercurial-5.2 into mercurial-5.1
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 25 Oct 2024 17:55:54 +0400
parents 7ec9f4b04519
children 361dcfcb3f08
comparison
equal deleted inserted replaced
6814:c203bc3114bb 6919:6859ed744625
4 import contextlib 4 import contextlib
5 import weakref 5 import weakref
6 6
7 from mercurial.i18n import _ 7 from mercurial.i18n import _
8 from mercurial import ( 8 from mercurial import (
9 branchmap,
10 bundle2, 9 bundle2,
11 discovery, 10 discovery,
12 encoding, 11 encoding,
13 exchange, 12 exchange,
14 extensions, 13 extensions,
21 from mercurial.wireprotov1peer import wirepeer 20 from mercurial.wireprotov1peer import wirepeer
22 from . import ( 21 from . import (
23 common, 22 common,
24 compat, 23 compat,
25 ) 24 )
25
26 try:
27 from mercurial.branching.rev_cache import revbranchcache
28 except ImportError:
29 # hg <= 6.8 (f0e07efc199f)
30 from mercurial.branchmap import revbranchcache
26 31
27 urlreq = util.urlreq 32 urlreq = util.urlreq
28 33
29 @contextlib.contextmanager 34 @contextlib.contextmanager
30 def override_context_branch(repo, publishedset=()): 35 def override_context_branch(repo, publishedset=()):
389 wireprotov1server.commands.pop(b'branchmap') 394 wireprotov1server.commands.pop(b'branchmap')
390 wireprotov1server.wireprotocommand(b'branchmap', permission=b'pull')(wireprotov1server.branchmap) 395 wireprotov1server.wireprotocommand(b'branchmap', permission=b'pull')(wireprotov1server.branchmap)
391 extensions.wrapfunction(wireprotov1server, '_capabilities', wireprotocaps) 396 extensions.wrapfunction(wireprotov1server, '_capabilities', wireprotocaps)
392 wirepeer.branchmaptns = wirepeer.branchmap 397 wirepeer.branchmaptns = wirepeer.branchmap
393 wireprotov1server.wireprotocommand(b'branchmaptns', permission=b'pull')(wireprotobranchmaptns) 398 wireprotov1server.wireprotocommand(b'branchmaptns', permission=b'pull')(wireprotobranchmaptns)
394 extensions.wrapfunction(branchmap.revbranchcache, 'branchinfo', wrapbranchinfo) 399 extensions.wrapfunction(revbranchcache, 'branchinfo', wrapbranchinfo)
395 # branchinfo method can get replaced by _branchinfo method directly when 400 # branchinfo method can get replaced by _branchinfo method directly when
396 # on-disk revbranchcache is not available, see revbranchcache.__init__() 401 # on-disk revbranchcache is not available, see revbranchcache.__init__()
397 extensions.wrapfunction(branchmap.revbranchcache, '_branchinfo', wrapslowbranchinfo) 402 extensions.wrapfunction(revbranchcache, '_branchinfo', wrapslowbranchinfo)
398 # we need a proper wrap b2 part stuff 403 # we need a proper wrap b2 part stuff
399 extensions.wrapfunction(bundle2, 'handlecheckheads', handlecheckheads) 404 extensions.wrapfunction(bundle2, 'handlecheckheads', handlecheckheads)
400 bundle2.handlecheckheads.params = frozenset() 405 bundle2.handlecheckheads.params = frozenset()
401 bundle2.parthandlermapping[b'check:heads'] = bundle2.handlecheckheads 406 bundle2.parthandlermapping[b'check:heads'] = bundle2.handlecheckheads
402 if util.safehasattr(bundle2, 'handlecheckupdatedheads'): 407 if util.safehasattr(bundle2, 'handlecheckupdatedheads'):