[PATCH 0 of 2] Progress: refactored

Stefano Tortarolo stefano.tortarolo at gmail.com
Sun Dec 14 04:32:42 CST 2008


2008/12/14 TK Soh <teekaysoh at gmail.com>:
> Maybe I missed this in earlier threads, but can you describe how the
> progress is display? BTW, I do like the way the progresses are
> displayed as described in the work posted by TAH. Somehow his work
> were discontinued. I am guessing it's due to lower priority.

The presentation logic is handled by the displayer used.
There are two main situations:
- we don't know how many steps (update) it will take to finish (maxval=None)
- maxval can be estimated in some ways (e.g., len(action) in merge.py)

The defaultdisplayer in progress.py handles both situations. In the
first it shows completing dots, in the latter value/maxval. You can
just run python mercurial/progress.py, I've written some tests to
explain how it works.

The progresshandler code is always the same, since it doesn't care
about the presentation and it just needs to know when update its
value. It's up to the given displayer to use properly maxval and
value.
It's also quite simple to use creation_time to show elapsed time or
remaining time (in this case the displayer could do some estimations
based on maxval, elapsed time and value).

Stefano


More information about the Mercurial-devel mailing list