ó ŸēƒQc@sWddlZddlmZmZmZmZmZmZmZm Z ddl m Z ddl m Z ddlmZmZmZmZddlmZmZmZddlmZmZddlmZddlZddlZddlZddlZid d 6d d 6d d 6d d 6d d6dd6dd6Zdd„Zde fd„ƒYZ!dS(i’’’’N(tuithgthookterrortencodingt templatertutiltrepoview(twebsub(t_(tget_statt ErrorResponset permhookstcaching(tHTTP_OKtHTTP_NOT_MODIFIEDtHTTP_BAD_REQUEST(tHTTP_NOT_FOUNDtHTTP_SERVER_ERROR(t wsgirequesttpullt changegrouptchangegroupsubsett getbundlet stream_outtlistkeystpushtunbundletpushkeytcCs×|jdƒr|d }n|r3d||}n|}|jdƒrU|d}ng}|}dg|jdƒ}xSt|ƒD]E}| s˜| rœPn|ji|d6|d6ƒtjj|ƒ}q„Wt|ƒS(sĘReturn a 'URL breadcrumb' list A 'URL breadcrumb' is a list of URL-name pairs, corresponding to each of the path items on a URL. This can be used to create path navigation entries. t/i’’’’iRturltname(tendswitht startswithtsplittreversedtappendtostpathtdirname(Rtprefixtrelpatht breadcrumbturlelt pathitemstpathel((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pytmakebreadcrumbs   thgwebcBs³eZddd„Zded„Zeed„Zded„Zd„Z dd„Z d„Z d„Z d„Z d „Zd „Zd „Zidd6dd6dd6Zd„ZRS(cCs,t|tƒrH|r$|jƒ}n tjƒ}tj||ƒ|_n ||_|j|jƒ|_|jjjdddƒ|jj jdddƒ|jjjdddƒ|jj jdddƒt j t ƒd|_ d|_||_d |_d |_|jd d ƒ|_|jƒ|_dS(NRtreport_untrustedtofftnonttyttruei’’’’tziptgztbz2itwebt templates(szipsgzsbz2(t isinstancetstrtcopyRRt repositorytrepot_getviewt setconfigtbaseuiRtredirecttTruetmtimetsizetreponametarchivest stripecounttconfigt templatepatht loadwebsubt websubtable(tselfR>R RAtu((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyt__init__8s&        cCs|jjj|||d|ƒS(Nt untrusted(R>RRI(RMtsectionR tdefaultRP((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyRITscCs|jjj|||d|ƒS(NRP(R>Rt configbool(RMRQR RRRP((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyRSXscCs|jjj|||d|ƒS(NRP(R>Rt configlist(RMRQR RRRP((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyRT\scCsX|jdddƒ}|dkr+|jƒS|tjkrG|j|ƒS|jdƒSdS(NR8tviewtservedtall(RIt unfilteredRt filtertabletfiltered(RMR>t viewconfig((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyR?`s    cCsKt|jjƒ}|j|jks6|j|jkr,|j|_|j|_tj|jj |jj ƒ}|j |ƒ|_t |j dddƒƒ|_t |j dddƒƒ|_t |j dddƒƒ|_t |j dddƒƒ|_|jdd tƒ|_|j dd tjƒt_n|rG|j|jj_ndS( NR8t maxchangesi tstripesitmaxshortchangesi<tmaxfilest allowpullR(R R>tspathtst_mtimeRDtst_sizeRERR=RAtrootR?tintRIR\RHR^R_RSRCR`RtenvRtenviron(RMtrequesttsttr((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pytrefreshis $   cCsPtjjddƒjdƒs-tdƒ‚nddljj}|j|ƒdS(NtGATEWAY_INTERFACERsCGI/1.sJThis function is only intended to be called while running as a CGI script.i’’’’( R&RgtgetR"t RuntimeErrortmercurial.hgweb.wsgicgiR0twsgicgitlaunch(RMRp((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pytrun}scCst||ƒ}|j|ƒS(N(Rtrun_wsgi(RMRftrespondtreq((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyt__call__„sc Css|j|ƒ|jd|_|jjdƒsA|jd7_nd|jkrm|j|jdd7_nd|jkrō|jdjdƒjdƒ}|jjddƒjdƒ}|t|ƒ |krā|t|ƒ}ndj|ƒ}n3|jdjddƒd }|jd dƒd }|j jd dgƒd }t j |ƒr-yR|rjt t ƒ‚n|tkr|j|t|ƒnt j|j||ƒSWq-t k r)}|d krć|jjd dƒjƒdksų|jjddƒr|jƒn|j|t jdd|jƒdSXn|jddƒ}d |j kr|r|d r|jd ƒ}|jdƒ}|dkr­|| g|j d<||d}ntjt|ƒrŅ|g|j d tlowertdrainRttHGTYPEtmessagetpoptrfindRt safehasattrt webcommandst archive_specst iteritemsRRt stringifytNoneRŒRSRCR t__all__RtctypetrawfiletgetattrRRt LookupErrortRepoLookupErrorR;R:tManifestLookupErrorR t RepoErrort RevlogErrorRtcodeR(RMRutpartst repo_partstqueryR}tinsttargsRR„tuatfnttype_tspectextttmplR£tmsgtcontentterr((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyRsˆsŗ            '  cCsØg}|jjjdƒ}||jjjdƒ7}xm|D]e\}}|d}tj|ƒ}tjd|||f|ƒ}|s®|jjjtdƒ||fƒq;ntjd|ƒ}|j ||j dƒƒ} |j ||j dƒƒ} |j dƒ} d } | r=x(| j ƒD]} | tj | O} qWny)tj| | ƒ} |j | | fƒWq;tjk rŸ|jjjtd ƒ|| fƒq;Xq;W|S( NRtinterhgis1^s%s(.+)(?:(?<=\\\\)|(?Rt configitemstretescapetmatchtwarnR tcompiletsubtgrouptuppert__dict__R%R(RMRLt websubdefstkeytpatterntunesctdelimR¾tdelim_retregexptformattflagintflagstflag((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyRK s8 cs|jjdƒ}|dkr-d}d}n d}d}|jd}||kr\d|p_d}d ||jd |f}ˆjd d d ƒ}ˆjd ddƒ}ˆjd dƒpĀ|jd}|jdƒsį|d7}n‡fd†} ‡fd†} ‡fd†} i} |jjddgƒdˆjd dƒdf} tj| ˆj ƒ\}}|| dkr}|| dRŚRÜRŻt sessionvarstpathdef(RfRmRIRR!RR”RtstylemapRJtwebutilRåRFRR>RdR/(RMRutprotot default_porttportRäR×RŲRŁRŚRÜRŻtvarststylesRtmapfiletstartRåRį((RMR¶s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyR4sZ       $    ccsy|jddƒ}x`|jjƒD]O\}}||ksP|jdd|ƒr"i|d6|dd6|d6Vq"q"WdS(NR8t allow_archivetallowRŠit extensionR„(RTRžRŸRS(RMtnodeidtallowedtiR“((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyt archivelist~s"sapplication/x-bzip2ttbz2s.tar.bz2R7sapplication/x-gzipttgzs.tar.gzR6sapplication/zipR5s.zipcCs%xtD]}||||ƒqWdS(N(R (RMRutopR((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyR”Šs N(sapplication/x-bzip2R÷s.tar.bz2N(sapplication/x-gzipRųs.tar.gzN(sapplication/zipszips.zipN(t__name__t __module__R”RORCRItFalseRSRTR?RkRrRvRsRKRRöRžR”(((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyR07s"    ƒ ) J  ("R&R‡RRRRRRRRtmercurial.templatefiltersRtmercurial.i18nR tcommonR R R R RRRRRRhRRR‘RčR¼R“R/tobjectR0(((s=/sys/lib/python2.7/site-packages/mercurial/hgweb/hgweb_mod.pyt s$ :"0