ó 9ÕÒTc@@sØddlmZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z mZddlmZmZejZejZejeƒZdefd „ƒYZejeƒdS( i(tabsolute_importN(tparse(trequest(tcall_subprocess(t display_pathtrmtree(tvcstVersionControltGitcB@seZdZdZdZdZdd„Zd „Zd „Z d „Z d „Z d „Z d„Z d„Zd„Zd„Zd„Zd„ZRS(tgits.gittclonesgit+https git+httpssgit+sshsgit+gitsgit+filec O@sí|rÍt|ƒ\}}}}}|jdƒrÍ|t|jdƒƒ } | tj|ƒjddƒjdƒ} t||| ||fƒ}|jdƒd} || t|| || ||fƒ}qÍnt t |ƒj |||ŽdS(Ntfilet/s\t+i( turlsplittendswithtlentlstripturllib_requestt url2pathnametreplacet urlunsplittfindtsuperRt__init__( tselfturltargstkwargstschemetnetloctpathtquerytfragmenttinitial_slashestnewpatht after_plus((s1/usr/lib/python2.7/vendor-packages/pip/vcs/git.pyRs #cC@s…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((s1/usr/lib/python2.7/vendor-packages/pip/vcs/git.pytexport3s  cC@s_|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_refstloggertwarning(Rtrevtdestt rev_optionst revisionst origin_rev((s1/usr/lib/python2.7/vendor-packages/pip/vcs/git.pytcheck_rev_options@s      cC@sPt|jdd|gd|ƒt|jddg|d|ƒ|j|ƒdS(Ntconfigsremote.origin.urlR'tcheckouts-q(RR+tupdate_submodules(RR5RR6((s1/usr/lib/python2.7/vendor-packages/pip/vcs/git.pytswitchTs cC@srt|jddgd|ƒ|r>|j|d||ƒ}nt|jdddg|d|ƒ|j|ƒdS(Ntfetchs-qR'itresets--hard(RR+R9R<(RR5R6((s1/usr/lib/python2.7/vendor-packages/pip/vcs/git.pytupdate\scC@sþ|jƒ\}}|r.|g}d|}ndg}d}|j||||ƒrútjd||t|ƒƒt|jdd||gƒ|rê|j|||ƒ}|j|ƒj |dƒsêt|jddg|d |ƒqên|j |ƒndS( Ns (to %s)s origin/mastertsCloning %s%s to %sR s-qiR;R'( t get_url_revtcheck_destinationR2tinfoRRR+R9t get_revisiont startswithR<(RR5RR4R6t rev_display((s1/usr/lib/python2.7/vendor-packages/pip/vcs/git.pytobtainks"    cC@s.t|jddgdtd|ƒ}|jƒS(NR:sremote.origin.urlR&R'(RR+R-tstrip(RR.R((s1/usr/lib/python2.7/vendor-packages/pip/vcs/git.pytget_url„scC@s.t|jddgdtd|ƒ}|jƒS(Ns rev-parsetHEADR&R'(RR+R-RI(RR.t current_rev((s1/usr/lib/python2.7/vendor-packages/pip/vcs/git.pyREŠs!cC@s÷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ƒ||s     Á