Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 45758:14ac6a74e7e7 stable
ui: fix echo back of ui.prompt() to not concatenate None as bytes
Spotted while writing tests for the issue6425. The default value may be
None.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 23 Oct 2020 20:10:17 +0900 |
parents | 02b17231f6c3 |
children | 330c258fe7ca 07b0a687c01a |
comparison
equal
deleted
inserted
replaced
45757:067707e026b4 | 45758:14ac6a74e7e7 |
---|---|
1657 try: | 1657 try: |
1658 r = self._readline(prompt=msg, promptopts=opts) | 1658 r = self._readline(prompt=msg, promptopts=opts) |
1659 if not r: | 1659 if not r: |
1660 r = default | 1660 r = default |
1661 if self.configbool(b'ui', b'promptecho'): | 1661 if self.configbool(b'ui', b'promptecho'): |
1662 self._writemsg(self._fmsgout, r, b"\n", type=b'promptecho') | 1662 self._writemsg( |
1663 self._fmsgout, r or b'', b"\n", type=b'promptecho' | |
1664 ) | |
1663 return r | 1665 return r |
1664 except EOFError: | 1666 except EOFError: |
1665 raise error.ResponseExpected() | 1667 raise error.ResponseExpected() |
1666 | 1668 |
1667 @staticmethod | 1669 @staticmethod |