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

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


��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.pyR3scs���\}}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(
RRR
t	thresholdtcopiesRR$tat	bestscoretmyscoretdesttvtsource((RRs5/sys/lib/python2.7/site-packages/mercurial/similar.pyt_findsimilarmatches's


ccsJ|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(RRR
R)t	parentctxt
workingctxtfpt
addedfilestremovedfilesR+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		)

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.