�
�c@s]ddkZddklZddklZlZddkZd�Zd�Zd�Z dS(i�N(t_(tshortthexc
s��i�tg}|dD]}|�i|�q~�}��fd�}d}||d|d�\}}|p'd}||d|d�\}}n�i|�} |p)titd�|t| �f��nh}
|g}g}x�|o�|id�}
||
gjou|i |
�xe�|
�D]S}|djo@||
jo|
|i |
�q�|
g|
|<|i |�q8q8Wq��|i
�t|�}g}|D]+}||jo||jo||q�q�~}|djp|o5g}|D]}
|�i|
�q
~d|fSn|d }d
}d}t�}xO|D]G}
|
|jo |i
|
i|
g��q]n||
p|
g}d
||
<t|�}||}t||�}||jo/|
|jo"|}|
}||joPqn||jo-|
|jo |i
|
i|
g��q]nxX|
i|
g�D]D}||o"tt|||��||<q\||g||<q\Wq]W|d
j pt��i|�}|g||fS(s�find the next node (if any) for testing during a bisect search.
returns a (nodes, number, good) tuple.
'nodes' is the final result of the bisect if 'number' is 0.
Otherwise 'number' indicates the remaining possible candidates for
the search and 'nodes' contains the next bisect target.
'good' is True if bisect is searching for a first good changeset, False
if searching for a first bad one.
tskipcstg}|D]}|�i|�q~�}g}|D]}|�i|�q;~}ggt��d}x|D]}d||<qxWxVtt��dd�D]<} || djo%x"�| �D]}
d||
<q�Wq�q�W||djo|dfSn||fS(Nii�(tmintrevtlentNonetxrange(tbadtgoodt_[1]tntbadrevt_[2]tgoodrevst ancestorstnodeRtprev(t clparentst changelog(s$/sys/lib/python/mercurial/hbisect.pytbuildancestorss0*
iR R
is)Inconsistent state, %s:%s is good and badi�iN(t
parentrevstsetRRtutiltAbortRRtpoptappendtsortRRtupdatetgetRtlisttAssertionError(RtstateRRRRR
R
RR tchildrentvisitt
candidatesRRttotRtct unskippedt_[3]tperfecttbest_revtbest_lentpoisontatxtytvaluet best_node((RRs$/sys/lib/python/mercurial/hbisect.pytbisectsz 4!
?5
"cCs�hgd<gd<gd<}tii|id��o~x{|id�D]f}|d i�\}}|i|�}||jotit d�|��n||i
|�qMWn|S(NR
R Rsbisect.statei�sunknown bisect kind %s(tostpathtexiststjointopenertsplittlookupRRRR(trepoR!tltkindR((s$/sys/lib/python/mercurial/hbisect.pyt
load_state{s!
c
Cs�|idddt�}|i�}zQx@|D]8}x/||D]#}|id|t|�f�q?Wq.W|i�Wd|i�XdS(Nsbisect.statetwt
atomictemps%s %s
(R7tTruetwlocktwriteRtrenametrelease(R:R!tfRAR<R((s$/sys/lib/python/mercurial/hbisect.pyt
save_state�s%(
R3ti18nRRRRRR2R=RF(((s$/sys/lib/python/mercurial/hbisect.pys<module>s k
|