Current File : //opt/alt/python35/lib/python3.5/site-packages/pip/vcs/git.pyo
�
�wMVc@s�ddlZddlZddlZddlmZddlmZmZddlm Z m
Z
ddlmZddl
mZmZejZejZde
fd��YZe je�dS( i����N(tcall_subprocess(tdisplay_pathtrmtree(tvcstVersionControl(tlogger(turl2pathnameturlparsetGitcBs�eZdZdZdZdZdZd Zdd
�Z d�Z
d�Zd
�Zd�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
cOs�|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/python35/lib/python3.5/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/python35/lib/python3.5/site-packages/pip/vcs/git.pytparse_vcs_bundle_file%s
"cCs�tjdd�}|j|�zT|jd�s>|d}nt|jdddd|gd|jd td
|�Wdt|�XdS(s@Export the Git repository at the url to the destination locations-exportspip-Rscheckout-indexs-as-fs--prefixt
filter_stdouttshow_stdouttcwdN( ttempfiletmkdtemptunpackRRtcmdt_filtertFalseR(Rtlocationttemp_dir((s</opt/alt/python35/lib/python3.5/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,tdesttrev_optionst revisionst
origin_rev((s</opt/alt/python35/lib/python3.5/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/python35/lib/python3.5/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/python35/lib/python3.5/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(tget_url_revtcheck_destinationRtnotifyRRR7RFRCtget_revisionR'(RR?RR,R@trev_display((s</opt/alt/python35/lib/python3.5/site-packages/pip/vcs/git.pytobtaines
cCs.t|jddgdtd|�}|j�S(NRDsremote.origin.urlR2R3(RR7R9R&(RR:R((s</opt/alt/python35/lib/python3.5/site-packages/pip/vcs/git.pytget_urlxscCs.t|jddgdtd|�}|j�S(Ns rev-parsetHEADR2R3(RR7R9R&(RR:tcurrent_rev((s</opt/alt/python35/lib/python3.5/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�||<q:q:W|S(
s=Return map of named refs (branches or tags) to commit hashes.sshow-refR2R3t is
refs/remotes/srefs/heads/s
refs/tags/N( RR7R9R&R%tsplitR$R'R(RR:toutputtrvR-tcommittreftref_name((s</opt/alt/python35/lib/python3.5/site-packages/pip/vcs/git.pyR=�s c
Cs�|j|�}|j�jd�s1d|}n|j�jdd�d}|sWdS|j|�}|j|�}td�|j �D��}||kr�d|||f} n
d|} d ||| fS(
Nsgit:sgit+t-iicss!|]\}}||fVqdS(N((t.0RZRY((s</opt/alt/python35/lib/python3.5/site-packages/pip/vcs/git.pys <genexpr>�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/python35/lib/python3.5/site-packages/pip/vcs/git.pytget_src_requirement�s
cCs|d|jkrW|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://sgit+s
git+ssh://sssh://RK(RRRRRL(RRR,((s</opt/alt/python35/lib/python3.5/site-packages/pip/vcs/git.pyRL�scCsNtjjtjj|d��s%dSt|jdddddgd|�dS(Ns.gitmodulest submoduleRJs--inits--recursives-qR3(tosRtexiststjoinRR7(RR:((s</opt/alt/python35/lib/python3.5/site-packages/pip/vcs/git.pyRF�s!(R sgit+https git+httpssgit+sshsgit+gitsgit+fileN(t__name__t
__module__tnametdirnamet repo_nametschemestbundle_filetguideR$RR0R<RCRGRJRQRRROR=RiRLRF(((s</opt/alt/python35/lib/python3.5/site-packages/pip/vcs/git.pyR
s&
(R4R(tos.pathRktpip.utilRRRtpip.vcsRRtpip.logRtpip.backwardcompatRRRRRtregister(((s</opt/alt/python35/lib/python3.5/site-packages/pip/vcs/git.pyt<module>s �