author | Pulkit Goyal <7895pulkit@gmail.com> |
Fri, 13 May 2016 03:28:44 +0530 | |
changeset 29160 | 0362605b82cf |
parent 29132 | 12769703d4ba |
child 29343 | e095b9e753f7 |
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 |
||
29 |
By default diff and log are paged, but summary is not: |
|
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 |
||
53 |
$ hg summary |
|
54 |
parent: 10:46106edeeb38 tip |
|
55 |
modify a 10 |
|
56 |
branch: default |
|
57 |
commit: (clean) |
|
58 |
update: (current) |
|
59 |
phases: 11 draft |
|
60 |
||
61 |
We can enable the pager on summary: |
|
62 |
||
63 |
$ hg --config pager.attend-summary=yes summary |
|
64 |
paged! 'parent: 10:46106edeeb38 tip\n' |
|
65 |
paged! ' modify a 10\n' |
|
66 |
paged! 'branch: default\n' |
|
67 |
paged! 'commit: (clean)\n' |
|
68 |
paged! 'update: (current)\n' |
|
69 |
paged! 'phases: 11 draft\n' |
|
70 |
||
71 |
If we completely change the attend list that's respected: |
|
72 |
||
73 |
$ hg --config pager.attend-diff=no diff -c 2 |
|
74 |
diff -r f4be7687d414 -r bce265549556 a |
|
75 |
--- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
76 |
+++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
77 |
@@ -1,2 +1,3 @@ |
|
78 |
a |
|
79 |
a 1 |
|
80 |
+a 2 |
|
81 |
||
82 |
$ hg --config pager.attend=summary diff -c 2 |
|
83 |
diff -r f4be7687d414 -r bce265549556 a |
|
84 |
--- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
85 |
+++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
86 |
@@ -1,2 +1,3 @@ |
|
87 |
a |
|
88 |
a 1 |
|
89 |
+a 2 |
|
90 |
||
91 |
If 'log' is in attend, then 'history' should also be paged: |
|
92 |
$ hg history --limit 2 --config pager.attend=log |
|
93 |
paged! 'changeset: 10:46106edeeb38\n' |
|
94 |
paged! 'tag: tip\n' |
|
95 |
paged! 'user: test\n' |
|
96 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
|
97 |
paged! 'summary: modify a 10\n' |
|
98 |
paged! '\n' |
|
99 |
paged! 'changeset: 9:6dd8ea7dd621\n' |
|
100 |
paged! 'user: test\n' |
|
101 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
|
102 |
paged! 'summary: modify a 9\n' |
|
103 |
paged! '\n' |
|
104 |
||
105 |
Possible bug: history is explicitly ignored in pager config, but |
|
106 |
because log is in the attend list it still gets pager treatment. |
|
107 |
||
108 |
$ hg history --limit 2 --config pager.attend=log \ |
|
109 |
> --config pager.ignore=history |
|
110 |
paged! 'changeset: 10:46106edeeb38\n' |
|
111 |
paged! 'tag: tip\n' |
|
112 |
paged! 'user: test\n' |
|
113 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
|
114 |
paged! 'summary: modify a 10\n' |
|
115 |
paged! '\n' |
|
116 |
paged! 'changeset: 9:6dd8ea7dd621\n' |
|
117 |
paged! 'user: test\n' |
|
118 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
|
119 |
paged! 'summary: modify a 9\n' |
|
120 |
paged! '\n' |
|
121 |
||
122 |
Possible bug: history is explicitly marked as attend-history=no, but |
|
123 |
it doesn't fail to get paged because log is still in the attend list. |
|
124 |
||
125 |
$ hg history --limit 2 --config pager.attend-history=no |
|
126 |
paged! 'changeset: 10:46106edeeb38\n' |
|
127 |
paged! 'tag: tip\n' |
|
128 |
paged! 'user: test\n' |
|
129 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
|
130 |
paged! 'summary: modify a 10\n' |
|
131 |
paged! '\n' |
|
132 |
paged! 'changeset: 9:6dd8ea7dd621\n' |
|
133 |
paged! 'user: test\n' |
|
134 |
paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' |
|
135 |
paged! 'summary: modify a 9\n' |
|
136 |
paged! '\n' |
|
137 |
||
138 |
Possible bug: disabling pager for log but enabling it for history |
|
139 |
doesn't result in history being paged. |
|
140 |
||
141 |
$ hg history --limit 2 --config pager.attend-log=no \ |
|
142 |
> --config pager.attend-history=yes |
|
143 |
changeset: 10:46106edeeb38 |
|
144 |
tag: tip |
|
145 |
user: test |
|
146 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
147 |
summary: modify a 10 |
|
148 |
||
149 |
changeset: 9:6dd8ea7dd621 |
|
150 |
user: test |
|
151 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
152 |
summary: modify a 9 |
|
153 |
||
28531
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
154 |
|
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
155 |
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
|
156 |
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
|
157 |
$ cat >> $HGRCPATH <<EOF |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
158 |
> [extensions] |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
159 |
> color= |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
160 |
> [color] |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
161 |
> mode = ansi |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
162 |
> EOF |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
163 |
$ hg log --limit 3 |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
164 |
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
|
165 |
paged! 'tag: tip\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
166 |
paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
167 |
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
|
168 |
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
|
169 |
paged! '\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
170 |
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
|
171 |
paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
172 |
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
|
173 |
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
|
174 |
paged! '\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
175 |
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
|
176 |
paged! 'user: test\n' |
fe79a5821e5a
test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents:
28319
diff
changeset
|
177 |
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
|
178 |
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
|
179 |
paged! '\n' |
29132
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
180 |
|
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
181 |
Pager works with shell aliases. |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
182 |
|
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
183 |
$ cat >> $HGRCPATH <<EOF |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
184 |
> [alias] |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
185 |
> echoa = !echo a |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
186 |
> EOF |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
187 |
|
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
188 |
$ hg echoa |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
189 |
a |
12769703d4ba
dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents:
28531
diff
changeset
|
190 |
$ 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
|
191 |
paged! 'a\n' |