[PATCH] progress: skip progress estimate when current exceeds total
Augie Fackler
durin42 at gmail.com
Sun Mar 13 08:50:53 CDT 2011
On Mar 13, 2011, at 6:49 AM, timeless wrote:
>
> # HG changeset patch
> # User timeless at mozdev.org
> # Date 1300013265 -7200
> # Node ID cd368f200fc0792c091a10810a7f560ccad7618d
> # Parent 395a84f78736aa1912d16ae2138e7d5596bdaa42
> progress: skip progress estimate when current exceeds total
>
> diff --git a/hgext/progress.py b/hgext/progress.py
> --- a/hgext/progress.py
> +++ b/hgext/progress.py
> @@ -207,13 +207,13 @@ class progbar(object):
> if total is None:
> return ''
> initialpos = self.startvals[topic]
> - target = total - initialpos
> - delta = pos - initialpos
> + interval = pos - initialpos
can we rename this to rate?
> + delta = total - pos
and this to remaining?
I think those renames would make the code clearer. I had a little trouble unpacking what was going on.
> if delta > 0:
> elapsed = now - self.starttimes[topic]
> if elapsed > float(
> self.ui.config('progress', 'estimate', default=2)):
> - seconds = (elapsed * (target - delta)) // delta + 1
> + seconds = (elapsed * (delta)) // interval + 1
> return fmtremaining(seconds)
> return ''
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list