��Qc@s�dZddlmZddlmZmZmZmZmZm Z ddl
Z
ddlZddlZdZ
d�Zd�Zd�Zd �Zied
dged�ed
�fddded�ed�fddded�ed�fddded�ed�fddeed�fdd eed!�fdd"eed#�fdd$ded%�ed&�fge jed'�fd(6Ze jd)7_dS(*s6command to display statistics about repository historyi�(t_(tpatchtcmdutiltscmutiltutilt templatertcommandsNtinternalcCsttj|dt�}y"tj||tddt�}Wn)tk
rb}tj|j d��nX|j
|�|S(Ntquotedi(RtparsestringtFalseRtchangeset_templatertNonetSyntaxErrorRtAborttargstuse_template(tuitrepottmpltttinst((s//sys/lib/python2.7/site-packages/hgext/churn.pyt
maketemplaters"
c
Cs�d \}}tj||�}djtj||j�|j�|��}xo|jd�D]^} | jd�r�| jd�r�|d7}q[| jd�r[| jd�r[|d7}q[q[W||fS(
Nits
t+s+++ it-s--- (ii(Rt
matchfilestjoinRtdifftnodetsplitt
startswith(
RRtctx1tctx2tfnstaddedtremovedtfmatchRtl((s//sys/lib/python2.7/site-packages/hgext/churn.pytchangedliness-
cs�jd�r!�fd��n6�jdd��t�������fd��idd6�i�t��jd�r�tj�d��ntj�d|��}��������fd �}x#tj �|�|�D] }q���j
td
�d��S(sCalculate statst
dateformatcsI|j�\}}tjtjt|�|�d �}|j�d�S(NiR((tdatetdatetimettimetgmtimetfloattstrftime(tctxRttzR)(topts(s//sys/lib/python2.7/site-packages/hgext/churn.pytgetkey)s&ttemplates{author|email}cs!�j��j|��j�S(N(t
pushbuffertshowt popbuffer(R/(RR(s//sys/lib/python2.7/site-packages/hgext/churn.pyR20s
itcountR)c s[|j�}�r-�|j�d�r-dS�|�j�}�j||�}�jd�r��j|d�dddf�|<n�|j�}t|�dkr��jtd�|f�dS|d}t��|||�}gt �j|d �|�D]\}}||^q�|<�dcd7<�j
td��ddt���dS(
Nit
changesetsis$revision %d is a merge, ignoring...
R7t analyzingttotal(i(ii(trevR)tstriptgettparentstlentnoteRR'tziptprogress( R/R"R;tkeyR>R tlinestrR&(tamaptdfR2R1trateRtstateR(s//sys/lib/python2.7/site-packages/hgext/churn.pytprep<s '
<R9N(R=RR
Rt matchdateRtmatchRRtwalkchangerevsRBR(RRRFtpatsR1tmRJR/(( RFRGR2R1RHRRIRRs//sys/lib/python2.7/site-packages/hgext/churn.pyt countrate&s
$csTd��i}|jd�}|rRtjj|jd��rR|jd�}n|r�t|d�D]�}yD|jd|kr�dp�dd�\}}|j�||j�<Wqht k
r�|j�}|rh�j
td�|�qhqhqhXqhWnt�||||�j
�} | s$dS|jd �r@| j�n| jd
d��ttd�| D���prd
�td�| D����j�}
�jd|
�|
�ddd�|jd�r�d8�����fd�}n�d8����fd�}��fd��x*| D]"\}}
�j|||
��q*WdS(sbhistogram of changes to the repository
This command will display a histogram representing the number
of changed lines or revisions, grouped according to the given
template. The default template will group changes by author.
The --dateformat option may be used to group the results by
date instead.
Statistics are based on the number of changed lines, or
alternatively the number of matching revisions if the
--changesets option is specified.
Examples::
# display count of changed lines for every committer
hg churn -t '{author|email}'
# display daily activity graph
hg churn -f '%H' -s -c
# display activity of developers by month
hg churn -f '%Y-%m' -s -c
# display count of lines changed in every year
hg churn -f '%Y' -s
It is possible to map alternate email addresses to a main address
by providing a file using the following format::
<alias email> = <actual email>
Such a file may be specified with the --aliases option, otherwise
a .hgchurn file will be looked for in the working directory root.
cSs|d|| S(Nt ((tsR&((s//sys/lib/python2.7/site-packages/hgext/churn.pytpad}staliasess.hgchurnREt=isskipping malformed alias: %s
NtsortRCcSst|d�|fS(Ni(tsum(tx((s//sys/lib/python2.7/site-packages/hgext/churn.pyt<lambda>�scss!|]\}}t|�VqdS(N(RW(t.0tktv((s//sys/lib/python2.7/site-packages/hgext/churn.pys <genexpr>�sg�ss!|]\}}t|�VqdS(N(R?(RZR[R\((s//sys/lib/python2.7/site-packages/hgext/churn.pys <genexpr>�ssassuming %i character terminal
itdiffstatics_|\}}d�|��d||f�jd�|�d��jd�|�d�fS(Ns
%s %15s %s%s
s+%d/-%dRsdiffstat.insertedRsdiffstat.deleted(tlabel(tnameR]R#R$(tcharnumtmaxnameRSR(s//sys/lib/python2.7/site-packages/hgext/churn.pytformat�s
ics0d�|��t|�d�t|��fS(Ns
%s %6d %s
t*(RW(R_R7(R`RaRS(s//sys/lib/python2.7/site-packages/hgext/churn.pyRb�scstt|����S(N(tinttround(R7(tmaxcounttwidth(s//sys/lib/python2.7/site-packages/hgext/churn.pyR`�s(R=tostpathtexiststwjointopenRRR<t
ValueErrortwarnRRPtitemsRVR-tmaxt termwidthtdebugtwrite(RRRNR1RFRTR&taliastactualRHtttywidthRbR_R7((R`RfRaRSRRgs//sys/lib/python2.7/site-packages/hgext/churn.pytchurnZsD# "*
"
RER;s.count rate for the specified revision or rangetREVtdR)Rs+count rate for revisions matching date spectDATERR3s{author|email}stemplate to group changesetstTEMPLATEtfR(s/strftime-compatible format for grouping by datetFORMATtcR8s"count rate by number of changesetsRRRVs$sort by key (default: sort by count)R]s&display added/removed lines separatelyRTsfile with email aliasestFILEs3hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]Rws churn(t__doc__tmercurial.i18nRt mercurialRRRRRRRhR+R*t
testedwithRR'RPRwR
twalkoptstcmdtablet inferrepo(((s//sys/lib/python2.7/site-packages/hgext/churn.pyt<module> s6. 4 ]
|