Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/hgext/progress.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Pc@s�dZddlZddlZddlmZdZd�Zd�Zd�Zde	fd	��YZ
dad
�Z
d�ZdS(sKshow progress bars for some actions

This extension uses the progress information logged by hg commands
to draw progress bars that are as informative as possible. Some progress
bars only offer indeterminate information, while others have a definite
end point.

The following settings are available::

  [progress]
  delay = 3 # number of seconds (float) before showing the progress bar
  changedelay = 1 # changedelay: minimum delay before showing a new topic.
                  # If set to less than 3 * refresh, that value will
                  # be used instead.
  refresh = 0.1 # time in seconds between refreshes of the progress bar
  format = topic bar number estimate # format of the progress bar
  width = <none> # if set, the maximum width of the progress information
                 # (that is, min(width, term width) will be used)
  clear-complete = True # clear the progress bar after it's done
  disable = False # if true, don't show a progress bar
  assume-tty = False # if true, ALWAYS show a progress bar, unless
                     # disable is given

Valid entries for the format field are topic, bar, number, unit,
estimate, speed, and item. item defaults to the last 20 characters of
the item, but this can be changed by adding either ``-<num>`` which
would take the last num characters, or ``+<num>`` for the first num
characters.
i�N(t_tinternalcGsdjd�|D��S(Nt css|]}|r|VqdS(N((t.0ts((s2/sys/lib/python2.7/site-packages/hgext/progress.pys	<genexpr>-s(tjoin(targs((s2/sys/lib/python2.7/site-packages/hgext/progress.pyt	spacejoin,scCs"|jtj�p!|jdd�S(Ntprogresss
assume-tty(t_isattytsyststderrt
configbool(tui((s2/sys/lib/python2.7/site-packages/hgext/progress.pytshouldprint/scCsN|dkrtd�|S|d}|dkrR||d8}td�||fS|d7}|d}||d8}|dkr�td�||fS|d7}|d}||d8}|dkr�td	�||fS|d7}|d
}||d
8}|dkrtd�||fS|d7}|d
}||d
8}td�||fS(Ni<s%02dss%dm%02dsiis%dh%02dmiis%dd%02dhii7s%dw%02ddi4s%dy%02dw(R(tsecondstminutesthourstdaystweekstyears((s2/sys/lib/python2.7/site-packages/hgext/progress.pytfmtremaining2s2








tprogbarcBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	ddd
d	�ZRS(cCs||_|j�dS(N(R
t
resetstate(tselfR
((s2/sys/lib/python2.7/site-packages/hgext/progress.pyt__init__Xs	cCs�g|_i|_i|_i|_t|_tj�t|jj	dddd��|_
d|_d|_
t|jj	dddd��|_td|jt|jj	dddd	���|_|jjdd
dddd
dg�|_dS(NRtdelaytdefaultiitrefreshg����tchangedelayitformatttopictbartnumbertestimate(ttopicsttopicstatest
starttimest	startvalstFalsetprintedttimetfloatR
tconfigt	lastprinttNonet	lasttopict
indetcountRtmaxRt
configlisttorder(R((s2/sys/lib/python2.7/site-packages/hgext/progress.pyR\s"							
		cCs�t|j�sdS|j�}t|_d}t}	d}
x�|jD]�}d}|dkre|}n�|dkr�|r�dttt|���d||f}q�|�}n:|j	d�ri|rid}
d|kr�|jd�d	�}n4d
|kr$d}
t
|jd
�d	�}nd}|
dkrD||}n
|| }||t|�d
7}n�|dkr�d}t}	ni|dkr�|r�|}nN|dkr�|j||||�}n'|dkr�j
||||�}n|	st||�}qDt|
|�}
qDW|	r[d}|rA|t|�d	7}n|
r^|t|
�d	7}n||d}|r�||kr�|||}d|d	}|dkr�|d7}n|d
||7}nf|d8}|jd	7_|jd|}||8}d
t
|t|��dd
t
t|��}djd|df�}t|||
�}nt||
�}tjjd|| �||_tjj�dS(NtRR!s% ss/%stitemtendt-it+t	beginningiRR tunitR"tspeediit=t>is<=>t[t]s
(RR
twidthtTrueR(R'R2tstrtlent
startswithtinttsplitR"R:RR/tabsRR
RtwriteR.tflush(RtnowRtposR4R9ttotalt	termwidththeadtneedprogressttailt	indicatortaddtslicetwidtusedt	progwidthtamtR tprogtout((s2/sys/lib/python2.7/site-packages/hgext/progress.pytshowos�		
		


	cCs5t|j�sdStjjdd|j��dS(Ns
%s
R(RR
R
RRGR?(R((s2/sys/lib/python2.7/site-packages/hgext/progress.pytclear�scCs\t|j�sdS|jjdddt�r;|j�ntjjd�tjj�dS(NRsclear-completeRs
(	RR
RR@RZR
RRGRH(R((s2/sys/lib/python2.7/site-packages/hgext/progress.pytcomplete�s
cCs7|jj�}tt|jjddd|��|�S(NRR?R(R
RLtminRDR+(Rttw((s2/sys/lib/python2.7/site-packages/hgext/progress.pyR?�sc
Cs�|dkrdS|j|}||}||}|dkr�||j|}|t|jjdddd��kr�||||d}	t|	�SndS(NR3iRR"Rii(R-R&R%R*R
R+R(
RRRJRKRIt
initialposttargettdeltatelapsedR((s2/sys/lib/python2.7/site-packages/hgext/progress.pyR"�s


!
cCsk|j|}||}||j|}|t|jjdddd��krgtd�|||fSdS(NRR"Ris	%d %s/secR3(R&R%R*R
R+R(RRRJR9RIR^R`Ra((s2/sys/lib/python2.7/site-packages/hgext/progress.pyR:�s

!R3cCs�tj�}|dkr�|jj|d�|jj|d�|jj|d�|jr�|jd|kr�|jr�|j�|j	�n||jkr�|j|jj
|� |_q�n�||jkr�|j|<||j|<|jj|�n||||f|j|<||j|j
kr�|jr�|jdksf||jksf||j|jkr�||_|j|||j|�q�ndS(Ni(R)R-R%tpopR&R$R#R(R[RtindextappendR,RR.RRY(RRRJR4R9RKRI((s2/sys/lib/python2.7/site-packages/hgext/progress.pyR�s*%

"

	N(t__name__t
__module__RRRYRZR[R?R"R:R-R(((s2/sys/lib/python2.7/site-packages/hgext/progress.pyRWs			K							cs�d|jf�fd��Y�|jdd�r5dSt|�r�|jr�|jr��|_�js�tdkr�t|�ant�_q�ndS(Nt
progressuicsDeZdZd�Z�fd�Z�fd�Z�fd�ZRS(cSs|jp|jS(N(t	debugflagtquiet(R((s2/sys/lib/python2.7/site-packages/hgext/progress.pyt_quietscs;|j�s"|jj||�nt�|�j||�S(N(Rjt_progbarRtsuper(RRtopts(Rg(s2/sys/lib/python2.7/site-packages/hgext/progress.pyR
scsB|j�r)|jjr)|jj�nt�|�j||�S(N(RjRkR(RZRlRG(RRRm(Rg(s2/sys/lib/python2.7/site-packages/hgext/progress.pyRGscsB|j�r)|jjr)|jj�nt�|�j||�S(N(RjRkR(RZRlt	write_err(RRRm(Rg(s2/sys/lib/python2.7/site-packages/hgext/progress.pyRnsN(ReRfR-RkRjRRGRn((Rg(s2/sys/lib/python2.7/site-packages/hgext/progress.pyRgs
	Rtdisable(	t	__class__RRRhRiRkt
_singletonR-R(R
((Rgs2/sys/lib/python2.7/site-packages/hgext/progress.pytuisetups 		cCst|j�dS(N(RrR
(R
trepo((s2/sys/lib/python2.7/site-packages/hgext/progress.pyt	reposetup&s(t__doc__R
R)tmercurial.i18nRt
testedwithRRRtobjectRR-RqRrRt(((s2/sys/lib/python2.7/site-packages/hgext/progress.pyt<module>$s			%�	$

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.