annotate tests/test-pager.t @ 46582:b0a3ca02d17a

copies-rust: implement PartialEqual manually Now that we know that each (dest, rev) pair has at most a unique CopySource, we can simplify comparison a lot. This "simple" step buy a good share of the previous slowdown back in some case: Repo Case Source-Rev Dest-Rev # of revisions old time new time Difference Factor time per rev --------------------------------------------------------------------------------------------------------------------------------------------------------------- mozilla-try x00000_revs_x00000_added_x000_copies 9b2a99adc05e 8e29777b48e6 : 382065 revs, 43.304637 s, 34.443661 s, -8.860976 s, × 0.7954, 90 µs/rev Full benchmark: Repo Case Source-Rev Dest-Rev # of revisions old time new time Difference Factor time per rev --------------------------------------------------------------------------------------------------------------------------------------------------------------- mercurial x_revs_x_added_0_copies ad6b123de1c7 39cfcef4f463 : 1 revs, 0.000043 s, 0.000043 s, +0.000000 s, × 1.0000, 43 µs/rev mercurial x_revs_x_added_x_copies 2b1c78674230 0c1d10351869 : 6 revs, 0.000114 s, 0.000117 s, +0.000003 s, × 1.0263, 19 µs/rev mercurial x000_revs_x000_added_x_copies 81f8ff2a9bf2 dd3267698d84 : 1032 revs, 0.004937 s, 0.004892 s, -0.000045 s, × 0.9909, 4 µs/rev pypy x_revs_x_added_0_copies aed021ee8ae8 099ed31b181b : 9 revs, 0.000339 s, 0.000196 s, -0.000143 s, × 0.5782, 21 µs/rev pypy x_revs_x000_added_0_copies 4aa4e1f8e19a 359343b9ac0e : 1 revs, 0.000049 s, 0.000050 s, +0.000001 s, × 1.0204, 50 µs/rev pypy x_revs_x_added_x_copies ac52eb7bbbb0 72e022663155 : 7 revs, 0.000202 s, 0.000117 s, -0.000085 s, × 0.5792, 16 µs/rev pypy x_revs_x00_added_x_copies c3b14617fbd7 ace7255d9a26 : 1 revs, 0.000409 s, 0.6f1f4a s, -0.000087 s, × 0.7873, 322 µs/rev pypy x_revs_x000_added_x000_copies df6f7a526b60 a83dc6a2d56f : 6 revs, 0.011984 s, 0.011949 s, -0.000035 s, × 0.9971, 1991 µs/rev pypy x000_revs_xx00_added_0_copies 89a76aede314 2f22446ff07e : 4785 revs, 0.050820 s, 0.050802 s, -0.000018 s, × 0.9996, 10 µs/rev pypy x000_revs_x000_added_x_copies 8a3b5bfd266e 2c68e87c3efe : 6780 revs, 0.087953 s, 0.088090 s, +0.000137 s, × 1.0016, 12 µs/rev pypy x000_revs_x000_added_x000_copies 89a76aede314 7b3dda341c84 : 5441 revs, 0.062902 s, 0.062079 s, -0.000823 s, × 0.9869, 11 µs/rev pypy x0000_revs_x_added_0_copies d1defd0dc478 c9cb1334cc78 : 43645 revs, 0.679234 s, 0.635337 s, -0.043897 s, × 0.9354, 14 µs/rev pypy x0000_revs_xx000_added_0_copies bf2c629d0071 4ffed77c095c : 2 revs, 0.013095 s, 0.013262 s, +0.000167 s, × 1.0128, 6631 µs/rev pypy x0000_revs_xx000_added_x000_copies 08ea3258278e d9fa043f30c0 : 11316 revs, 0.120910 s, 0.120085 s, -0.000825 s, × 0.9932, 10 µs/rev netbeans x_revs_x_added_0_copies fb0955ffcbcd a01e9239f9e7 : 2 revs, 0.000087 s, 0.000085 s, -0.000002 s, × 0.9770, 42 µs/rev netbeans x_revs_x000_added_0_copies 6f360122949f 20eb231cc7d0 : 2 revs, 0.000107 s, 0.000110 s, +0.000003 s, × 1.0280, 55 µs/rev netbeans x_revs_x_added_x_copies 1ada3faf6fb6 5a39d12eecf4 : 3 revs, 0.000186 s, 0.000177 s, -0.000009 s, × 0.9516, 59 µs/rev netbeans x_revs_x00_added_x_copies 35be93ba1e2c 9eec5e90c05f : 9 revs, 0.000754 s, 0.000743 s, -0.000011 s, × 0.9854, 82 µs/rev netbeans x000_revs_xx00_added_0_copies eac3045b4fdd 51d4ae7f1290 : 1421 revs, 0.010443 s, 0.010168 s, -0.000275 s, × 0.9737, 7 µs/rev netbeans x000_revs_x000_added_x_copies e2063d266acd 6081d72689dc : 1533 revs, 0.015697 s, 0.015946 s, +0.000249 s, × 1.0159, 10 µs/rev netbeans x000_revs_x000_added_x000_copies ff453e9fee32 411350406ec2 : 5750 revs, 0.063528 s, 0.062712 s, -0.000816 s, × 0.9872, 10 µs/rev netbeans x0000_revs_xx000_added_x000_copies 588c2d1ced70 1aad62e59ddd : 66949 revs, 0.545515 s, 0.523832 s, -0.021683 s, × 0.9603, 7 µs/rev mozilla-central x_revs_x_added_0_copies 3697f962bb7b 7015fcdd43a2 : 2 revs, 0.000089 s, 0.000090 s, +0.000001 s, × 1.0112, 45 µs/rev mozilla-central x_revs_x000_added_0_copies dd390860c6c9 40d0c5bed75d : 8 revs, 0.000265 s, 0.000264 s, -0.000001 s, × 0.9962, 33 µs/rev mozilla-central x_revs_x_added_x_copies 8d198483ae3b 14207ffc2b2f : 9 revs, 0.000381 s, 0.000187 s, -0.000194 s, × 0.4908, 20 µs/rev mozilla-central x_revs_x00_added_x_copies 98cbc58cc6bc 446a150332c3 : 7 revs, 0.000672 s, 0.000665 s, -0.000007 s, × 0.9896, 95 µs/rev mozilla-central x_revs_x000_added_x000_copies 3c684b4b8f68 0a5e72d1b479 : 3 revs, 0.003497 s, 0.003556 s, +0.000059 s, × 1.0169, 1185 µs/rev mozilla-central x_revs_x0000_added_x0000_copies effb563bb7e5 c07a39dc4e80 : 6 revs, 0.073204 s, 0.071345 s, -0.001859 s, × 0.9746, 11890 µs/rev mozilla-central x000_revs_xx00_added_0_copies 6100d773079a 04a55431795e : 1593 revs, 0.006482 s, 0.006551 s, +0.000069 s, × 1.0106, 4 µs/rev mozilla-central x000_revs_x000_added_x_copies 9f17a6fc04f9 2d37b966abed : 41 revs, 0.005066 s, 0.005078 s, +0.000012 s, × 1.0024, 123 µs/rev mozilla-central x000_revs_x000_added_x000_copies 7c97034feb78 4407bd0c6330 : 7839 revs, 0.065707 s, 0.065823 s, +0.000116 s, × 1.0018, 8 µs/rev mozilla-central x0000_revs_xx000_added_0_copies 9eec5917337d 67118cc6dcad : 615 revs, 0.026800 s, 0.027050 s, +0.000250 s, × 1.0093, 43 µs/rev mozilla-central x0000_revs_xx000_added_x000_copies f78c615a656c 96a38b690156 : 30263 revs, 0.203856 s, 0.202443 s, -0.001413 s, × 0.9931, 6 µs/rev mozilla-central x00000_revs_x0000_added_x0000_copies 6832ae71433c 4c222a1d9a00 : 153721 revs, 1.293394 s, 1.261583 s, -0.031811 s, × 0.9754, 8 µs/rev mozilla-central x00000_revs_x00000_added_x000_copies 76caed42cf7c 1daa622bbe42 : 204976 revs, 1.698239 s, 1.643869 s, -0.054370 s, × 0.9680, 8 µs/rev mozilla-try x_revs_x_added_0_copies aaf6dde0deb8 9790f499805a : 2 revs, 0.000875 s, 0.000868 s, -0.000007 s, × 0.9920, 434 µs/rev mozilla-try x_revs_x000_added_0_copies d8d0222927b4 5bb8ce8c7450 : 2 revs, 0.000891 s, 0.000887 s, -0.000004 s, × 0.9955, 443 µs/rev mozilla-try x_revs_x_added_x_copies 092fcca11bdb 936255a0384a : 4 revs, 0.000292 s, 0.000168 s, -0.000124 s, × 0.5753, 42 µs/rev mozilla-try x_revs_x00_added_x_copies b53d2fadbdb5 017afae788ec : 2 revs, 0.003939 s, 0.001160 s, -0.002779 s, × 0.2945, 580 µs/rev mozilla-try x_revs_x000_added_x000_copies 20408ad61ce5 6f0ee96e21ad : 1 revs, 0.033027 s, 0.033016 s, -0.000011 s, × 0.9997, 33016 µs/rev mozilla-try x_revs_x0000_added_x0000_copies effb563bb7e5 c07a39dc4e80 : 6 revs, 0.073703 s, 0.073312 s, -0.39ae31 s, × 0.9947, 12218 µs/rev mozilla-try x000_revs_xx00_added_0_copies 6100d773079a 04a55431795e : 1593 revs, 0.006469 s, 0.006485 s, +0.000016 s, × 1.0025, 4 µs/rev mozilla-try x000_revs_x000_added_x_copies 9f17a6fc04f9 2d37b966abed : 41 revs, 0.005278 s, 0.005494 s, +0.000216 s, × 1.0409, 134 µs/rev mozilla-try x000_revs_x000_added_x000_copies 1346fd0130e4 4c65cbdabc1f : 6657 revs, 0.064995 s, 0.064879 s, -0.000116 s, × 0.9982, 9 µs/rev mozilla-try x0000_revs_x_added_0_copies 63519bfd42ee a36a2a865d92 : 40314 revs, 0.301041 s, 0.301469 s, +0.000428 s, × 1.0014, 7 µs/rev mozilla-try x0000_revs_x_added_x_copies 9fe69ff0762d bcabf2a78927 : 38690 revs, 0.285575 s, 0.297113 s, +0.011538 s, × 1.0404, 7 µs/rev mozilla-try x0000_revs_xx000_added_x_copies 156f6e2674f2 4d0f2c178e66 : 8598 revs, 0.085597 s, 0.085890 s, +0.000293 s, × 1.0034, 9 µs/rev mozilla-try x0000_revs_xx000_added_0_copies 9eec5917337d 67118cc6dcad : 615 revs, 0.027118 s, 0.027718 s, +0.000600 s, × 1.0221, 45 µs/rev mozilla-try x0000_revs_xx000_added_x000_copies 89294cd501d9 7ccb2fc7ccb5 : 97052 revs, 2.119204 s, 2.048949 s, -0.070255 s, × 0.9668, 21 µs/rev mozilla-try x0000_revs_x0000_added_x0000_copies e928c65095ed e951f4ad123a : 52031 revs, 0.701479 s, 0.685924 s, -0.015555 s, × 0.9778, 13 µs/rev mozilla-try x00000_revs_x_added_0_copies 6a320851d377 1ebb79acd503 : 363753 revs, 4.482399 s, 4.482891 s, +0.000492 s, × 1.0001, 12 µs/rev mozilla-try x00000_revs_x00000_added_0_copies dc8a3ca7010e d16fde900c9c : 34414 revs, 0.574082 s, 0.577633 s, +0.003551 s, × 1.0062, 16 µs/rev mozilla-try x00000_revs_x_added_x_copies 5173c4b6f97c 95d83ee7242d : 362229 revs, 4.480366 s, 4.397816 s, -0.082550 s, × 0.9816, 12 µs/rev mozilla-try x00000_revs_x000_added_x_copies 9126823d0e9c ca82787bb23c : 359344 revs, 4.369070 s, 4.370538 s, +0.001468 s, × 1.0003, 12 µs/rev mozilla-try x00000_revs_x0000_added_x0000_copies 8d3fafa80d4b eb884023b810 : 192665 revs, 1.592506 s, 1.570439 s, -0.022067 s, × 0.9861, 8 µs/rev mozilla-try x00000_revs_x00000_added_x0000_copies 1b661134e2ca 1ae03d022d6d : 228985 revs, 87.824489 s, 88.388512 s, +0.564023 s, × 1.0064, 386 µs/rev mozilla-try x00000_revs_x00000_added_x000_copies 9b2a99adc05e 8e29777b48e6 : 382065 revs, 43.304637 s, 34.443661 s, -8.860976 s, × 0.7954, 90 µs/rev private : 459513 revs, 33.853687 s, 27.370148 s, -6.483539 s, × 0.8085, 59 µs/rev Differential Revision: https://phab.mercurial-scm.org/D9653
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 16 Dec 2020 11:11:05 +0100
parents 5abc47d4ca6b
children 9aad229a773a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
1 $ cat >> fakepager.py <<EOF
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
2 > import sys
32541
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
3 > printed = False
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
4 > for line in sys.stdin:
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
5 > sys.stdout.write('paged! %r\n' % line)
32541
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
6 > printed = True
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
7 > if not printed:
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
8 > sys.stdout.write('paged empty output!\n')
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
9 > EOF
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
10
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
11 Enable ui.formatted because pager won't fire without it, and set up
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
12 pager and tell it to use our fake pager that lets us see when the
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
13 pager was running.
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
14 $ cat >> $HGRCPATH <<EOF
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
15 > [ui]
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
16 > formatted = yes
32026
57042e91521a color: turn on by default (but for windows)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32025
diff changeset
17 > color = no
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
18 > [pager]
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 38074
diff changeset
19 > pager = "$PYTHON" $TESTTMP/fakepager.py
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
20 > EOF
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
21
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
22 $ hg init repo
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
23 $ cd repo
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
24 $ echo a >> a
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
25 $ hg add a
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
26 $ hg ci -m 'add a'
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 38074
diff changeset
27 $ for x in `"$PYTHON" $TESTDIR/seq.py 1 10`; do
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
28 > echo a $x >> a
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
29 > hg ci -m "modify a $x"
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
30 > done
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
31
30944
b7e073ae44c4 tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents: 30942
diff changeset
32 By default diff and log are paged, but id is not:
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
33
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
34 $ hg diff -c 2 --pager=yes
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
35 paged! 'diff -r f4be7687d414 -r bce265549556 a\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
36 paged! '--- a/a\tThu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
37 paged! '+++ b/a\tThu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
38 paged! '@@ -1,2 +1,3 @@\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
39 paged! ' a\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
40 paged! ' a 1\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
41 paged! '+a 2\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
42
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
43 $ hg log --limit 2
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
44 paged! 'changeset: 10:46106edeeb38\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
45 paged! 'tag: tip\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
46 paged! 'user: test\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
47 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
48 paged! 'summary: modify a 10\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
49 paged! '\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
50 paged! 'changeset: 9:6dd8ea7dd621\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
51 paged! 'user: test\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
52 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
53 paged! 'summary: modify a 9\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
54 paged! '\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
55
30944
b7e073ae44c4 tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents: 30942
diff changeset
56 $ hg id
b7e073ae44c4 tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents: 30942
diff changeset
57 46106edeeb38 tip
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
58
32098
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
59 We can control the pager from the config
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
60
32104
f06d23af6cdf pager: rename 'pager.enable' to 'ui.paginate'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32103
diff changeset
61 $ hg log --limit 1 --config 'ui.paginate=False'
32098
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
62 changeset: 10:46106edeeb38
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
63 tag: tip
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
64 user: test
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
65 date: Thu Jan 01 00:00:00 1970 +0000
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
66 summary: modify a 10
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
67
32104
f06d23af6cdf pager: rename 'pager.enable' to 'ui.paginate'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32103
diff changeset
68 $ hg log --limit 1 --config 'ui.paginate=0'
32098
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
69 changeset: 10:46106edeeb38
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
70 tag: tip
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
71 user: test
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
72 date: Thu Jan 01 00:00:00 1970 +0000
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
73 summary: modify a 10
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
74
32104
f06d23af6cdf pager: rename 'pager.enable' to 'ui.paginate'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32103
diff changeset
75 $ hg log --limit 1 --config 'ui.paginate=1'
32098
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
76 paged! 'changeset: 10:46106edeeb38\n'
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
77 paged! 'tag: tip\n'
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
78 paged! 'user: test\n'
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
79 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
80 paged! 'summary: modify a 10\n'
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
81 paged! '\n'
149440d7e1a7 pager: test the 'enable' config option
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32074
diff changeset
82
33620
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
83 explicit --pager=on should take precedence over other configurations
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
84 (issue5580)
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
85
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
86 $ cat >> $HGRCPATH <<EOF
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
87 > [ui]
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
88 > paginate = false
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
89 > EOF
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
90 $ hg log --limit 1 --pager=on
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
91 paged! 'changeset: 10:46106edeeb38\n'
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
92 paged! 'tag: tip\n'
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
93 paged! 'user: test\n'
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
94 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
95 paged! 'summary: modify a 10\n'
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
96 paged! '\n'
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
97
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
98 $ cat >> $HGRCPATH <<EOF
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
99 > [ui]
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
100 > # true is default value of ui.paginate
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
101 > paginate = true
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
102 > EOF
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
103 $ hg log --limit 1 --pager=off
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
104 changeset: 10:46106edeeb38
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
105 tag: tip
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
106 user: test
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
107 date: Thu Jan 01 00:00:00 1970 +0000
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
108 summary: modify a 10
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
109
cc047a733f69 ui: enable pager always for explicit --pager=on (issue5580)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
110
30944
b7e073ae44c4 tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents: 30942
diff changeset
111 We can enable the pager on id:
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
112
31405
d5eb20934c36 tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents: 31079
diff changeset
113 BROKEN: should be paged
30944
b7e073ae44c4 tests: switch "this command isn't paged" example to id
Augie Fackler <augie@google.com>
parents: 30942
diff changeset
114 $ hg --config pager.attend-id=yes id
31405
d5eb20934c36 tests: duplicate test for pager for old extension and for in-core pager
Martin von Zweigbergk <martinvonz@google.com>
parents: 31079
diff changeset
115 46106edeeb38 tip
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
116
30996
cc3c9b6f1e09 tests: clean up a bunch of pager testing that is about to be invalidated
Augie Fackler <augie@google.com>
parents: 30944
diff changeset
117 Setting attend-$COMMAND to a false value works, even with pager in
cc3c9b6f1e09 tests: clean up a bunch of pager testing that is about to be invalidated
Augie Fackler <augie@google.com>
parents: 30944
diff changeset
118 core:
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
119 $ hg --config pager.attend-diff=no diff -c 2
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
120 diff -r f4be7687d414 -r bce265549556 a
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
121 --- a/a Thu Jan 01 00:00:00 1970 +0000
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
122 +++ b/a Thu Jan 01 00:00:00 1970 +0000
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
123 @@ -1,2 +1,3 @@
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
124 a
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
125 a 1
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
126 +a 2
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
127
32072
05cdd5678c6b tests: drop unnecessary pager attend in test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32026
diff changeset
128 Command aliases should have same behavior as main command
05cdd5678c6b tests: drop unnecessary pager attend in test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32026
diff changeset
129
05cdd5678c6b tests: drop unnecessary pager attend in test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32026
diff changeset
130 $ hg history --limit 2
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
131 paged! 'changeset: 10:46106edeeb38\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
132 paged! 'tag: tip\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
133 paged! 'user: test\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
134 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
135 paged! 'summary: modify a 10\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
136 paged! '\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
137 paged! 'changeset: 9:6dd8ea7dd621\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
138 paged! 'user: test\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
139 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
140 paged! 'summary: modify a 9\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
141 paged! '\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
142
32073
04629b2da72c tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32072
diff changeset
143 Abbreviated command alias should also be paged
04629b2da72c tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32072
diff changeset
144
04629b2da72c tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32072
diff changeset
145 $ hg hist -l 1
04629b2da72c tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32072
diff changeset
146 paged! 'changeset: 10:46106edeeb38\n'
04629b2da72c tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32072
diff changeset
147 paged! 'tag: tip\n'
04629b2da72c tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32072
diff changeset
148 paged! 'user: test\n'
04629b2da72c tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32072
diff changeset
149 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
04629b2da72c tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32072
diff changeset
150 paged! 'summary: modify a 10\n'
04629b2da72c tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32072
diff changeset
151 paged! '\n'
04629b2da72c tests: test that abbreviated command alias is also paged
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32072
diff changeset
152
32074
769c831708c7 tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32073
diff changeset
153 Attend for an abbreviated command does not work
769c831708c7 tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32073
diff changeset
154
769c831708c7 tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32073
diff changeset
155 $ hg --config pager.attend-ident=true ident
769c831708c7 tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32073
diff changeset
156 46106edeeb38 tip
769c831708c7 tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32073
diff changeset
157
769c831708c7 tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32073
diff changeset
158 $ hg --config extensions.pager= --config pager.attend-ident=true ident
769c831708c7 tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32073
diff changeset
159 46106edeeb38 tip
769c831708c7 tests: demonstrate that pager.attend-<abbreviated> doesn't work
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32073
diff changeset
160
30847
e12553cfd0a4 pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents: 29344
diff changeset
161 Pager should not start if stdout is not a tty.
e12553cfd0a4 pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents: 29344
diff changeset
162
e12553cfd0a4 pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents: 29344
diff changeset
163 $ hg log -l1 -q --config ui.formatted=False
e12553cfd0a4 pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents: 29344
diff changeset
164 10:46106edeeb38
e12553cfd0a4 pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents: 29344
diff changeset
165
31079
873ebdd6e84d pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents: 31000
diff changeset
166 Pager should be disabled if pager.pager is empty (otherwise the output would
873ebdd6e84d pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents: 31000
diff changeset
167 be silently lost.)
873ebdd6e84d pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents: 31000
diff changeset
168
873ebdd6e84d pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents: 31000
diff changeset
169 $ hg log -l1 -q --config pager.pager=
873ebdd6e84d pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents: 31000
diff changeset
170 10:46106edeeb38
873ebdd6e84d pager: do not try to run an empty pager command
Yuya Nishihara <yuya@tcha.org>
parents: 31000
diff changeset
171
28531
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
172 Pager with color enabled allows colors to come through by default,
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
173 even though stdout is no longer a tty.
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
174 $ cat >> $HGRCPATH <<EOF
32025
d323d9e0d7b4 pager: stop using the color extension in tests
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31954
diff changeset
175 > [ui]
32103
9a98023ac8db color: special case 'always' in 'ui.color'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32102
diff changeset
176 > color = always
28531
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
177 > [color]
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
178 > mode = ansi
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
179 > EOF
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
180 $ hg log --limit 3
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
181 paged! '\x1b[0;33mchangeset: 10:46106edeeb38\x1b[0m\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
182 paged! 'tag: tip\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
183 paged! 'user: test\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
184 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
185 paged! 'summary: modify a 10\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
186 paged! '\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
187 paged! '\x1b[0;33mchangeset: 9:6dd8ea7dd621\x1b[0m\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
188 paged! 'user: test\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
189 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
190 paged! 'summary: modify a 9\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
191 paged! '\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
192 paged! '\x1b[0;33mchangeset: 8:cff05a6312fe\x1b[0m\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
193 paged! 'user: test\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
194 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
195 paged! 'summary: modify a 8\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
196 paged! '\n'
29132
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
197
34442
73d8a5283f87 test-pager: make it compatible with chg
Jun Wu <quark@fb.com>
parents: 34021
diff changeset
198 #if no-chg
31478
9335dc6b2a9c pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents: 31405
diff changeset
199 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
200 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
201 $ 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
202 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
203 \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
204 tag: tip
9335dc6b2a9c pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents: 31405
diff changeset
205 user: test
9335dc6b2a9c pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents: 31405
diff changeset
206 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
207 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
208
9335dc6b2a9c pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents: 31405
diff changeset
209 \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
210 user: test
9335dc6b2a9c pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents: 31405
diff changeset
211 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
212 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
213
9335dc6b2a9c pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents: 31405
diff changeset
214 \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
215 user: test
9335dc6b2a9c pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents: 31405
diff changeset
216 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
217 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
218
34442
73d8a5283f87 test-pager: make it compatible with chg
Jun Wu <quark@fb.com>
parents: 34021
diff changeset
219 #endif
31478
9335dc6b2a9c pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents: 31405
diff changeset
220
9335dc6b2a9c pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents: 31405
diff changeset
221 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
222 improve this.
9335dc6b2a9c pager: avoid shell=True on subprocess.Popen for better errors (issue5491)
Augie Fackler <augie@google.com>
parents: 31405
diff changeset
223 $ 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
224 > --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
225 > 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
226
29132
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
227 Pager works with shell aliases.
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
228
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
229 $ cat >> $HGRCPATH <<EOF
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
230 > [alias]
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
231 > echoa = !echo a
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
232 > EOF
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
233
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
234 $ hg echoa
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
235 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
236 BROKEN: should be paged
29132
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
237 $ 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
238 a
29343
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
239
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
240 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
241
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
242 $ cat >> $HGRCPATH <<'EOF'
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
243 > [alias]
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
244 > 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
245 > EOF
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
246
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
247 $ 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
248 paged! '1\n'
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
249 $ 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
250 paged! '2\n'
29344
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
251
30942
65a3b4d67a65 pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents: 30847
diff changeset
252 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
253 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
254 $ 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
255 2
65a3b4d67a65 pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents: 30847
diff changeset
256
29344
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
257 Pager should not override the exit code of other commands
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
258
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
259 $ cat >> $TESTTMP/fortytwo.py <<'EOF'
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32104
diff changeset
260 > from mercurial import commands, registrar
29344
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
261 > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32104
diff changeset
262 > command = registrar.command(cmdtable)
38074
5a3feb2bc9dd py3: add b'' prefixes in tests/test-pager.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 37598
diff changeset
263 > @command(b'fortytwo', [], b'fortytwo', norepo=True)
29344
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
264 > def fortytwo(ui, *opts):
38074
5a3feb2bc9dd py3: add b'' prefixes in tests/test-pager.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 37598
diff changeset
265 > ui.write(b'42\n')
29344
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
266 > return 42
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
267 > EOF
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
268
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
269 $ cat >> $HGRCPATH <<'EOF'
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
270 > [extensions]
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
271 > fortytwo = $TESTTMP/fortytwo.py
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
272 > EOF
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
273
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
274 $ hg fortytwo --pager=on
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
275 paged! '42\n'
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
276 [42]
30999
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
277
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
278 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
279 $ hg blame a
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
280 paged! ' 0: a\n'
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
281 paged! ' 1: a 1\n'
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
282 paged! ' 2: a 2\n'
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
283 paged! ' 3: a 3\n'
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
284 paged! ' 4: a 4\n'
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
285 paged! ' 5: a 5\n'
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
286 paged! ' 6: a 6\n'
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
287 paged! ' 7: a 7\n'
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
288 paged! ' 8: a 8\n'
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
289 paged! ' 9: a 9\n'
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
290 paged! '10: a 10\n'
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
291 but not with HGPLAIN
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
292 $ HGPLAIN=1 hg blame a
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
293 0: a
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
294 1: a 1
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
295 2: a 2
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
296 3: a 3
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
297 4: a 4
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
298 5: a 5
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
299 6: a 6
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
300 7: a 7
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
301 8: a 8
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
302 9: a 9
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
303 10: a 10
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
304 explicit flags work too:
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
305 $ hg blame --pager=no a
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
306 0: a
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
307 1: a 1
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
308 2: a 2
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
309 3: a 3
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
310 4: a 4
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
311 5: a 5
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
312 6: a 6
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
313 7: a 7
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
314 8: a 8
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
315 9: a 9
334cf948c758 annotate: migrate to modern pager API
Augie Fackler <augie@google.com>
parents: 30996
diff changeset
316 10: a 10
31000
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
317
32541
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
318 A command with --output option:
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
319
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
320 $ hg cat -r0 a
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
321 paged! 'a\n'
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
322 $ hg cat -r0 a --output=-
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
323 paged! 'a\n'
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
324 $ hg cat -r0 a --output=out
37598
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
325
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
326 $ hg export -r0
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
327 paged! '# HG changeset patch\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
328 paged! '# User test\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
329 paged! '# Date 0 0\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
330 paged! '# Thu Jan 01 00:00:00 1970 +0000\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
331 paged! '# Node ID 1f0dee641bb7258c56bd60e93edfa2405381c41e\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
332 paged! '# Parent 0000000000000000000000000000000000000000\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
333 paged! 'add a\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
334 paged! '\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
335 paged! '\x1b[0;1mdiff -r 000000000000 -r 1f0dee641bb7 a\x1b[0m\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
336 paged! '\x1b[0;31;1m--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
337 paged! '\x1b[0;32;1m+++ b/a\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
338 paged! '\x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
339 paged! '\x1b[0;32m+a\x1b[0m\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
340 $ hg export -r0 -o -
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
341 paged! '# HG changeset patch\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
342 paged! '# User test\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
343 paged! '# Date 0 0\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
344 paged! '# Thu Jan 01 00:00:00 1970 +0000\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
345 paged! '# Node ID 1f0dee641bb7258c56bd60e93edfa2405381c41e\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
346 paged! '# Parent 0000000000000000000000000000000000000000\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
347 paged! 'add a\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
348 paged! '\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
349 paged! '\x1b[0;1mdiff -r 000000000000 -r 1f0dee641bb7 a\x1b[0m\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
350 paged! '\x1b[0;31;1m--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
351 paged! '\x1b[0;32;1m+++ b/a\tThu Jan 01 00:00:00 1970 +0000\x1b[0m\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
352 paged! '\x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
353 paged! '\x1b[0;32m+a\x1b[0m\n'
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
354 $ hg export -r0 -o out
7a9c905e51f9 export: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 34791
diff changeset
355
32541
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
356 $ rm out
3b569745af6c cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org>
parents: 32337
diff changeset
357
31000
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
358 Put annotate in the ignore list for pager:
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
359 $ cat >> $HGRCPATH <<EOF
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
360 > [pager]
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
361 > ignore = annotate
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
362 > EOF
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
363 $ hg blame a
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
364 0: a
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
365 1: a 1
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
366 2: a 2
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
367 3: a 3
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
368 4: a 4
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
369 5: a 5
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
370 6: a 6
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
371 7: a 7
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
372 8: a 8
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
373 9: a 9
84ec2d6a2831 tests: prove that ignore works
Augie Fackler <augie@google.com>
parents: 30999
diff changeset
374 10: a 10
31954
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
375
34021
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
376 During pushbuffer, pager should not start:
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
377 $ cat > $TESTTMP/pushbufferpager.py <<EOF
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
378 > def uisetup(ui):
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
379 > ui.pushbuffer()
38074
5a3feb2bc9dd py3: add b'' prefixes in tests/test-pager.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 37598
diff changeset
380 > ui.pager(b'mycmd')
5a3feb2bc9dd py3: add b'' prefixes in tests/test-pager.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 37598
diff changeset
381 > ui.write(b'content\n')
34021
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
382 > ui.write(ui.popbuffer())
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
383 > EOF
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
384
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
385 $ echo append >> a
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
386 $ hg --config extensions.pushbuffer=$TESTTMP/pushbufferpager.py status --color=off
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
387 content
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
388 paged! 'M a\n'
31a2eb0f74e5 pager: do not start pager if `ui` has been `pushbuffer`-ed
Jun Wu <quark@fb.com>
parents: 33971
diff changeset
389
31954
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
390 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
391 $ cat > $TESTTMP/printlesslv.py <<EOF
33971
dcfa83652744 tests: update test-pager to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33620
diff changeset
392 > from __future__ import absolute_import
dcfa83652744 tests: update test-pager to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33620
diff changeset
393 > import os
dcfa83652744 tests: update test-pager to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33620
diff changeset
394 > import sys
31954
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
395 > sys.stdin.read()
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
396 > 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
397 > 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
398 > sys.stdout.flush()
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
399 > EOF
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
400
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
401 $ cat >> $HGRCPATH <<EOF
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
402 > [alias]
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
403 > 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
404 > [ui]
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
405 > formatted=1
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
406 > [pager]
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 38074
diff changeset
407 > pager = "$PYTHON" $TESTTMP/printlesslv.py
31954
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
408 > EOF
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
409 $ unset LESS
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
410 $ unset LV
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
411 $ hg noop --pager=on
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
412 LESS=FRX
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
413 LV=-c
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
414 $ 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
415 LESS=EFGH
e518192d6bac pager: set some environment variables if they're not set
Jun Wu <quark@fb.com>
parents: 31478
diff changeset
416 LV=-c