Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/hgext/convert/monotone.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�t�c@s�ddlZddlZddlmZddlmZmZmZmZddlm	Z	ddl
mZdee	fd��YZdS(i�N(tutil(tNoRepotcommittconverter_sourcet	checktool(tcommandline(t_tmonotone_sourcecBs�eZddd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�ZRS(c
Cs|tj||||�tj||d�||_||_t|_||_tt	d�|�}t
jjt
jj|d��s�,t
|d�}|jd�}|j�Wntk
r�d}nX|dkr��q�d}d	}|}	d
}
d}tj|d|�|_tj|d
|d|
�|_tj|d|d|
�|_tj|d|d|
d|
�|_tj|d|d|�|_tj|d|�|_tj|d|d|
�|_tj||d|d|	�|_|d
||d|}tj|d|d�|_d|_d|_d|_d|_ t!ddt�dS(Ntmtns+%s does not look like a monotone repositoryt_MTNtrbitsSQLite format 3s\s*s\s+"((?:\\"|[^"])*)"\s*s\s+\[(\w+)\]\s*s	(?:.|\n)+tdirtfiletcontenttadd_filetpatchtfromttotrenametdeletettagtrevisiontnametvaluetattrs
"mtn:execute"s"true"tabort("Rt__init__RtuitpathtFalset
automatestdiotrevRRtostexiststjoinR
treadtclosetIOErrortretcompiletdir_retfile_retadd_file_retpatch_ret	rename_ret	delete_rettag_retcert_retattr_execute_retNonetmanifest_revtmanifesttfilestdirsR(
tselfRRR tnorepotftheadertspaceRRRtlinesR((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pyRsV				
!

$"
 				cOs-|jr|j||�S|j||�SdS(N(Rtmtnrunstdiotmtnrunsingle(R7targstkwargs((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pytmtnrunGs	cOs |j|d<|jd||�S(Ntdtautomate(Rtrun0(R7R?R@((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pyR>Ms
cOsg}x]|j�D]O\}}|jdt|�|f�|r|jdt|�|f�qqW|r�|jdd�|jd�n|jd�x(|D] }|dt|�|f7}q�W|jd�dj|�}|jjd|�|jj|�|jj	�|j
|�S(Ns%s:%sitotetlRsmtn: sending '%s'
(t	iteritemstappendtlentinsertR#Rtdebugt
mtnwritefptwritetflushtmtnstdioreadcommandoutput(R7R?R@tcommandtktvtarg((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pyR=Qs"$



cCs�d}d}xJ|dkrX|jjd�}|sKtjtd���n||7}qW|d }|jjd�}|dkr�tjtd�|��n|jjd�}|dkr�tjtd���nd}d}xJ|dkr+|jjd�}|stjtd	���n||7}q�yt|d �}Wn*tk
rltjtd
�|��nX|jj|�}t|�|kr�tjtd�t|�|f��n||||fS(NRt:is%bad mtn packet - no end of commandnbri�tmewptls#bad mtn packet - bad stream type %ss'bad mtn packet - no divider before sizes&bad mtn packet - no end of packet sizes#bad mtn packet - bad packet size %ss9bad mtn packet - unable to read full packet read %s of %s(	R2t	mtnreadfpR$RtAbortRtlongt	TypeErrorRJ(R7R$t
commandnbrtstreamt	lengthstrtlength((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pytmtnstdioreadpackeths>

cCsg}x�r|j�\}}}}|jjd|||f�|dkr�|dkr~tjtd�||f��nPq	|dkr�|jjtd�|j�|jj|�q	|dkr�jjd|�q	|d	kr	|j	|�q	q	Wd
j
|�S(Nsmtn: read packet %s:%s:%s
RGt0smtn command '%s' returned %stews
%s error:
tpsmtn: tmR(tTrueR_RRLRRXRtwarnRQRIR#(R7RQtretvalR[R\R^toutput((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pyRP�s$	cCs|j|krdS|jd|�jd�|_||_i|_i|_x�|jD]�}|jj|�}|r�d}|jd�}|jd�}|j	j|�r�|d7}n||f|j|<n|j
j|�}|rVt|j|jd�<qVqVWdS(Ntget_manifest_ofs

Riitx(R3RAtsplitR4R5R6R*tmatchtgroupR1R)Rd(R7R RFRcRRtnode((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pytmtnloadmanifest�s$			
cCs|j|�||jkS(N(RnR5(R7RR ((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pyt	mtnisfile�s
cCs|j|�||jkS(N(RnR6(R7RR ((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pytmtnisdir�s
cCs�idd6dd6dd6dd6}|jd|�}tjd|�}xi|D]a}|jj|�}|rM|j�\}}|jdd	�}|jd
d�}|||<qMqMW|djd�d
d|d<|S(Ns	<missing>tauthortdatet	changelogtbranchtcertss

      key ["\[]s\"t"s\\s\t.is UTC(RAR'RjR0Rktgroupstreplace(R7R RutcertlistRFRcRR((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pytmtngetcerts�s
cCs*|js|jd�j�S|jgSdS(Ntleaves(R RAt
splitlines(R7((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pytgetheads�s	cCs|jd|�jd�}i}i}g}i}xI|D]A}|jj|�}|r�|||jd�<|||jd�<n|jj|�}|r�|||jd�<n|jj|�}|r�|||jd�<n|jj|�}|r:|jd�}	|jd�}
|j|	|�rPd||	<|
||	<|||	<|||
<q{|j	|	|�r{|j
|
|	f�q{q:q:Wx�D]�}}i}
x[|jD]P}||kr�q�n|j|d�r�||t
|�|
|<d||<q�q�WxQ|
j�D]C\}}|jjtd�||fd�|||<|||<qWx|
j�D]}|||<qWWq�W|j�|fS(Ntget_revisions

iit/s3copying file in renamed directory from '%s' to '%s's
(RARjR+RkRlR,R.R-RoRpRIR5t
startswithRJtitemsRRLRtvalues(R7R RR5t
ignoremovetrenameddirstcopiesRFRcttonametfromnametfromdirttodirtrenamedttofiletfromfile((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pyt
getchanges�sV





cCs�|j||�st�ny|jd|d|�}Wntk
rPt�nX|j|�|jj|d�\}}||fS(Ntget_file_oftrR(NR(RoR&RAt	ExceptionRnR5tgetR2(R7RR tdataRmR((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pytgetfiles	


cCs�i}|j|�}|jd�|dkr;d|d<ntd|ddtjtj|dd��d|d	d
|d|jd|�j�d|dd|�S(
NtsuspendRtt1R%RqRrs%Y-%m-%dT%H:%M:%StdescRsR tparentstextra(R{R�RRtdatestrtstrdateRAR}(R7R R�Ru((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pyt	getcommit&s



cCsdi}xW|jd�jd�D]=}|jj|�}|r|jd�||jd�<qqW|S(Nttagss

ii(RARjR/RkRl(R7R�RFRc((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pytgettags4s#cCs
t�dS(N(tNotImplementedError(R7R ti((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pytgetchangedfiles<scCs0d}y|jd�}t|�}Wn&tk
rMtjtd���nX|dkrt|_|jj	d|�|j
ddd|j�\|_|_
|j
j�}|d	kr�tjtd
�|��nxT|dkr|j
j�}|s�tjtd���q�q�Wn|jj	d
|�dS(Ngtinterface_versions2unable to determine mtn automate interface versiong(@s/mtn automate version %s - using automate stdio
RCtstdios-dsformat-version: 2
s(mtn automate stdio header unexpected: %ss
s1failed to reach end of mtn automate stdio headerss^mtn automate version %s - not using automate stdio (automate >= 12.0 - mtn >= 0.46 is needed)
(R>tfloatR�RRXRRdRRRLt_run2RRMRWtreadline(R7tversiont
versionstrR$((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pytbeforeAs,
	
cCs<|jr8|jj�d|_|jj�d|_ndS(N(RRMR%R2RW(R7((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pytafteras
	
	
N(t__name__t
__module__R2RRAR>R=R_RPRnRoRpR{R~R�R�R�R�R�R�R�(((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pyRs$7				&							8					 (
R!R't	mercurialRtcommonRRRRRtmercurial.i18nRR(((s:/sys/lib/python2.7/site-packages/hgext/convert/monotone.pyt<module>	s
"

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.