tests/test-pager-legacy.t
author Manuel Jacob <me@manueljacob.de>
Thu, 15 Sep 2022 01:48:38 +0200
changeset 49494 c96ed4029fda
parent 40369 ef6cab7930b3
permissions -rw-r--r--
templates: add filter to reverse list The filter supports only lists because for lists, it’s straightforward to implement. Reversing text doesn’t seem very useful and is hard to implement. Reversing the bytes would break multi-bytes encodings. Reversing the code points would break characters consisting of multiple code points. Reversing graphemes is non-trivial without using a library not included in the standard library.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
     3
  > for line in sys.stdin:
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
     4
  >     sys.stdout.write('paged! %r\n' % line)
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
     5
  > EOF
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
     6
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
     7
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
     8
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
     9
pager was running.
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    10
  $ cat >> $HGRCPATH <<EOF
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    11
  > [ui]
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    12
  > 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
    13
  > color = no
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    14
  > [extensions]
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    15
  > pager=
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    16
  > [pager]
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 38362
diff changeset
    17
  > pager = "$PYTHON" $TESTTMP/fakepager.py
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    18
  > EOF
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    19
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    20
  $ hg init repo
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    21
  $ cd repo
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    22
  $ echo a >> a
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    23
  $ hg add a
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    24
  $ hg ci -m 'add a'
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 38362
diff changeset
    25
  $ for x in `"$PYTHON" $TESTDIR/seq.py 1 10`; do
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    26
  >   echo a $x >> a
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    27
  >   hg ci -m "modify a $x"
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    28
  > done
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    29
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
    30
By default diff and log are paged, but summary is not:
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    31
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    32
  $ hg diff -c 2 --pager=yes
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    33
  paged! 'diff -r f4be7687d414 -r bce265549556 a\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    34
  paged! '--- a/a\tThu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    35
  paged! '+++ b/a\tThu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    36
  paged! '@@ -1,2 +1,3 @@\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    37
  paged! ' a\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    38
  paged! ' a 1\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    39
  paged! '+a 2\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    40
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    41
  $ hg log --limit 2
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    42
  paged! 'changeset:   10:46106edeeb38\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    43
  paged! 'tag:         tip\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    44
  paged! 'user:        test\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    45
  paged! 'date:        Thu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    46
  paged! 'summary:     modify a 10\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    47
  paged! '\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    48
  paged! 'changeset:   9:6dd8ea7dd621\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    49
  paged! 'user:        test\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    50
  paged! 'date:        Thu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    51
  paged! 'summary:     modify a 9\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    52
  paged! '\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    53
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
    54
  $ hg summary
31406
e83302d43748 pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents: 31405
diff changeset
    55
  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
    56
   modify a 10
e83302d43748 pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents: 31405
diff changeset
    57
  branch: default
e83302d43748 pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents: 31405
diff changeset
    58
  commit: (clean)
e83302d43748 pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents: 31405
diff changeset
    59
  update: (current)
e83302d43748 pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents: 31405
diff changeset
    60
  phases: 11 draft
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    61
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
    62
We can enable the pager on summary:
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    63
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
    64
  $ 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
    65
  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
    66
  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
    67
  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
    68
  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
    69
  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
    70
  paged! 'phases: 11 draft\n'
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    71
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    72
  $ hg --config pager.attend-diff=no diff -c 2
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    73
  diff -r f4be7687d414 -r bce265549556 a
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    74
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    75
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    76
  @@ -1,2 +1,3 @@
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    77
   a
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    78
   a 1
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    79
  +a 2
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    80
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
    81
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
    82
  $ 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
    83
  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
    84
  --- 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
    85
  +++ 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
    86
  @@ -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
    87
   a
e83302d43748 pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents: 31405
diff changeset
    88
   a 1
e83302d43748 pager: if old pager extensions is enabled, respect pager.attend
Martin von Zweigbergk <martinvonz@google.com>
parents: 31405
diff changeset
    89
  +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
    90
28319
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    91
If 'log' is in attend, then 'history' should also be paged:
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    92
  $ hg history --limit 2 --config pager.attend=log
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    93
  paged! 'changeset:   10:46106edeeb38\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    94
  paged! 'tag:         tip\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    95
  paged! 'user:        test\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    96
  paged! 'date:        Thu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    97
  paged! 'summary:     modify a 10\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    98
  paged! '\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
    99
  paged! 'changeset:   9:6dd8ea7dd621\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
   100
  paged! 'user:        test\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
   101
  paged! 'date:        Thu Jan 01 00:00:00 1970 +0000\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
   102
  paged! 'summary:     modify a 9\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
   103
  paged! '\n'
09222d39fa34 pager: add tests
Augie Fackler <augie@google.com>
parents:
diff changeset
   104
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
   105
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
   106
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
   107
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
  $ 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
   109
  >   --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
   110
  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
   111
  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
   112
  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
   113
  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
   114
  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
   115
  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
   116
  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
   117
  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
   118
  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
   119
  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
   120
  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
   121
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
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
   123
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
   124
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
  $ 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
   126
  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
   127
  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
   128
  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
   129
  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
   130
  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
   131
  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
   132
  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
   133
  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
   134
  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
   135
  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
   136
  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
   137
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
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
   139
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
   140
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
  $ 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
   142
  > --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
   143
  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
   144
  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
   145
  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
   146
  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
   147
  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
   148
  
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
  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
   150
  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
   151
  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
   152
  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
   153
  
