�
�c@slddkZddklZlZddklZddkZdd�Zd�Z d�Z
dd�ZdS( i�N(tnullrevtshort(t_c Cs�|i||d|�}|id�}tii|�pti|�ntii|dt|�|f�}|iit d�|�t
i||d�S(s8create a bundle with the specified revisions as a backuptstripsstrip-backups%s-%sssaving bundle to %s
tHG10BZ(tchangegroupsubsettjointostpathtisdirtmkdirRtuitwarnRtchangegrouptwritebundle( trepotbasestheadstnodetsuffixt
extranodestcgt backupdirtname((s#/sys/lib/python/mercurial/repair.pyt_bundles%cCsJt�}x4t|t|��D]}|i||i��qWt|�S(s+find out the filelogs affected by the strip(tsettxrangetlentupdatetfilestsorted(RtstriprevRtx((s#/sys/lib/python/mercurial/repair.pyt
_collectfiless
cs���fd�}h}|i�||i�}|o||d<nx>|D]6}|i|�}||�}|o|||<qLqLW|S(s7return the nodes that have to be saved before the stripcs�g}t|�}}x?t|�D]1}|i|�}|�jo|d}Pq#q#Wxbt||�D]Q}|i|�}|i|�}|�jo |i|�i|�f�qhqhW|S(Ni(RRtlinkrevRtappend(trevlogtextratstartrevtcounttitlrevR(tcltlink(s#/sys/lib/python/mercurial/repair.pyt
collectone#s
$i(t changelogtmanifesttfile(RRR+R,RR%tfnametf((R*R+s#/sys/lib/python/mercurial/repair.pyt_collectextranodes!s tallcCsz|i}|i|�}t|f�}t�}g}x
t|dt|��D]� |i| �}
|
d|jp|
d|job|i| �|
dtjo@x=|
D]1}||jo||jo|i|�q�q�Wq?qP|
d|jo+|
d|jo|i|i | ��n|i
|
�|i| �qPWg}|D]} ||i | �qN~}t||�}
t||
|�}|djo#t
||g|i�|d�n|p|ot
||||d|�}n|i}|i�}t|i�}|i�|i||�|i||�x'|
D]}|i|�i||�q@W|i�y`xOt|t|i��D]5}|i|\}}}|i|d�i|�q�W|i�Wn|i��nX|p|oz|itd��t|d�}ti||�}|i|d d
|t �|i�|d jot!i"|�qln|i#�dS(NiiR3tbackupttemptasadding branch
trbRsbundle:($R-trevRRRt
parentrevstaddRR#Rtdifference_updateR!R2RRR.ttransactiontentriest
startgroupRR/tendgrouptsopenerttruncatetclosetaborttstatusRtopenR
t
readbundletaddchangegrouptTrueRtunlinkt destroyed(RRRR4R*Rttostript saveheadst savebasestrtparentstpt_[1]RRt chgrpfiletmfstttrtoffsettfnR(R/ttroffsettignoreR1tgen((s#/sys/lib/python/mercurial/repair.pyRDsn "
"
*
#
(R
RRRti18nRRtNoneRR!R2R(((s#/sys/lib/python/mercurial/repair.pys<module> s
#
|