Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 37084:f0b6fbea00cf
stringutil: bulk-replace call sites to point to new module
This might conflict with other patches floating around, sorry.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 22 Mar 2018 21:56:20 +0900 |
parents | 98487ad0cf8b |
children | d4a2e0d5d042 |
comparison
equal
deleted
inserted
replaced
37083:f99d64e8a4e4 | 37084:f0b6fbea00cf |
---|---|
35 pycompat, | 35 pycompat, |
36 rcutil, | 36 rcutil, |
37 scmutil, | 37 scmutil, |
38 util, | 38 util, |
39 ) | 39 ) |
40 from .utils import dateutil | 40 from .utils import ( |
41 dateutil, | |
42 stringutil, | |
43 ) | |
41 | 44 |
42 urlreq = util.urlreq | 45 urlreq = util.urlreq |
43 | 46 |
44 # for use with str.translate(None, _keepalnum), to keep just alphanumerics | 47 # for use with str.translate(None, _keepalnum), to keep just alphanumerics |
45 _keepalnum = ''.join(c for c in map(pycompat.bytechr, range(256)) | 48 _keepalnum = ''.join(c for c in map(pycompat.bytechr, range(256)) |
369 cfg.read(filename, fp, sections=sections, remap=remap) | 372 cfg.read(filename, fp, sections=sections, remap=remap) |
370 fp.close() | 373 fp.close() |
371 except error.ConfigError as inst: | 374 except error.ConfigError as inst: |
372 if trusted: | 375 if trusted: |
373 raise | 376 raise |
374 self.warn(_("ignored: %s\n") % util.forcebytestr(inst)) | 377 self.warn(_("ignored: %s\n") % stringutil.forcebytestr(inst)) |
375 | 378 |
376 if self.plain(): | 379 if self.plain(): |
377 for k in ('debug', 'fallbackencoding', 'quiet', 'slash', | 380 for k in ('debug', 'fallbackencoding', 'quiet', 'slash', |
378 'logtemplate', 'statuscopies', 'style', | 381 'logtemplate', 'statuscopies', 'style', |
379 'traceback', 'verbose'): | 382 'traceback', 'verbose'): |
589 if default is _unset: | 592 if default is _unset: |
590 return False | 593 return False |
591 return default | 594 return default |
592 if isinstance(v, bool): | 595 if isinstance(v, bool): |
593 return v | 596 return v |
594 b = util.parsebool(v) | 597 b = stringutil.parsebool(v) |
595 if b is None: | 598 if b is None: |
596 raise error.ConfigError(_("%s.%s is not a boolean ('%s')") | 599 raise error.ConfigError(_("%s.%s is not a boolean ('%s')") |
597 % (section, name, v)) | 600 % (section, name, v)) |
598 return b | 601 return b |
599 | 602 |
819 return user | 822 return user |
820 | 823 |
821 def shortuser(self, user): | 824 def shortuser(self, user): |
822 """Return a short representation of a user name or email address.""" | 825 """Return a short representation of a user name or email address.""" |
823 if not self.verbose: | 826 if not self.verbose: |
824 user = util.shortuser(user) | 827 user = stringutil.shortuser(user) |
825 return user | 828 return user |
826 | 829 |
827 def expandpath(self, loc, default=None): | 830 def expandpath(self, loc, default=None): |
828 """Return repository location relative to cwd or from [paths]""" | 831 """Return repository location relative to cwd or from [paths]""" |
829 try: | 832 try: |