ó 9ÕÒTc@@sÒddlmZddlZddlZddlZddlZddlmZddlmZm Z ddl m Z m Z ddl mZddlmZejeƒZde fd „ƒYZe jeƒdS( i(tabsolute_importN(tcall_subprocess(t display_pathtrmtree(tvcstVersionControl(t path_to_url(t configparsert MercurialcB@szeZdZdZdZdZd„Zd„Zd „Zd „Z d „Z d „Z d „Z d„Z d„Zd„ZRS(thgs.hgtcloneshg+httpshg+httpsshg+sshshg+static-httpcC@s`tjddƒ}|j|ƒz/t|jd|gd|jdtd|ƒWdt|ƒXdS(s?Export the Hg repository at the url to the destination locations-exportspip-tarchivet filter_stdoutt show_stdouttcwdN(ttempfiletmkdtemptunpackRtcmdt_filtertFalseR(tselftlocationttemp_dir((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pytexports cC@sÆtjj||jdƒ}tjƒ}yI|j|ƒ|jdd|ƒt|dƒ}|j |ƒWdQXWn/t tj fk r¡}t j d||ƒn!Xt|jddg|d|ƒdS( Nthgrctpathstdefaulttws/Could not switch Mercurial repository to %s: %stupdates-qR(tostpathtjointdirnameRtSafeConfigParsertreadtsettopentwritetOSErrortNoSectionErrortloggertwarningRR(Rtdestturlt rev_optionst repo_configtconfigt config_filetexc((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pytswitch#s  cC@s@t|jddgd|ƒt|jddg|d|ƒdS(Ntpulls-qRR(RR(RR+R-((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pyR2scC@s´|jƒ\}}|r.|g}d|}n g}d}|j||||ƒr°tjd||t|ƒƒt|jddd||gƒt|jddg|d|ƒndS( Ns (to revision %s)tsCloning hg %s%s to %sR s --noupdates-qRR(t get_url_revtcheck_destinationR)tinfoRRR(RR+R,trevR-t rev_display((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pytobtain7s   cC@sRt|jddgdtd|ƒjƒ}|j|ƒrHt|ƒ}n|jƒS(Nt showconfigs paths.defaultR R(RRRtstript_is_local_repositoryR(RRR,((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pytget_urlIs cC@s¯t|jdgdtd|ƒ}g}x{|jƒD]m}tjd|ƒ}|r4|jdƒ}|jdƒ}d|kr¡|j|jƒ|jƒfƒq¡q4q4Wt |ƒS(NttagsR Rs([\w\d\.-]+)\s*([\d]+):.*$iittip( RRRt splitlinestretsearchtgrouptappendR<tdict(RRR?ttag_revstlinet tags_matchttagR8((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pyt get_tag_revsQs )cC@s¯t|jdgdtd|ƒ}g}x{|jƒD]m}tjd|ƒ}|r4|jdƒ}|jdƒ}d|kr¡|j|jƒ|jƒfƒq¡q4q4Wt |ƒS(NtbranchesR Rs([\w\d\.-]+)\s*([\d]+):.*$iiR( RRRRARBRCRDRER<RF(RRRLt branch_revsRHtbranches_matchtbranchR8((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pytget_branch_revs^s )cC@s.t|jddgdtd|ƒjƒ}|S(Ntparentss--template={rev}R R(RRRR<(RRtcurrent_revision((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pyt get_revisionkscC@s.t|jddgdtd|ƒjƒ}|S(NRQs--template={node}R R(RRRR<(RRtcurrent_rev_hash((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pytget_revision_hashqsc C@sô|j|ƒ}|jƒjdƒs1d|}n|jƒjddƒd}|sWdS|j|ƒ}|j|ƒ}|j|ƒ}|j |ƒ} ||kr¶d|||f} n-|| krÙd|| |f} n d|} d||| fS( Nshg:shg+t-iis%s-%ss%s-devs %s@%s#egg=%s( R>tlowert startswithtegg_nametsplittNoneRSRURKRP( RtdistRt find_tagstrepotegg_project_namet current_revRTRGRMt full_egg_name((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pytget_src_requirementws$    (R shg+httpshg+httpsshg+sshshg+static-http(t__name__t __module__tnameR!t repo_nametschemesRR2RR:R>RKRPRSRURb(((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pyRs      (t __future__RtloggingRRRBt pip.utilsRRRtpip.vcsRRt pip.downloadRtpip._vendor.six.movesRt getLoggerRcR)Rtregister(((s7/usr/lib/python2.7/vendor-packages/pip/vcs/mercurial.pyts    }