30847
e12553cfd0a4 pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents: 29344
diff changeset
   154
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
   155
e12553cfd0a4 pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents: 29344
diff changeset
   156
  $ 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
   157
  10:46106edeeb38
e12553cfd0a4 pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents: 29344
diff changeset
   158
28531
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   159
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
   160
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
   161
  $ cat >> $HGRCPATH <<EOF
32025
d323d9e0d7b4 pager: stop using the color extension in tests
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31406
diff changeset
   162
  > [ui]
32103
9a98023ac8db color: special case 'always' in 'ui.color'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32102
diff changeset
   163
  > color = always
28531
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   164
  > [color]
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   165
  > mode = ansi
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   166
  > EOF
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   167
  $ hg log --limit 3
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   168
  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
   169
  paged! 'tag:         tip\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   170
  paged! 'user:        test\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   171
  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
   172
  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
   173
  paged! '\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   174
  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
   175
  paged! 'user:        test\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   176
  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
   177
  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
   178
  paged! '\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   179
  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
   180
  paged! 'user:        test\n'
fe79a5821e5a test-pager: add a test for pager with color enabled
Augie Fackler <augie@google.com>
parents: 28319
diff changeset
   181
  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
   182
  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
   183
  paged! '\n'
29132
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
   184
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
   185
Pager works with shell aliases.
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
   186
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
   187
  $ cat >> $HGRCPATH <<EOF
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
   188
  > [alias]
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
   189
  > echoa = !echo a
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
   190
  > EOF
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
   191
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
   192
  $ hg echoa
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
   193
  a
12769703d4ba dispatch: always load extensions before running shell aliases (issue5230)
Jun Wu <quark@fb.com>
parents: 28531
diff changeset
   194
  $ 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
   195
  paged! 'a\n'
29343
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
   196
34918
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   197
Pager attributes should be copied to mq repo. Otherwise pager would be started
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   198
twice and color mode would be lost.
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   199
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   200
  $ cat >> $HGRCPATH <<EOF
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   201
  > [extensions]
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   202
  > mq =
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   203
  > EOF
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   204
  $ hg init --mq
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   205
  $ hg qnew foo.patch
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   206
  $ hg qpop
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   207
  popping foo.patch
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   208
  patch queue now empty
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   209
  $ hg ci --mq -m 'commit patches'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   210
  $ hg log --mq --debug
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   211
  starting pager for command 'extension-via-attend-log'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   212
  paged! '\x1b[0;33mchangeset:   0:6cc2ded15503e368aaf76b6cc3d12f320c9e3b87\x1b[0m\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   213
  paged! 'tag:         tip\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   214
  paged! 'phase:       draft\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   215
  paged! 'parent:      -1:0000000000000000000000000000000000000000\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   216
  paged! 'parent:      -1:0000000000000000000000000000000000000000\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   217
  paged! 'manifest:    0:4980de1ae1b612014d5bcfa9507da84ce8891daa\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   218
  paged! 'user:        test\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   219
  paged! 'date:        Thu Jan 01 00:00:00 1970 +0000\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   220
  paged! 'files+:      .hgignore foo.patch series\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   221
  paged! 'extra:       branch=default\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   222
  paged! 'description:\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   223
  paged! 'commit patches\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   224
  paged! '\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   225
  paged! '\n'
274811627808 mq: copy pager attributes back to qrepo.ui
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   226
29343
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
   227
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
   228
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
   229
  $ cat >> $HGRCPATH <<'EOF'
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
   230
  > [alias]
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
   231
  > 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
   232
  > EOF
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
   233
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
   234
  $ 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
   235
  paged! '1\n'
e095b9e753f7 tests: move chg pager test to test-pager.t
Jun Wu <quark@fb.com>
parents: 29132
diff changeset
   236
  $ 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
   237
  paged! '2\n'
29344
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   238
30942
65a3b4d67a65 pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents: 30847
diff changeset
   239
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
   240
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
   241
  $ 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
   242
  2
65a3b4d67a65 pager: add a test of --pager=no functionality
Augie Fackler <augie@google.com>
parents: 30847
diff changeset
   243
29344
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   244
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
   245
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   246
  $ cat >> $TESTTMP/fortytwo.py <<'EOF'
40369
ef6cab7930b3 py3: fix module imports in tests, as flagged by test-check-module-imports.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 39707
diff changeset
   247
  > from mercurial import commands, registrar
29344
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   248
  > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 32103
diff changeset
   249
  > command = registrar.command(cmdtable)
38362
e53879421ecd py3: add couple of missing b'' prefixes in tests/test-pager-legacy.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34918
diff changeset
   250
  > @command(b'fortytwo', [], b'fortytwo', norepo=True)
29344
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   251
  > def fortytwo(ui, *opts):
38362
e53879421ecd py3: add couple of missing b'' prefixes in tests/test-pager-legacy.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34918
diff changeset
   252
  >     ui.write(b'42\n')
29344
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   253
  >     return 42
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   254
  > EOF
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   255
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   256
  $ cat >> $HGRCPATH <<'EOF'
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   257
  > [extensions]
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   258
  > fortytwo = $TESTTMP/fortytwo.py
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   259
  > EOF
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   260
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   261
  $ hg fortytwo --pager=on
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   262
  paged! '42\n'
bb3d5c20eaf6 chg: exec pager in child process
Jun Wu <quark@fb.com>
parents: 29343
diff changeset
   263
  [42]