��Qc@s�ddlZddlZddlZddlZddlmZddlmZmZddl m
Z
ddlmZm
Z
mZmZddlmZddlZdefd��YZdS( i�N(tStringIO(tencodingtutil(t_(tNoRepotcommittconverter_sourcet checktool(tmakedatetimestamptconvert_cvscBs\eZd d�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d�ZRS(
cCstt|�j||d|�tjj|d�}tjj|�s_ttd�|��nt d�d|_i|_i|_
i|_d|_ttjj|d��j�d |_ttjj|d��j�d |_tj|_|j�dS(NtrevtCVSs$%s does not look like a CVS checkouttcvstRooti�t
Repository(tsuperR t__init__tostpathtjointexistsRRRtNonet changesettfilesttagst
lastbranchtsockettopentreadtcvsroottcvsrepoRt_connect(tselftuiRR
R((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pyRs
((c
Cs|jdk rdSi|_d}|jrqyt|j�}Wqqtk
rmtjtd�|j��qqXntj �}zutj
|j�d}d}|jj
ddt�s�d}ntj|jd|�}tj|j|dt|jjddd ��d
|jjddd�d|jjdd
d��}x�|D]�}|r^|j|kr^Pnt|j�}|j|j�|_||j|j<|j|j�|_|jj
dd�r�t|jd�|_ntj|jd�}|jjtj |j|��i}xZ|j!D]O} ddj"g| j#D]}
t|
�^q2�ddg| j$f|| j%<qWt&d|jd|dg|j'D]}t|j�^q�d|jd|jp�d�}||j|<||j(|<q?W|jj)�|_*Wdtj
|�XdS(Nis$revision %s is not a patchset numbertupdatetconvertscvsps.cachetcachetfuzzs
cvsps.fuzzi<tmergetos
cvsps.mergetot mergefromscvsps.mergefromt
localtimezones%Y-%m-%d %H:%M:%S %1%2s%s%st.ts(DEAD)tauthortdatetparentstdesctbranch(+RRR
tintt
ValueErrorRtAbortRRtgetcwdtchdirRR!t
configbooltTruetcvspst createlogtcreatechangesettconfigtidtstrtrecodeR+RR/tcommentRR,tdatestrRR"tdicttfromkeystentriesRtrevisiontdeadtfileRR-Rtvaluestheads(
R tmaxrevtdR;R$tdbtcsR,Rtftxtptc((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pyt_parse&sZ
"%
cCs�|j}d}d-\}}ddg}|jjtd�|�|jd�r~|d}tjd|�}|r~d}|j�\}}}} }|s�d}n| s�d } nt | �} d
|||f}
d||| |f}|s�}t
jjd
�}y�t
|�}
x{|
j�j�D]g}|jdd�\}}|dkrq|jdd�\}}|}n|
}||kr&|}Pq&q&W|
j�Wq�tk
r�}|jtjkr�|dd�s�||_n�q��ntj�}|j|| f�|jdjd|||ddg��|jd�dkr_tjtd���n|jd�|_|_ q~n|r�|jd�r�d}|d}n|s5|jd�r�|d}ntjd|�}t
jj!|�s�r�}q5d }|j"d�|j"d!�|j"d"�}}}n|dkr�d kr�t
j#j$d#�pbd$}|r�|d%||g|}q�||g|}ng|D]}tj%|�^q�}tj&dj|��}tj'|�\|_|_ n||_(|jj)d&|�|jj)d'�|jj)d(�|jj*�|j j+�}|jd)�sstjtd*�|��nd+|kr�|jj)d,�|jj*�|j j+�}ndS(.NRtserversconnecting to %s
s :pserver:i s.(?:(.*?)(?::(.*?))?@)?([^:\/]*)(?::(\d*))?(.*)tpservert anonymousia s:pserver:%s@%s:%ss:pserver:%s@%s:%d%stAs
~/.cvspasst is/1tfilenames
sBEGIN AUTH REQUESTsEND AUTH REQUESTR*i�sI LOVE YOU
s!CVS pserver authentication failedsr+s:local:tlocalis:ext:is(?:([^@:/]+)@)?([^:/]+):?(.*)trshiitCVS_RSHtsshs-lsRoot %s
scValid-responses ok error Valid-requests Mode M Mbinary E Checked-in Created Updated Merged Removed
svalid-requests
sValid-requestssKunexpected response from CVS server (expected "Valid-requests", but got %r)tUseUnchangeds
UseUnchanged
(NN(,RRR!tstatusRt
startswithtretmatchtgroupsR0RRt
expanduserRRt
splitlinestsplittclosetIOErrorterrnotENOENTtgetattrRVRtconnecttsendRtrecvRR2tmakefiletwriteptreadptisdirtgrouptenvirontgett
shellquotetquotecommandtpopen2trealroottwritetflushtreadline(R troottconntypetuserthosttcmdtmtpasswtservtporttformat0tformat1tcvspasstpftlinetpart1tpart2tformattinsttsckRXtargtr((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pyR`s�
2"
cCs|j�|jS(N(RPRG(R ((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pytgetheads�s
c
Csdd�}|j�|jd�r+t�nd|j�}|j|jd|�x"|D]}|jjd|�qZW|jjd|j�|jj �d}d}x�tr_|jj
�}|jd�s�|jd �r9|jj
�|jj
�|jj
�d
}t|jj
�d
�} ||j| �}q�|jd�rY||d7}q�|jd
�rkq�|jd�r�t|jj
�d
�} ||j| �}q�|dkr�dkr�tjtd���n|d|kr�p�fS|jd�r$|jjtd�|d�q�|jd�rC|jj
�q�tjtd�|��q�WdS(NcSs�d}t�}xg|dkrx|jt||��}|sXtjtd�|��n|t|�8}|j|�qW|j�S(Niis!%d bytes missing from remote file( RRtminRR2RtlenRwtgetvalue(tfptcountt chunksizetoutputtdata((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pytchunkedread�s
s(DEAD)s-N -P -kk -r %s --t/sArgument %s
sDirectory .
%s
co
R*sCreated sUpdated i�RUisM sMbinary sok
smalformed response from CVSRMsE scvs server: %s
itRemovesunknown CVS response: %s(RPtendswithReRctappendRRmRwRvRxRR6RnRyR]R0RR2RR!twarn(
R tnameR
R�targsRMR�tmodeR�R�((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pytgetfile�sH
!cCs'|j�t|j|j��ifS(N(RPtsortedRt iteritems(R R
((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pyt
getchangess
cCs|j�|j|S(N(RPR(R R
((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pyt getcommit s
cCs|j�|jS(N(RPR(R ((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pytgettags
s
cCs|j�t|j|�S(N(RPR�R(R R
ti((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pytgetchangedfiless
N(t__name__t
__module__RRRPRR�R�R�R�R�R�(((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pyR s : i 8 (RR^RRft cStringIORt mercurialRRtmercurial.i18nRtcommonRRRRRR7R (((s5/sys/lib/python2.7/site-packages/hgext/convert/cvs.pyt<module>s0"
|