tests/test-progress.t
author pacien <pacien.trangirard@pacien.net>
Thu, 22 Sep 2022 16:09:53 +0200
changeset 49499 4f36738a869a
parent 48876 42d2b31cee0b
permissions -rw-r--r--
tests: fix http-bad-server expected errors for python 3.10 (issue6643) The format of the error message changed with this version of Python. This also removes obsolete Python 3 checks.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
     2
  $ cat > loop.py <<EOF
33984
a37417e30a1f tests: update test-progress to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33624
diff changeset
     3
  > import time
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 28881
diff changeset
     4
  > from mercurial import commands, registrar
21254
51e5c793a9f4 tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19619
diff changeset
     5
  > 
51e5c793a9f4 tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19619
diff changeset
     6
  > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 28881
diff changeset
     7
  > command = registrar.command(cmdtable)
21254
51e5c793a9f4 tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19619
diff changeset
     8
  > 
19619
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
     9
  > class incrementingtime(object):
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
    10
  >     def __init__(self):
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
    11
  >         self._time = 0.0
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
    12
  >     def __call__(self):
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
    13
  >         self._time += 0.25
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
    14
  >         return self._time
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
    15
  > time.time = incrementingtime()
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    16
  > 
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 32337
diff changeset
    17
  > @command(b'loop',
38076
34592dd3bfa2 py3: add b'' prefixes in tests/test-progress.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34316
diff changeset
    18
  >     [(b'', b'total', b'', b'override for total'),
34592dd3bfa2 py3: add b'' prefixes in tests/test-progress.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34316
diff changeset
    19
  >     (b'', b'nested', False, b'show nested results'),
45025
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
    20
  >     (b'', b'parallel', False, b'show parallel sets of results'),
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
    21
  >     (b'', b'warn', False, b'show warning if step divisible by 3')],
38076
34592dd3bfa2 py3: add b'' prefixes in tests/test-progress.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34316
diff changeset
    22
  >     b'hg loop LOOPS',
21773
26d2fb899637 tests: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 21254
diff changeset
    23
  >     norepo=True)
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    24
  > def loop(ui, loops, **opts):
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    25
  >     loops = int(loops)
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    26
  >     total = None
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    27
  >     if loops >= 0:
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    28
  >         total = loops
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    29
  >     if opts.get('total', None):
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    30
  >         total = int(opts.get('total'))
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
    31
  >     nested = False
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
    32
  >     if opts.get('nested', None):
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
    33
  >         nested = True
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    34
  >     loops = abs(loops)
45025
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
    35
  >     showwarn = opts.get('warn', False)
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    36
  > 
40222
af5e2b23040a py3: add b'' prefixes in tests/test-progress.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38411
diff changeset
    37
  >     progress = ui.makeprogress(topiclabel, unit=b'loopnum', total=total)
af5e2b23040a py3: add b'' prefixes in tests/test-progress.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38411
diff changeset
    38
  >     other = ui.makeprogress(b'other', unit=b'othernum', total=total)
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    39
  >     for i in range(loops):
38411
26523316e4d0 tests: use progress helper
Martin von Zweigbergk <martinvonz@google.com>
parents: 38076
diff changeset
    40
  >         progress.update(i, item=getloopitem(i))
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
    41
  >         if opts.get('parallel'):
40222
af5e2b23040a py3: add b'' prefixes in tests/test-progress.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38411
diff changeset
    42
  >             other.update(i, item=b'other.%d' % i)
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
    43
  >         if nested:
19619
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
    44
  >             nested_steps = 2
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
    45
  >             if i and i % 4 == 0:
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
    46
  >                 nested_steps = 5
40222
af5e2b23040a py3: add b'' prefixes in tests/test-progress.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38411
diff changeset
    47
  >             nested = ui.makeprogress(b'nested', unit=b'nestnum',
38411
26523316e4d0 tests: use progress helper
Martin von Zweigbergk <martinvonz@google.com>
parents: 38076
diff changeset
    48
  >                                      total=nested_steps)
19619
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
    49
  >             for j in range(nested_steps):
