comparison mercurial/chgserver.py @ 31690:2d11d278279a

ui: defer setting pager related properties until the pager has spawned When --pager=on is given, dispatch.py spawns a pager before setting up color. If the pager failed to launch, ui.pageractive was left set to True, so color configured itself based on 'color.pagermode'. A typical MSYS setting would be 'color.mode=auto, color.pagermode=ansi'. In the failure case, this would print a warning, disable the pager, and then print the raw ANSI codes to the terminal. Care needs to be taken, because it appears that leaving ui.pageractive=True was the only thing that prevented an attempt at running the pager again from inside the command. This results in a double warning message, so pager is simply disabled on failure. The ui config settings didn't need to be moved to fix this, but it seemed like the right thing to do for consistency.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 25 Mar 2017 21:12:00 -0400
parents 82b3ec04b652
children d73490957d61
comparison
equal deleted inserted replaced
31689:57a22f699179 31690:2d11d278279a
191 return self._csystem(cmd, util.shellenviron(environ), cwd) 191 return self._csystem(cmd, util.shellenviron(environ), cwd)
192 192
193 def _runpager(self, cmd): 193 def _runpager(self, cmd):
194 self._csystem(cmd, util.shellenviron(), type='pager', 194 self._csystem(cmd, util.shellenviron(), type='pager',
195 cmdtable={'attachio': attachio}) 195 cmdtable={'attachio': attachio})
196 return True
196 197
197 return chgui(srcui) 198 return chgui(srcui)
198 199
199 def _loadnewui(srcui, args): 200 def _loadnewui(srcui, args):
200 from . import dispatch # avoid cycle 201 from . import dispatch # avoid cycle