��Pc@sSddlmZddlZddlZddlZd�Zd�Zd�ZdS(i�(t_Nccst|�t|�}i}x^t|�D]P\}}|jjtd�|d|�tj|j��j�}|||<q)Wx|t|�D]n\}}|jjtd�|t|�d|�tj|j��j�}||kr�|||fVq�q�W|jjtd�d�dS(s�find renamed files that have no changes
Takes a list of new filectxs and a list of removed filectxs, and yields
(before, after) tuples of exact matches.
ssearching for exact renamesttotalN(
tlent enumeratetuitprogressRtutiltsha1tdatatdigesttNone(trepotaddedtremovedtnumfilesthashestitfctxth((s5/sys/lib/python2.7/site-packages/mercurial/similar.pyt_findexactmatches
s"c
#s!i}x�t|�D]�\}�|jjtd�|dt|��tj�fd����fd�}x[|D]S}|j|d|f�d}||j ��} | |krr�| f||<qrqrWqW|jjtd�d�x4|j
�D]&\}
}|\}}||
|fVq�S(s�find potentially renamed files based on similar file content
Takes a list of new filectxs and a list of removed filectxs, and yields
(before, after, score) tuples of partial matches.
ssearching for similar filesRcs�j�}|tj|�fS(N(Rtmdifft
splitnewlines(torig(tr(s5/sys/lib/python2.7/site-packages/mercurial/similar.pyR3scs���\}}d}tj||�}xB|D]:\}}}}x%|||!D]} |t| �7}qNWq.Wt|�t|�}
|d|
S(Nig@(tbdifftblocksR(ttextRtlinestequaltmatchestx1tx2ty1ty2tlinetlengths(R(s5/sys/lib/python2.7/site-packages/mercurial/similar.pytscore8sit searchingN(RRRRRRt cachefunctgetR
Rt iteritems(
RRR
t thresholdtcopiesRR$tat bestscoretmyscoretdesttvtsource((RRs5/sys/lib/python2.7/site-packages/mercurial/similar.pyt_findsimilarmatches's
ccsJ|d}|d}tg|D]&}||j�dkr||^q�}tg|D]2}||krW||j�dkrW||^qW�}xSt|t|�t|��D]3\} }
|j|
�| j�|
j�dfVq�W|dkrFxOt|t|�t|�|�D])\} }
}| j�|
j�|fVqWndS(s:find renamed files -- yields (before, after, score) tuplest.ig�R
tsettsizeRtsortedtremovetpathR1(RRR
R)t parentctxt
workingctxtfpt
addedfilestremovedfilesR+tbR$((s5/sys/lib/python2.7/site-packages/mercurial/similar.pytfindrenamesPs
)5 "
((ti18nRRRRRR1R>(((s5/sys/lib/python2.7/site-packages/mercurial/similar.pyt<module>s )
|