ž 7’ReÚc@s¿ddlZddlZddlZddlmZddlmZmZddlm Z m Z ddl m Z ddl mZmZejZejZGdd„de ƒZe jeƒdS( iN(ucall_subprocess(u display_pathurmtree(uvcsuVersionControl(ulogger(u url2pathnameuurlparsecsã|EeZdZdZdZdZd%Zd Zd Zd&‡fd d †Z d d„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd „Z‡fd!d"†Zd#d$„Z‡S('uGitugitu.gitucloneugit+httpu git+httpsugit+sshugit+gitugit+fileu git-clone.txtus# 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 sü|rÜt|ƒ\}}}}}|jdƒrÜ|dt|jdƒƒ …} | t|ƒjddƒjdƒ} t||| ||fƒ}|jdƒd} |d| …t|| d…|| ||fƒ}qÜntt |ƒj |||ŽdS(Nufileu/u\u+i( uurlsplituendswithulenulstripu url2pathnameureplaceu urlunsplitufindusuperuGitu__init__( uselfuurluargsukwargsuschemeunetlocupathuqueryufragmentuinitial_slashesunewpathu after_plus(u __class__(u$/tmp/pip-zej_zi-build/pip/vcs/git.pyu__init__s %9u Git.__init__cCsÃd}}x²|jƒD]¤}|jƒ s|jƒjdƒrEqntjd|ƒ}|ru|jdƒjƒ}ntjd|ƒ}|r¥|jdƒjƒ}n|r|r||fSqWdS(Nu#u$git\s*remote\s*add\s*origin(.*)\s*-fiu^git\s*checkout\s*-q\s*(.*)\s*(NN(uNoneu splitlinesustripu startswithureusearchugroup(uselfucontentuurlurevulineu url_matchu rev_match((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuparse_vcs_bundle_file%s " uGit.parse_vcs_bundle_filecCs…tjddƒ}|j|ƒzT|jdƒs>|d}nt|jdddd|gd|jd d d |ƒWd t|ƒXd S( u@Export the Git repository at the url to the destination locationu-exportupip-u/ucheckout-indexu-au-fu--prefixu filter_stdoutu show_stdoutucwdNF( utempfileumkdtempuunpackuendswithucall_subprocessucmdu_filteruFalseurmtree(uselfulocationutemp_dir((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuexport4s  u Git.exportcCs`|j|ƒ}d|}||kr0||gS||krG||gStjd|ƒ|SdS(u¶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. u origin/%su5Could not find a tag or branch '%s', assuming commit.N(uget_refsuloggeruwarn(uselfurevudestu rev_optionsu revisionsu origin_rev((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyucheck_rev_optionsAs     uGit.check_rev_optionscCsPt|jdd|gd|ƒt|jddg|d|ƒ|j|ƒdS(Nuconfiguremote.origin.urlucwducheckoutu-q(ucall_subprocessucmduupdate_submodules(uselfudestuurlu rev_options((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuswitchSs u Git.switchcCsrt|jddgd|ƒ|r>|j|d||ƒ}nt|jdddg|d|ƒ|j|ƒdS(Nufetchu-qucwdiuresetu--hard(ucall_subprocessucmducheck_rev_optionsuupdate_submodules(uselfudestu rev_options((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuupdate[s #u Git.updatecCs|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( Nu (to %s)u origin/masteruuCloning %s%s to %sucloneu-qiucheckoutucwd( u get_url_revucheck_destinationuloggerunotifyu display_pathucall_subprocessucmduupdate_submodulesucheck_rev_optionsu get_revisionu startswith(uselfudestuurlurevu rev_optionsu rev_display((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuobtaines     u Git.obtaincCs.t|jddgddd|ƒ}|jƒS(Nuconfiguremote.origin.urlu show_stdoutucwdF(ucall_subprocessucmduFalseustrip(uselfulocationuurl((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuget_urlxsu Git.get_urlcCs.t|jddgddd|ƒ}|jƒS(Nu rev-parseuHEADu show_stdoutucwdF(ucall_subprocessucmduFalseustrip(uselfulocationu current_rev((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyu get_revision~s!uGit.get_revisioncCs t|jdgdd d|ƒ}i}xÛ|jƒjƒD]Ç}|jddƒ\}}|jƒ}d}|jdƒr’|tdƒd…}nP|jdƒrº|tdƒd…}n(|jd ƒrâ|td ƒd…}n|dk r:|jƒ||¡su*Git.get_src_requirement..u%s-%su%s-devu %s@%s#egg=%s( uget_urluloweru startswithuegg_nameusplituNoneu get_revisionuget_refsudictuitems( uselfudistulocationu find_tagsurepouegg_project_nameu current_revurefsunames_by_commitu full_egg_name((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuget_src_requirement–s   uGit.get_src_requirementcs‘d|jkrld|jks$t‚|jjddƒ|_tt|ƒjƒ\}}|jddƒ}ntt|ƒjƒ\}}||fS(u; 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. u://ufile:ugit+u git+ssh://ussh://u(uurluAssertionErrorureplaceusuperuGitu get_url_rev(uselfuurlurev(u __class__(u$/tmp/pip-zej_zi-build/pip/vcs/git.pyu get_url_rev«suGit.get_url_revcCsNtjjtjj|dƒƒs%dSt|jdddddgd|ƒdS(Nu .gitmodulesu submoduleuupdateu--initu --recursiveu-qucwd(uosupathuexistsujoinucall_subprocessucmd(uselfulocation((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuupdate_submodules¼s!uGit.update_submodules(ugitugit+httpu git+httpsugit+sshugit+gitugit+fileN(u__name__u __module__u __qualname__unameudirnameu repo_nameuschemesu bundle_fileuguideuNoneu__init__uparse_vcs_bundle_fileuexportucheck_rev_optionsuswitchuupdateuobtainuget_urlu get_revisionuget_refsuget_src_requirementu get_url_revuupdate_submodules(u __locals__((u __class__u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuGit s&        uGit(utempfileureuos.pathuosupip.utilucall_subprocessu display_pathurmtreeupip.vcsuvcsuVersionControlupip.loguloggerupip.backwardcompatu url2pathnameuurlparseuurlsplitu urlunsplituGituregister(((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyus     µ