Mercurial > hg
annotate tests/test-pager.t @ 34107:4f60720cf0df
blackbox: fix rotation with chg
The added test will show:
$ $PYTHON showsize.py .hg/blackbox*
.hg/blackbox.log: < 500
.hg/blackbox.log.1: < 500
.hg/blackbox.log.2: < 500
.hg/blackbox.log.3: < 500
.hg/blackbox.log.4: < 500
.hg/blackbox.log.5: >= 500
with previous code.
The issue is caused by blackbox caching file objects *by path*, and the
rotation size check could run on a wrong file object (i.e. it should check
"blackbox.log", but `filehandles["blackbox.log"]` contains a file object
that has been renamed to "blackbox.log.5").
This patch removes the "filehandlers" global cache added by 45313f5a3a8c to
solve the issue.
I think the original patch was trying to make different ui objects use a same
file object if their blackbox.log path is the same. In theory it could also
be problematic in the rotation case. Anyway, that should become unnecessary
after D650.
Differential Revision: https://phab.mercurial-scm.org/D648
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 06 Sep 2017 19:27:30 -0700 |
parents | 31a2eb0f74e5 |
children | 73d8a5283f87 |
rev | line source |
---|---|
28319 | 1 $ cat >> fakepager.py <<EOF |
2 > import sys | |
32541
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
3 > printed = False |
28319 | 4 > for line in sys.stdin: |
5 > sys.stdout.write('paged! %r\n' % line) | |
32541
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
6 > printed = True |
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
7 > if not printed: |
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
8 > sys.stdout.write('paged empty output!\n') |
28319 | 9 > EOF |
10 | |
11 Enable ui.formatted because pager won't fire without it, and set up | |
12 pager and tell it to use our fake pager that lets us see when the | |
13 pager was running. | |
14 $ cat >> $HGRCPATH <<EOF | |
15 > [ui] | |
16 > formatted = yes | |
32026
57042e91521a
color: turn on by default (but for windows)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32025
diff
changeset
|
17 > color = no |
28319 | 18 > [pager] |
32940
75be14993fda
cleanup: use $PYTHON to run python in many more tests
Augie Fackler <augie@google.com>
parents:
32541
diff
changeset
|
19 > pager = $PYTHON $TESTTMP/fakepager.py |
28319 | 20 > EOF |
21 | |
22 $ hg init repo | |
23 $ cd repo | |
24 $ echo a >> a | |
25 $ hg add a | |
26 $ hg ci -m 'add a' | |
32940
75be14993fda
cleanup: use $PYTHON to run python in many more tests
Augie Fackler <augie@google.com>
parents:
32541
diff
changeset
|
27 $ for x in `$PYTHON $TESTDIR/seq.py 1 10`; do |
28319 | 28 > echo a $x >> a |
29 > hg ci -m "modify a $x" | |
30 > done | |
31 | |
30944
b7e073ae44c4
tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents:
30942
diff
changeset
|
32 By default diff and log are paged, but id is not: |
28319 | 33 |
34 $ hg diff -c 2 --pager=yes | |
35 paged! 'diff -r f4be7687d414 -r bce265549556 a\n' | |
36 paged! '--- a/a\tThu Jan 01 00:00:00 1970 +0000\n' | |
37 paged! '+++ b/a\tThu Jan 01 00:00:00 1970 +0000\n' | |
38 paged! '@@ -1,2 +1,3 @@\n' | |
39 paged! ' a\n' | |
40 paged! ' a 1\n' | |
41 paged! '+a 2\n' | |
42 | |
43 $ hg log --limit 2 | |
44 paged! 'changeset: 10:46106edeeb38\n' | |
45 paged! 'tag: tip\n' | |
46 paged! 'user: test\n' | |
47 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' | |
48 paged! 'summary: modify a 10\n' | |
49 paged! '\n' | |
50 paged! 'changeset: 9:6dd8ea7dd621\n' | |
51 paged! 'user: test\n' | |
52 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' | |
53 paged! 'summary: modify a 9\n' | |
54 paged! '\n' | |
55 | |
30944
b7e073ae44c4
tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents:
30942
diff
changeset
|
56 $ hg id |
b7e073ae44c4
tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents:
30942
diff
changeset
|
57 46106edeeb38 tip |
28319 | 58 |
32098
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
59 We can control the pager from the config |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
60 |
32104
f06d23af6cdf
pager: rename 'pager.enable' to 'ui.paginate'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32103
diff
changeset
|
61 $ hg log --limit 1 --config 'ui.paginate=False' |
32098
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
62 changeset: 10:46106edeeb38 |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
63 tag: tip |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
64 user: test |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
65 date: Thu Jan 01 00:00:00 1970 +0000 |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
66 summary: modify a 10 |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
67 |
32104
f06d23af6cdf
pager: rename 'pager.enable' to 'ui.paginate'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32103
diff
changeset
|
68 $ hg log --limit 1 --config 'ui.paginate=0' |
32098
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
69 changeset: 10:46106edeeb38 |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
70 tag: tip |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
71 user: test |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
72 date: Thu Jan 01 00:00:00 1970 +0000 |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
73 summary: modify a 10 |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
74 |
32104
f06d23af6cdf
pager: rename 'pager.enable' to 'ui.paginate'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32103
diff
changeset
|
75 $ hg log --limit 1 --config 'ui.paginate=1' |
32098
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
76 paged! 'changeset: 10:46106edeeb38\n' |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
77 paged! 'tag: tip\n' |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
78 paged! 'user: test\n' |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
79 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
80 paged! 'summary: modify a 10\n' |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
81 paged! '\n' |
149440d7e1a7
pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32074
diff
changeset
|
82 |
33620
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
83 explicit --pager=on should take precedence over other configurations |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
84 (issue5580) |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
85 |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
86 $ cat >> $HGRCPATH <<EOF |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
87 > [ui] |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
88 > paginate = false |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
89 > EOF |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
90 $ hg log --limit 1 --pager=on |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
91 paged! 'changeset: 10:46106edeeb38\n' |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
92 paged! 'tag: tip\n' |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
93 paged! 'user: test\n' |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
94 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
95 paged! 'summary: modify a 10\n' |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
96 paged! '\n' |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
97 |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
98 $ cat >> $HGRCPATH <<EOF |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
99 > [ui] |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
100 > # true is default value of ui.paginate |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
101 > paginate = true |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
102 > EOF |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
103 $ hg log --limit 1 --pager=off |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
104 changeset: 10:46106edeeb38 |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
105 tag: tip |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
106 user: test |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
107 date: Thu Jan 01 00:00:00 1970 +0000 |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
108 summary: modify a 10 |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
109 |
cc047a733f69
ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33097
diff
changeset
|
110 |
30944
b7e073ae44c4
tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents:
30942
diff
changeset
|
111 We can enable the pager on id: |
28319 | 112 |
31405
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
113 BROKEN: should be paged |
30944
b7e073ae44c4
tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents:
30942
diff
changeset
|
114 $ hg --config pager.attend-id=yes id |
31405
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
115 46106edeeb38 tip |
28319 | 116 |
30996
cc3c9b6f1e09
tests: clean up a bunch of pager testing that is about to be invalidated
Augie Fackler <augie@google.com>
parents:
30944
diff
changeset
|
117 Setting attend-$COMMAND to a false value works, even with pager in |
cc3c9b6f1e09
tests: clean up a bunch of pager testing that is about to be invalidated
Augie Fackler <augie@google.com>
parents:
30944
diff
changeset
|
118 core: |
28319 | 119 $ hg --config pager.attend-diff=no diff -c 2 |
120 diff -r f4be7687d414 -r bce265549556 a | |
121 --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
122 +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
123 @@ -1,2 +1,3 @@ | |
124 a | |
125 a 1 | |
126 +a 2 | |
127 | |
32072
05cdd5678c6b
tests: drop unnecessary pager attend in test
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32026
diff
changeset
|
128 Command aliases should have same behavior as main command |
05cdd5678c6b
tests: drop unnecessary pager attend in test
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32026
diff
changeset
|
129 |
05cdd5678c6b
tests: drop unnecessary pager attend in test
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32026
diff
changeset
|
130 $ hg history --limit 2 |
28319 | 131 paged! 'changeset: 10:46106edeeb38\n' |
132 paged! 'tag: tip\n' | |
133 paged! 'user: test\n' | |
134 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' | |
135 paged! 'summary: modify a 10\n' | |
136 paged! '\n' | |
137 paged! 'changeset: 9:6dd8ea7dd621\n' | |
138 paged! 'user: test\n' | |
139 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' | |
140 paged! 'summary: modify a 9\n' | |
141 paged! '\n' | |
142 | |
32073
04629b2da72c
tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32072
diff
changeset
|
143 Abbreviated command alias should also be paged |
04629b2da72c
tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32072
diff
changeset
|
144 |
04629b2da72c
tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32072
diff
changeset
|
145 $ hg hist -l 1 |
04629b2da72c
tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32072
diff
changeset
|
146 paged! 'changeset: 10:46106edeeb38\n' |
04629b2da72c
tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32072
diff
changeset
|
147 paged! 'tag: tip\n' |
04629b2da72c
tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32072
diff
changeset
|
148 paged! 'user: test\n' |
04629b2da72c
tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32072
diff
changeset
|
149 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
04629b2da72c
tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32072
diff
changeset
|
150 paged! 'summary: modify a 10\n' |
04629b2da72c
tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32072
diff
changeset
|
151 paged! '\n' |
04629b2da72c
tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32072
diff
changeset
|
152 |
32074
769c831708c7
tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32073
diff
changeset
|
153 Attend for an abbreviated command does not work |
769c831708c7
tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32073
diff
changeset
|
154 |
769c831708c7
tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32073
diff
changeset
|
155 $ hg --config pager.attend-ident=true ident |
769c831708c7
tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32073
diff
changeset
|
156 46106edeeb38 tip |
769c831708c7
tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32073
diff
changeset
|
157 |
769c831708c7
tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32073
diff
changeset
|
158 $ hg --config extensions.pager= --config pager.attend-ident=true ident |
769c831708c7
tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32073
diff
changeset
|
159 46106edeeb38 tip |
769c831708c7
tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32073
diff
changeset
|
160 |
30847
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
29344
diff
changeset
|
161 Pager should not start if stdout is not a tty. |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
29344
diff
changeset
|
162 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
29344
diff
changeset
|
163 $ hg log -l1 -q --config ui.formatted=False |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
29344
diff
changeset
|
164 10:46106edeeb38 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
29344
diff
changeset
|
165 |
31079
873ebdd6e84d
pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents:
31000
diff
changeset
|
166 Pager should be disabled if pager.pager is empty (otherwise the output would |
873ebdd6e84d
pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents:
31000
diff
changeset
|
167 be silently lost.) |
873ebdd6e84d
pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents:
31000
diff
changeset
|
168 |
873ebdd6e84d
pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents:
31000
diff
changeset
|
169 $ hg log -l1 -q --config pager.pager= |
873ebdd6e84d
pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents:
31000
diff
changeset
|
170 10:46106edeeb38 |
873ebdd6e84d
pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents:
31000
diff
changeset
|
171 |
28531
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
172 Pager with color enabled allows colors to come through by default, |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
173 even though stdout is no longer a tty. |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
174 $ cat >> $HGRCPATH <<EOF |
32025
d323d9e0d7b4
pager: stop using the color extension in tests
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31954
diff
changeset
|
175 > [ui] |
32103
9a98023ac8db
color: special case 'always' in 'ui.color'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32102
diff
changeset
|
176 > color = always |
28531
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
177 > [color] |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
178 > mode = ansi |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
179 > EOF |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
180 $ hg log --limit 3 |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
181 paged! '\x1b[0;33mchangeset: 10:46106edeeb38\x1b[0m\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
182 paged! 'tag: tip\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
183 paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
184 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
185 paged! 'summary: modify a 10\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
186 paged! '\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
187 paged! '\x1b[0;33mchangeset: 9:6dd8ea7dd621\x1b[0m\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
188 paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
189 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
190 paged! 'summary: modify a 9\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
191 paged! '\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
192 paged! '\x1b[0;33mchangeset: 8:cff05a6312fe\x1b[0m\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
193 paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
194 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
195 paged! 'summary: modify a 8\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
196 paged! '\n' |
29132
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
197 |
31478
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
198 An invalid pager command name is reported sensibly if we don't have to |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
199 use shell=True in the subprocess call: |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
200 $ hg log --limit 3 --config pager.pager=this-command-better-never-exist |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
201 missing pager command 'this-command-better-never-exist', skipping pager |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
202 \x1b[0;33mchangeset: 10:46106edeeb38\x1b[0m (esc) |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
203 tag: tip |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
204 user: test |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
205 date: Thu Jan 01 00:00:00 1970 +0000 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
206 summary: modify a 10 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
207 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
208 \x1b[0;33mchangeset: 9:6dd8ea7dd621\x1b[0m (esc) |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
209 user: test |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
210 date: Thu Jan 01 00:00:00 1970 +0000 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
211 summary: modify a 9 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
212 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
213 \x1b[0;33mchangeset: 8:cff05a6312fe\x1b[0m (esc) |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
214 user: test |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
215 date: Thu Jan 01 00:00:00 1970 +0000 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
216 summary: modify a 8 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
217 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
218 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
219 A complicated pager command gets worse behavior. Bonus points if you can |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
220 improve this. |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
221 $ hg log --limit 3 \ |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
222 > --config pager.pager='this-command-better-never-exist --seriously' \ |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
223 > 2>/dev/null || true |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
224 |
29132
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
225 Pager works with shell aliases. |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
226 |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
227 $ cat >> $HGRCPATH <<EOF |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
228 > [alias] |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
229 > echoa = !echo a |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
230 > EOF |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
231 |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
232 $ hg echoa |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
233 a |
31405
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
234 BROKEN: should be paged |
29132
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
235 $ hg --config pager.attend-echoa=yes echoa |
31405
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
236 a |
29343
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
237 |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
238 Pager works with hg aliases including environment variables. |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
239 |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
240 $ cat >> $HGRCPATH <<'EOF' |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
241 > [alias] |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
242 > printa = log -T "$A\n" -r 0 |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
243 > EOF |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
244 |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
245 $ A=1 hg --config pager.attend-printa=yes printa |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
246 paged! '1\n' |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
247 $ A=2 hg --config pager.attend-printa=yes printa |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
248 paged! '2\n' |
29344 | 249 |
30942
65a3b4d67a65
pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents:
30847
diff
changeset
|
250 Something that's explicitly attended is still not paginated if the |
65a3b4d67a65
pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents:
30847
diff
changeset
|
251 pager is globally set to off using a flag: |
65a3b4d67a65
pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents:
30847
diff
changeset
|
252 $ A=2 hg --config pager.attend-printa=yes printa --pager=no |
65a3b4d67a65
pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents:
30847
diff
changeset
|
253 2 |
65a3b4d67a65
pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents:
30847
diff
changeset
|
254 |
29344 | 255 Pager should not override the exit code of other commands |
256 | |
257 $ cat >> $TESTTMP/fortytwo.py <<'EOF' | |
32337
46ba2cdda476
registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents:
32104
diff
changeset
|
258 > from mercurial import commands, registrar |
29344 | 259 > cmdtable = {} |
32337
46ba2cdda476
registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents:
32104
diff
changeset
|
260 > command = registrar.command(cmdtable) |
33097
fce4ed2912bb
py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents:
32940
diff
changeset
|
261 > @command(b'fortytwo', [], 'fortytwo', norepo=True) |
29344 | 262 > def fortytwo(ui, *opts): |
263 > ui.write('42\n') | |
264 > return 42 | |
265 > EOF | |
266 | |
267 $ cat >> $HGRCPATH <<'EOF' | |
268 > [extensions] | |
269 > fortytwo = $TESTTMP/fortytwo.py | |
270 > EOF | |
271 | |
272 $ hg fortytwo --pager=on | |
273 paged! '42\n' | |
274 [42] | |
30999
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
275 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
276 A command that asks for paging using ui.pager() directly works: |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
277 $ hg blame a |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
278 paged! ' 0: a\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
279 paged! ' 1: a 1\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
280 paged! ' 2: a 2\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
281 paged! ' 3: a 3\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
282 paged! ' 4: a 4\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
283 paged! ' 5: a 5\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
284 paged! ' 6: a 6\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
285 paged! ' 7: a 7\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
286 paged! ' 8: a 8\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
287 paged! ' 9: a 9\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
288 paged! '10: a 10\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
289 but not with HGPLAIN |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
290 $ HGPLAIN=1 hg blame a |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
291 0: a |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
292 1: a 1 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
293 2: a 2 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
294 3: a 3 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
295 4: a 4 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
296 5: a 5 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
297 6: a 6 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
298 7: a 7 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
299 8: a 8 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
300 9: a 9 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
301 10: a 10 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
302 explicit flags work too: |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
303 $ hg blame --pager=no a |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
304 0: a |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
305 1: a 1 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
306 2: a 2 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
307 3: a 3 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
308 4: a 4 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
309 5: a 5 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
310 6: a 6 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
311 7: a 7 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
312 8: a 8 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
313 9: a 9 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
314 10: a 10 |
31000
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
315 |
32541
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
316 A command with --output option: |
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
317 |
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
318 $ hg cat -r0 a |
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
319 paged! 'a\n' |
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
320 $ hg cat -r0 a --output=- |
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
321 paged! 'a\n' |
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
322 $ hg cat -r0 a --output=out |
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
323 $ rm out |
3b569745af6c
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents:
32337
diff
changeset
|
324 |
31000
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
325 Put annotate in the ignore list for pager: |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
326 $ cat >> $HGRCPATH <<EOF |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
327 > [pager] |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
328 > ignore = annotate |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
329 > EOF |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
330 $ hg blame a |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
331 0: a |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
332 1: a 1 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
333 2: a 2 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
334 3: a 3 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
335 4: a 4 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
336 5: a 5 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
337 6: a 6 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
338 7: a 7 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
339 8: a 8 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
340 9: a 9 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
341 10: a 10 |
31954
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
342 |
34021
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
343 During pushbuffer, pager should not start: |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
344 $ cat > $TESTTMP/pushbufferpager.py <<EOF |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
345 > def uisetup(ui): |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
346 > ui.pushbuffer() |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
347 > ui.pager('mycmd') |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
348 > ui.write('content\n') |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
349 > ui.write(ui.popbuffer()) |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
350 > EOF |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
351 |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
352 $ echo append >> a |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
353 $ hg --config extensions.pushbuffer=$TESTTMP/pushbufferpager.py status --color=off |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
354 content |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
355 paged! 'M a\n' |
31a2eb0f74e5
pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents:
33971
diff
changeset
|
356 |
31954
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
357 Environment variables like LESS and LV are set automatically: |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
358 $ cat > $TESTTMP/printlesslv.py <<EOF |
33971
dcfa83652744
tests: update test-pager to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33620
diff
changeset
|
359 > from __future__ import absolute_import |
dcfa83652744
tests: update test-pager to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33620
diff
changeset
|
360 > import os |
dcfa83652744
tests: update test-pager to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33620
diff
changeset
|
361 > import sys |
31954
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
362 > sys.stdin.read() |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
363 > for name in ['LESS', 'LV']: |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
364 > sys.stdout.write(('%s=%s\n') % (name, os.environ.get(name, '-'))) |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
365 > sys.stdout.flush() |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
366 > EOF |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
367 |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
368 $ cat >> $HGRCPATH <<EOF |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
369 > [alias] |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
370 > noop = log -r 0 -T '' |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
371 > [ui] |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
372 > formatted=1 |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
373 > [pager] |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
374 > pager = $PYTHON $TESTTMP/printlesslv.py |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
375 > EOF |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
376 $ unset LESS |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
377 $ unset LV |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
378 $ hg noop --pager=on |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
379 LESS=FRX |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
380 LV=-c |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
381 $ LESS=EFGH hg noop --pager=on |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
382 LESS=EFGH |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
383 LV=-c |