[PATCH] ui: add brief comment why raw_input() needs dummy ' ' prompt string

Yuya Nishihara yuya at tcha.org
Sun Aug 24 04:57:41 UTC 2014


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1408851353 -32400
#      Sun Aug 24 12:35:53 2014 +0900
# Node ID 6eec2f3116ab5ab02fe3b6ed026e34df265ffdb8
# Parent  90cf454edd709c616d1e5ea4f30fb4d02f0c01a4
ui: add brief comment why raw_input() needs dummy ' ' prompt string

Retrieved from 17ffb30d9174.

I was about to move ' ' to label(msg + ' ', 'ui.prompt') so that subclass can
distinguish prompt output from data.  But it was not that simple.

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -626,6 +626,8 @@ class ui(object):
         oldout = sys.stdout
         sys.stdin = self.fin
         sys.stdout = self.fout
+        # prompt ' ' must exist; otherwise readline may delete entire line
+        # - http://bugs.python.org/issue12833
         line = raw_input(' ')
         sys.stdin = oldin
         sys.stdout = oldout



More information about the Mercurial-devel mailing list