Your IP : 18.118.126.51


Current Path : /opt/alt/python33/lib/python3.3/site-packages/pip/vcs/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/pip/vcs/__pycache__/git.cpython-33.pyc

�
7�Re�c@s�ddlZddlZddlZddlmZddlmZmZddlm	Z	m
Z
ddlmZddl
mZmZejZejZGdd�de
�Ze	je�dS(	iN(ucall_subprocess(udisplay_pathurmtree(uvcsuVersionControl(ulogger(uurl2pathnameuurlparsecs�|EeZdZdZdZdZd%Zd	Zd
Zd&�fdd�Z
d
d�Zdd�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
|�Wdt|�XdS(
u@Export the Git repository at the url to the destination locationu-exportupip-u/ucheckout-indexu-au-fu--prefixu
filter_stdoutushow_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(uselfurevudesturev_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(uselfudestuurlurev_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(uselfudesturev_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(uget_url_revucheck_destinationuloggerunotifyudisplay_pathucall_subprocessucmduupdate_submodulesucheck_rev_optionsuget_revisionu
startswith(uselfudestuurlurevurev_optionsurev_display((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuobtaines	
	 
u
Git.obtaincCs.t|jddgddd|�}|j�S(Nuconfiguremote.origin.urlushow_stdoutucwdF(ucall_subprocessucmduFalseustrip(uselfulocationuurl((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuget_urlxsuGit.get_urlcCs.t|jddgddd|�}|j�S(Nu	rev-parseuHEADushow_stdoutucwdF(ucall_subprocessucmduFalseustrip(uselfulocationucurrent_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�||<q:q:W|S(u=Return map of named refs (branches or tags) to commit hashes.ushow-refushow_stdoutucwdu iu
refs/remotes/Nurefs/heads/u
refs/tags/F(	ucall_subprocessucmduFalseustripu
splitlinesusplituNoneu
startswithulen(uselfulocationuoutputurvulineucommiturefuref_name((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuget_refs�s uGit.get_refsc
Cs�|j|�}|j�jd�s1d|}n|j�jdd�d}|sWdS|j|�}|j|�}tdd�|j	�D��}||kr�d|||f}	n
d	|}	d
|||	fS(Nugit:ugit+u-iicss!|]\}}||fVqdS(N((u.0urefucommit((u$/tmp/pip-zej_zi-build/pip/vcs/git.pyu	<genexpr>�su*Git.get_src_requirement.<locals>.<genexpr>u%s-%su%s-devu%s@%s#egg=%s(
uget_urluloweru
startswithuegg_nameusplituNoneuget_revisionuget_refsudictuitems(
uselfudistulocationu	find_tagsurepouegg_project_nameucurrent_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(uurluAssertionErrorureplaceusuperuGituget_url_rev(uselfuurlurev(u	__class__(u$/tmp/pip-zej_zi-build/pip/vcs/git.pyuget_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_nameuschemesubundle_fileuguideuNoneu__init__uparse_vcs_bundle_fileuexportucheck_rev_optionsuswitchuupdateuobtainuget_urluget_revisionuget_refsuget_src_requirementuget_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.pyu<module>s		�

?>