changeset 38726:d79f3afb079e

curses: use "text" interface if TERM=dumb Differential Revision: https://phab.mercurial-scm.org/D3948
author Kyle Lippincott <spectral@google.com>
date Mon, 16 Jul 2018 11:38:56 -0700
parents c382c19ce9bd
children fcb517ff9562
files mercurial/ui.py tests/test-commit-interactive-curses.t
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Mon Jul 16 00:32:33 2018 -0400
+++ b/mercurial/ui.py	Mon Jul 16 11:38:56 2018 -0700
@@ -1214,7 +1214,7 @@
                 "Feature %s does not handle all default interfaces" %
                 feature)
 
-        if self.plain():
+        if self.plain() or encoding.environ.get('TERM') == 'dumb':
             return "text"
 
         # Default interface for all the features
--- a/tests/test-commit-interactive-curses.t	Mon Jul 16 00:32:33 2018 -0400
+++ b/tests/test-commit-interactive-curses.t	Mon Jul 16 11:38:56 2018 -0700
@@ -368,6 +368,16 @@
   $ chunkselectorinterface
   curses
 
+If TERM=dumb, we use text, even if the config says curses
+  $ chunkselectorinterface
+  curses
+  $ TERM=dumb chunkselectorinterface
+  text
+(Something is keeping TERM=dumb in the environment unless I do this, it's not
+scoped to just that previous command like in many shells)
+  $ TERM=xterm chunkselectorinterface
+  curses
+
 It is possible to override the default interface with a feature specific
 interface
   $ cp $HGRCPATH.pretest $HGRCPATH