�
�c
@s�ddklZlZddklZddkZddkZddkZddkZddk Z de
fd��YZdeifd��YZ
e
ZdS(i�(tbinthex(t_Nt
remotelockcBs#eZd�Zd�Zd�ZRS(cCs
||_dS(N(trepo(tselfR((s$/sys/lib/python/mercurial/sshrepo.pyt__init__scCs|ii�d|_dS(N(RtunlocktNone(R((s$/sys/lib/python/mercurial/sshrepo.pytreleases
cCs|io|i�ndS(N(RR (R((s$/sys/lib/python/mercurial/sshrepo.pyt__del__s
(t__name__t
__module__RR R
(((s$/sys/lib/python/mercurial/sshrepo.pyR
s t
sshrepositorycBs�eZdd�Zd�Zd�Zd�Zd�Zd�ZeZd�Z d�Z
d �Zed
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(ic
Cs�||_||_tid|�}|p$|ititd�|��n|id�|_ |id�|_
|id�|_|id�pd|_|ii
dd d �}|ii
dd
d�}ti||i
|i |i�}|ovd}|||||if}|itd
�|�ti|�} | djo |ititd���qln|i||||�dS(Ns,^ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?$scouldn't parse location %siiiit.tuitssht remotecmdthgs%s %s "%s init %s"srunning %s
iscould not create remote repo(t_urlRtretmatchtabortterrort RepoErrorRtgrouptuserthosttporttpathtconfigtutiltsshargstnotetsystemt
validate_repo(
RRRtcreatetmtsshcmdRtargstcmdtres((s$/sys/lib/python/mercurial/sshrepo.pyRs( $!
$cCs|iS(N(R(R((s$/sys/lib/python/mercurial/sshrepo.pyturl5sc
Cs�|i�d}|||||if}ti|�}|itd�|�ti|�\|_|_|_ |i
d�|i
dddddddf�}d d
g}d}x�|do||ou|i�} |i�|dd
jo| djoPn| o|i
td�| �n|i| �|d8}q�W|ititd���t�|_xPt|�D]B} | id�o,|ii| d id�di��PqvqvWdS(Ns%s %s "%s -R %s serve --stdio"srunning %s
thellotbetweentpairss%s-%st0i(ttdummyi�i�s1
s
sremote: is#no suitable response from remote hgs
capabilities:t:(tcleanupRRtquotecommandR!Rtpopen3tpipeotpipeitpipeetdo_cmdtreadlinetreaderrtdebugtappendRRRtsettcapabilitiestreversedt
startswithtupdatetsplit(
RRR&R'RR(trtlinest max_noisetl((s$/sys/lib/python/mercurial/sshrepo.pyR#8s4
!
'
'cCsex^ti|i�i}|djoPn|ii�}|pPn|iitd�|�qdS(Nisremote: (RtfstatR7tst_sizeR9RtstatusR(RtsizeRF((s$/sys/lib/python/mercurial/sshrepo.pyR:ZscCs|i�|�dS(N(R2(Rt exception((s$/sys/lib/python/mercurial/sshrepo.pyRbs
cCsfyX|ii�|ii�x*|iD]}|iitd�|�q'W|ii�WnnXdS(Nsremote: (R5tcloseR6R7RRIR(RRF((s$/sys/lib/python/mercurial/sshrepo.pyR2fs
cKs�|iitd�|�|iid|�xJ|i�D]<\}}|iid|t|�f�|ii|�q;W|ii�|iS(Nssending %s command
s%s
s%s %d
( RR;RR5twritet iteritemstlentflushR6(RR(R'tktv((s$/sys/lib/python/mercurial/sshrepo.pyR8ss
cKs|i||�|i�S(N(R8t_recv(RR(R'((s$/sys/lib/python/mercurial/sshrepo.pytcall}scCsb|ii�}|i�yt|�}Wn&|ititd�|��nX|ii|�S(Nsunexpected response:( R6R9R:tintRRt
ResponseErrorRtread(RRF((s$/sys/lib/python/mercurial/sshrepo.pyRS�s
#cCs[|iidt|��|o|ii|�n|o|ii�n|i�dS(Ns%d
(R5RMRORPR:(RtdataRP((s$/sys/lib/python/mercurial/sshrepo.pyt_send�scCs|id�t|�S(Ntlock(RTR(R((s$/sys/lib/python/mercurial/sshrepo.pyRZ�s
cCs|id�dS(NR(RT(R((s$/sys/lib/python/mercurial/sshrepo.pyR�scCs||idtd��|idd|�}|d idd�\}}t|�ot|�Sn|iti|��dS(Ntlookupslook up remote revisiontkeyi�t i( t
requirecapRRTRBRURRRR(RR\tdtsuccessRX((s$/sys/lib/python/mercurial/sshrepo.pyR[�s
cCsZ|id�}ytt|d id��SWn&|ititd�|��nXdS(Ntheadsi�R]sunexpected response:(RTtmapRRBRRRVR(RR_((s$/sys/lib/python/mercurial/sshrepo.pyRa�s
c
Cs�|id�}y|h}xk|i�D]]}|id�}ti|d�}g}|dD]}|t|�q\~}|||<q%W|SWntitd�|��nXdS(Nt branchmapR]iisunexpected response:( RTt
splitlinesRBturllibtunquoteRRRVR(RR_Rct
branchparttbranchheadst
branchnamet_[1]tx((s$/sys/lib/python/mercurial/sshrepo.pyRc�s
+cCs�ditt|��}|idd|�}yGg}|i�D]%}|ttt|id���qA~}|SWn&|it i
td�|��nXdS(NR]tbranchestnodessunexpected response:(tjoinRbRRTRdttupleRRBRRRVR(RRmtnR_Rjtbtbr((s$/sys/lib/python/mercurial/sshrepo.pyRl�s?cCs�dig}|D]}|ditt|��q~�}|idd|�}yOg}|i�D]-}||ott|id��pgqe~}|SWn&|iti t
d�|��nXdS(NR]t-R,R-sunexpected response:(RnRbRRTRdRRBRRRVR(RR-RjtpRpR_t_[2]RF((s$/sys/lib/python/mercurial/sshrepo.pyR,�s<GcCs+ditt|��}|idd|�S(NR]tchangegrouptroots(RnRbRR8(RRmtkindRp((s$/sys/lib/python/mercurial/sshrepo.pyRv�scCs_|idtd��ditt|��}ditt|��}|idd|d|�S(Ntchangegroupsubsetslook up remote changesR]tbasesRa(R^RRnRbRR8(RRzRaRx((s$/sys/lib/python/mercurial/sshrepo.pyRy�scCs|iddditt|���}|o$|ititd�|��nx+|id�}|pPn|i |�qU|i ddt
�|i�}|o$|ititd�|��n|i�}yt|�SWn&|iti
td �|��nXdS(
NtunbundleRaR]spush refused: %siR/RPspush failed: %ssunexpected response:(RTRnRbRRRRRRWRYtTrueRSRURV(RtcgRatsourceR_RC((s$/sys/lib/python/mercurial/sshrepo.pyR{�s"'$$cCs�|id�}|o$|ititd�|��nx8|id�}|pPn|ii|�|i�q=|ii �|i�|i
�}|pdSnyt|�SWn&|ititd�|��nXdS(Ntaddchangegroupspush refused: %siisunexpected response:(
RTRRRRRWR5RMR:RPRSRURV(RR}R~R*R_RC((s$/sys/lib/python/mercurial/sshrepo.pyR�s$$
cCs
|id�S(Nt
stream_out(R8(R((s$/sys/lib/python/mercurial/sshrepo.pyR�s(RRRR*R#R:RR2R
R8RTRStFalseRYRZRR[RaRcRlR,RvRyR{RR�(((s$/sys/lib/python/mercurial/sshrepo.pyR
s. "
(tnodeRRti18nRRRRRRetobjectRt
repositoryR
tinstance(((s$/sys/lib/python/mercurial/sshrepo.pys<module>s$
|