Commit Graph

33 Commits

Author SHA1 Message Date
Jun Wu
53fcfd8fe0 test-patchbomb: use mocktime
The test was using system time for displaying ETAs, which could be flaky if
the sysload is high. This patch extracts mocktime.py from test-progress.t to
make sure test-patchbomb.t is unaffected by system time.

Differential Revision: https://phab.mercurial-scm.org/D844
2017-09-29 11:41:24 -07:00
Jun Wu
c1e9f8f474 progress: make ETA only consider progress made in the last minute
This patch limits the estimate time interval to roughly the last minute
(configurable by `estimateinterval`) to be more practical. See the test
change for why this is better.

.. feature:: Estimated time is more accurate with non-linear progress

Differential Revision: https://phab.mercurial-scm.org/D820
2017-09-27 15:14:59 -07:00
Jun Wu
c712efe446 progress: demonstrate non-linear progress has a bad ETA experience
Previously, the ETA and speed assumes the progress is linear. Often, due to
network or other issues, it could be fast for the most time, and suddenly
slow down:

    [====================================================>         ]
     \___________________________________________/\______/
        very fast                                  suddenly much slower

This patch adds a test demonstrating the ETA could be way off in those
cases.

Differential Revision: https://phab.mercurial-scm.org/D819
2017-09-26 12:48:15 -07:00
Augie Fackler
da58a4fdbf tests: update test-progress to pass our import checker 2017-08-22 16:59:12 -04:00
Yuya Nishihara
7e9483b814 tests: clear __pycache__ for PyPy compatibility (issue5638) (issue5642) 2017-08-02 22:04:02 +09:00
Pulkit Goyal
b4347ea80f py3: make sure commands name are bytes in tests 2017-06-25 08:20:05 +05:30
Yuya Nishihara
3e663dde68 registrar: move cmdutil.command to registrar module (API)
cmdutil.command wasn't a member of the registrar framework only for a
historical reason. Let's make that happen. This patch keeps cmdutil.command
as an alias for extension compatibility.
2016-01-09 23:07:20 +09:00
Yuya Nishihara
805fdba29f test-progress: disable mocking-time tests on chg
It's hard to make these tests compatible with chg because a mocked time.time()
is recorded and accessed by progbar at random timing. I don't think it's worth
fixing this test as it is considered a unit test of time estimates, so just
ignores on chg.
2016-03-20 16:49:56 -07:00
Matt Anderson
4dd1bfc11b progress: display progress bar when HGPLAINEXCEPT contains "progress"
This patch changes "progress.shouldprint()" so a feature name is provided to
"ui.plain()" to determine if there is an exception specificed in HGPLAINEXCEPT
for the progress extension.

This will allow user-facing scripts to provide progress output while HGPLAIN
is enabled.
2016-02-17 15:18:30 -08:00
Augie Fackler
200363343c progress: respect ui.quiet (issue4726)
Caught when I was running the hgsubversion testsuite and it started
printing progress bars over top of my test output lines.
2015-06-16 14:11:58 -04:00
Mads Kiilerich
523c87c1fe spelling: fixes from proofreading of spell checker issues 2014-04-17 22:47:38 +02:00
FUJIWARA Katsunori
2038822d9f progress: use 'encoding.colwidth' to get column width of items correctly
Before this patch, 'progress' extension applies 'len' on byte sequence
to get column width of it, but it causes incorrect result, when length
of byte sequence and columns in display are different from each other
in multi-byte characters.

This patch uses 'encoding.colwidth' to get column width of items in
output line correctly, even if it contains multi-byte characters.
2014-07-06 02:56:41 +09:00
FUJIWARA Katsunori
d07c57ee16 progress: use 'encoding.trim' to trim items in output line correctly
Before this patch, 'progress' extension trims items in output line by
directly slicing byte sequence, but it may split at intermediate
multi-byte sequence.

This patch uses 'encoding.trim' to trim items in output line
correctly, even if it contains multi-byte characters.
2014-07-06 02:56:41 +09:00
FUJIWARA Katsunori
8469506e74 progress: use 'encoding.colwidth' to get column width of output line correctly
Before this patch, 'progress' extension applies 'len' on byte sequence
to get column width of it, but it causes incorrect result, when length
of byte sequence and columns in display are different from each other
in multi-byte characters.

This patch uses 'encoding.colwidth' to get column width of output line
correctly, even if it contains multi-byte characters.
2014-07-06 02:56:41 +09:00
FUJIWARA Katsunori
7cbb15561a 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.
2014-07-06 02:56:41 +09:00
Gregory Szorc
0c523b218f tests: define norepo in command decorator 2014-05-04 22:07:45 -07:00
Gregory Szorc
02f50211af tests: declare commands using decorator 2014-05-04 22:48:07 -07:00
Augie Fackler
3aa5f557a5 progress: stop getting stuck in a nested topic during a long inner step
Convert, for example, has loops like this:
for revision in source_repo:
  progress(revisions)
  for file in revision:
    progresss(file)

