Show More
@@ -1,35 +1,35 | |||||
1 | # pager.py - display output using a pager |
|
1 | # pager.py - display output using a pager | |
2 | # |
|
2 | # | |
3 | # Copyright 2008 David Soria Parra <dsp@php.net> |
|
3 | # Copyright 2008 David Soria Parra <dsp@php.net> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
6 | # of the GNU General Public License, incorporated herein by reference. |
|
6 | # of the GNU General Public License, incorporated herein by reference. | |
7 | # |
|
7 | # | |
8 | # To load the extension, add it to your .hgrc file: |
|
8 | # To load the extension, add it to your .hgrc file: | |
9 | # |
|
9 | # | |
10 | # [extension] |
|
10 | # [extension] | |
11 | # hgext.pager = |
|
11 | # hgext.pager = | |
12 | # |
|
12 | # | |
13 | # To set the pager that should be used, set the application variable: |
|
13 | # To set the pager that should be used, set the application variable: | |
14 | # |
|
14 | # | |
15 | # [pager] |
|
15 | # [pager] | |
16 | # pager = LESS='FSRX' less |
|
16 | # pager = LESS='FSRX' less | |
17 | # |
|
17 | # | |
18 | # If no pager is set, the pager extensions uses the environment |
|
18 | # If no pager is set, the pager extensions uses the environment | |
19 | # variable $PAGER. If neither pager.pager, nor $PAGER is set, no pager |
|
19 | # variable $PAGER. If neither pager.pager, nor $PAGER is set, no pager | |
20 | # is used. |
|
20 | # is used. | |
21 | # |
|
21 | # | |
22 | # If you notice "BROKEN PIPE" error messages, you can disable them |
|
22 | # If you notice "BROKEN PIPE" error messages, you can disable them | |
23 | # by setting: |
|
23 | # by setting: | |
24 | # |
|
24 | # | |
25 | # [pager] |
|
25 | # [pager] | |
26 | # quiet = True |
|
26 | # quiet = True | |
27 |
|
27 | |||
28 | import sys, os, signal |
|
28 | import sys, os, signal | |
29 |
|
29 | |||
30 | def uisetup(ui): |
|
30 | def uisetup(ui): | |
31 | p = ui.config("pager", "pager", os.environ.get("PAGER")) |
|
31 | p = ui.config("pager", "pager", os.environ.get("PAGER")) | |
32 |
if p and sys.stdout.isatty() and not |
|
32 | if p and sys.stdout.isatty() and '--debugger' not in sys.argv: | |
33 | if ui.configbool('pager', 'quiet'): |
|
33 | if ui.configbool('pager', 'quiet'): | |
34 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) |
|
34 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) | |
35 | sys.stderr = sys.stdout = os.popen(p, "wb") |
|
35 | sys.stderr = sys.stdout = os.popen(p, "wb") |
General Comments 0
You need to be logged in to leave comments.
Login now