##// END OF EJS Templates
ui: fix crash by non-interactive prompt echo for user name...
Yuya Nishihara -
r28039:89003c49 stable
parent child Browse files
Show More
@@ -798,7 +798,7 b' class ui(object):'
798 If ui is not interactive, the default is returned.
798 If ui is not interactive, the default is returned.
799 """
799 """
800 if not self.interactive():
800 if not self.interactive():
801 self.write(msg, ' ', default, "\n")
801 self.write(msg, ' ', default or '', "\n")
802 return default
802 return default
803 try:
803 try:
804 r = self._readline(self.label(msg, 'ui.prompt'))
804 r = self._readline(self.label(msg, 'ui.prompt'))
@@ -66,6 +66,31 b''
66 date: Thu Jan 01 00:00:00 1970 +0000
66 date: Thu Jan 01 00:00:00 1970 +0000
67 summary: commit-1
67 summary: commit-1
68
68
69 # test prompt username
70
71 $ cat > .hg/hgrc <<EOF
72 > [ui]
73 > askusername = True
74 > EOF
75
76 $ echo 12345 > asdf
77 $ hg commit --config ui.interactive=False -m ask
78 enter a commit username:
79 no username found, using '[^']*' instead (re)
80 $ hg rollback -q
81
82 $ hg commit --config ui.interactive=True -m ask <<EOF
83 > Asked User <ask@example.com>
84 > EOF
85 enter a commit username: Asked User <ask@example.com>
86 $ hg tip
87 changeset: 5:84c91d963b70
88 tag: tip
89 user: Asked User <ask@example.com>
90 date: Thu Jan 01 00:00:00 1970 +0000
91 summary: ask
92
93
69 # test no .hg/hgrc (uses generated non-interactive username)
94 # test no .hg/hgrc (uses generated non-interactive username)
70
95
71 $ echo space > asdf
96 $ echo space > asdf
General Comments 0
You need to be logged in to leave comments. Login now