Show More
@@ -535,12 +535,6 b' ui::' | |||||
535 | Print debugging information. True or False. Default is False. |
|
535 | Print debugging information. True or False. Default is False. | |
536 | editor;; |
|
536 | editor;; | |
537 | The editor to use during a commit. Default is $EDITOR or "vi". |
|
537 | The editor to use during a commit. Default is $EDITOR or "vi". | |
538 | pager;; |
|
|||
539 | The pager that is used when displaying long output. |
|
|||
540 | Default is $PAGER. If not set, the output is written to the |
|
|||
541 | stdandard output. |
|
|||
542 | usepager;; |
|
|||
543 | If set to true, the system pager is used. True or False. Default is False. |
|
|||
544 | fallbackencoding;; |
|
538 | fallbackencoding;; | |
545 | Encoding to try if it's not possible to decode the changelog using |
|
539 | Encoding to try if it's not possible to decode the changelog using | |
546 | UTF-8. Default is ISO-8859-1. |
|
540 | UTF-8. Default is ISO-8859-1. |
@@ -31,7 +31,6 b' class ui(object):' | |||||
31 | parentui=None): |
|
31 | parentui=None): | |
32 | self.overlay = None |
|
32 | self.overlay = None | |
33 | self.buffers = [] |
|
33 | self.buffers = [] | |
34 | self.pager = None |
|
|||
35 | if parentui is None: |
|
34 | if parentui is None: | |
36 | # this is the parent of all ui children |
|
35 | # this is the parent of all ui children | |
37 | self.parentui = None |
|
36 | self.parentui = None | |
@@ -66,15 +65,6 b' class ui(object):' | |||||
66 | def __getattr__(self, key): |
|
65 | def __getattr__(self, key): | |
67 | return getattr(self.parentui, key) |
|
66 | return getattr(self.parentui, key) | |
68 |
|
67 | |||
69 | def __del__(self): |
|
|||
70 | if self.pager: |
|
|||
71 | try: |
|
|||
72 | self.pager.close() |
|
|||
73 | except IOException: |
|
|||
74 | # we might get into an broken pipe if the users quit |
|
|||
75 | # the pager before we finished io |
|
|||
76 | pass |
|
|||
77 |
|
||||
78 | def isatty(self): |
|
68 | def isatty(self): | |
79 | if ui._isatty is None: |
|
69 | if ui._isatty is None: | |
80 | ui._isatty = sys.stdin.isatty() |
|
70 | ui._isatty = sys.stdin.isatty() | |
@@ -381,14 +371,9 b' class ui(object):' | |||||
381 | return "".join(self.buffers.pop()) |
|
371 | return "".join(self.buffers.pop()) | |
382 |
|
372 | |||
383 | def write(self, *args): |
|
373 | def write(self, *args): | |
384 | """Write to a pager if available, otherwise to stdout""" |
|
|||
385 | if self.buffers: |
|
374 | if self.buffers: | |
386 | self.buffers[-1].extend([str(a) for a in args]) |
|
375 | self.buffers[-1].extend([str(a) for a in args]) | |
387 | else: |
|
376 | else: | |
388 | if self.getpager() and not self.pager: |
|
|||
389 | self.pager = os.popen(self.getpager(), "wb") |
|
|||
390 | sys.stderr = self.pager |
|
|||
391 | sys.stdout = self.pager |
|
|||
392 | for a in args: |
|
377 | for a in args: | |
393 | sys.stdout.write(str(a)) |
|
378 | sys.stdout.write(str(a)) | |
394 |
|
379 | |||
@@ -493,9 +478,3 b' class ui(object):' | |||||
493 | self.config("ui", "editor") or |
|
478 | self.config("ui", "editor") or | |
494 | os.environ.get("VISUAL") or |
|
479 | os.environ.get("VISUAL") or | |
495 | os.environ.get("EDITOR", "vi")) |
|
480 | os.environ.get("EDITOR", "vi")) | |
496 |
|
||||
497 | def getpager(self): |
|
|||
498 | '''return a pager''' |
|
|||
499 | if sys.stdout.isatty() and self.configbool("ui", "usepager", False): |
|
|||
500 | return (self.config("ui", "pager") |
|
|||
501 | or os.environ.get("PAGER")) |
|
General Comments 0
You need to be logged in to leave comments.
Login now