��c@s�ddlZddlZddlmZmZmZmZmZmZddl m
Z
ddlmZm
Z
ddlmZddlmZddlZd�Zdd�Zd efd
��YZdefd��YZgdd
�Zdd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Z e
d�Z!e
d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d �Z+d!�Z,d"�Z-d#efd$��YZ.d%ejfd&��YZ/dS('i�N(tmatchtpatchtscmutilterrortuitutil(t_(thextnullid(t
ErrorResponse(tHTTP_NOT_FOUNDcCsd|ddkrd|}n|ddkr:|d }ntjj|�}|dkr\dS|dS(Nit/i�(tostpathtdirname(tptup((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyRs
ccs�|ru|V|dkr1|dkr1d}|Vn|dksCt�|dksUt�x||krq|d9}qXWnx&tr�d|Vd|V|d9}qxWdS(Nii(i2ii
ii(tAssertionErrortTrue(tstept firststep((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt_navseqs trevnavcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs|j|_dS(sUNavigation generation object
:repo: repo object we generate nav for
N(t changelogt_revlog(tselftrepo((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt__init__,scCs|j�dk S(s,return True if any revision to navigate overN(t_firsttNone(R((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt__nonzero__4scCs0yt|j�j�SWntk
r+dSXdS(s1return the minimum non-filtered changeset or NoneN(titerRtnextt
StopIterationR(R((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyR8s
cCst|jj|��S(N(RRtnode(Rtrev((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyR?scs�|sidd6d
d6fSg}xItd|�D]8}||krGPn|j||�|j||�q1W|j�|j�}d||j|�fg�g�x�|D]�}||jkr�q�n||ko�|knr�jdt||�|j|�f�nd|ko'|knr��jdt||�|j|�f�q�q�W�jd�d ��i��fd
�d6��fd�d6fS(s�computes label and revision id for navigation link
:pos: is the revision relative to which we generate navigation.
:pagelen: the size of each navigation page
:limit: how far shall we link
The return is:
- a single element tuple
- containing a dictionary with a `before` and `after` key
- values are generator functions taking arbitrary number of kwargs
- yield items are dictionaries with `label` and `node` keys
tbeforetafteris(%i)s+%dis-%dttipcSsi|dd6|dd6S(NitlabeliR"((ti((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt<lambda>iscs�fd��D�S(Nc3s|]}�|�VqdS(N((t.0R((tdata(s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pys <genexpr>js((tmap(R+t navbefore(s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyR)jscs�fd��D�S(Nc3s|]}�|�VqdS(N((R*R((R+(s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pys <genexpr>ks((R,(R+tnavafter(s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyR)ks(((R&R&(RtappendtsortRRRtabs(RtpostpagelentlimitttargetstftfirstR#((R+R.R-s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytgenBs.
-1
(t__name__t
__module__RRRRR8(((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyR*s
t
filerevnavcBseZd�Zd�ZRS(cCs(|j�j|_|j|�|_dS(s�Navigation generation object
:repo: repo object we generate nav for
:path: path of the file we generate nav for
N(t
unfilteredRt
_changelogtfileR(RRR
((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyRoscCs"t|jj|jj|���S(N(RR=R"Rtlinkrev(RR#((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyRzs(R9R:RR(((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyR;ms ccs�g|D]}|j�tkr|^q}t|�dkrW|dj�|krWdSx�|D]�}i|j�d6|j�d6}|j�|d<|j�|d<|j�|d<|j�|d<t j
|d �r�j�|d
<n|Vq^WdS(NiiR"R#tusertdatetdescriptiontbranchR
R>(R"RtlenR#RR@RARBRCRtsafehasattrR
(tsiblingsthiderevtstd((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt _siblings~s+(
cCst|j�|�S(N(RJtparents(tctxthide((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyRK�scCst|j�|�S(N(RJtchildren(RLRM((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyRN�scCs:|j�}|r6td|ddt|d��gSgS(NR>iR"i(trenamedtdictR(tfctxtr((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt
renamelink�s$cCs'g|j|�D]}i|d6^qS(Ntname(tnodetags(RR"R(((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytnodetagsdict�scCs'g|j|�D]}i|d6^qS(NRT(t
nodebookmarks(RR"R(((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytnodebookmarksdict�scCsog}|j�}y|j|�}Wntjk
rAd}nX||j�krk|ji|d6�n|S(NRT(RCt branchtipRtRepoLookupErrorRR"R/(RRLtbranchesRCt
branchnode((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytnodebranchdict�s
cCs{g}|j�}y|j|�}Wntjk
rAd}nX|dkrw||j�krw|ji|d6�n|S(NtdefaultRT(RCRYRRZRR"R/(RRLR[RCR\((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytnodeinbranch�s
cCs9g}|j�}|dkr5|ji|d6�n|S(NR^RT(RCR/(RLR[RC((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytnodebranchnodefault�s
cks2x+|j|�D]}||d||�VqWdS(Nttag(RU(Rttmpltt1R"targstt((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytshowtag�scks2x+|j|�D]}||d||�VqWdS(Ntbookmark(RW(RRbRcR"RdRe((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytshowbookmark�scCs%|jd�}tj|jd|�S(NRt(tlstripRt canonpathtroot(RR
((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt cleanpath�scCsWy||}WnBtjk
rR|j}||j|j|j|���}nX|S(N(Rt RepoErrortmanifestR?R#tlookup(RtchangeidRLtman((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytchangeidctx�s )cCs�d}d|jkrU|jdd}|jd�}|dkrx||d}qxn#d|jkrx|jdd}nt||�S(NR&R"it:i�iRo(tformtfindRs(RtreqRqtipos((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt changectx�scCsYd|jkrU|jdd}|jd�}|dkrU|| }t||�SndS(NR"iRti�(RuRvRsR(RRwRqRx((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt
basechangectx�s
cCs�d|jkr!ttd��nt||jdd�}d|jkr^|jdd}n2d|jkr�|jdd}nttd��y|||}Wn)tjk
r�|j|d|�}nX|S(NR>sfile not giveniR"tfilenodesnode or filenode not giventfileid(RuR R
RmRRntfilectx(RRwR
RqRQ((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyR}�sccsVx/|| D]#}|ddt|�d|�VqWt|�|krR|d�VndS(NtfiledifflinkR"R>tfileellipses(RRD(RbtfilesR"tmaxR6((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt
listfilediffs�s!c#s�d�}|�}�fd�} |rHtj|j|j�|�}
ntj|j|j��}
tj|jdt�}|dkr�|j
�}|r�|dj�p�t}
n|j�}
|j�}g}x�tj
||
||
d|�D]�}|jd�rT|rT|j�}�dd|j�d |d
| dj|�|��Vg}n|jd�r�|dkr�dj|jt�d
�}n|j|�q�|j�}�dd|j�d |d
| dj|�|��VdS(Ncss&d}xtr!|V|d7}q WdS(Ni(R(tstart((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytcountgens c
3s�x�t|jt��D]�\}}d||df}|jd�rNd}n6|jd�rfd}n|jd�r~d}nd }�|d
|dd|d
d|�VqWdS(Ns%d.%dit+tdifflineplust-t
difflineminust@t
difflineattdifflinetlinetlineidsl%st
linenumbers% 8s(t enumeratet
splitlinesRt
startswith(tdifftblocknotlinenotltltype(Rb(s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytprettyprintliness"
t untrusteditoptsR�t diffblocktparityR�tlinesRitrawi(RtexactRltgetcwdtalwaysRtdiffoptsRRRRKR"RR�R�R tjoinR�R/(RRbRLtbasectxR�R�tstyleR�t
blockcountR�tmR�RKtnode1tnode2tblocktchunkR�((Rbs;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytdiffs�s2 !% c#s��fd�����fd�}tjd���}|dkre�dd||j���Vn4x1|jd|�D]}�dd||��VqxWdS(s>Generator function that provides side-by-side comparison data.cs~|rd|pd}||r)d|p,d7}�dd|d|dd|pQdd |p^dd
d|pmdd|pzd�S(Nsl%sRisr%stcomparisonlinettypeR�tleftlinenumbers% 6stleftlinetrightlinenumbert rightline((R�t
leftlinenoR�trightlinenoR�R�(Rb(s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytcompline6s c
3sZxS|D]K\}}}}}||}||}t||�}xZt|�D]L} �d|d|| dd�|| d|| dd�|| �VqLW||kr�t|||�D]4} �d|d| dd�| dddd�Vq�Wq||krxLt|||�D]4} �d|ddddd| dd�| �VqWqqWdS(NR�R�iR�R�R�(tmintxrangeR(
topcodesR�tllotlhitrlotrhitlen1tlen2tcountR((R�t leftlinest
rightlines(s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytgetblockAs0
itcomparisonblockR�tnN(tdifflibtSequenceMatcherRtget_opcodestget_grouped_opcodes(RbtcontextR�R�R�RHtoc((R�R�R�Rbs;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytcompare3s ccsgtjtj|j|���}tj|�\}}}}}x!trb||||||fVqBWdS(s3Generator function that provides the diffstat data.N(RtdiffstatdataRt iterlinesR�tdiffstatsumR(RLR�tstatstmaxnametmaxtotaltaddtotaltremovetotaltbinary((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytdiffstatgenbs! cCs;|j�\}}}}}}td�t|�||fS(s#Return a short summary of the diff.s5 %d files changed, %d insertions(+), %d deletions(-)
(R RRD(tstatgenR�R�R�R�R�R�((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytdiffsummaryjs c#s�|j�\}}�}}}|j�} �fd�}
d}x�|D]�\}}
}}|| krjdpmd}|
|}|d7}||d|j�d|d|d |d
|
|
�d|
|�d|j��VqFWd
S(s5Return a diffstat template for each file in the diff.cs"�dkrdSt|��dS(Niid(tfloat(R((R�(s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytpctwsitdiffstatlinktdiffstatnolinkiR"R>tfilenottotaltaddpctt removepctR�N(R R�R(RbRLR�R�R�R�R�R�R�R�R�R�tfilenametaddstremovestisbinaryttemplateR�((R�s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pytdiffstatqs
!tsessionvarscBs8eZdd�Zd�Zd�Zd�Zd�ZRS(t?cCs||_||_dS(N(R�tvars(RR�R�((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyR�s cCs|j|S(N(R�(Rtkey((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt__getitem__�scCs||j|<dS(N(R�(RR�tvalue((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt__setitem__�scCsttj|j�|j�S(N(R�tcopyR�R�(R((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt__copy__�sccsY|j}xIt|jj��D]2\}}i|d6t|�d6|d6Vd}qWdS(NRTR�t separatort&(R�tsortedR�t iteritemststr(RR�R�R�((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt__iter__�s " (R9R:RR�R�R�R�(((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyR��s
twsgiuicBseZd�ZRS(cCsdS(NiP((R((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt termwidth�s(R9R:R�(((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyR��s(0RR�t mercurialRRRRRRtmercurial.i18nRtmercurial.nodeRRtcommonR R
R�RRRtobjectRR;RJRKRNRSRVRXR]R_R`RfRhRmRsRyRzR}R�R�R�R�R�R�R�R�(((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/webutil.pyt<module> sD.
C
4 /
|