Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/wireprototypes.py @ 42041:3e47d1ec9da5
util: extract compression code in `mercurial.utils.compression`
The code seems large enough to be worth extracting. This is similar to what was
done for various module in `mercurial/utils/`.
Since None of the compression logic takes a `ui` objet, issuing deprecation
warning is tricky. Luckly the logic does not seems to have many external users.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 27 Mar 2019 16:45:14 +0100 |
parents | 440f5b65be57 |
children | c767e655ffda |
comparison
equal
deleted
inserted
replaced
42040:02fa567f8a3c | 42041:3e47d1ec9da5 |
---|---|
16 from . import ( | 16 from . import ( |
17 error, | 17 error, |
18 util, | 18 util, |
19 ) | 19 ) |
20 from .utils import ( | 20 from .utils import ( |
21 compression, | |
21 interfaceutil, | 22 interfaceutil, |
22 ) | 23 ) |
23 | 24 |
24 # Names of the SSH protocol implementations. | 25 # Names of the SSH protocol implementations. |
25 SSHV1 = 'ssh-v1' | 26 SSHV1 = 'ssh-v1' |
314 | 315 |
315 return True | 316 return True |
316 | 317 |
317 def supportedcompengines(ui, role): | 318 def supportedcompengines(ui, role): |
318 """Obtain the list of supported compression engines for a request.""" | 319 """Obtain the list of supported compression engines for a request.""" |
319 assert role in (util.CLIENTROLE, util.SERVERROLE) | 320 assert role in (compression.CLIENTROLE, compression.SERVERROLE) |
320 | 321 |
321 compengines = util.compengines.supportedwireengines(role) | 322 compengines = compression.compengines.supportedwireengines(role) |
322 | 323 |
323 # Allow config to override default list and ordering. | 324 # Allow config to override default list and ordering. |
324 if role == util.SERVERROLE: | 325 if role == compression.SERVERROLE: |
325 configengines = ui.configlist('server', 'compressionengines') | 326 configengines = ui.configlist('server', 'compressionengines') |
326 config = 'server.compressionengines' | 327 config = 'server.compressionengines' |
327 else: | 328 else: |
328 # This is currently implemented mainly to facilitate testing. In most | 329 # This is currently implemented mainly to facilitate testing. In most |
329 # cases, the server should be in charge of choosing a compression engine | 330 # cases, the server should be in charge of choosing a compression engine |