15 from . import ( |
15 from . import ( |
16 common, |
16 common, |
17 compat, |
17 compat, |
18 ) |
18 ) |
19 |
19 |
20 # hg <= 4.5 (b4d85bc122bd) |
20 from mercurial import wireprotov1server |
21 try: |
|
22 from mercurial import wireproto # pytype: disable=import-error |
|
23 wireproto.branchmap |
|
24 except (AttributeError, ImportError): |
|
25 from mercurial import wireprotov1server as wireproto |
|
26 |
21 |
27 def _headssummary(orig, pushop, *args, **kwargs): |
22 def _headssummary(orig, pushop, *args, **kwargs): |
28 # In mercurial > 4.3, we receive the pushop as arguments |
23 # In mercurial > 4.3, we receive the pushop as arguments |
29 repo = pushop.repo.unfiltered() |
24 repo = pushop.repo.unfiltered() |
30 remote = pushop.remote |
25 remote = pushop.remote |
205 return caps |
200 return caps |
206 |
201 |
207 def modsetup(ui): |
202 def modsetup(ui): |
208 """run at uisetup time to install all destinations wrapping""" |
203 """run at uisetup time to install all destinations wrapping""" |
209 extensions.wrapfunction(discovery, '_headssummary', _headssummary) |
204 extensions.wrapfunction(discovery, '_headssummary', _headssummary) |
210 extensions.wrapfunction(wireproto, 'branchmap', wireprotobranchmap) |
205 extensions.wrapfunction(wireprotov1server, 'branchmap', wireprotobranchmap) |
211 extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps) |
206 extensions.wrapfunction(wireprotov1server, '_capabilities', wireprotocaps) |
212 # we need a proper wrap b2 part stuff |
207 # we need a proper wrap b2 part stuff |
213 extensions.wrapfunction(bundle2, 'handlecheckheads', handlecheckheads) |
208 extensions.wrapfunction(bundle2, 'handlecheckheads', handlecheckheads) |
214 bundle2.handlecheckheads.params = frozenset() |
209 bundle2.handlecheckheads.params = frozenset() |
215 bundle2.parthandlermapping[b'check:heads'] = bundle2.handlecheckheads |
210 bundle2.parthandlermapping[b'check:heads'] = bundle2.handlecheckheads |
216 if util.safehasattr(bundle2, 'handlecheckupdatedheads'): |
211 if util.safehasattr(bundle2, 'handlecheckupdatedheads'): |