40222
af5e2b23040a py3: add b'' prefixes in tests/test-progress.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38411
diff changeset
    50
  >                 nested.update(j, item=b'nested.%d' % j)
38411
26523316e4d0 tests: use progress helper
Martin von Zweigbergk <martinvonz@google.com>
parents: 38076
diff changeset
    51
  >             nested.complete()
45025
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
    52
  >         if showwarn and i % 3 == 0:
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
    53
  >             ui.warn(b'reached step %d\n' %i)
38411
26523316e4d0 tests: use progress helper
Martin von Zweigbergk <martinvonz@google.com>
parents: 38076
diff changeset
    54
  >     progress.complete()
21859
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
    55
  > 
40222
af5e2b23040a py3: add b'' prefixes in tests/test-progress.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38411
diff changeset
    56
  > topiclabel = b'loop'
21862
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
    57
  > def getloopitem(i):
40222
af5e2b23040a py3: add b'' prefixes in tests/test-progress.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38411
diff changeset
    58
  >     return b'loop.%d' % i
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    59
  > 
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    60
  > EOF
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    61
15372
695ac6aca77f check-code: fix issues with finding patterns in unified tests, fix tests
Matt Mackall <mpm@selenic.com>
parents: 14838
diff changeset
    62
  $ cp $HGRCPATH $HGRCPATH.orig
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    63
  $ echo "[extensions]" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    64
  $ echo "progress=" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    65
  $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    66
  $ echo "[progress]" >> $HGRCPATH
16675
f29f187ee73d test-progress: fix whitespace typo
Martin Geisler <mg@lazybytes.net>
parents: 16350
diff changeset
    67
  $ echo "format = topic bar number" >> $HGRCPATH
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    68
  $ echo "assume-tty=1" >> $HGRCPATH
13142
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
    69
  $ echo "width=60" >> $HGRCPATH
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    70
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    71
test default params, display nothing because of delay
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    72
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
    73
  $ hg -y loop 3
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    74
  $ echo "delay=0" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    75
  $ echo "refresh=0" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    76
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
    77
test with delay=0, refresh=0
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    78
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
    79
  $ hg -y loop 3
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
    80
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
    81
  loop [                                                ] 0/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
    82
  loop [===============>                                ] 1/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
    83
  loop [===============================>                ] 2/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
    84
                                                              \r (no-eol) (esc)
25581
79c75459321e progress: respect ui.quiet (issue4726)
Augie Fackler <augie@google.com>
parents: 23139
diff changeset
    85
no progress with --quiet
79c75459321e progress: respect ui.quiet (issue4726)
Augie Fackler <augie@google.com>
parents: 23139
diff changeset
    86
  $ hg -y loop 3 --quiet
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
    87
28171
2d20d1d2ea76 progress: display progress bar when HGPLAINEXCEPT contains "progress"
Matt Anderson <andersonmat@fb.com>
parents: 25581
diff changeset
    88
test plain mode exception
2d20d1d2ea76 progress: display progress bar when HGPLAINEXCEPT contains "progress"
Matt Anderson <andersonmat@fb.com>
parents: 25581
diff changeset
    89
  $ HGPLAINEXCEPT=progress hg -y loop 1
2d20d1d2ea76 progress: display progress bar when HGPLAINEXCEPT contains "progress"
Matt Anderson <andersonmat@fb.com>
parents: 25581
diff changeset
    90
  \r (no-eol) (esc)
2d20d1d2ea76 progress: display progress bar when HGPLAINEXCEPT contains "progress"
Matt Anderson <andersonmat@fb.com>
parents: 25581
diff changeset
    91
  loop [                                                ] 0/1\r (no-eol) (esc)
2d20d1d2ea76 progress: display progress bar when HGPLAINEXCEPT contains "progress"
Matt Anderson <andersonmat@fb.com>
parents: 25581
diff changeset
    92
                                                              \r (no-eol) (esc)
2d20d1d2ea76 progress: display progress bar when HGPLAINEXCEPT contains "progress"
Matt Anderson <andersonmat@fb.com>
parents: 25581
diff changeset
    93
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
    94
