��c@svddlZddlZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Z d
�Z
d�ZdS(i�NcCs5tg|D]$}||kr
||kr
|^q
�S(s-Return list of elements in d1 not in d2 or d3(tsorted(td1td2td3td((s4/sys/lib/python2.7/site-packages/mercurial/copies.pyt_nonoverlapscCs'|jd�}|dkrdS|| S(Nt/i�t(trfind(tfts((s4/sys/lib/python2.7/site-packages/mercurial/copies.pyt_dirnamesc
Cs�|j}t|�}|dkr*|}n|dkr?|}nid|6d|6}||g}tj|�t|�}t}|} x#|r�tj|�}
|
|kr�g|jj�D]}|j |�^q�}n|j
|
�}x�|D]�}|dkrq�||krL||
||<||r8|d7}ntj||�q�|r�|||
kr�||<|d8}t}q��||
r�|
} |d8}q�q�W|s�dS| S(soFind the earliest revision that's an ancestor of a or b but not both,
None if no such revision exists.
i�iiN(
t changelogtlentNonetheapqtheapifytFalsetheappoptdirstatetparentstrevt
parentrevstheappushtTrue(
trepotatbtcltworkingtsidetvisittinterestingthascommonancestortlimittrtpR((s4/sys/lib/python2.7/site-packages/mercurial/copies.pyt
_findlimitsF
.
cCs�|j�}xy|j�D]k\}}||krk|||krR||||<n||krk||=qkn||kr|||<qqWx<|j�D].\}}||kr�||kr�||=q�q�W|S(schain two sets of copies a->b(tcopyt iteritemstitems(tsrctdstRRtttktv((s4/sys/lib/python2.7/site-packages/mercurial/copies.pyt_chainNs
cCsq|j�}|j�}xR|j�D]D}|j|j�d�|j�krS|S|j�|kr%dSq%WdS(s@return file context that is the ancestor of fctx present in actxN(Rtmanifestt ancestorstgettpathRtfilenode(tfctxtactxtstoptamR ((s4/sys/lib/python2.7/site-packages/mercurial/copies.pyt
_tracefilees$cCsS|jj}|j�j�}x.|j�D] }||dkr+||=q+q+W|S(Ntanm(t_repoRtcopiesR&tkeys(RtdstcR,((s4/sys/lib/python2.7/site-packages/mercurial/copies.pyt_dirstatecopiespscCs�d}|j�dkrC|}|j�}||krCt|�Sni}t|j�j��}|j|j�j��x:|D]2}t|||�}|r�|j �||<q�q�W|dk r�
|||t|��}n|S(s<find {dst@b: src@a} copy mapping where a is an ancestor of bN(RRtp1R?tsetR/titerkeystdifference_updateR8R2R.(RRtwtcmtmissingR tofctx((s4/sys/lib/python2.7/site-packages/mercurial/copies.pyt_forwardcopiesxs
cCsXt||�}i}x<t|j��D](\}}||krFq(n|||<q(W|S(N(RHRR'(RRR R#R,R-((s4/sys/lib/python2.7/site-packages/mercurial/copies.pyt_backwardrenames�sc Cs�||ks|s|riS|j|�}||krFt||�S||kr_t||�St||t||�t||��S(s5find {dst@y: src@x} copy mapping for directed compare(tancestorRHRIR.(txtyR((s4/sys/lib/python2.7/site-packages/mercurial/copies.pyt
pathcopies�s
cs��s�s��kr*iiiifS�j�dkrp�j��jj�krp�jj�iiifSt��j��j����dkr�iiiifS�j�}�j�}�j�����fd�}tj |��i�i}i�i�d����������fd�}�j
jd��t||��} t||��}
| r��j
jddj
| ��n|
r��j
jddj
|
��nx| D]}||||�q�Wx|
D]}||||�q�i}t�}
t�}x��j�D]�\}}t|�dksX|�ksX|�kr��|=|�kr�|�kr�g|D]$}|�ks�|�kr~|^q~||<|
j|�q�q"|j|�q"W�rr�j
jd �x�t��D]x}d
}|�kr|d7}n||kr1|d7}n||
krJ|d
7}n�j
jd�|||f�q�~�s��|�|fS�j
jd��j��j�}}|jd�|jd�t�}i}x��j�D]�\}}t|�t|�}}||kr!q��|krI||krI|j|�q�|krq||krq|j|�q�|kr�|||kr�|j|�q�d||d<q�x$|D]}||kr�||=q�q�W~~~|s�|�|fSx,|D]$}�j
jd|||f�qWx�| |
D]�}|�kr3xo|D]d}|j|�rL|||t|�}|�kr�|||<�j
jd||f�nPqLqLWq3q3W�|�|fS(s&
Find moves and copies between context c1 and c2 that are relevant
for merging.
Returns four dicts: "copy", "movewithdir", "diverge", and
"renamedelete".
"copy" is a mapping from destination name -> source name,
where source is in c1 and destination is in c2 or vice-versa.
"movewithdir" is a mapping from source name -> destination name,
where the file at source present in one context but not the other
needs to be moved to destination by the merge process, because the
other context moved the directory it is in.
"diverge" is a mapping of source name -> list of destination names
for divergent renames.
"renamedelete" is a mapping of source name -> list of destination
names for files deleted in c1 that were renamed in c2 or vice-versa.
csQt|�dkr>�j�dkr1�j|�S�j|�S�j|d|�S(Nitfileid(R
RRtfilectx(R tn(tc1tc2R(s4/sys/lib/python2.7/site-packages/mercurial/copies.pytmakectx�s
cSs)||kr|S|j�|j�}}y�j�|j�}}|dkr`|j�}n|dkr{|j�}nx�tr|j�|j�}}||kr�|j�}q~||kr�|j�}q~||kr�S||ks||ks||kr~tSq~WWntk
r$tSXdS(N(R0RRtnextRRt
StopIteration(tf1tf2R"tg1tg2tf1rtf2r((s4/sys/lib/python2.7/site-packages/mercurial/copies.pytrelated�s* $
c sHd}t|g�}x�|||�j�D]�|j�}|j�}||kro|�kr/Pq/q/n|j|�|�|<||kr�q/n||�j|�kr�Pn�|||�}�||�j��}|r/||ks||j�kr/|�|<d}Pq/q/W|�krD�j|g�j|�ndS(s(check possible copies of f from m1 to m2N( RRAR0RR2taddR1t
setdefaulttappend( R tm1tm2toftseentoctocrRRtcr(tcaR&tctxtdivergetfullcopyR"tmaR\(s4/sys/lib/python2.7/site-packages/mercurial/copies.pytcheckcopiess.
$
s& searching for copies back to rev %d
s" unmatched files in local:
%s
s
s" unmatched files in other:
%s
isK all copies found (* = to merge, ! = divergent, % = renamed and deleted):
Rt*t!t%s src: '%s' -> dst: '%s' %s
s! checking for directory renames
Rs) discovered dir src: '%s' -> dst: '%s'
s' pending file src: '%s' -> dst: '%s'
N(tnodeRRR@R;R%RR/tutiltlrucachefunctuitdebugRtjoinRAR(R
tupdateRtdirstaddpathR'RR]t
startswith(RRQRRRgR`RaRStmovewithdirRltu1tu2R trenamedeletet
renamedelete2tdiverge2RbtfltnoteRRtinvalidtdirmoveR*R)tdsrctddsttiRtdf((RQRRRgR&RhRiRjR"RkR\Rs4/sys/lib/python2.7/site-packages/mercurial/copies.pytmergecopies�s�- $
*5
(RqRRRR%R.R8R?RHRIRMR�(((s4/sys/lib/python2.7/site-packages/mercurial/copies.pyt<module>s 9
|