##// END OF EJS Templates
pager: account for flakiness in Windows output...
Raphaël Gomès -
r48610:570cbb3d stable draft
parent child Browse files
Show More
@@ -1,438 +1,438 b''
1 $ cat >> fakepager.py <<EOF
1 $ cat >> fakepager.py <<EOF
2 > import sys
2 > import sys
3 > printed = False
3 > printed = False
4 > for line in sys.stdin:
4 > for line in sys.stdin:
5 > sys.stdout.write('paged! %r\n' % line)
5 > sys.stdout.write('paged! %r\n' % line)
6 > printed = True
6 > printed = True
7 > if not printed:
7 > if not printed:
8 > sys.stdout.write('paged empty output!\n')
8 > sys.stdout.write('paged empty output!\n')
9 > EOF
9 > EOF
10
10
11 Enable ui.formatted because pager won't fire without it, and set up
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
12 pager and tell it to use our fake pager that lets us see when the
13 pager was running.
13 pager was running.
14 $ cat >> $HGRCPATH <<EOF
14 $ cat >> $HGRCPATH <<EOF
15 > [ui]
15 > [ui]
16 > formatted = yes
16 > formatted = yes
17 > color = no
17 > color = no
18 > [pager]
18 > [pager]
19 > pager = "$PYTHON" $TESTTMP/fakepager.py
19 > pager = "$PYTHON" $TESTTMP/fakepager.py
20 > EOF
20 > EOF
21
21
22 $ hg init repo
22 $ hg init repo
23 $ cd repo
23 $ cd repo
24 $ echo a >> a
24 $ echo a >> a
25 $ hg add a
25 $ hg add a
26 $ hg ci -m 'add a'
26 $ hg ci -m 'add a'
27 $ for x in `"$PYTHON" $TESTDIR/seq.py 1 10`; do
27 $ for x in `"$PYTHON" $TESTDIR/seq.py 1 10`; do
28 > echo a $x >> a
28 > echo a $x >> a
29 > hg ci -m "modify a $x"
29 > hg ci -m "modify a $x"
30 > done
30 > done
31
31
32 By default diff and log are paged, but id is not:
32 By default diff and log are paged, but id is not:
33
33
34 $ hg diff -c 2 --pager=yes
34 $ hg diff -c 2 --pager=yes
35 paged! 'diff -r f4be7687d414 -r bce265549556 a\n'
35 paged! 'diff -r f4be7687d414 -r bce265549556 a\n'
36 paged! '--- a/a\tThu Jan 01 00:00:00 1970 +0000\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'
37 paged! '+++ b/a\tThu Jan 01 00:00:00 1970 +0000\n'
38 paged! '@@ -1,2 +1,3 @@\n'
38 paged! '@@ -1,2 +1,3 @@\n'
39 paged! ' a\n'
39 paged! ' a\n'
40 paged! ' a 1\n'
40 paged! ' a 1\n'
41 paged! '+a 2\n'
41 paged! '+a 2\n'
42
42
43 $ hg log --limit 2
43 $ hg log --limit 2
44 paged! 'changeset: 10:46106edeeb38\n'
44 paged! 'changeset: 10:46106edeeb38\n'
45 paged! 'tag: tip\n'
45 paged! 'tag: tip\n'
46 paged! 'user: test\n'
46 paged! 'user: test\n'
47 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
47 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
48 paged! 'summary: modify a 10\n'
48 paged! 'summary: modify a 10\n'
49 paged! '\n'
49 paged! '\n'
50 paged! 'changeset: 9:6dd8ea7dd621\n'
50 paged! 'changeset: 9:6dd8ea7dd621\n'
51 paged! 'user: test\n'
51 paged! 'user: test\n'
52 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
52 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
53 paged! 'summary: modify a 9\n'
53 paged! 'summary: modify a 9\n'
54 paged! '\n'
54 paged! '\n'
55
55
56 $ hg id
56 $ hg id
57 46106edeeb38 tip
57 46106edeeb38 tip
58
58
59 We can control the pager from the config
59 We can control the pager from the config
60
60
61 $ hg log --limit 1 --config 'ui.paginate=False'
61 $ hg log --limit 1 --config 'ui.paginate=False'
62 changeset: 10:46106edeeb38
62 changeset: 10:46106edeeb38
63 tag: tip
63 tag: tip
64 user: test
64 user: test
65 date: Thu Jan 01 00:00:00 1970 +0000
65 date: Thu Jan 01 00:00:00 1970 +0000
66 summary: modify a 10
66 summary: modify a 10
67
67
68 $ hg log --limit 1 --config 'ui.paginate=0'
68 $ hg log --limit 1 --config 'ui.paginate=0'
69 changeset: 10:46106edeeb38
69 changeset: 10:46106edeeb38
70 tag: tip
70 tag: tip
71 user: test
71 user: test
72 date: Thu Jan 01 00:00:00 1970 +0000
72 date: Thu Jan 01 00:00:00 1970 +0000
73 summary: modify a 10
73 summary: modify a 10
74
74
75 $ hg log --limit 1 --config 'ui.paginate=1'
75 $ hg log --limit 1 --config 'ui.paginate=1'
76 paged! 'changeset: 10:46106edeeb38\n'
76 paged! 'changeset: 10:46106edeeb38\n'
77 paged! 'tag: tip\n'
77 paged! 'tag: tip\n'
78 paged! 'user: test\n'
78 paged! 'user: test\n'
79 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
79 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
80 paged! 'summary: modify a 10\n'
80 paged! 'summary: modify a 10\n'
81 paged! '\n'
81 paged! '\n'
82
82
83 explicit --pager=on should take precedence over other configurations
83 explicit --pager=on should take precedence over other configurations
84 (issue5580)
84 (issue5580)
85
85
86 $ cat >> $HGRCPATH <<EOF
86 $ cat >> $HGRCPATH <<EOF
87 > [ui]
87 > [ui]
88 > paginate = false
88 > paginate = false
89 > EOF
89 > EOF
90 $ hg log --limit 1 --pager=on
90 $ hg log --limit 1 --pager=on
91 paged! 'changeset: 10:46106edeeb38\n'
91 paged! 'changeset: 10:46106edeeb38\n'
92 paged! 'tag: tip\n'
92 paged! 'tag: tip\n'
93 paged! 'user: test\n'
93 paged! 'user: test\n'
94 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
94 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
95 paged! 'summary: modify a 10\n'
95 paged! 'summary: modify a 10\n'
96 paged! '\n'
96 paged! '\n'
97
97
98 $ cat >> $HGRCPATH <<EOF
98 $ cat >> $HGRCPATH <<EOF
99 > [ui]
99 > [ui]
100 > # true is default value of ui.paginate
100 > # true is default value of ui.paginate
101 > paginate = true
101 > paginate = true
102 > EOF
102 > EOF
103 $ hg log --limit 1 --pager=off
103 $ hg log --limit 1 --pager=off
104 changeset: 10:46106edeeb38
104 changeset: 10:46106edeeb38
105 tag: tip
105 tag: tip
106 user: test
106 user: test
107 date: Thu Jan 01 00:00:00 1970 +0000
107 date: Thu Jan 01 00:00:00 1970 +0000
108 summary: modify a 10
108 summary: modify a 10
109
109
110
110
111 We can enable the pager on id:
111 We can enable the pager on id:
112
112
113 BROKEN: should be paged
113 BROKEN: should be paged
114 $ hg --config pager.attend-id=yes id
114 $ hg --config pager.attend-id=yes id
115 46106edeeb38 tip
115 46106edeeb38 tip
116
116
117 Setting attend-$COMMAND to a false value works, even with pager in
117 Setting attend-$COMMAND to a false value works, even with pager in
118 core:
118 core:
119 $ hg --config pager.attend-diff=no diff -c 2
119 $ hg --config pager.attend-diff=no diff -c 2
120 diff -r f4be7687d414 -r bce265549556 a
120 diff -r f4be7687d414 -r bce265549556 a
121 --- a/a Thu Jan 01 00:00:00 1970 +0000
121 --- a/a Thu Jan 01 00:00:00 1970 +0000
122 +++ b/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 @@
123 @@ -1,2 +1,3 @@
124 a
124 a
125 a 1
125 a 1
126 +a 2
126 +a 2
127
127
128 Command aliases should have same behavior as main command
128 Command aliases should have same behavior as main command
129
129
130 $ hg history --limit 2
130 $ hg history --limit 2
131 paged! 'changeset: 10:46106edeeb38\n'
131 paged! 'changeset: 10:46106edeeb38\n'
132 paged! 'tag: tip\n'
132 paged! 'tag: tip\n'
133 paged! 'user: test\n'
133 paged! 'user: test\n'
134 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
134 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
135 paged! 'summary: modify a 10\n'
135 paged! 'summary: modify a 10\n'
136 paged! '\n'
136 paged! '\n'
137 paged! 'changeset: 9:6dd8ea7dd621\n'
137 paged! 'changeset: 9:6dd8ea7dd621\n'
138 paged! 'user: test\n'
138 paged! 'user: test\n'
139 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
139 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
140 paged! 'summary: modify a 9\n'
140 paged! 'summary: modify a 9\n'
141 paged! '\n'
141 paged! '\n'
142
142
143 Abbreviated command alias should also be paged
143 Abbreviated command alias should also be paged
144
144
145 $ hg hist -l 1
145 $ hg hist -l 1
146 paged! 'changeset: 10:46106edeeb38\n'
146 paged! 'changeset: 10:46106edeeb38\n'
147 paged! 'tag: tip\n'
147 paged! 'tag: tip\n'
148 paged! 'user: test\n'
148 paged! 'user: test\n'
149 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
149 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
150 paged! 'summary: modify a 10\n'
150 paged! 'summary: modify a 10\n'
151 paged! '\n'
151 paged! '\n'
152
152
153 Attend for an abbreviated command does not work
153 Attend for an abbreviated command does not work
154
154
155 $ hg --config pager.attend-ident=true ident
155 $ hg --config pager.attend-ident=true ident
156 46106edeeb38 tip
156 46106edeeb38 tip
157
157
158 $ hg --config extensions.pager= --config pager.attend-ident=true ident
158 $ hg --config extensions.pager= --config pager.attend-ident=true ident
159 46106edeeb38 tip
159 46106edeeb38 tip
160
160
161 Pager should not start if stdout is not a tty.
161 Pager should not start if stdout is not a tty.
162
162
163 $ hg log -l1 -q --config ui.formatted=False
163 $ hg log -l1 -q --config ui.formatted=False
164 10:46106edeeb38
164 10:46106edeeb38
165
165
166 Pager should be disabled if pager.pager is empty (otherwise the output would
166 Pager should be disabled if pager.pager is empty (otherwise the output would
167 be silently lost.)
167 be silently lost.)
168
168
169 $ hg log -l1 -q --config pager.pager=
169 $ hg log -l1 -q --config pager.pager=
170 10:46106edeeb38
170 10:46106edeeb38
171
171
172 Pager with color enabled allows colors to come through by default,
172 Pager with color enabled allows colors to come through by default,
173 even though stdout is no longer a tty.
173 even though stdout is no longer a tty.
174 $ cat >> $HGRCPATH <<EOF
174 $ cat >> $HGRCPATH <<EOF
175 > [ui]
175 > [ui]
176 > color = always
176 > color = always
177 > [color]
177 > [color]
178 > mode = ansi
178 > mode = ansi
179 > EOF
179 > EOF
180 $ hg log --limit 3
180 $ hg log --limit 3
181 paged! '\x1b[0;33mchangeset: 10:46106edeeb38\x1b[0m\n'
181 paged! '\x1b[0;33mchangeset: 10:46106edeeb38\x1b[0m\n'
182 paged! 'tag: tip\n'
182 paged! 'tag: tip\n'
183 paged! 'user: test\n'
183 paged! 'user: test\n'
184 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
184 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
185 paged! 'summary: modify a 10\n'
185 paged! 'summary: modify a 10\n'
186 paged! '\n'
186 paged! '\n'
187 paged! '\x1b[0;33mchangeset: 9:6dd8ea7dd621\x1b[0m\n'
187 paged! '\x1b[0;33mchangeset: 9:6dd8ea7dd621\x1b[0m\n'
188 paged! 'user: test\n'
188 paged! 'user: test\n'
189 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
189 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
190 paged! 'summary: modify a 9\n'
190 paged! 'summary: modify a 9\n'
191 paged! '\n'
191 paged! '\n'
192 paged! '\x1b[0;33mchangeset: 8:cff05a6312fe\x1b[0m\n'
192 paged! '\x1b[0;33mchangeset: 8:cff05a6312fe\x1b[0m\n'
193 paged! 'user: test\n'
193 paged! 'user: test\n'
194 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
194 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
195 paged! 'summary: modify a 8\n'
195 paged! 'summary: modify a 8\n'
196 paged! '\n'
196 paged! '\n'
197
197
198 #if no-chg
198 #if no-chg
199 An invalid pager command name is reported sensibly if we don't have to
199 An invalid pager command name is reported sensibly if we don't have to
200 use shell=True in the subprocess call:
200 use shell=True in the subprocess call:
201 $ hg log --limit 3 --config pager.pager=this-command-better-never-exist
201 $ hg log --limit 3 --config pager.pager=this-command-better-never-exist
202 missing pager command 'this-command-better-never-exist', skipping pager
202 missing pager command 'this-command-better-never-exist', skipping pager
203 \x1b[0;33mchangeset: 10:46106edeeb38\x1b[0m (esc)
203 \x1b[0;33mchangeset: 10:46106edeeb38\x1b[0m (esc)
204 tag: tip
204 tag: tip
205 user: test
205 user: test
206 date: Thu Jan 01 00:00:00 1970 +0000
206 date: Thu Jan 01 00:00:00 1970 +0000
207 summary: modify a 10
207 summary: modify a 10
208
208
209 \x1b[0;33mchangeset: 9:6dd8ea7dd621\x1b[0m (esc)
209 \x1b[0;33mchangeset: 9:6dd8ea7dd621\x1b[0m (esc)
210 user: test
210 user: test
211 date: Thu Jan 01 00:00:00 1970 +0000
211 date: Thu Jan 01 00:00:00 1970 +0000
212 summary: modify a 9
212 summary: modify a 9
213
213
214 \x1b[0;33mchangeset: 8:cff05a6312fe\x1b[0m (esc)
214 \x1b[0;33mchangeset: 8:cff05a6312fe\x1b[0m (esc)
215 user: test
215 user: test
216 date: Thu Jan 01 00:00:00 1970 +0000
216 date: Thu Jan 01 00:00:00 1970 +0000
217 summary: modify a 8
217 summary: modify a 8
218
218
219 #endif
219 #endif
220
220
221 A complicated pager command gets worse behavior. Bonus points if you can
221 A complicated pager command gets worse behavior. Bonus points if you can
222 improve this. Windows apparently does this better?
222 improve this. Windows apparently does this better, but only sometimes?
223 #if windows
223 #if windows
224 $ hg log --limit 3 \
224 $ hg log --limit 3 \
225 > --config pager.pager='this-command-better-never-exist --seriously' \
225 > --config pager.pager='this-command-better-never-exist --seriously' \
226 > 2>/dev/null || true
226 > 2>/dev/null || true
227 \x1b[0;33mchangeset: 10:46106edeeb38\x1b[0m (esc)
227 \x1b[0;33mchangeset: 10:46106edeeb38\x1b[0m (esc) (?)
228 tag: tip
228 tag: tip (?)
229 user: test
229 user: test (?)
230 date: Thu Jan 01 00:00:00 1970 +0000
230 date: Thu Jan 01 00:00:00 1970 +0000 (?)
231 summary: modify a 10
231 summary: modify a 10 (?)
232
232 (?)
233 \x1b[0;33mchangeset: 9:6dd8ea7dd621\x1b[0m (esc)
233 \x1b[0;33mchangeset: 9:6dd8ea7dd621\x1b[0m (esc) (?)
234 user: test
234 user: test (?)
235 date: Thu Jan 01 00:00:00 1970 +0000
235 date: Thu Jan 01 00:00:00 1970 +0000 (?)
236 summary: modify a 9
236 summary: modify a 9 (?)
237
237 (?)
238 \x1b[0;33mchangeset: 8:cff05a6312fe\x1b[0m (esc)
238 \x1b[0;33mchangeset: 8:cff05a6312fe\x1b[0m (esc) (?)
239 user: test
239 user: test (?)
240 date: Thu Jan 01 00:00:00 1970 +0000
240 date: Thu Jan 01 00:00:00 1970 +0000 (?)
241 summary: modify a 8
241 summary: modify a 8 (?)
242
242 (?)
243 #else
243 #else
244 $ hg log --limit 3 \
244 $ hg log --limit 3 \
245 > --config pager.pager='this-command-better-never-exist --seriously' \
245 > --config pager.pager='this-command-better-never-exist --seriously' \
246 > 2>/dev/null || true
246 > 2>/dev/null || true
247 #endif
247 #endif
248
248
249 Pager works with shell aliases.
249 Pager works with shell aliases.
250
250
251 $ cat >> $HGRCPATH <<EOF
251 $ cat >> $HGRCPATH <<EOF
252 > [alias]
252 > [alias]
253 > echoa = !echo a
253 > echoa = !echo a
254 > EOF
254 > EOF
255
255
256 $ hg echoa
256 $ hg echoa
257 a
257 a
258 BROKEN: should be paged
258 BROKEN: should be paged
259 $ hg --config pager.attend-echoa=yes echoa
259 $ hg --config pager.attend-echoa=yes echoa
260 a
260 a
261
261
262 Pager works with hg aliases including environment variables.
262 Pager works with hg aliases including environment variables.
263
263
264 $ cat >> $HGRCPATH <<'EOF'
264 $ cat >> $HGRCPATH <<'EOF'
265 > [alias]
265 > [alias]
266 > printa = log -T "$A\n" -r 0
266 > printa = log -T "$A\n" -r 0
267 > EOF
267 > EOF
268
268
269 $ A=1 hg --config pager.attend-printa=yes printa
269 $ A=1 hg --config pager.attend-printa=yes printa
270 paged! '1\n'
270 paged! '1\n'
271 $ A=2 hg --config pager.attend-printa=yes printa
271 $ A=2 hg --config pager.attend-printa=yes printa
272 paged! '2\n'
272 paged! '2\n'
273
273
274 Something that's explicitly attended is still not paginated if the
274 Something that's explicitly attended is still not paginated if the
275 pager is globally set to off using a flag:
275 pager is globally set to off using a flag:
276 $ A=2 hg --config pager.attend-printa=yes printa --pager=no
276 $ A=2 hg --config pager.attend-printa=yes printa --pager=no
277 2
277 2
278
278
279 Pager should not override the exit code of other commands
279 Pager should not override the exit code of other commands
280
280
281 $ cat >> $TESTTMP/fortytwo.py <<'EOF'
281 $ cat >> $TESTTMP/fortytwo.py <<'EOF'
282 > from mercurial import commands, registrar
282 > from mercurial import commands, registrar
283 > cmdtable = {}
283 > cmdtable = {}
284 > command = registrar.command(cmdtable)
284 > command = registrar.command(cmdtable)
285 > @command(b'fortytwo', [], b'fortytwo', norepo=True)
285 > @command(b'fortytwo', [], b'fortytwo', norepo=True)
286 > def fortytwo(ui, *opts):
286 > def fortytwo(ui, *opts):
287 > ui.write(b'42\n')
287 > ui.write(b'42\n')
288 > return 42
288 > return 42
289 > EOF
289 > EOF
290
290
291 $ cat >> $HGRCPATH <<'EOF'
291 $ cat >> $HGRCPATH <<'EOF'
292 > [extensions]
292 > [extensions]
293 > fortytwo = $TESTTMP/fortytwo.py
293 > fortytwo = $TESTTMP/fortytwo.py
294 > EOF
294 > EOF
295
295
296 $ hg fortytwo --pager=on
296 $ hg fortytwo --pager=on
297 paged! '42\n'
297 paged! '42\n'
298 [42]
298 [42]
299
299
300 A command that asks for paging using ui.pager() directly works:
300 A command that asks for paging using ui.pager() directly works:
301 $ hg blame a
301 $ hg blame a
302 paged! ' 0: a\n'
302 paged! ' 0: a\n'
303 paged! ' 1: a 1\n'
303 paged! ' 1: a 1\n'
304 paged! ' 2: a 2\n'
304 paged! ' 2: a 2\n'
305 paged! ' 3: a 3\n'
305 paged! ' 3: a 3\n'
306 paged! ' 4: a 4\n'
306 paged! ' 4: a 4\n'
307 paged! ' 5: a 5\n'
307 paged! ' 5: a 5\n'
308 paged! ' 6: a 6\n'
308 paged! ' 6: a 6\n'
309 paged! ' 7: a 7\n'
309 paged! ' 7: a 7\n'
310 paged! ' 8: a 8\n'
310 paged! ' 8: a 8\n'
311 paged! ' 9: a 9\n'
311 paged! ' 9: a 9\n'
312 paged! '10: a 10\n'
312 paged! '10: a 10\n'
313 but not with HGPLAIN
313 but not with HGPLAIN
314 $ HGPLAIN=1 hg blame a
314 $ HGPLAIN=1 hg blame a
315 0: a
315 0: a
316 1: a 1
316 1: a 1
317 2: a 2
317 2: a 2
318 3: a 3
318 3: a 3
319 4: a 4
319 4: a 4
320 5: a 5
320 5: a 5
321 6: a 6
321 6: a 6
322 7: a 7
322 7: a 7
323 8: a 8
323 8: a 8
324 9: a 9
324 9: a 9
325 10: a 10
325 10: a 10
326 explicit flags work too:
326 explicit flags work too:
327 $ hg blame --pager=no a
327 $ hg blame --pager=no a
328 0: a
328 0: a
329 1: a 1
329 1: a 1
330 2: a 2
330 2: a 2
331 3: a 3
331 3: a 3
332 4: a 4
332 4: a 4
333 5: a 5
333 5: a 5
334 6: a 6
334 6: a 6
335 7: a 7
335 7: a 7
336 8: a 8
336 8: a 8
337 9: a 9
337 9: a 9
338 10: a 10
338 10: a 10
339
339
340 A command with --output option:
340 A command with --output option:
341
341
342 $ hg cat -r0 a
342 $ hg cat -r0 a
343 paged! 'a\n'
343 paged! 'a\n'
344 $ hg cat -r0 a --output=-
344 $ hg cat -r0 a --output=-
345 paged! 'a\n'
345 paged! 'a\n'
346 $ hg cat -r0 a --output=out
346 $ hg cat -r0 a --output=out
347
347
348 $ hg export -r0
348 $ hg export -r0
349 paged! '# HG changeset patch\n'
349 paged! '# HG changeset patch\n'
350 paged! '# User test\n'
350 paged! '# User test\n'
351 paged! '# Date 0 0\n'
351 paged! '# Date 0 0\n'
352 paged! '# Thu Jan 01 00:00:00 1970 +0000\n'
352 paged! '# Thu Jan 01 00:00:00 1970 +0000\n'
353 paged! '# Node ID 1f0dee641bb7258c56bd60e93edfa2405381c41e\n'
353 paged! '# Node ID 1f0dee641bb7258c56bd60e93edfa2405381c41e\n'
354 paged! '# Parent 0000000000000000000000000000000000000000\n'
354 paged! '# Parent 0000000000000000000000000000000000000000\n'
355 paged! 'add a\n'
355 paged! 'add a\n'
356 paged! '\n'
356 paged! '\n'
357 paged! '\x1b[0;1mdiff -r 000000000000 -r 1f0dee641bb7 a\x1b[0m\n'
357 paged! '\x1b[0;1mdiff -r 000000000000 -r 1f0dee641bb7 a\x1b[0m\n'
358 paged! '\x1b[0;31;1m--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
358 paged! '\x1b[0;31;1m--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
359 paged! '\x1b[0;32;1m+++ b/a\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
359 paged! '\x1b[0;32;1m+++ b/a\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
360 paged! '\x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m\n'
360 paged! '\x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m\n'
361 paged! '\x1b[0;32m+a\x1b[0m\n'
361 paged! '\x1b[0;32m+a\x1b[0m\n'
362 $ hg export -r0 -o -
362 $ hg export -r0 -o -
363 paged! '# HG changeset patch\n'
363 paged! '# HG changeset patch\n'
364 paged! '# User test\n'
364 paged! '# User test\n'
365 paged! '# Date 0 0\n'
365 paged! '# Date 0 0\n'
366 paged! '# Thu Jan 01 00:00:00 1970 +0000\n'
366 paged! '# Thu Jan 01 00:00:00 1970 +0000\n'
367 paged! '# Node ID 1f0dee641bb7258c56bd60e93edfa2405381c41e\n'
367 paged! '# Node ID 1f0dee641bb7258c56bd60e93edfa2405381c41e\n'
368 paged! '# Parent 0000000000000000000000000000000000000000\n'
368 paged! '# Parent 0000000000000000000000000000000000000000\n'
369 paged! 'add a\n'
369 paged! 'add a\n'
370 paged! '\n'
370 paged! '\n'
371 paged! '\x1b[0;1mdiff -r 000000000000 -r 1f0dee641bb7 a\x1b[0m\n'
371 paged! '\x1b[0;1mdiff -r 000000000000 -r 1f0dee641bb7 a\x1b[0m\n'
372 paged! '\x1b[0;31;1m--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
372 paged! '\x1b[0;31;1m--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
373 paged! '\x1b[0;32;1m+++ b/a\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
373 paged! '\x1b[0;32;1m+++ b/a\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
374 paged! '\x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m\n'
374 paged! '\x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m\n'
375 paged! '\x1b[0;32m+a\x1b[0m\n'
375 paged! '\x1b[0;32m+a\x1b[0m\n'
376 $ hg export -r0 -o out
376 $ hg export -r0 -o out
377
377
378 $ rm out
378 $ rm out
379
379
380 Put annotate in the ignore list for pager:
380 Put annotate in the ignore list for pager:
381 $ cat >> $HGRCPATH <<EOF
381 $ cat >> $HGRCPATH <<EOF
382 > [pager]
382 > [pager]
383 > ignore = annotate
383 > ignore = annotate
384 > EOF
384 > EOF
385 $ hg blame a
385 $ hg blame a
386 0: a
386 0: a
387 1: a 1
387 1: a 1
388 2: a 2
388 2: a 2
389 3: a 3
389 3: a 3
390 4: a 4
390 4: a 4
391 5: a 5
391 5: a 5
392 6: a 6
392 6: a 6
393 7: a 7
393 7: a 7
394 8: a 8
394 8: a 8
395 9: a 9
395 9: a 9
396 10: a 10
396 10: a 10
397
397
398 During pushbuffer, pager should not start:
398 During pushbuffer, pager should not start:
399 $ cat > $TESTTMP/pushbufferpager.py <<EOF
399 $ cat > $TESTTMP/pushbufferpager.py <<EOF
400 > def uisetup(ui):
400 > def uisetup(ui):
401 > ui.pushbuffer()
401 > ui.pushbuffer()
402 > ui.pager(b'mycmd')
402 > ui.pager(b'mycmd')
403 > ui.write(b'content\n')
403 > ui.write(b'content\n')
404 > ui.write(ui.popbuffer())
404 > ui.write(ui.popbuffer())
405 > EOF
405 > EOF
406
406
407 $ echo append >> a
407 $ echo append >> a
408 $ hg --config extensions.pushbuffer=$TESTTMP/pushbufferpager.py status --color=off
408 $ hg --config extensions.pushbuffer=$TESTTMP/pushbufferpager.py status --color=off
409 content
409 content
410 paged! 'M a\n'
410 paged! 'M a\n'
411
411
412 Environment variables like LESS and LV are set automatically:
412 Environment variables like LESS and LV are set automatically:
413 $ cat > $TESTTMP/printlesslv.py <<EOF
413 $ cat > $TESTTMP/printlesslv.py <<EOF
414 > from __future__ import absolute_import
414 > from __future__ import absolute_import
415 > import os
415 > import os
416 > import sys
416 > import sys
417 > sys.stdin.read()
417 > sys.stdin.read()
418 > for name in ['LESS', 'LV']:
418 > for name in ['LESS', 'LV']:
419 > sys.stdout.write(('%s=%s\n') % (name, os.environ.get(name, '-')))
419 > sys.stdout.write(('%s=%s\n') % (name, os.environ.get(name, '-')))
420 > sys.stdout.flush()
420 > sys.stdout.flush()
421 > EOF
421 > EOF
422
422
423 $ cat >> $HGRCPATH <<EOF
423 $ cat >> $HGRCPATH <<EOF
424 > [alias]
424 > [alias]
425 > noop = log -r 0 -T ''
425 > noop = log -r 0 -T ''
426 > [ui]
426 > [ui]
427 > formatted=1
427 > formatted=1
428 > [pager]
428 > [pager]
429 > pager = "$PYTHON" $TESTTMP/printlesslv.py
429 > pager = "$PYTHON" $TESTTMP/printlesslv.py
430 > EOF
430 > EOF
431 $ unset LESS
431 $ unset LESS
432 $ unset LV
432 $ unset LV
433 $ hg noop --pager=on
433 $ hg noop --pager=on
434 LESS=FRX
434 LESS=FRX
435 LV=-c
435 LV=-c
436 $ LESS=EFGH hg noop --pager=on
436 $ LESS=EFGH hg noop --pager=on
437 LESS=EFGH
437 LESS=EFGH
438 LV=-c
438 LV=-c
General Comments 0
You need to be logged in to leave comments. Login now