comparison hgext/progress.py @ 10891:83af68e38be3

progress: fall back to indeterminate progress if position is >= total
author Augie Fackler <durin42@gmail.com>
date Thu, 08 Apr 2010 15:04:00 -0500
parents 32b213b9b22c
children ec21d91c79b3
comparison
equal deleted inserted replaced
10890:301633755dec 10891:83af68e38be3
112 if head: 112 if head:
113 used += len(head) + 1 113 used += len(head) + 1
114 if tail: 114 if tail:
115 used += len(tail) + 1 115 used += len(tail) + 1
116 progwidth = termwidth - used - 3 116 progwidth = termwidth - used - 3
117 if total: 117 if total and pos <= total:
118 amt = pos * progwidth // total 118 amt = pos * progwidth // total
119 bar = '=' * (amt - 1) 119 bar = '=' * (amt - 1)
120 if amt > 0: 120 if amt > 0:
121 bar += '>' 121 bar += '>'
122 bar += ' ' * (progwidth - amt) 122 bar += ' ' * (progwidth - amt)