��c@s�ddlZddlmZddlZddlZddlZdefd��YZd�Zdej fd��YZ
e
ZdS(i�N(t_t
remotelockcBs#eZd�Zd�Zd�ZRS(cCs
||_dS(N(trepo(tselfR((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyt__init__
scCs|jj�d|_dS(N(RtunlocktNone(R((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pytreleases
cCs|jr|j�ndS(N(RR(R((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyt__del__s (t__name__t
__module__RRR(((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyRs cCs*tjd|�r|Sd|jdd�S(s=quote a string for the remote shell ... which we assume is shs[a-zA-Z0-9@%_+=:,./-]*$s'%s't's'\''(tretmatchtreplace(ts((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyt_serverquotestsshpeercBs�eZed�Zd�Zd�Zd�Zd�Zd�Zd�Z e Z
d�Zd�Zd �Z
d
�Zd�Zed�Zd
�Zd�Zdd�ZRS(c
Cs�||_||_d|_|_|_tj|dtdt�}|j dksl|j
sl|jdkr�|jt
jtd�|��n|j|_|jdk r�|jt
jtd���n|j
|_
|j|_|jp�|_|jjddd�}|jjddd �}tj||j
|j|j�}|r�d
||tjdt|�t|j�f�f}|jtd�|�tj|�} | d
kr�|jt
jtd���q�n|j||||�dS(Nt
parsequeryt
parsefragmenttsshscouldn't parse location %sspassword in URL not supportedt.tuit remotecmdthgs%s %s %ss
%s init %ssrunning %s
iscould not create remote repo(t_urlRRtpipeotpipeitpipeetutilturltFalsetschemethosttpatht_abortterrort RepoErrorRtusertpasswdtporttconfigtsshargst
shellquoteRtnotetsystemt
validate_repo(
RRR"tcreatetutsshcmdRtargstcmdtres((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyRs0 (#! #"cCs|jS(N(R(R((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyR=sc
Cs�|j�d||tjdt|�t|j�f�f}|jtd�|�tj|�}tj|�\|_ |_
|_|_|j
d�|j
ddddd dd f�}d
dg}d}x�|d
rN|rN|j�} |j�|d
dkr| dkrPn| r4|jd| �n|j| �|d8}q�W|jtjtd���t�|_xNt|�D]@} | jd�r�|jj| d
jd�dj��Pq�q�WdS(Ns%s %s %ss%s -R %s serve --stdiosrunning %s
thellotbetweentpairss%s-%st0i(ttdummyi�i�s1
s
sremote: is#no suitable response from remote hgs
capabilities:t:(tcleanupRR+RR"R,Rtquotecommandtpopen4RRRt
subprocesst_callstreamtreadlinetreaderrtdebugtappendR#R$R%tsett_capstreversedt
startswithtupdatetsplit(
RRR1R2RR3trtlinest max_noisetl((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyR.@s4
#'
'
'cCs|jS(N(RF(R((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyt
_capabilitiesfscCs�x~tr�tj|j�j}|dkr.Pn|jj|�}|sJPnx0|j�D]"}|jjt d�|d�qWWqWdS(Nisremote: s
(
tTrueRtfstatRtst_sizetreadt
splitlinesRtstatusR(RtsizeRRN((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyRBis cCs|j�|�dS(N(R<(Rt exception((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyR#ts
cCs�|jdkrdS|jj�|jj�y1x*|jD]}|jjtd�|�q:WWntt fk
rwnX|jj�dS(Nsremote: (
RRtcloseRRRRURtIOErrort
ValueError(RRN((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyR<xs
!cKsS|jjd|�|jjd|�tj|\}}|j�}i}x=|D]5}|dkrt||d<PqT||||<||=qTWx�t|j��D]�\}}|jjd|t |�f�t
|t�r+x]|j�D]<\} }
|jjd| t |
�f�|jj|
�q�q�|jj|�q�W|jj�|j
S(Nssending %s command
s%s
t*s%s %d
(RRCRtwritet wireprototcommandsRJtsortedt iteritemstlent
isinstancetdicttflushR(RR3R2t_functnamestkeystwireargstktvtdktdv((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyR@�s(
cKs|j||�|j�S(N(R@t_recv(RR3R2((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyt_call�scKs�|j||�}|r"d|fSx0trT|jd�}|sDPn|j|�q%W|jddt�|j�}|r�d|fS|j�dfS(NR9iRd(RnRPRSt_sendRm(RR3tfpR2RKtd((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyt _callpush�s
cCs|S(N((Rtstream((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyt_decompress�scCs�|jj�}|dkr�g}x9tr\|jj�}|dkrIPn|j|g�q$Wt|�dkr�|dd |d<n|jtj|��n|j �yt
|�}Wn0tk
r�|jtjt
d�|��nX|jj|�S(Ns
s-
ii�sunexpected response:(RRARPRtextendRaR#R$tOutOfBandErrorRBtintRZt
ResponseErrorRRS(RRNterrtline((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyRm�s"
#cCsW|jjdt|��|r3|jj|�n|rI|jj�n|j�dS(Ns%d
(RR\RaRdRB(RtdataRd((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyRo�scCs|jd�t|�S(Ntlock(RnR(R((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyR|�s
cCs|jd�dS(NR(Rn(R((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyR�scCs�|jd�}|r8|jtjtd�|��nx=trw|jd�}|sZPn|jj|�|j �q;W|jj
�|j �|j�}|s�dSyt|�SWn0t
k
r�|jtjtd�|��nXdS(s�Send a changegroup to the remote server. Return an integer
similar to unbundle(). DEPRECATED, since it requires locking the
remote.taddchangegroupspush refused: %siisunexpected response:N(RnR#R$R%RRPRSRR\RBRdRmRwRZRx(RtcgtsourceRR|RqRK((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyR}�s$#
N(R R
RRRR.RORBR#R<RR@RnRrRtRmRoR|RRR}(((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyRs" &
(Rti18nRRR$R]tobjectRRtwirepeerRtinstance(((s5/sys/lib/python2.7/site-packages/mercurial/sshpeer.pyt<module>s$
|