Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGd79f3afb079e: curses: use "text" interface if TERM=dumb
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/ui.py (2 lines) | |||
M | tests/test-commit-interactive-curses.t (10 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Kyle Lippincott | Jul 16 2018, 2:38 PM |
availableinterfaces = frozenset(featureinterfaces[feature]) | availableinterfaces = frozenset(featureinterfaces[feature]) | ||||
if alldefaults > availableinterfaces: | if alldefaults > availableinterfaces: | ||||
# Programming error, not user error. We need a use case to | # Programming error, not user error. We need a use case to | ||||
# define the right thing to do here. | # define the right thing to do here. | ||||
raise ValueError( | raise ValueError( | ||||
"Feature %s does not handle all default interfaces" % | "Feature %s does not handle all default interfaces" % | ||||
feature) | feature) | ||||
if self.plain(): | if self.plain() or encoding.environ.get('TERM') == 'dumb': | ||||
return "text" | return "text" | ||||
# Default interface for all the features | # Default interface for all the features | ||||
defaultinterface = "text" | defaultinterface = "text" | ||||
i = self.config("ui", "interface") | i = self.config("ui", "interface") | ||||
if i in alldefaults: | if i in alldefaults: | ||||
defaultinterface = i | defaultinterface = i | ||||
$ cp $HGRCPATH.pretest $HGRCPATH | $ cp $HGRCPATH.pretest $HGRCPATH | ||||
$ cat <<EOF >> $HGRCPATH | $ cat <<EOF >> $HGRCPATH | ||||
> [ui] | > [ui] | ||||
> interface = curses | > interface = curses | ||||
> EOF | > EOF | ||||
$ chunkselectorinterface | $ chunkselectorinterface | ||||
curses | 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 | It is possible to override the default interface with a feature specific | ||||
interface | interface | ||||
$ cp $HGRCPATH.pretest $HGRCPATH | $ cp $HGRCPATH.pretest $HGRCPATH | ||||
$ cat <<EOF >> $HGRCPATH | $ cat <<EOF >> $HGRCPATH | ||||
> [ui] | > [ui] | ||||
> interface = text | > interface = text | ||||
> interface.chunkselector = curses | > interface.chunkselector = curses | ||||
> EOF | > EOF |