# HG changeset patch # User Yuya Nishihara # Date 2020-10-23 11:10:17 # Node ID 14ac6a74e7e749e5ca20f3ea8eb89460478ff9f6 # Parent 067707e026b406f68f95802f858de82d28976d70 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. diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1659,7 +1659,9 @@ class ui(object): if not r: r = default if self.configbool(b'ui', b'promptecho'): - self._writemsg(self._fmsgout, r, b"\n", type=b'promptecho') + self._writemsg( + self._fmsgout, r or b'', b"\n", type=b'promptecho' + ) return r except EOFError: raise error.ResponseExpected()