�t�c@s�ddlmZddlmZddlZddlZddlZdd�Zd�Zd�Z d�Z
d d
ed�ZdS(i�(tnullid(t_Nic
CsG|r|j|�}n|j�}i}tj|�}t�}d} x�rB|j�}
|
|kroqKn|j|
d�}|| kr�| d9} n|| kr�
|kr�j|
�|r�t|�|kr�dSq�|j|
�xN|j |
�D]=}|s||kr�j||d�|j
|�q�WqKWdS(Nii(theadsetofconnectedstheadstutiltdequetsettpopleftt
setdefaulttaddtlentparentstappend(
tdagtnodestsampletalwaystquicksamplesizeRtdisttvisittseentfactortcurrtdtp((s:/sys/lib/python2.7/site-packages/mercurial/setdiscovery.pyt
_updatesample
s0
cCsmt|�|kr%t|�ddfS|j|�}|t|�}|dkr]|d|fS|t�|fS(Ni(R
RtNoneR(R
RtsizeRt
desiredlen((s:/sys/lib/python2.7/site-packages/mercurial/setdiscovery.pyt_setupsample)s
cCsjt|||�\}}}|dkr+|S|r:d}n|}t||||d|�|j|�|S(NR(RRRtupdate(R
RRtinitialRRRtfromset((s:/sys/lib/python2.7/site-packages/mercurial/setdiscovery.pyt_takequicksample4s
cCs�t|||�\}}}|dkr+|St||||�t|j�|||�|sct�t|�|kr�ttj||��}nLt|�|kr�|t|�}|j tjt
|||�|��n|j |�|S(N(RRRtinversetAssertionErrorR
RtrandomRRtlist(R
RRRRRtmore((s:/sys/lib/python2.7/site-packages/mercurial/setdiscovery.pyt_takefullsample@s*
idi�cs�d}|j}tj|�}|jd�|d7}|j�} | }
|j�rz|j�}|j|j|
���np|jd�r�|j �}|j�}
|j|j|
��}|j
�|
j}|j�n|j�}g}
|j�t
kr+|t
gkrt
gt|fSt
gtgfS|jtd��|j|dt�}t|�t|�kr�|jd�|t|fS|
r�tj��r�|jtd��|j| �}|t|fS|j�}t�}t�}|j|j|��|j|�t}x�|r�|
r�t�fd �t|
�D��}|j|j||��gt|
�D]\}}�|sg|^qg}|j|j||��|j|�|j|�n|s�Pn|r�jtd
��t||d|�}
nS|r%|jd�t||d|�}
n(|jd
�t||d|dt�}
|d7}|j td�|dtd��|jd|t|�t|
�f�t!|
�}
|j|j|
���t}qW|j"|�}|j td�d�|jd|�|r`|t
gkr`|r7tj$td���n|j%td��tt
g�t|fS|t
gk}|j|�||fS(slReturn a tuple (common, anyincoming, remoteheads) used to identify
missing nodes from or in remote.
isquery 1; heads
itbatchssearching for changes
t
filterunknownsall remote heads known locally
sall local heads known remotely
c3s%|]\}}�|r|VqdS(N((t.0titn(tyesno(s:/sys/lib/python2.7/site-packages/mercurial/setdiscovery.pys <genexpr>�sssampling from both directions
Rstaking initial sample
staking quick initial sample
Rt searchingtunittqueriess2query %i; still undecided: %i, sample size is: %i
s%d total queries
srepository is unrelateds!warning: repository is unrelated
N(&t changelogtdagutilt revlogdagtdebugRtlocaltknowntexternalizealltcapableR(tsubmittvaluettipRtTruetFalsetstatusRtinternalizeallR
RtalltnotetnodesetRRtancestorsettdifference_updatet enumeratet
descendantsetR'R!tprogressR%RRtAborttwarn(tuiR5tremotetinitialsamplesizetfullsamplesizetabortwhenunrelatedt
roundtripstclR
townheadsRt
srvheadhashesR(tsrvheadhashesreftyesnoreftsrvheadst
ownheadhashest undecidedtcommontmissingtfulltcommoninsampleR+R,tmissinginsampletresulttanyincoming((R-s:/sys/lib/python2.7/site-packages/mercurial/setdiscovery.pytfindcommonheadsQs�
"/
"
(
tnodeRti18nRR$RR2RRR!R'R<R_(((s:/sys/lib/python2.7/site-packages/mercurial/setdiscovery.pyt<module> s$
|