Prior to this change, we would start showing the file-level progress
when we encountered a big revision, and then we'd get stuck in showing
file-progress instead of revision progress, often producing many many
instantly-completing progress bars rather than the actually-helpful
top-level revisions bar.
2013-08-23 13:28:18 -04:00
Durham Goode
1e38cba77a blackbox: fix recording exit codes (issue3938)
Previously the blackbox wrapped runcommand, but this failed to see the error
codes that were created if an exception occurred. I moved that logging to now
wrap _runcatch, so it can observe and log the actual error code (such as when
a user ctrl+c's during a command).

Updated the tests as well. Tested the change by running all the tests with the
blackbox extension enabled and verifying nothing broke (aside from things that
printed what extensions were enabeld).

The progress tests are affected by calls to time.time() so they needed to be
updated to pass.
2013-05-22 17:31:47 -07:00
Durham Goode
49b2c47b06 blackbox: log the commands that are run
Uses ui.log to log which commands are run, their exit code, the time taken,
and any unhandled exceptions thrown.

Example log lines:
2013/02/09 08:35:19 durham> add foo
2013/02/09 08:35:19 durham> add exited 0 after 0.02 seconds

Updates the progress tests because they use a mocked time.time() which these
changes affect.
2013-02-09 09:04:14 -08:00
Mads Kiilerich
13cd04eefb tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup 2012-10-10 01:37:54 +02:00
Martin Geisler
194d85c712 test-progress: fix whitespace typo 2012-05-11 15:13:13 +02:00
Thomas Arendsen Hein
21bb7c4cdc tests: make tests work if directory contains special characters
With this quoting tests will work e.g. in "/tmp/foo bar/mercurial/".
2012-04-03 19:06:35 +02:00
Matt Mackall
8971e5af3c check-code: fix issues with finding patterns in unified tests, fix tests
- old-style patterns without ^ were getting improperly anchored
- finditer was matching against beginning of line poorly
- \s was matching newlines
- [^x] was matching newlines

so we:

- remove earlier hacks for multiline matching
- fix unified test anchoring by adding .*
- replace \s with [ \t]
- replace [^x] with [^\nx]
- force all matches into multiline mode so ^ anchors work

This uncovers a number of test issues that are then repaired.
2011-10-27 17:22:04 -05:00
Augie Fackler
c679d5be7b progress: add a changedelay to prevent parallel topics from flapping (issue2698)
When combined with the earlier change to make the progress object
truly a singleton, this prevents the progress bar swapping on 'hg
clone --pull' on a local filesystem.

Thanks to timeless for lots of debugging help at the Copenhagen sprint
to isolate the root cause of this and a first draft an idea that would
fix it.
2011-06-23 15:00:45 -05:00
timeless
1df4cf63b6 progress: handle days, weeks and years
using hg clone svn://anonsvn.kde.org/home/kde/trunk kde ... with progress
yields 3008/1210830 1314h56m, which is unusable.

Add code to switch to days at 30 hours, to weeks at 15 days, and to years
at 55 weeks. A day has 24 hours, a week has 7 days, and a year has 52 weeks.
Months are intentionally omitted because they do not have a fixed length. The
Use of 52 weeks is a known and understandable estimate for a year.

It might make sense to spell our year to alert people when progress is
impractical, but...
2011-01-02 18:51:59 +02:00
Augie Fackler
fe6b4b14cf progress: don't compute estimate without a total
Without this, computing an estimate crashes. Test included.
2010-12-16 07:45:22 -06:00
Augie Fackler
5de2d97578 progress using tests: disable time estimates to avoid flakiness 2010-12-15 10:55:14 -06:00
Augie Fackler
61faaef57b test-progress: test completion estimates and progress bar delay 2010-12-15 11:20:32 -06:00
Martin Geisler
a86cb6d064 progress: test setting progress.width
This also makes the tests readable in a 80-character terminal which is
why I made the change to both tests.
2010-12-15 16:35:09 +01:00
Martin Geisler
0433940880 tests: add filtercr.py helper for progress tests
The two tests that used filtercr.py already used a slightly different
version, which explains why test-convert-svn-move.t changed after
switching to using $TESTDIR/filtercr.py.
2010-12-15 16:29:46 +01:00
Mads Kiilerich
635406bf76 tests: use (esc) for all non-ASCII test output 2010-11-08 01:41:41 +01:00
Matt Mackall
5cf7b705da tests: unify test-progress 2010-09-26 13:44:49 -05:00