��c@syddlmZddlmZddlmZddlZddlZed�Z d�Z
d�Zdd d
�ZdS(i�(tchangegroup(tshort(t_Nc
Cs�|j||d�}|jd�}tjj|�sFtj|�ntjj|dt|�|f�}|rzd} nd} tj||| �S(s8create a bundle with the specified revisions as a backuptstripsstrip-backups%s-%s.hgtHG10BZtHG10UN( tchangegroupsubsettjointostpathtisdirtmkdirRRtwritebundle(
trepotbasestheadstnodetsuffixtcompresstcgt backupdirtnamet
bundletype((s4/sys/lib/python2.7/site-packages/mercurial/repair.pyt_bundles% cCsJt�}x4t|t|��D]}|j||j��qWt|�S(s+find out the filelogs affected by the strip(tsettxrangetlentupdatetfilestsorted(R
tstriprevRtx((s4/sys/lib/python2.7/site-packages/mercurial/repair.pyt
_collectfiless csPt����fd�}||j�x!|D]}||j|��q/W�S(s<return the changesets which will be broken by the truncationcsh�fd��D�}x|D]}|�krPqqWx*|D]"}|�kr>�j|�q>q>WdS(Nc3s|]}�j|�VqdS(N(tlinkrev(t.0ti(trevlog(s4/sys/lib/python2.7/site-packages/mercurial/repair.pys <genexpr>)s(tadd(R$tlinkgentlrev(tsR(R$s4/sys/lib/python2.7/site-packages/mercurial/repair.pyt
collectone(s
(Rtmanifesttfile(R
RRR)tfname((R(Rs4/sys/lib/python2.7/site-packages/mercurial/repair.pyt_collectbrokencsets%s
talltbackupc& Cs�|j�}|j�|j}t|t�r:|g}ng|D]}|j|�^qA}t|�}|dk} t|�}
x8|D]0}x'|j|g�D]}|
j |�q�Wq�Wt
||�}
t||
|�}t|�}x`t|dt
|��D]E}||
kr|j |�|j|j|��|j |�qqWg|D]}|j|�^qR}|r�t|j|��}|j|�ng|D]}|j|�^q�}g|
D]}|j|�^q�}|jd|
|
�}|r||dj�}nd}|j}g}x>|D]6}|||j�}||
kr*|j|�q*q*Wd}|dkr�t|||j�||�}|jjtd�|�|jjdd|�n|s�|r�||||d d
| �}n|j}|jd�}t
|j�}y3|j�|j||�|j||�x'|
D]}|j |�j||�qOW|j!�y`xOt|t
|j��D]5}|j|\}} }!|j"|d�j#| �q�W|j$�Wn|j%��nX|s�r�|j&td��t'|d
�}"t(j)|"|�}#|jj*sO|jj+�n|j,|#dd|t-�|jj*s�|jj.�n|"j$�| s�t/j0|�q�nxs|j1�D]e}$yt/j0|$�Wq�t2k
r}%|%j3t3j4kr|j5td�|$t|%�f�qq�Xq�Wx"|D]}||j�||<q%W|j6�WnJ|rt|j5td�|�n |r�|j5td�|�n�nX|j7�dS(NRismax(parents(%ld) - (%ld))it.R.ssaved backup bundle to %s
tbackupbundlettempRtasadding branch
trbsbundle:serror removing %s: %s
s)strip failed, full bundle stored in '%s'
s,strip failed, partial bundle stored in '%s'
(8t
unfilteredt
destroyingt changelogt
isinstancetstrtrevtminRtdescendantsR%R R-RRtdifference_updatet
parentrevsRtrevst
_bookmarkstappendtNoneRRtuitstatusRtlogR*ttransactiontentriest
startgroupRR+tendgrouptsopenerttruncatetclosetaborttnotetopenRt
readbundletverboset
pushbuffertaddchangegrouptTruet popbufferRtunlinkt undofilestOSErrorterrnotENOENTtwarntwritet destroyed(&RCR
tnodelistR/ttopictclRt striplistRtkeeppartialbundlettostripR:tdescRtsaverevst saveheadstrR<t savebasest
stripbasestnewbmtargettbmtupdatebmtmt
backupfilet chgrpfiletmfstttrtoffsettfnR#R+ttroffsettignoretftgentundofilete((s4/sys/lib/python2.7/site-packages/mercurial/repair.pyR:s�
"
"""
.
(
t mercurialRtmercurial.nodeRtmercurial.i18nRRRYRTRR R-R(((s4/sys/lib/python2.7/site-packages/mercurial/repair.pyt<module> s
|