�t�c@s�ddlmZmZmZmZddlmZddlmZm Z ddl
Z
ddlZddlZddl
Z
ddlmZdeefd��YZdS(i�(tNoRepotcommandlinetcommittconverter_source(t_(tencodingtutilN(tParsertgnuarch_sourcecBs�eZdefd��YZdd�Zd�Zd�Zd�Zd�Z d�Z
d�Zd �Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(tgnuarch_revcBseZd�ZRS(cCs^||_d|_d|_d|_d|_g|_g|_g|_i|_ i|_
dS(Nt(trevtsummarytNonetdatetauthortcontinuationoft add_filest mod_filest del_filest ren_filestren_dirs(tselfR((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyt__init__s (t__name__t
__module__R(((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyR scCs3tt|�j||d|�tjjtjj|d��sYttd�|��nd|_
tjd�r}d|_
n0tjd�r�d|_
ntj
td���tj|||j
�tjj|�|_d|_d|_d|_i|_i|_i|_t�|_tj|_g|_dS(NRs{arch}s+%s does not look like a GNU Arch repositorytbazttlascannot find a GNU Arch tool(tsuperRRtostpathtexiststjoinRRR
texecmdRtfindexetAbortRtrealpathttmppathttreeversiontlastrevtchangestparentsttagsRtcatlogparserRtarchives(RtuiRR((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyRs*!
cCsjg|jdd�D]}|jd�^q|_|jdkrX|jd|j�}n|jdd|j�}|j�|_|jjd�}t jj
tj�d|d �|_
g|jd<|j}d}x�|re|jjtd
�|�|jd�d}||jkr6|jjtd�|�Pn|jd
dd|�\}}|j|d|�d}x�D]�|j�} |j| �|j| <g|j| <|jdd|j| �\}
}|r�jd| �}
n|j|
| �|j|j| �| }|j| jrJdj
|j| jjd�d �}Pn| ddkruPququWq�WdS(NR,s-ns
Rstree-versions-dt/shg-%sisanalyzing tree version %s...
isItree analysis stopped because it points to an unregistered archive %s...
t revisionss-rs-fs"failed retrieving revisions for %sscat-logscat-archive-logs--i�i�sbase-0(t runlines0trstripR,R!trun0RtstripR&tsplitRR ttempfilet
gettempdirR%R)R
R-tstatusRtrunlinest checkexitR R(trunt_parsecatlogtappendR(RtitoutputtversionR&tchildtarchiveR7tlRtcatlog((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pytbefore=sN.
! cCs1|jjd|j�tj|jdt�dS(Nscleaning up %s
t
ignore_errors(R-tdebugR%tshutiltrmtreetTrue(R((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pytafter�scCs|jdS(N(R)R
(R((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pytgetheads�scCsd||jkr'tjtd���ntjjtjj|j|��sTt �n|j
||�S(Nsinternal calling inconsistency(R'RR#RRRtlexistsR R%tIOErrort_getfile(RtnameR((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pytgetfile�s
$ c Cs�|j|�g}i}x+|j|jD]}|j||f�q*Wx+|j|jD]}|j||f�qXWx+|j|jD]}|j||f�q�Wx\|j|jD]J}|j|j|}|j||f�|j||f�|||<q�Wxt|j|jD]b}|j|j|}|j||�\}}|g|D]}||f^qO7}|j |�qW||_
tt|��|fS(N(
t_updateR(RR<RRRRt_rendirchangestupdateR'tsortedtset( RRR(tcopiestftsrcttotchgstcps((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyt
getchanges�s*
# cCsB|j|}td|jd|jd|jd|j|d|�S(NRRtdescR)R(R(RRRRR)(RRR(((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyt getcommit�s
cCs|jS(N(R*(R((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pytgettags�scOs�|j|g}||7}g|D]}tj|�^q }|dtjdtjg7}tjdj|��}|jj|d�tj |�S(Nt>s2>t s
(
R!Rt
shellquoteRtdevnulltquotecommandR R-RFtsystem(Rtcmdtargstkwargstcmdlinetarg((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyt_execute�s
"cCs�|jjd|�|jdd|j|�\}}|ratj|jdt�|j|�n;|j|d}|jjd||f�|j ||�dS(Nsapplying revision %s...
treplays-dREis)computing changeset between %s and %s...
(
R-RFR8R%RGRHRIt_obtainrevisionR)t_parsechangeset(RRt changesetR7told_rev((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyRQ�scCs�tjtjj|j|��j}tj|�ritjtjj|j|��}|r`dpcd}n=t tjj|j|�d�j
�}|d@r�dp�d}||fS(NRBR
trbiItx(RtlstatRR R%tst_modetstattS_ISLNKtreadlinktopentread(RRORtmodetdata((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyRN�s$!'cCs=dddg}x'|D]}|j|�dkrtSqWtS(Ns{arch}s .arch-idss.arch-inventoryi�(tfindRItFalse(RROtexcludetexc((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyt_exclude�s
cCs�g}tj|�}x�t|�dkr�|j�}tjj||�}|j|�stjj|�r�|gtj|�D]}tjj||�^q7}q�|j|�qqW|S(Ni( RtlistdirtlentpopRR R�tisdirR<(RRtfilestcontentstctpRW((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyt
_readcontents�s8c Cs�g}i}|jtjj|j|��}x\|D]T}tjj||�}tjj||�}|j|�|j|�|||<q4W||fS(N(R�RRR R%R<( RRXtdestR(RVR�RWtstd((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyRR�s!
cCsy|jjd|�|jd||j�}|j|�|jjd|�|j|j�}|j|j|7_dS(Nsobtaining revision %s...
tgetsanalyzing revision %s...
(R-RFRkR%R9R�R(R(RRR>R�((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyRm�s
cCs|jd�r|dS|S(Ns./i(t
startswith(RR((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyt_stripbasepathscCsy�|jj|�}tjtj|dd��|j|_|j|d�|j|_dj |d|j
�f�|j|_|j|j|j�|j|_d|kr�|j|d�|j|_nWn*t
k
rtjtd�|��nXdS(Ns
Standard-dates%Y-%m-%d %H:%M:%StCreators
tSummarysContinuation-ofscould not parse cat-log of %s(R+tparsestrRtdatestrtstrdateR(RtrecodeRR tget_payloadRRt ExceptionR#R(RR{RRC((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyR;s
#
c Cs�x�|D]�}|j�}|jd�r}|jd�r}|j|dj��}|j|�s�|j|jj|�q�q|jd�r�jd�r�j|dj��}|j|�s�|j|jj|�q�q|jd�r5|j|dj��}|j|�s�|j|jj|�q�q|jd�r�|j|d j��}|j|�s�|j|jj|�q�q|jd
�r�|j|dj��}|j|�s�|j|jj|�q�q|jd�r�|dj�j d�}t
|�dkr3|dj�j d
�}n|j|d�}|j|d�}|j|�r�|j|�r�||j|j|<q�q|jd�r�j|dj��}|j|�s�|j|jj|�q�q|jd�r|dj�j d�}t
|�dkr=|dj�j d
�}n|j|d�}|j|d�}|j|�r�|j|�r�||j|j|<q�qqWdS(NtAsA/itDsD/tMbisM->itMs=>Ras itchs/>(
R3R�R�R�R(RR<RRR4R�RR( RR{RRBtfileR�RXtdsttdirs((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyRn sT
N(RRtobjectR R
RRDRJRKRPR\R^R_RkRQRNR�R�RRRmR�R;Rn(((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyRs&
D
(tcommonRRRRtmercurial.i18nRt mercurialRRRRGR5Rutemail.ParserRR(((s9/sys/lib/python2.7/site-packages/hgext/convert/gnuarch.pyt<module> s
"0
|