test nested short-lived topics (which shouldn't display with nestdelay):
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
    95
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
    96
  $ hg -y loop 3 --nested
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
    97
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
    98
  loop [                                                ] 0/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
    99
  loop [===============>                                ] 1/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   100
  loop [===============================>                ] 2/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   101
                                                              \r (no-eol) (esc)
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
   102
19619
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   103
Test nested long-lived topic which has the same name as a short-lived
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   104
peer. We shouldn't get stuck showing the short-lived inner steps, and
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   105
should go back to skipping the inner steps when the slow nested step
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   106
finishes.
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   107
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   108
  $ hg -y loop 7 --nested
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   109
  \r (no-eol) (esc)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   110
  loop [                                                ] 0/7\r (no-eol) (esc)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   111
  loop [=====>                                          ] 1/7\r (no-eol) (esc)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   112
  loop [============>                                   ] 2/7\r (no-eol) (esc)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   113
  loop [===================>                            ] 3/7\r (no-eol) (esc)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   114
  loop [==========================>                     ] 4/7\r (no-eol) (esc)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   115
  nested [==========================>                   ] 3/5\r (no-eol) (esc)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   116
  nested [===================================>          ] 4/5\r (no-eol) (esc)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   117
  loop [=================================>              ] 5/7\r (no-eol) (esc)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   118
  loop [========================================>       ] 6/7\r (no-eol) (esc)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   119
                                                              \r (no-eol) (esc)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
   120
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
   121
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   122
  $ hg --config progress.changedelay=0 -y loop 3 --nested
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   123
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   124
  loop [                                                ] 0/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   125
  nested [                                              ] 0/2\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   126
  nested [======================>                       ] 1/2\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   127
  loop [===============>                                ] 1/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   128
  nested [                                              ] 0/2\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   129
  nested [======================>                       ] 1/2\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   130
  loop [===============================>                ] 2/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   131
  nested [                                              ] 0/2\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   132
  nested [======================>                       ] 1/2\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   133
                                                              \r (no-eol) (esc)
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
   134
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
   135
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
   136
test two topics being printed in parallel (as when we're doing a local
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
   137
--pull clone, where you get the unbundle and bundle progress at the
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
   138
same time):
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   139
  $ hg loop 3 --parallel
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   140
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   141
  loop [                                                ] 0/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   142
  loop [===============>                                ] 1/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   143
  loop [===============================>                ] 2/3\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   144
                                                              \r (no-eol) (esc)
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
   145
test refresh is taken in account
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   146
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   147
  $ hg -y --config progress.refresh=100 loop 3
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
   148
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
   149
test format options 1
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   150
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   151
  $ hg -y --config 'progress.format=number topic item+2' loop 2
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   152
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   153
  0/2 loop lo\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   154
  1/2 loop lo\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   155
                                                              \r (no-eol) (esc)
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   156
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
   157
test format options 2
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   158
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   159
  $ hg -y --config 'progress.format=number item-3 bar' loop 2
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   160
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   161
  0/2 p.0 [                                                 ]\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   162
  1/2 p.1 [=======================>                         ]\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   163
                                                              \r (no-eol) (esc)
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   164
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
   165
test format options and indeterminate progress
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   166
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   167
  $ hg -y --config 'progress.format=number item bar' loop -- -2
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   168
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   169
  0 loop.0               [ <=>                              ]\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   170
  1 loop.1               [  <=>                             ]\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   171
                                                              \r (no-eol) (esc)
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   172
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
   173
make sure things don't fall over if count > total
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   174
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   175
  $ hg -y loop --total 4 6
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   176
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   177
  loop [                                                ] 0/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   178
  loop [===========>                                    ] 1/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   179
  loop [=======================>                        ] 2/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   180
  loop [===================================>            ] 3/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   181
  loop [===============================================>] 4/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   182
  loop [ <=>                                            ] 5/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   183
                                                              \r (no-eol) (esc)
10891
83af68e38be3 progress: fall back to indeterminate progress if position is >= total
Augie Fackler <durin42@gmail.com>
parents: 10788
diff changeset
   184
45025
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   185
test interaction with ui.warn
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   186
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   187
  $ hg loop --warn 6
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   188
  \r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   189
  loop [                                                ] 0/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   190
                                                              \r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   191
  reached step 0
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   192
  \r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   193
  loop [=======>                                        ] 1/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   194
  loop [===============>                                ] 2/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   195
  loop [=======================>                        ] 3/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   196
                                                              \r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   197
  reached step 3
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   198
  \r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   199
  loop [===============================>                ] 4/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   200
  loop [=======================================>        ] 5/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   201
                                                              \r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   202
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   203
test interaction with ui.timestamp-output
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   204
46074
31ecf715efe2 tests: conditionalize the progress timestamp for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 45025
diff changeset
   205
XXX: The timestamp on Windows with py2 hg is in 1970, and py3 hg is now.  But
31ecf715efe2 tests: conditionalize the progress timestamp for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 45025
diff changeset
   206
the py2/py3 checks here test the test runner, not the binary.  The Windows lines
31ecf715efe2 tests: conditionalize the progress timestamp for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 45025
diff changeset
   207
can be dropped when switching to py3-only.
31ecf715efe2 tests: conditionalize the progress timestamp for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 45025
diff changeset
   208
45025
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   209
  $ hg loop --warn --config ui.timestamp-output=true 6
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   210
  \r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   211
  loop [                                                ] 0/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   212
                                                              \r (no-eol) (esc)
46074
31ecf715efe2 tests: conditionalize the progress timestamp for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 45025
diff changeset
   213
  [*T*] reached step 0 (glob) (windows !)
31ecf715efe2 tests: conditionalize the progress timestamp for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 45025
diff changeset
   214
  \[20[2-9][0-9]-[01][0-9]-[0-3][0-9]T[0-5][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]\] reached step 0 (re) (no-windows !)
45025
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   215
  \r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   216
  loop [=======>                                        ] 1/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   217
  loop [===============>                                ] 2/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   218
  loop [=======================>                        ] 3/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   219
                                                              \r (no-eol) (esc)
46074
31ecf715efe2 tests: conditionalize the progress timestamp for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 45025
diff changeset
   220
  [*T*] reached step 3 (glob) (windows !)
31ecf715efe2 tests: conditionalize the progress timestamp for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 45025
diff changeset
   221
  \[20[2-9][0-9]-[01][0-9]-[0-3][0-9]T[0-5][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]\] reached step 3 (re) (no-windows !)
45025
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   222
  \r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   223
  loop [===============================>                ] 4/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   224
  loop [=======================================>        ] 5/6\r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   225
                                                              \r (no-eol) (esc)
24b1a8eb73aa ui: add option to timestamp status and diagnostic messages
Joerg Sonnenberger <joerg@bec.de>
parents: 40222
diff changeset
   226
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
   227
test immediate progress completion
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
   228
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   229
  $ hg -y loop 0
13145
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   230
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   231
test delay time estimates
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   232
28881
d9f7f590f1e3 test-progress: disable mocking-time tests on chg
Yuya Nishihara <yuya@tcha.org>
parents: 28171
diff changeset
   233
#if no-chg
d9f7f590f1e3 test-progress: disable mocking-time tests on chg
Yuya Nishihara <yuya@tcha.org>
parents: 28171
diff changeset
   234
15372
695ac6aca77f check-code: fix issues with finding patterns in unified tests, fix tests
Matt Mackall <mpm@selenic.com>
parents: 14838
diff changeset
   235
  $ cp $HGRCPATH.orig $HGRCPATH
695ac6aca77f check-code: fix issues with finding patterns in unified tests, fix tests
Matt Mackall <mpm@selenic.com>
parents: 14838
diff changeset
   236
  $ echo "[extensions]" >> $HGRCPATH
34316
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents: 34314
diff changeset
   237
  $ echo "mocktime=$TESTDIR/mocktime.py" >> $HGRCPATH
13145
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   238
  $ echo "progress=" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   239
  $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   240
  $ echo "[progress]" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   241
  $ echo "assume-tty=1" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   242
  $ echo "delay=25" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   243
  $ echo "width=60" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   244
34316
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents: 34314
diff changeset
   245
  $ MOCKTIME=11 hg -y loop 8
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   246
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   247
  loop [=========>                                ] 2/8 1m07s\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   248
  loop [===============>                            ] 3/8 56s\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   249
  loop [=====================>                      ] 4/8 45s\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   250
  loop [==========================>                 ] 5/8 34s\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   251
  loop [================================>           ] 6/8 23s\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   252
  loop [=====================================>      ] 7/8 12s\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   253
                                                              \r (no-eol) (esc)
13145
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   254
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   255
  $ MOCKTIME=10000 hg -y loop 4
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   256
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   257
  loop [                                                ] 0/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   258
  loop [=========>                                ] 1/4 8h21m\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   259
  loop [====================>                     ] 2/4 5h34m\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   260
  loop [==============================>           ] 3/4 2h47m\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   261
                                                              \r (no-eol) (esc)
13145
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
   262
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   263
  $ MOCKTIME=1000000 hg -y loop 4
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   264
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   265
  loop [                                                ] 0/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   266
  loop [=========>                                ] 1/4 5w00d\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   267
  loop [====================>                     ] 2/4 3w03d\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   268
  loop [=============================>           ] 3/4 11d14h\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   269
                                                              \r (no-eol) (esc)
13236
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
   270
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
   271
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   272
  $ MOCKTIME=14000000 hg -y loop 4
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   273
  \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   274
  loop [                                                ] 0/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   275
  loop [=========>                                ] 1/4 1y18w\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   276
  loop [===================>                     ] 2/4 46w03d\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   277
  loop [=============================>           ] 3/4 23w02d\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   278
                                                              \r (no-eol) (esc)
13236
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
   279
34312
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   280
Non-linear progress:
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   281
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   282
  $ MOCKTIME='20 20 20 20 20 20 20 20 20 20 500 500 500 500 500 20 20 20 20 20' hg -y loop 20
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   283
  \r (no-eol) (esc)
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   284
  loop [=>                                      ]  1/20 6m21s\r (no-eol) (esc)
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   285
  loop [===>                                    ]  2/20 6m01s\r (no-eol) (esc)
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   286
  loop [=====>                                  ]  3/20 5m41s\r (no-eol) (esc)
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   287
  loop [=======>                                ]  4/20 5m21s\r (no-eol) (esc)
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   288
  loop [=========>                              ]  5/20 5m01s\r (no-eol) (esc)
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   289
  loop [===========>                            ]  6/20 4m41s\r (no-eol) (esc)
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   290
  loop [=============>                          ]  7/20 4m21s\r (no-eol) (esc)
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   291
  loop [===============>                        ]  8/20 4m01s\r (no-eol) (esc)
34314
a667f0ca1d5f progress: make ETA only consider progress made in the last minute
Jun Wu <quark@fb.com>
parents: 34312
diff changeset
   292
  loop [================>                      ]  9/20 25m40s\r (no-eol) (esc)
a667f0ca1d5f progress: make ETA only consider progress made in the last minute
Jun Wu <quark@fb.com>
parents: 34312
diff changeset
   293
  loop [===================>                    ] 10/20 1h06m\r (no-eol) (esc)
a667f0ca1d5f progress: make ETA only consider progress made in the last minute
Jun Wu <quark@fb.com>
parents: 34312
diff changeset
   294
  loop [=====================>                  ] 11/20 1h13m\r (no-eol) (esc)
a667f0ca1d5f progress: make ETA only consider progress made in the last minute
Jun Wu <quark@fb.com>
parents: 34312
diff changeset
   295
  loop [=======================>                ] 12/20 1h07m\r (no-eol) (esc)
a667f0ca1d5f progress: make ETA only consider progress made in the last minute
Jun Wu <quark@fb.com>
parents: 34312
diff changeset
   296
  loop [========================>              ] 13/20 58m19s\r (no-eol) (esc)
a667f0ca1d5f progress: make ETA only consider progress made in the last minute
Jun Wu <quark@fb.com>
parents: 34312
diff changeset
   297
  loop [===========================>            ] 14/20 7m09s\r (no-eol) (esc)
a667f0ca1d5f progress: make ETA only consider progress made in the last minute
Jun Wu <quark@fb.com>
parents: 34312
diff changeset
   298
  loop [=============================>          ] 15/20 3m38s\r (no-eol) (esc)
a667f0ca1d5f progress: make ETA only consider progress made in the last minute
Jun Wu <quark@fb.com>
parents: 34312
diff changeset
   299
  loop [===============================>        ] 16/20 2m15s\r (no-eol) (esc)
a667f0ca1d5f progress: make ETA only consider progress made in the last minute
Jun Wu <quark@fb.com>
parents: 34312
diff changeset
   300
  loop [=================================>      ] 17/20 1m27s\r (no-eol) (esc)
a667f0ca1d5f progress: make ETA only consider progress made in the last minute
Jun Wu <quark@fb.com>
parents: 34312
diff changeset
   301
  loop [====================================>     ] 18/20 52s\r (no-eol) (esc)
a667f0ca1d5f progress: make ETA only consider progress made in the last minute
Jun Wu <quark@fb.com>
parents: 34312
diff changeset
   302
  loop [======================================>   ] 19/20 25s\r (no-eol) (esc)
34312
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   303
                                                              \r (no-eol) (esc)
d64c2c050b54 progress: demonstrate non-linear progress has a bad ETA experience
Jun Wu <quark@fb.com>
parents: 33984
diff changeset
   304
13154
e11c14f14491 progress: don't compute estimate without a total
Augie Fackler <durin42@gmail.com>
parents: 13149
diff changeset
   305
Time estimates should not fail when there's no end point:
34316
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents: 34314
diff changeset
   306
  $ MOCKTIME=11 hg -y loop -- -4
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   307
  \r (no-eol) (esc)
19229
41e39a0299cb blackbox: fix recording exit codes (issue3938)
Durham Goode <durham@fb.com>
parents: 18670
diff changeset
   308
  loop [ <=>                                              ] 2\r (no-eol) (esc)
41e39a0299cb blackbox: fix recording exit codes (issue3938)
Durham Goode <durham@fb.com>
parents: 18670
diff changeset
   309
  loop [  <=>                                             ] 3\r (no-eol) (esc)
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
   310
                                                              \r (no-eol) (esc)
21859
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   311
28881
d9f7f590f1e3 test-progress: disable mocking-time tests on chg
Yuya Nishihara <yuya@tcha.org>
parents: 28171
diff changeset
   312
#endif
d9f7f590f1e3 test-progress: disable mocking-time tests on chg
Yuya Nishihara <yuya@tcha.org>
parents: 28171
diff changeset
   313
21859
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   314
test line trimming by '[progress] width', when progress topic contains
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   315
multi-byte characters, of which length of byte sequence and columns in
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   316
display are different from each other.
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   317
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   318
  $ cp $HGRCPATH.orig $HGRCPATH
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   319
  $ cat >> $HGRCPATH <<EOF
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   320
  > [extensions]
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   321
  > progress=
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   322
  > loop=`pwd`/loop.py
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   323
  > [progress]
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   324
  > assume-tty = 1
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   325
  > delay = 0
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   326
  > refresh = 0
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   327
  > EOF
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   328
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   329
  $ rm -f loop.pyc
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   330
  $ cat >> loop.py <<EOF
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   331
  > # use non-ascii characters as topic label of progress
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   332
  > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   333
  > topiclabel = u'\u3042\u3044\u3046\u3048'.encode('utf-8')
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   334
  > EOF
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   335
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   336
  $ cat >> $HGRCPATH <<EOF
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   337
  > [progress]
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   338
  > format = topic number
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   339
  > width= 12
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   340
  > EOF
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   341
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   342
  $ hg --encoding utf-8 -y loop --total 3 3
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   343
  \r (no-eol) (esc)
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   344
  \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 0/3\r (no-eol) (esc)
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   345
  \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 1/3\r (no-eol) (esc)
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   346
  \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 2/3\r (no-eol) (esc)
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
   347
              \r (no-eol) (esc)
21860
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   348
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   349
test calculation of bar width, when progress topic contains multi-byte
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   350
characters, of which length of byte sequence and columns in display
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   351
are different from each other.
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   352
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   353
  $ cat >> $HGRCPATH <<EOF
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   354
  > [progress]
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   355
  > format = topic bar
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   356
  > width= 21
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   357
  > # progwidth should be 9 (= 21 - (8+1) - 3)
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   358
  > EOF
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   359
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   360
  $ hg --encoding utf-8 -y loop --total 3 3
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   361
  \r (no-eol) (esc)
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   362
  \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 [         ]\r (no-eol) (esc)
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   363
  \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 [==>      ]\r (no-eol) (esc)
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   364
  \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 [=====>   ]\r (no-eol) (esc)
e382cf9ec30b progress: use 'encoding.colwidth' to get column width of output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21859
diff changeset
   365
                       \r (no-eol) (esc)
21862
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   366
23139
e53f6b72a0e4 spelling: fixes from proofreading of spell checker issues
Mads Kiilerich <madski@unity3d.com>
parents: 21863
diff changeset
   367
test trimming progress items, when they contain multi-byte characters,
21862
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   368
of which length of byte sequence and columns in display are different
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   369
from each other.
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   370
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   371
  $ rm -f loop.pyc
33624
b4793cc8e1c0 tests: clear __pycache__ for PyPy compatibility (issue5638) (issue5642)
Yuya Nishihara <yuya@tcha.org>
parents: 33097
diff changeset
   372
  $ rm -Rf __pycache__
21862
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   373
  $ cat >> loop.py <<EOF
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   374
  > # use non-ascii characters as loop items of progress
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   375
  > loopitems = [
21863
f9c91c638378 progress: use 'encoding.colwidth' to get column width of items correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21862
diff changeset
   376
  >     u'\u3042\u3044'.encode('utf-8'), # 2 x 2 = 4 columns
21862
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   377
  >     u'\u3042\u3044\u3046'.encode('utf-8'), # 2 x 3 = 6 columns
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   378
  >     u'\u3042\u3044\u3046\u3048'.encode('utf-8'), # 2 x 4 = 8 columns
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   379
  > ]
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   380
  > def getloopitem(i):
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   381
  >     return loopitems[i % len(loopitems)]
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   382
  > EOF
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   383
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   384
  $ cat >> $HGRCPATH <<EOF
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   385
  > [progress]
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   386
  > # trim at tail side
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   387
  > format = item+6
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   388
  > EOF
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   389
21863
f9c91c638378 progress: use 'encoding.colwidth' to get column width of items correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21862
diff changeset
   390
  $ hg --encoding utf-8 -y loop --total 3 3
21862
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   391
  \r (no-eol) (esc)
21863
f9c91c638378 progress: use 'encoding.colwidth' to get column width of items correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21862
diff changeset
   392
  \xe3\x81\x82\xe3\x81\x84  \r (no-eol) (esc)
21862
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   393
  \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\r (no-eol) (esc)
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   394
  \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\r (no-eol) (esc)
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   395
                       \r (no-eol) (esc)
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   396
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   397
  $ cat >> $HGRCPATH <<EOF
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   398
  > [progress]
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   399
  > # trim at left side
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   400
  > format = item-6
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   401
  > EOF
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   402
21863
f9c91c638378 progress: use 'encoding.colwidth' to get column width of items correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21862
diff changeset
   403
  $ hg --encoding utf-8 -y loop --total 3 3
21862
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   404
  \r (no-eol) (esc)
21863
f9c91c638378 progress: use 'encoding.colwidth' to get column width of items correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21862
diff changeset
   405
  \xe3\x81\x82\xe3\x81\x84  \r (no-eol) (esc)
21862
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   406
  \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\r (no-eol) (esc)
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   407
  \xe3\x81\x84\xe3\x81\x86\xe3\x81\x88\r (no-eol) (esc)
ba7f75e7f4e5 progress: use 'encoding.trim' to trim items in output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21860
diff changeset
   408
                       \r (no-eol) (esc)