³ò ø$•Jc@s:ddkZddkZddkZddkZddkZddkZddkZddklZl Z ddk l Z l Z ddkl ZddklZlZlZlZdddd d d d d ddg ZdZd„Zd„Zd„Zd„Zd„Zd„Z d„Zd„Zd„Zd„ZdS(iÿÿÿÿN(tutilt streamclone(tbinthex(t changegroup(t ErrorResponsetHTTP_OKtHTTP_NOT_FOUNDtHTTP_SERVER_ERRORtlookuptheadstbranchestbetweenRtchangegroupsubsett capabilitiestunbundlet stream_outt branchmapsapplication/mercurial-0.1c cs‰y*t|i|iddƒƒ}d}Wn'tj o}t|ƒ}d}nXd||f}|ittdt|ƒƒ|VdS(Ntkeyiis%s %s tlength( RR tformt ExceptiontstrtrespondRtHGTYPEtlen(trepotreqtrtsuccesstinsttresp((s+/sys/lib/python/mercurial/hgweb/protocol.pyR s    ccsGditt|iƒƒƒd}|ittdt|ƒƒ|VdS(Nt s R(tjointmapRR RRRR(RRR((s+/sys/lib/python/mercurial/hgweb/protocol.pyR $s"c cs¹|iƒ}g}xp|iƒD]b\}}ti|ƒ}g}|D]}|t|ƒqE~} |id|di| ƒfƒqWdi|ƒ} |itt dt | ƒƒ| VdS(Ns%s %sR s R( Rt iteritemsturllibtquoteRtappendR!RRRR( RRR R tbranchtnodest branchnamet_[1]tnodet branchnodesR((s+/sys/lib/python/mercurial/hgweb/protocol.pyR)s  '$ccs·g}d|ijo'tt|iddidƒƒ}ntiƒ}x:|i|ƒD])}|iditt |ƒƒdƒqYW|i ƒ}|i t t dt|ƒƒ|VdS(NR(iR s R(RR"Rtsplitt cStringIOtStringIOR twriteR!RtgetvalueRRRR(RRR(Rtb((s+/sys/lib/python/mercurial/hgweb/protocol.pyR 4s' ' c csÕd|ijoKg}|iddidƒD]}|tt|idƒƒq/~}ntiƒ}x:|i|ƒD])}|iditt |ƒƒdƒqwW|i ƒ}|i t t dt|ƒƒ|VdS(NtpairsiR t-s R(RR-R"RR.R/R R0R!RR1RRRR(RRR*tpR3RR2((s+/sys/lib/python/mercurial/hgweb/protocol.pyR ?sD ' ccs©|ittƒg}d|ijo'tt|iddidƒƒ}ntiƒ}|i |dƒ}x,|i dƒ}|pPn|i |ƒVqn|i ƒVdS(NtrootsiR tservei( RRRRR"RR-tzlibt compressobjRtreadtcompresstflush(RRR(tztftchunk((s+/sys/lib/python/mercurial/hgweb/protocol.pyRJs' c cs|ittƒg}g}d|ijo?g}|iddidƒD]}|t|ƒqK~}nd|ijo?g}|iddidƒD]}|t|ƒqš~}ntiƒ}|i||dƒ}x,|i dƒ} | pPn|i | ƒVqÞ|i ƒVdS(NtbasesiR R R7i( RRRRR-RR8R9R R:R;R<( RRR@R R*txt_[2]R=R>R?((s+/sys/lib/python/mercurial/hgweb/protocol.pyR [s?? ccs¥dddg}|iidddtƒo|id|iiƒntio!|idd itiƒƒnd i|ƒ}|i t t d t |ƒƒ|VdS( NR R Rtservert uncompressedt untrusteds stream=%ds unbundle=%st,R R( tuit configbooltTrueR&t changelogtversiontchangegroupmodtbundlepriorityR!RRRR(RRtcapstrsp((s+/sys/lib/python/mercurial/hgweb/protocol.pyRos !cs|iidƒpd}|iddidƒ‰‡‡fd†}|ƒp|iƒttdƒ‚ntidd ƒ\}}t i |d ƒ}zÚt |id ƒ}x*t i |d |ƒD]}|i|ƒqÂWyÁˆiƒ} z£|ƒpttdƒ‚n|idƒ|id ƒ} | idƒo!| idƒ otdƒ‚n!| tijotdƒ‚nti| |ƒ} titif} tiƒt_t_z•d|ti|iiddƒƒti|iiddƒƒf} yˆi| d| ƒ}Wn2t ij o#}tiid|ƒd}nXWdtii ƒ}| \t_t_X|i!tt"ƒd||ffSWd| i#ƒXWnÒtj o}tt|ƒ‚n°t$t%fj o}t&|ddƒ}|iˆi'ƒo|t(ˆi'ƒd}nd}t&|ddƒ}|i)t)i*jo t+}nt,}t|d||fƒ‚nXWd|i-ƒt i.|ƒXdS(Nswsgi.url_schemethttpR iR cs5ttˆiƒƒ}ˆtdƒgjp ˆ|jS(Ntforce(R"RR (R (Rt their_heads(s+/sys/lib/python/mercurial/hgweb/protocol.pyt check_heads~ssunsynced changestprefixs hg-unbundle-swb+tCONTENT_LENGTHtlimititHGtHG10sunknown bundle versionsunknown bundle compression typesremote:%s:%s:%st REMOTE_HOSTtt REMOTE_USERR7s abort: %s s%d %stfilenameitstrerrors Unknown errors%s: %s(/tenvtgetRR-tdrainRRttempfiletmkstemptostfdopentintRt filechunkiterR0tlocktseekR:t startswitht ValueErrorRLt bundletypesRtsyststdouttstderrR.R/R$R%taddchangegrouptAbortR1RRtreleasetOSErrortIOErrortgetattrtrootRterrnotENOENTRRtclosetunlink(RRtprotoRStfdttempnametfpRtsRgtheadertgentoldioturltretRtvalR\terrortcode((RRRs+/sys/lib/python/mercurial/hgweb/protocol.pyRysp     !" " ccsc|ittƒy)x"ti|dtƒD] }|Vq)WWn#tij o}t|ƒVnXdS(NRE(RRRRRRItStreamExceptionR(RRR?R((s+/sys/lib/python/mercurial/hgweb/protocol.pyRÈs (R.R8RaRvRcRlR$t mercurialRRtmercurial.nodeRRRRLtcommonRRRRt__all__RR R RR R R RRR(((s+/sys/lib/python/mercurial/hgweb/protocol.pyss$T"      O