# HG changeset patch # User Matt Mackall # Date 1206029555 18000 # Node ID 41c77bb8d7f309a6b0ea6194b9c1618a4f86eff0 # Parent ee1077b41d5cc45a27595c847f3743e5e902fe2a pager: remove pager code from core diff -r ee1077b41d5c -r 41c77bb8d7f3 doc/hgrc.5.txt --- a/doc/hgrc.5.txt Thu Mar 20 11:12:35 2008 -0500 +++ b/doc/hgrc.5.txt Thu Mar 20 11:12:35 2008 -0500 @@ -535,12 +535,6 @@ Print debugging information. True or False. Default is False. editor;; The editor to use during a commit. Default is $EDITOR or "vi". - pager;; - The pager that is used when displaying long output. - Default is $PAGER. If not set, the output is written to the - stdandard output. - usepager;; - If set to true, the system pager is used. True or False. Default is False. fallbackencoding;; Encoding to try if it's not possible to decode the changelog using UTF-8. Default is ISO-8859-1. diff -r ee1077b41d5c -r 41c77bb8d7f3 mercurial/ui.py --- a/mercurial/ui.py Thu Mar 20 11:12:35 2008 -0500 +++ b/mercurial/ui.py Thu Mar 20 11:12:35 2008 -0500 @@ -31,7 +31,6 @@ parentui=None): self.overlay = None self.buffers = [] - self.pager = None if parentui is None: # this is the parent of all ui children self.parentui = None @@ -66,15 +65,6 @@ def __getattr__(self, key): return getattr(self.parentui, key) - def __del__(self): - if self.pager: - try: - self.pager.close() - except IOException: - # we might get into an broken pipe if the users quit - # the pager before we finished io - pass - def isatty(self): if ui._isatty is None: ui._isatty = sys.stdin.isatty() @@ -381,14 +371,9 @@ return "".join(self.buffers.pop()) def write(self, *args): - """Write to a pager if available, otherwise to stdout""" if self.buffers: self.buffers[-1].extend([str(a) for a in args]) else: - if self.getpager() and not self.pager: - self.pager = os.popen(self.getpager(), "wb") - sys.stderr = self.pager - sys.stdout = self.pager for a in args: sys.stdout.write(str(a)) @@ -493,9 +478,3 @@ self.config("ui", "editor") or os.environ.get("VISUAL") or os.environ.get("EDITOR", "vi")) - - def getpager(self): - '''return a pager''' - if sys.stdout.isatty() and self.configbool("ui", "usepager", False): - return (self.config("ui", "pager") - or os.environ.get("PAGER"))