annotate tests/test-progress.t @ 21859:be4270d27a7e

progress: use 'encoding.trim' to trim output line correctly Before this patch, 'progress' extension trims output line by directly slicing byte sequence, but it may split at intermediate multi-byte sequence. This patch uses 'encoding.trim' to trim output line correctly, even if it contains multi-byte characters. "rm -f loop.pyc" before changing "loop.py" in "test-progress.t" ensures that re-compilation of "loop.py", even if "loop.py" and "loop.pyc" have same timestamp in seconds.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 06 Jul 2014 02:56:41 +0900
parents 26d2fb899637
children e382cf9ec30b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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
21254
51e5c793a9f4 tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19619
diff changeset
3 > from mercurial import cmdutil, commands
19619
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
4 > import time
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 = {}
51e5c793a9f4 tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19619
diff changeset
7 > command = cmdutil.command(cmdtable)
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 >
21254
51e5c793a9f4 tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19619
diff changeset
17 > @command('loop',
51e5c793a9f4 tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19619
diff changeset
18 > [('', 'total', '', 'override for total'),
51e5c793a9f4 tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19619
diff changeset
19 > ('', 'nested', False, 'show nested results'),
51e5c793a9f4 tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19619
diff changeset
20 > ('', 'parallel', False, 'show parallel sets of results')],
21773
26d2fb899637 tests: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 21254
diff changeset
21 > 'hg loop LOOPS',
26d2fb899637 tests: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 21254
diff changeset
22 > norepo=True)
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
23 > def loop(ui, loops, **opts):
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
24 > loops = int(loops)
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
25 > total = None
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
26 > if loops >= 0:
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
27 > total = loops
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
28 > if opts.get('total', None):
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
29 > 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
30 > nested = False
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
31 > 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
32 > nested = True
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
33 > loops = abs(loops)
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
34 >
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
35 > for i in range(loops):
21859
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
36 > ui.progress(topiclabel, i, 'loop.%d' % i, 'loopnum', total)
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
37 > if opts.get('parallel'):
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
38 > ui.progress('other', i, 'other.%d' % i, 'othernum', total)
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
39 > 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
40 > 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
41 > 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
42 > nested_steps = 5
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
43 > for j in range(nested_steps):
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
44 > ui.progress(
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
45 > 'nested', j, 'nested.%d' % j, 'nestnum', nested_steps)
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
46 > ui.progress(
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
47 > 'nested', None, 'nested.done', 'nestnum', nested_steps)
21859
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
48 > ui.progress(topiclabel, None, 'loop.done', 'loopnum', total)
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
49 >
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
50 > topiclabel = 'loop'
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
51 >
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
52 > EOF
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
53
15372
695ac6aca77f check-code: fix issues with finding patterns in unified tests, fix tests
Matt Mackall <mpm@selenic.com>
parents: 14838
diff changeset
54 $ cp $HGRCPATH $HGRCPATH.orig
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
55 $ echo "[extensions]" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
56 $ echo "progress=" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
57 $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
58 $ echo "[progress]" >> $HGRCPATH
16675
f29f187ee73d test-progress: fix whitespace typo
Martin Geisler <mg@lazybytes.net>
parents: 16350
diff changeset
59 $ echo "format = topic bar number" >> $HGRCPATH
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
60 $ echo "assume-tty=1" >> $HGRCPATH
13142
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
61 $ echo "width=60" >> $HGRCPATH
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
62
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
63 test default params, display nothing because of delay
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
64
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
65 $ hg -y loop 3
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
66 $ echo "delay=0" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
67 $ echo "refresh=0" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
68
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
69 test with delay=0, refresh=0
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
70
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
71 $ 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
72 \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
73 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
74 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
75 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
76 \r (no-eol) (esc)
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
77
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
78
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
79 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
80
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
81 $ 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
82 \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 [ ] 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
84 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
85 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
86 \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
87
19619
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
88 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
89 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
90 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
91 finishes.
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
92
4694ccd5d994 progress: stop getting stuck in a nested topic during a long inner step
Augie Fackler <raf@durin42.com>
parents: 19229
diff changeset
93 $ 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
94 \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
95 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
96 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
97 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
98 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
99 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
100 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
101 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
102 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
103 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
104 \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
105
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
106
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
107 $ 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
108 \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
109 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
110 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
111 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
112 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
113 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
114 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
115 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
116 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
117 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
118 \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
119
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
120
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
121 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
122 --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
123 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
124 $ 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
125 \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 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
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 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
129 \r (no-eol) (esc)
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
130 test refresh is taken in account
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
131
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
132 $ hg -y --config progress.refresh=100 loop 3
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
133
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
134 test format options 1
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
135
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
136 $ 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
137 \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
138 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
139 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
140 \r (no-eol) (esc)
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
141
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
142 test format options 2
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
143
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
144 $ 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
145 \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
146 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
147 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
148 \r (no-eol) (esc)
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
149
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
150 test format options and indeterminate progress
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
151
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
152 $ 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
153 \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 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
155 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
156 \r (no-eol) (esc)
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
157
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
158 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
159
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
160 $ 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
161 \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 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
163 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
164 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
165 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
166 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
167 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
168 \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
169
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
170 test immediate progress completion
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
171
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
172 $ hg -y loop 0
13145
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
173
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
174 test delay time estimates
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
175
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
176 $ cat > mocktime.py <<EOF
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
177 > import os
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
178 > import time
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
179 >
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
180 > class mocktime(object):
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
181 > def __init__(self, increment):
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
182 > self.time = 0
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
183 > self.increment = increment
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
184 > def __call__(self):
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
185 > self.time += self.increment
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
186 > return self.time
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
187 >
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
188 > def uisetup(ui):
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
189 > time.time = mocktime(int(os.environ.get('MOCKTIME', '11')))
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
190 > EOF
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
191
15372
695ac6aca77f check-code: fix issues with finding patterns in unified tests, fix tests
Matt Mackall <mpm@selenic.com>
parents: 14838
diff changeset
192 $ 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
193 $ echo "[extensions]" >> $HGRCPATH
13145
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
194 $ echo "mocktime=`pwd`/mocktime.py" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
195 $ echo "progress=" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
196 $ 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
197 $ echo "[progress]" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
198 $ echo "assume-tty=1" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
199 $ echo "delay=25" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
200 $ echo "width=60" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
201
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
202 $ hg -y loop 8
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 16675
diff changeset
203 \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
204 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
205 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
206 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
207 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
208 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
209 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
210 \r (no-eol) (esc)
13145
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
211
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
212 $ 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
213 \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
214 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
215 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
216 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
217 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
218 \r (no-eol) (esc)
13145
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
219
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
220 $ 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
221 \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
222 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
223 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
224 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
225 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
226 \r (no-eol) (esc)
13236
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
227
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
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 $ 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
230 \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
231 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
232 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
233 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
234 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
235 \r (no-eol) (esc)
13236
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
236
13154
e11c14f14491 progress: don't compute estimate without a total
Augie Fackler <durin42@gmail.com>
parents: 13149
diff changeset
237 Time estimates should not fail when there's no end point:
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
238 $ 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
239 \r (no-eol) (esc)
19229
41e39a0299cb blackbox: fix recording exit codes (issue3938)
Durham Goode <durham@fb.com>
parents: 18670
diff changeset
240 loop [ <=> ] 2\r (no-eol) (esc)
41e39a0299cb blackbox: fix recording exit codes (issue3938)
Durham Goode <durham@fb.com>
parents: 18670
diff changeset
241 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
242 \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
243
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
244 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
245 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
246 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
247
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
248 $ 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
249 $ cat >> $HGRCPATH <<EOF
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
250 > [extensions]
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
251 > progress=
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
252 > 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
253 > [progress]
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
254 > assume-tty = 1
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
255 > delay = 0
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
256 > refresh = 0
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
257 > EOF
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
258
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
259 $ 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
260 $ 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
261 > # 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
262 > # 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
263 > 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
264 > EOF
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
265
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
266 $ cat >> $HGRCPATH <<EOF
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
267 > [progress]
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
268 > format = topic number
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
269 > width= 12
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
270 > EOF
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
271
be4270d27a7e progress: use 'encoding.trim' to trim output line correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21773
diff changeset
272 $ 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
273 \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
274 \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
275 \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
276 \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
277 \r (no-eol) (esc)