[PATCH] ui: remove any combinations of CR|LF from prompt response
Yuya Nishihara
yuya at tcha.org
Sat Mar 10 07:52:00 UTC 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1520664609 -32400
# Sat Mar 10 15:50:09 2018 +0900
# Node ID c38b2b364df79a9defc3520f19207ce47abcc7d8
# Parent 9ddc9aa26801bac571bd3413a8aed900c2d2efb8
ui: remove any combinations of CR|LF from prompt response
On Windows, we have to accept both CR+LF and LF. This patch simply makes
any trailing CRs and LFs removed from a user input instead of doing stricter
parsing, as an input must be a readable text.
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1296,8 +1296,7 @@ class ui(object):
line = self.fin.readline()
if not line:
raise EOFError
- if line.endswith(pycompat.oslinesep):
- line = line[:-len(pycompat.oslinesep)]
+ line = line.rstrip(pycompat.oslinesep)
return line
More information about the Mercurial-devel
mailing list