Show More
@@ -24,12 +24,37 b'' | |||
|
24 | 24 | # |
|
25 | 25 | # [pager] |
|
26 | 26 | # quiet = True |
|
27 | # | |
|
28 | # You can disable the pager for certain commands by adding them to the | |
|
29 | # pager.ignore list: | |
|
30 | # | |
|
31 | # [pager] | |
|
32 | # ignore = version, help, update | |
|
33 | # | |
|
34 | # You can also enable the pager only for certain commands using pager.attend: | |
|
35 | # | |
|
36 | # [pager] | |
|
37 | # attend = log | |
|
38 | # | |
|
39 | # If pager.attend is present, pager.ignore will be ignored. | |
|
40 | # | |
|
41 | # To ignore global commands like 'hg version' or 'hg help', you have to specify them | |
|
42 | # in the global .hgrc | |
|
27 | 43 | |
|
28 | 44 | import sys, os, signal |
|
45 | from mercurial import dispatch | |
|
29 | 46 | |
|
30 | 47 | def uisetup(ui): |
|
31 | p = ui.config("pager", "pager", os.environ.get("PAGER")) | |
|
32 | if p and sys.stdout.isatty(): | |
|
33 | if ui.configbool('pager', 'quiet'): | |
|
34 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) | |
|
35 | sys.stderr = sys.stdout = os.popen(p, "wb") | |
|
48 | def pagecmd(ui, options, cmd, cmdfunc): | |
|
49 | p = ui.config("pager", "pager", os.environ.get("PAGER")) | |
|
50 | if p and sys.stdout.isatty(): | |
|
51 | attend = ui.configlist('pager', 'attend') | |
|
52 | if (cmd in attend or | |
|
53 | (cmd not in ui.configlist('pager', 'ignore') and not attend)): | |
|
54 | sys.stderr = sys.stdout = os.popen(p, "wb") | |
|
55 | if ui.configbool('pager', 'quiet'): | |
|
56 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) | |
|
57 | return oldrun(ui, options, cmd, cmdfunc) | |
|
58 | ||
|
59 | oldrun = dispatch._runcommand | |
|
60 | dispatch._runcommand = pagecmd |
General Comments 0
You need to be logged in to leave comments.
Login now