author | Yuya Nishihara <yuya@tcha.org> |
Fri, 22 Apr 2016 21:46:33 +0900 | |
changeset 31807 | e6eb86b154c5 |
parent 31406 | e83302d43748 |
child 32025 | d323d9e0d7b4 |
permissions | -rw-r--r-- |
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 |
> [extensions] |
|
14 |
> pager= |
|
15 |
> [pager] |
|
16 |
> pager = python $TESTTMP/fakepager.py |
|
17 |
> EOF |
|
18 |
||
19 |
$ hg init repo |
|
20 |
$ cd repo |
|
21 |
$ echo a >> a |
|
22 |
$ hg add a |
|
23 |
$ hg ci -m 'add a' |
|
24 |
$ for x in `python $TESTDIR/seq.py 1 10`; do |
|
25 |
> echo a $x >> a |
|
26 |
> hg ci -m "modify a $x" |
|
27 |
> done |
|
28 |
||
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
|
29 |
By default diff and log are paged, but summary is not: |
28319 | 30 |
|
31 |
$ hg diff -c 2 --pager=yes |
|
32 |
paged! 'diff -r f4be7687d414 -r bce265549556 a\n' |
|
33 |
paged! '--- a/a\tThu Jan 01 00:00:00 1970 +0000\n' |
|
34 |
paged! '+++ b/a\tThu Jan 01 00:00:00 1970 +0000\n' |
|
35 |
paged! '@@ -1,2 +1,3 @@\n' |
|
36 |
paged! ' a\n' |
|
37 |
paged! ' a 1\n' |
|
38 |
paged! '+a 2\n' |
|
39 |
||
40 |
$ hg log --limit 2 |
|
41 |
paged! 'changeset: 10:46106edeeb38\n' |
|
42 |
paged! 'tag: tip\n' |
|
43 |
paged! 'user: test\n' |
|
44 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
|
45 |
paged! 'summary: modify a 10\n' |
|
46 |
paged! '\n' |
|
47 |
paged! 'changeset: 9:6dd8ea7dd621\n' |
|
48 |
paged! 'user: test\n' |
|
49 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
|
50 |
paged! 'summary: modify a 9\n' |
|
51 |
paged! '\n' |
|
52 |
||
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
|
53 |
$ hg summary |
31406
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
54 |
parent: 10:46106edeeb38 tip |
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
55 |
modify a 10 |
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
56 |
branch: default |
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
57 |
commit: (clean) |
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
58 |
update: (current) |
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
59 |
phases: 11 draft |
28319 | 60 |
|
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
|
61 |
We can enable the pager on summary: |
28319 | 62 |
|
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
|
63 |
$ hg --config pager.attend-summary=yes summary |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
64 |
paged! 'parent: 10:46106edeeb38 tip\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
65 |
paged! ' modify a 10\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
66 |
paged! 'branch: default\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
67 |
paged! 'commit: (clean)\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
68 |
paged! 'update: (current)\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
69 |
paged! 'phases: 11 draft\n' |
28319 | 70 |
|
71 |
$ hg --config pager.attend-diff=no diff -c 2 |
|
72 |
diff -r f4be7687d414 -r bce265549556 a |
|
73 |
--- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
74 |
+++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
75 |
@@ -1,2 +1,3 @@ |
|
76 |
a |
|
77 |
a 1 |
|
78 |
+a 2 |
|
79 |
||
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
|
80 |
If we completely change the attend list that's respected: |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
81 |
$ hg --config pager.attend=summary diff -c 2 |
31406
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
82 |
diff -r f4be7687d414 -r bce265549556 a |
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
83 |
--- a/a Thu Jan 01 00:00:00 1970 +0000 |
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
84 |
+++ b/a Thu Jan 01 00:00:00 1970 +0000 |
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
85 |
@@ -1,2 +1,3 @@ |
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
86 |
a |
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
87 |
a 1 |
e83302d43748
pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents:
31405
diff
changeset
|
88 |
+a 2 |
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
|
89 |
|
28319 | 90 |
If 'log' is in attend, then 'history' should also be paged: |
91 |
$ hg history --limit 2 --config pager.attend=log |
|
92 |
paged! 'changeset: 10:46106edeeb38\n' |
|
93 |
paged! 'tag: tip\n' |
|
94 |
paged! 'user: test\n' |
|
95 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
|
96 |
paged! 'summary: modify a 10\n' |
|
97 |
paged! '\n' |
|
98 |
paged! 'changeset: 9:6dd8ea7dd621\n' |
|
99 |
paged! 'user: test\n' |
|
100 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
|
101 |
paged! 'summary: modify a 9\n' |
|
102 |
paged! '\n' |
|
103 |
||
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
|
104 |
Possible bug: history is explicitly ignored in pager config, but |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
105 |
because log is in the attend list it still gets pager treatment. |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
106 |
|
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
107 |
$ hg history --limit 2 --config pager.attend=log \ |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
108 |
> --config pager.ignore=history |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
109 |
paged! 'changeset: 10:46106edeeb38\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
110 |
paged! 'tag: tip\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
111 |
paged! 'user: test\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
112 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
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 |
paged! 'summary: modify a 10\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
114 |
paged! '\n' |
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 |
paged! 'changeset: 9:6dd8ea7dd621\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
116 |
paged! 'user: test\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
117 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
118 |
paged! 'summary: modify a 9\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
119 |
paged! '\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
120 |
|
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
121 |
Possible bug: history is explicitly marked as attend-history=no, but |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
122 |
it doesn't fail to get paged because log is still in the attend list. |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
123 |
|
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
124 |
$ hg history --limit 2 --config pager.attend-history=no |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
125 |
paged! 'changeset: 10:46106edeeb38\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
126 |
paged! 'tag: tip\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
127 |
paged! 'user: test\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
128 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
129 |
paged! 'summary: modify a 10\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
130 |
paged! '\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
131 |
paged! 'changeset: 9:6dd8ea7dd621\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
132 |
paged! 'user: test\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
133 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
134 |
paged! 'summary: modify a 9\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
135 |
paged! '\n' |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
136 |
|
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
137 |
Possible bug: disabling pager for log but enabling it for history |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
138 |
doesn't result in history being paged. |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
139 |
|
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
140 |
$ hg history --limit 2 --config pager.attend-log=no \ |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
141 |
> --config pager.attend-history=yes |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
142 |
changeset: 10:46106edeeb38 |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
143 |
tag: tip |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
144 |
user: test |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
145 |
date: Thu Jan 01 00:00:00 1970 +0000 |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
146 |
summary: modify a 10 |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
147 |
|
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
148 |
changeset: 9:6dd8ea7dd621 |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
149 |
user: test |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
150 |
date: Thu Jan 01 00:00:00 1970 +0000 |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
151 |
summary: modify a 9 |
d5eb20934c36
tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents:
31079
diff
changeset
|
152 |
|
30847
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
29344
diff
changeset
|
153 |
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
|
154 |
|
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
29344
diff
changeset
|
155 |
$ 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
|
156 |
10:46106edeeb38 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
29344
diff
changeset
|
157 |
|
28531
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
158 |
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
|
159 |
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
|
160 |
$ cat >> $HGRCPATH <<EOF |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
161 |
> [extensions] |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
162 |
> color= |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
163 |
> [color] |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
164 |
> mode = ansi |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
165 |
> EOF |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
166 |
$ hg log --limit 3 |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
167 |
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
|
168 |
paged! 'tag: tip\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
169 |
paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
170 |
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
|
171 |
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
|
172 |
paged! '\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
173 |
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
|
174 |
paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
175 |
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
|
176 |
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
|
177 |
paged! '\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
178 |
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
|
179 |
paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
180 |
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
|
181 |
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
|
182 |
paged! '\n' |
29132
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
183 |
|
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
184 |
Pager works with shell aliases. |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
185 |
|
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
186 |
$ cat >> $HGRCPATH <<EOF |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
187 |
> [alias] |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
188 |
> echoa = !echo a |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
189 |
> EOF |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
190 |
|
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
191 |
$ hg echoa |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
192 |
a |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
193 |
$ hg --config pager.attend-echoa=yes echoa |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
194 |
paged! 'a\n' |
29343
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
195 |
|
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
196 |
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
|
197 |
|
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
198 |
$ cat >> $HGRCPATH <<'EOF' |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
199 |
> [alias] |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
200 |
> 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
|
201 |
> EOF |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
202 |
|
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
203 |
$ 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
|
204 |
paged! '1\n' |
e095b9e753f7
tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents:
29132
diff
changeset
|
205 |
$ 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
|
206 |
paged! '2\n' |
29344 | 207 |
|
30942
65a3b4d67a65
pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents:
30847
diff
changeset
|
208 |
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
|
209 |
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
|
210 |
$ 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
|
211 |
2 |
65a3b4d67a65
pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents:
30847
diff
changeset
|
212 |
|
29344 | 213 |
Pager should not override the exit code of other commands |
214 |
||
215 |
$ cat >> $TESTTMP/fortytwo.py <<'EOF' |
|
216 |
> from mercurial import cmdutil, commands |
|
217 |
> cmdtable = {} |
|
218 |
> command = cmdutil.command(cmdtable) |
|
219 |
> @command('fortytwo', [], 'fortytwo', norepo=True) |
|
220 |
> def fortytwo(ui, *opts): |
|
221 |
> ui.write('42\n') |
|
222 |
> return 42 |
|
223 |
> EOF |
|
224 |
||
225 |
$ cat >> $HGRCPATH <<'EOF' |
|
226 |
> [extensions] |
|
227 |
> fortytwo = $TESTTMP/fortytwo.py |
|
228 |
> EOF |
|
229 |
||
230 |
$ hg fortytwo --pager=on |
|
231 |
paged! '42\n' |
|
232 |
[42] |