comparison mercurial/wireprotoserver.py @ 37783:9d818539abfa

wireproto: move supportedcompengines out of wireproto This function is used by both version 1 and version 2. It belongs in a common module. "wireprototypes" may not be the best module name. I may rename it... Differential Revision: https://phab.mercurial-scm.org/D3398
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 16 Apr 2018 22:08:13 -0700
parents 77c9ee77687c
children b4d85bc122bd
comparison
equal deleted inserted replaced
37782:99accae4cc59 37783:9d818539abfa
147 147
148 # FUTURE advertise 0.2rx once support is implemented 148 # FUTURE advertise 0.2rx once support is implemented
149 # FUTURE advertise minrx and mintx after consulting config option 149 # FUTURE advertise minrx and mintx after consulting config option
150 caps.append('httpmediatype=0.1rx,0.1tx,0.2tx') 150 caps.append('httpmediatype=0.1rx,0.1tx,0.2tx')
151 151
152 compengines = wireproto.supportedcompengines(repo.ui, util.SERVERROLE) 152 compengines = wireprototypes.supportedcompengines(repo.ui,
153 util.SERVERROLE)
153 if compengines: 154 if compengines:
154 comptypes = ','.join(urlreq.quote(e.wireprotosupport().name) 155 comptypes = ','.join(urlreq.quote(e.wireprotosupport().name)
155 for e in compengines) 156 for e in compengines)
156 caps.append('compression=%s' % comptypes) 157 caps.append('compression=%s' % comptypes)
157 158
327 if prefer_uncompressed: 328 if prefer_uncompressed:
328 return HGTYPE2, util._noopengine(), {} 329 return HGTYPE2, util._noopengine(), {}
329 330
330 # Now find an agreed upon compression format. 331 # Now find an agreed upon compression format.
331 compformats = wireproto.clientcompressionsupport(proto) 332 compformats = wireproto.clientcompressionsupport(proto)
332 for engine in wireproto.supportedcompengines(ui, util.SERVERROLE): 333 for engine in wireprototypes.supportedcompengines(ui, util.SERVERROLE):
333 if engine.wireprotosupport().name in compformats: 334 if engine.wireprotosupport().name in compformats:
334 opts = {} 335 opts = {}
335 level = ui.configint('server', '%slevel' % engine.name()) 336 level = ui.configint('server', '%slevel' % engine.name())
336 if level is not None: 337 if level is not None:
337 opts['level'] = level 338 opts['level'] = level