pager: remove pager code from core
authorMatt Mackall <mpm@selenic.com>
Thu, 20 Mar 2008 11:12:35 -0500
changeset 6325 41c77bb8d7f3
parent 6324 ee1077b41d5c
child 6326 af3f26b6bba4
pager: remove pager code from core
doc/hgrc.5.txt
mercurial/ui.py
--- 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.
--- 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"))