ó œ0{Yc@s¿ddlZddlZddlZddlmZddlmZmZddlm Z m Z ddl m Z ddl mZmZejZejZde fd„ƒYZe jeƒdS( iÿÿÿÿN(tcall_subprocess(t display_pathtrmtree(tvcstVersionControl(tlogger(t url2pathnameturlparsetGitcBs¤eZdZdZdZdZdZd Zdd „Z d „Z d „Z d „Z d„Z d„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(tgits.gittclonesgit+https git+httpssgit+sshsgit+gitsgit+files git-clone.txtss# This was a Git repo; to make it a repo again run: git init git remote add origin %(url)s -f git checkout %(rev)s c Osê|rÊt|ƒ\}}}}}|jdƒrÊ|t|jdƒƒ } | t|ƒjddƒjdƒ} t||| ||fƒ}|jdƒd} || t|| || ||fƒ}qÊntt |ƒj |||ŽdS(Ntfilet/s\t+i( turlsplittendswithtlentlstripRtreplacet urlunsplittfindtsuperRt__init__( tselfturltargstkwargstschemetnetloctpathtquerytfragmenttinitial_slashestnewpatht after_plus((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pyRs%-cCsÃd}}x²|jƒD]¤}|jƒ s|jƒjdƒrEqntjd|ƒ}|ru|jdƒjƒ}ntjd|ƒ}|r¥|jdƒjƒ}n|r|r||fSqWdS(Nt#s$git\s*remote\s*add\s*origin(.*)\s*-fis^git\s*checkout\s*-q\s*(.*)\s*(NN(tNonet splitlineststript startswithtretsearchtgroup(RtcontentRtrevtlinet url_matcht rev_match((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pytparse_vcs_bundle_file%s " cCs…tjddƒ}|j|ƒzT|jdƒs>|d}nt|jdddd|gd|jd td |ƒWd t|ƒXd S( s@Export the Git repository at the url to the destination locations-exportspip-R scheckout-indexs-as-fs--prefixt filter_stdoutt show_stdouttcwdN( ttempfiletmkdtemptunpackRRtcmdt_filtertFalseR(Rtlocationttemp_dir((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pytexport4s  cCs`|j|ƒ}d|}||kr0||gS||krG||gStjd|ƒ|SdS(s¶Check the revision options before checkout to compensate that tags and branches may need origin/ as a prefix. Returns the SHA1 of the branch or tag if found. s origin/%ss5Could not find a tag or branch '%s', assuming commit.N(tget_refsRtwarn(RR,tdestt rev_optionst revisionst origin_rev((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pytcheck_rev_optionsAs     cCsPt|jdd|gd|ƒt|jddg|d|ƒ|j|ƒdS(Ntconfigsremote.origin.urlR3tcheckouts-q(RR7tupdate_submodules(RR?RR@((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pytswitchSs cCsrt|jddgd|ƒ|r>|j|d||ƒ}nt|jdddg|d|ƒ|j|ƒdS(Ntfetchs-qR3itresets--hard(RR7RCRF(RR?R@((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pytupdate[s #cCs|jƒ\}}|r.|g}d|}ndg}d}|j||||ƒrþtjd||t|ƒfƒt|jdd||gƒ|j|ƒ|rþ|j|||ƒ}|j |ƒj |dƒsût|jddg|d |ƒqûqþndS( Ns (to %s)s origin/mastertsCloning %s%s to %sR s-qiRER3( t get_url_revtcheck_destinationRtnotifyRRR7RFRCt get_revisionR'(RR?RR,R@t rev_display((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pytobtaines     cCs.t|jddgdtd|ƒ}|jƒS(NRDsremote.origin.urlR2R3(RR7R9R&(RR:R((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pytget_urlxscCs.t|jddgdtd|ƒ}|jƒS(Ns rev-parsetHEADR2R3(RR7R9R&(RR:t current_rev((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pyRO~s!cCs÷t|jdgdtd|ƒ}i}xÉ|jƒjƒD]µ}|jddƒ\}}|jƒ}d }|jdƒrŒ|tdƒ}nD|jdƒr®|tdƒ}n"|jdƒrÐ|tdƒ}n|d k r:|jƒ||¡ss%s-%ss%s-devs %s@%s#egg=%s( RRtlowerR'tegg_nameRVR$ROR=tdicttitems( RtdistR:t find_tagstrepotegg_project_nameRTtrefstnames_by_committ full_egg_name((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pytget_src_requirement–s   cCs‘d|jkrld|jks$t‚|jjddƒ|_tt|ƒjƒ\}}|jddƒ}ntt|ƒjƒ\}}||fS(s; Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes doesn't work with a ssh:// scheme (e.g. Github). But we need a scheme for parsing. Hence we remove it again afterwards and return it as a stub. s://sfile:sgit+s git+ssh://sssh://RK(RtAssertionErrorRRRRL(RRR,((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pyRL«scCsNtjjtjj|dƒƒs%dSt|jdddddgd|ƒdS(Ns .gitmodulest submoduleRJs--inits --recursives-qR3(tosRtexiststjoinRR7(RR:((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pyRF¼s!(R sgit+https git+httpssgit+sshsgit+gitsgit+fileN(t__name__t __module__tnametdirnamet repo_nametschemest bundle_filetguideR$RR0R<RCRGRJRQRRROR=RiRLRF(((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pyR s&          (R4R(tos.pathRltpip.utilRRRtpip.vcsRRtpip.logRtpip.backwardcompatRRRRRtregister(((s</opt/alt/python34/lib/python3.4/site-packages/pip/vcs/git.pyts     µ