Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG73d0a3dd7e53: stringutil: teach pprint how to format None
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/utils/stringutil.py (2 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
return '{%s}' % (b', '.join( | return '{%s}' % (b', '.join( | ||||
'%s: %s' % (pprint(k), pprint(v)) for k, v in sorted(o.items()))) | '%s: %s' % (pprint(k), pprint(v)) for k, v in sorted(o.items()))) | ||||
elif isinstance(o, bool): | elif isinstance(o, bool): | ||||
return b'True' if o else b'False' | return b'True' if o else b'False' | ||||
elif isinstance(o, int): | elif isinstance(o, int): | ||||
return '%d' % o | return '%d' % o | ||||
elif isinstance(o, float): | elif isinstance(o, float): | ||||
return '%f' % o | return '%f' % o | ||||
elif o is None: | |||||
return b'None' | |||||
else: | else: | ||||
raise error.ProgrammingError('do not know how to format %r' % o) | raise error.ProgrammingError('do not know how to format %r' % o) | ||||
def binary(s): | def binary(s): | ||||
"""return true if a string is binary data""" | """return true if a string is binary data""" | ||||
return bool(s and '\0' in s) | return bool(s and '\0' in s) | ||||
def stringmatcher(pattern, casesensitive=True): | def stringmatcher(pattern, casesensitive=True): |