Show More
@@ -6,7 +6,7 b'' | |||||
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from i18n import _ |
|
8 | from i18n import _ | |
9 |
import errno, getpass, os |
|
9 | import errno, getpass, os, socket, sys, tempfile, traceback | |
10 | import config, scmutil, util, error, formatter |
|
10 | import config, scmutil, util, error, formatter | |
11 |
|
11 | |||
12 | class ui(object): |
|
12 | class ui(object): | |
@@ -284,22 +284,16 b' class ui(object):' | |||||
284 | ConfigError: foo.invalid is not a byte quantity ('somevalue') |
|
284 | ConfigError: foo.invalid is not a byte quantity ('somevalue') | |
285 | """ |
|
285 | """ | |
286 |
|
286 | |||
287 |
|
|
287 | value = self.config(section, name) | |
288 |
if |
|
288 | if value is None: | |
289 | if not isinstance(default, str): |
|
289 | if not isinstance(default, str): | |
290 | return default |
|
290 | return default | |
291 |
|
|
291 | value = default | |
292 | multiple = 1 |
|
|||
293 | m = re.match(r'([^kmbg]+?)\s*([kmg]?)b?$', string, re.I) |
|
|||
294 | if m: |
|
|||
295 | string, key = m.groups() |
|
|||
296 | key = key.lower() |
|
|||
297 | multiple = dict(k=1024, m=1048576, g=1073741824).get(key, 1) |
|
|||
298 | try: |
|
292 | try: | |
299 |
return int( |
|
293 | return util.sizetoint(value) | |
300 |
except |
|
294 | except error.ParseError: | |
301 | raise error.ConfigError(_("%s.%s is not a byte quantity ('%s')") |
|
295 | raise error.ConfigError(_("%s.%s is not a byte quantity ('%s')") | |
302 |
% (section, name, |
|
296 | % (section, name, value)) | |
303 |
|
297 | |||
304 | def configlist(self, section, name, default=None, untrusted=False): |
|
298 | def configlist(self, section, name, default=None, untrusted=False): | |
305 | """parse a configuration element as a list of comma/space separated |
|
299 | """parse a configuration element as a list of comma/space separated |
General Comments 0
You need to be logged in to leave comments.
Login now