Mercurial > hg
annotate tests/test-pager.t @ 32017:9f7ba0daada1
obsolescence: add test for the "branch replacement" logic during push, case D5
Mercurial checks for the introduction of new heads on push. Evolution comes
into play to detect if existing branches on the server are being replaced by
some of the new one we push.
This changeset adds test for the improved "branch replacement" logic introduce
in an earlier commits. This tests initially lived in the evolve extensions.
Since we now have the code handling this logic in core, it make sense to have
the tests in core too.
See inline documentation for details about the test case added in this
changeset.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sat, 15 Apr 2017 02:54:27 +0200 |
parents | e518192d6bac |
children | d323d9e0d7b4 |
rev | line source |
---|---|
28319 | 1 $ cat >> fakepager.py <<EOF |
2 > import sys | |
3 > for line in sys.stdin: | |
4 > sys.stdout.write('paged! %r\n' % line) | |
5 > EOF | |
6 | |
7 Enable ui.formatted because pager won't fire without it, and set up | |
8 pager and tell it to use our fake pager that lets us see when the | |
9 pager was running. | |
10 $ cat >> $HGRCPATH <<EOF | |
11 > [ui] | |
12 > formatted = yes | |
13 > [pager] | |
14 > pager = python $TESTTMP/fakepager.py | |
15 > EOF | |
16 | |
17 $ hg init repo | |
18 $ cd repo | |
19 $ echo a >> a | |
20 $ hg add a | |
21 $ hg ci -m 'add a' | |
22 $ for x in `python $TESTDIR/seq.py 1 10`; do | |
23 > echo a $x >> a | |
24 > hg ci -m "modify a $x" | |
25 > done | |
26 | |
30944
b7e073ae44c4
tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents:
30942
diff
changeset
|
27 By default diff and log are paged, but id is not: |
28319 | 28 |
29 $ hg diff -c 2 --pager=yes | |
30 paged! 'diff -r f4be7687d414 -r bce265549556 a\n' | |
31 paged! '--- a/a\tThu Jan 01 00:00:00 1970 +0000\n' | |
32 paged! '+++ b/a\tThu Jan 01 00:00:00 1970 +0000\n' | |
33 paged! '@@ -1,2 +1,3 @@\n' | |
34 paged! ' a\n' | |
35 paged! ' a 1\n' | |
36 paged! '+a 2\n' | |
37 | |
38 $ hg log --limit 2 | |
39 paged! 'changeset: 10:46106edeeb38\n' | |
40 paged! 'tag: tip\n' | |
41 paged! 'user: test\n' | |
42 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' | |
43 paged! 'summary: modify a 10\n' | |
44 paged! '\n' | |
45 paged! 'changeset: 9:6dd8ea7dd621\n' | |
46 paged! 'user: test\n' | |
47 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' | |
48 paged! 'summary: modify a 9\n' | |
49 paged! '\n' | |
50 | |
30944
b7e073ae44c4
tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents:
30942
diff
changeset
|
51 $ hg id |
b7e073ae44c4
tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents:
30942
diff
changeset
|
52 46106edeeb38 tip |
28319 | 53 |
30944
b7e073ae44c4
tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents:
30942
diff
changeset
|
54 We can enable the pager on id: |
28319 | 55 |
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
|
56 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
|
57 $ 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
|
58 46106edeeb38 tip |
28319 | 59 |
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
|
60 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
|
61 core: |
28319 | 62 $ hg --config pager.attend-diff=no diff -c 2 |
63 diff -r f4be7687d414 -r bce265549556 a | |
64 --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
65 +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
66 @@ -1,2 +1,3 @@ | |
67 a | |
68 a 1 | |
69 +a 2 | |
70 | |
71 If 'log' is in attend, then 'history' should also be paged: | |
72 $ hg history --limit 2 --config pager.attend=log | |
73 paged! 'changeset: 10:46106edeeb38\n' | |
74 paged! 'tag: tip\n' | |
75 paged! 'user: test\n' | |
76 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' | |
77 paged! 'summary: modify a 10\n' | |
78 paged! '\n' | |
79 paged! 'changeset: 9:6dd8ea7dd621\n' | |
80 paged! 'user: test\n' | |
81 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' | |
82 paged! 'summary: modify a 9\n' | |
83 paged! '\n' | |
84 | |
30847
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
29344
diff
changeset
|
85 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
|
86 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
29344
diff
changeset
|
87 $ 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
|
88 10:46106edeeb38 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
29344
diff
changeset
|
89 |
31079
873ebdd6e84d
pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents:
31000
diff
changeset
|
90 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
|
91 be silently lost.) |
873ebdd6e84d
pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents:
31000
diff
changeset
|
92 |
873ebdd6e84d
pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents:
31000
diff
changeset
|
93 $ 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
|
94 10:46106edeeb38 |
873ebdd6e84d
pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents:
31000
diff
changeset
|
95 |
28531
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
96 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
|
97 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
|
98 $ cat >> $HGRCPATH <<EOF |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
99 > [extensions] |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
100 > color= |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
101 > [color] |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
102 > mode = ansi |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
103 > EOF |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
104 $ hg log --limit 3 |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
105 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
|
106 paged! 'tag: tip\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
107 paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
108 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
|
109 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
|
110 paged! '\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
111 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
|
112 paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
113 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
|
114 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
|
115 paged! '\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
116 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
|
117 paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
118 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
|
119 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
|
120 paged! '\n' |
29132
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
121 |
31478
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
122 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
|
123 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
|
124 $ 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
|
125 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
|
126 \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
|
127 tag: tip |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
128 user: test |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
129 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
|
130 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
|
131 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
132 \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
|
133 user: test |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
134 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
|
135 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
|
136 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
137 \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
|
138 user: test |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
139 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
|
140 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
|
141 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
142 |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
143 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
|
144 improve this. |
9335dc6b2a9c
pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents:
31405
diff
changeset
|
145 $ 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
|
146 > --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
|
147 > 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
|
148 |
29132
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
149 Pager works with shell aliases. |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
150 |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
151 $ cat >> $HGRCPATH <<EOF |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
152 > [alias] |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
153 > echoa = !echo a |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
154 > EOF |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
155 |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
156 $ hg echoa |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
157 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
|
158 BROKEN: should be paged |
29132
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
159 $ 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
|
160 a |
29343
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
161 |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
162 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
|
163 |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
164 $ cat >> $HGRCPATH <<'EOF' |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
165 > [alias] |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
166 > 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
|
167 > EOF |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
168 |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
169 $ 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
|
170 paged! '1\n' |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
171 $ 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
|
172 paged! '2\n' |
29344 | 173 |
30942
65a3b4d67a65
pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents:
30847
diff
changeset
|
174 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
|
175 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
|
176 $ 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
|
177 2 |
65a3b4d67a65
pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents:
30847
diff
changeset
|
178 |
29344 | 179 Pager should not override the exit code of other commands |
180 | |
181 $ cat >> $TESTTMP/fortytwo.py <<'EOF' | |
182 > from mercurial import cmdutil, commands | |
183 > cmdtable = {} | |
184 > command = cmdutil.command(cmdtable) | |
185 > @command('fortytwo', [], 'fortytwo', norepo=True) | |
186 > def fortytwo(ui, *opts): | |
187 > ui.write('42\n') | |
188 > return 42 | |
189 > EOF | |
190 | |
191 $ cat >> $HGRCPATH <<'EOF' | |
192 > [extensions] | |
193 > fortytwo = $TESTTMP/fortytwo.py | |
194 > EOF | |
195 | |
196 $ hg fortytwo --pager=on | |
197 paged! '42\n' | |
198 [42] | |
30999
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
199 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
200 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
|
201 $ hg blame a |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
202 paged! ' 0: a\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
203 paged! ' 1: a 1\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
204 paged! ' 2: a 2\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
205 paged! ' 3: a 3\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
206 paged! ' 4: a 4\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
207 paged! ' 5: a 5\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
208 paged! ' 6: a 6\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
209 paged! ' 7: a 7\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
210 paged! ' 8: a 8\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
211 paged! ' 9: a 9\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
212 paged! '10: a 10\n' |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
213 but not with HGPLAIN |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
214 $ HGPLAIN=1 hg blame a |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
215 0: a |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
216 1: a 1 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
217 2: a 2 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
218 3: a 3 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
219 4: a 4 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
220 5: a 5 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
221 6: a 6 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
222 7: a 7 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
223 8: a 8 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
224 9: a 9 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
225 10: a 10 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
226 explicit flags work too: |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
227 $ hg blame --pager=no a |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
228 0: a |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
229 1: a 1 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
230 2: a 2 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
231 3: a 3 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
232 4: a 4 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
233 5: a 5 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
234 6: a 6 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
235 7: a 7 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
236 8: a 8 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
237 9: a 9 |
334cf948c758
annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents:
30996
diff
changeset
|
238 10: a 10 |
31000
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
239 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
240 Put annotate in the ignore list for pager: |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
241 $ cat >> $HGRCPATH <<EOF |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
242 > [pager] |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
243 > ignore = annotate |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
244 > EOF |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
245 $ hg blame a |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
246 0: a |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
247 1: a 1 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
248 2: a 2 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
249 3: a 3 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
250 4: a 4 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
251 5: a 5 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
252 6: a 6 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
253 7: a 7 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
254 8: a 8 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
255 9: a 9 |
84ec2d6a2831
tests: prove that ignore works
Augie Fackler <augie@google.com>
parents:
30999
diff
changeset
|
256 10: a 10 |
31954
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
257 |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
258 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
|
259 $ cat > $TESTTMP/printlesslv.py <<EOF |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
260 > import os, sys |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
261 > sys.stdin.read() |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
262 > 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
|
263 > 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
|
264 > sys.stdout.flush() |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
265 > EOF |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
266 |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
267 $ cat >> $HGRCPATH <<EOF |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
268 > [alias] |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
269 > 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
|
270 > [ui] |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
271 > formatted=1 |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
272 > [pager] |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
273 > 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
|
274 > EOF |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
275 $ unset LESS |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
276 $ unset LV |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
277 $ hg noop --pager=on |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
278 LESS=FRX |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
279 LV=-c |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
280 $ 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
|
281 LESS=EFGH |
e518192d6bac
pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents:
31478
diff
changeset
|
282 LV=-c |