�
�c@seddklZddkZddkZd�Zd�Zd�Zd�Zd�Ze d�Z
dS( i�(t_NcCsCtg}|D]+}||jo||jo||qq~�S(s-Return list of elements in d1 not in d2 or d3(tsorted(td1td2td3t_[1]td((s#/sys/lib/python/mercurial/copies.pyt_nonoverlapscCs,|id�}|djodSn|| S(Nt/i�t(trfind(tfts((s#/sys/lib/python/mercurial/copies.pyt_dirnames
cCsXt�}xH|D]@}t|�}x+||jo|i|�t|�}q%WqW|S(N(tsetR
tadd(tfilesRR((s#/sys/lib/python/mercurial/copies.pyt_dirss
c
CsOh}t�}|i�}|dfg}x�o�|i�\}}t|�}||joq-n|i|�|i�|jo3|i�|jo ||i�f||i�<n|i�dj o|i�|joq-n|g} |i�D]}
| |
|dfq�7}q-Wg}t|i ��D]}||dq7~S(s;find files that path was copied from, back to linkrev limitiiN(
RtpathtpoptstrRtrevtNonetparentsRtvalues(
tfctxtlimittoldtseentorigtvisittfctdepthRRtpt_[2]to((s#/sys/lib/python/mercurial/copies.pyt
_findoldnamess
& &:c
Cs�|i}t|�}|djo
|}n|djo
|}nhd|<d|<}||g}ti|�t|�}|}x |oti|�} | |jo7g}
|ii�D]}|
|i|�q�~
}n|i | �}x�|D]�}||jo<|| ||<||o|d7}nti
||�q�|o-|||| jod||<|d8}q��| o| }|d8}q�q�W|S(sDfind the earliest revision that's an ancestor of a or b but not bothi�iiN(t changelogtlenRtheapqtheapifytheappoptdirstateRRt
parentrevstheappush(
trepotatbtcltworkingtsideRtinterestingRtrRR!R((s#/sys/lib/python/mercurial/copies.pyt
_findlimit4s<
7
cs0�p�p
��johhfSn�i�djo7�i��ii�djo�ii�hfSnt��i��i����i�}�i�}|i�����fd�}ti |��h�h�h�������fd�}�i
itd���t
||��} t
||��}
| o'�i
itd�di| ��n|
o'�i
itd�di|
��nx| D]}||||�q�Wx|
D]}||||�q�Wt�}xE�i�D]7\}
}t|�djo�|
=q�i|�q�o��i
itd ��xo�D]c}d
}|�jo|d7}n||jo|d7}n�i
id
|�||f�q\Wn~�p|o��fSn�i
itd��t|�t|�}}t�}h}x��i�D]�\}}t|�t|�}}||joq3q3||jo||jo|i|�q3||jo||jo|i|�q3||jo"|||jo|i|�q3|d||d<q3Wx&|D]}||jo||=qqW~~~|p��fSnx2|D]*}�i
itd�|||f�qUWx�| |
D]�}|�jo�x~|D]r}|i|�o\|||t|�}|�jo2|�|<�i
itd�|�|f�nPq�q�Wq�q�W��fS(s9
Find moves and copies between context c1 and c2
ics[t|�djo5�i�djo�i|�Sn�i|�Sn�i|d|�S(Nitfileid(R&RRtfilectx(Rtn(R-tc2tc1(s#/sys/lib/python/mercurial/copies.pytmakectxus
cs�|||�}x�|��D]�|�|<||jo�||�i|�jo��|||�}|i|�}|oX|i�|jp|i�|i�jo,||jp
||jo|�|<q�q�q
q#|�jo�i|g�i|�q#q#WdS(s(check possible copies of f from m1 to m2N(R$tgettancestorRt
setdefaulttappend(Rtm1tm2R:tofR9tca(tmatctxtdivergeRtcopytfullcopy(s#/sys/lib/python/mercurial/copies.pytcheckcopies�s
3
s& searching for copies back to rev %d
s" unmatched files in local:
%s
s
s" unmatched files in other:
%s
is2 all copies found (* = to merge, ! = divergent):
R t*t!s %s -> %s %s
s! checking for directory renames
Rs dir %s -> %s
s file %s -> %s
N(tnodeRR*RtcopiesR5RtmanifesttutiltlrucachefunctuitdebugRRtjoinRtitemsR&tupdateRt iteritemsR
Rt
startswith(R-R:R9RCt checkdirsR@RAR;RItu1tu2Rtdiverge2RBtfltnoteRRtinvalidtdirmovetdsttsrctdsrctddsttiRtdf(( RFRHR9R:RGR-RDRERs#/sys/lib/python/mercurial/copies.pyRMds�3
)
(
((ti18nRROR'RR
RR$R5tFalseRM(((s#/sys/lib/python/mercurial/copies.pys<module>s 0
|