py3: make sure we return strings from __str__ and __repr__
On Python 3:
>>> class abc:
... def __repr__(self):
... return b'abc'
...
>>> abc()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __repr__ returned non-string (type bytes)
>>> class abc:
... def __str__(self):
... return b'abc'
...
>>> str(abc())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __str__ returned non-string (type bytes)
So the __str__ and __repr__ must return strings.
py3: replace None with -1 to sort an integer array
In Python 2:
>>> ls = [4, 2, None]
>>> sorted(ls)
[None, 2, 4]
In Python 3:
>>> ls = [4, 2, None]
>>> sorted(ls)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: NoneType() < int()
Therefore we replaced None with -1, and the safe part is that, None and -1 are
only the keys which are used for sorting so we don't need to convert the -1's
back to None.
py3: pass str in os.sysconf()
os.sysconf() doesn't accepts bytes on Python 3. Adding r'' will make
sure b'' is not added here.
context: move dirty() to committablectx
This is a pedantic move. It should be an error if dirty() is called on a
read-only context. Based on Mads Kiilerix's and my work at the sprint.
committablectx: extra is already normalized by committablectx.__init__
Avoid doing the same work again. Based on work done by Mads Kiilerix.
help: clarify the choice of pager
This follows the change made in
d83e51654c8a to use environment variables
between system and user configuration.