????

Your IP : 216.73.216.152


Current Path : /proc/self/root/proc/self/root/lib/python2.7/site-packages/pip/_internal/vcs/
Upload File :
Current File : //proc/self/root/proc/self/root/lib/python2.7/site-packages/pip/_internal/vcs/git.pyc

�
}�\]c@@s&ddlmZddlZddlZddlZddlmZddl	mZ
ddl	mZddl
mZddlmZddlmZmZddlmZdd	lmZmZmZe
jZe
jZeje�Zejd
�Z d�Z!defd
��YZ"ej#e"�dS(i(tabsolute_importN(tparse(trequest(t
BadCommand(tsamefile(tdisplay_pathtredact_password_from_url(t
TempDirectory(tRemoteNotFoundErrortVersionControltvcss^[a-fA-F0-9]{40}$cC@sttj|��S(N(tboolt
HASH_REGEXtmatch(tsha((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pytlooks_like_hashstGitcB@seZdZdZdZdZdZd
Zed��Z	d�Z
ed
��Zd�Z
ed��Zed��Zed��Zd�Zd�Zd�Zed��Zedd��Zed��Zed��Zed��Zed��ZRS(tgits.gittclonesgit+https	git+httpssgit+sshsgit+gitsgit+filetGIT_DIRt
GIT_WORK_TREEtHEADcC@s|gS(N((trev((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pytget_base_rev_args-scC@svd}|jdgdt�}|j|�rJ|t|�j�d}nd}dj|jd�d �}t|�S(Nsgit version tversiontshow_stdoutitt.i(trun_commandtFalset
startswithtlentsplittjoint
parse_version(tselftVERSION_PFXR((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pytget_git_version1scC@s]dddg}|j|dd	dtd|�}|j�}|jd�rY|td�Sd
S(sl
        Return the current branch, or None if HEAD isn't at a branch
        (e.g. detached HEAD).
        ssymbolic-refs-qRtextra_ok_returncodesiRtcwdsrefs/heads/(iN(RRtstripRRtNone(tclstlocationtargstoutputtref((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pytget_current_branch>s
c
C@sy|jd�s|d}ntdd��H}|j|jd|�|jdddd|gd	td
|j�WdQXdS(s@Export the Git repository at the url to the destination locationt/tkindtexportturlscheckout-indexs-as-fs--prefixRR'N(tendswithRtunpacktpathRR(R#R+R3ttemp_dir((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pyR2Ss
c
C@s�|jd|gd|dtdd�}i}xc|j�j�D]O}y|j�\}}Wn&tk
r�tdj|���nX|||<q@Wdj|�}dj|�}	|j|�}|d	k	r�|t	fS|j|	�}|tfS(
s�
        Return (sha_or_none, is_branch), where sha_or_none is a commit hash
        if the revision names a remote branch or tag, otherwise None.

        Args:
          dest: the repository directory.
          rev: the revision name.
        sshow-refR'Rt
on_returncodetignoresunexpected show-ref line: {!r}srefs/remotes/origin/{}srefs/tags/{}N(
RRR(t
splitlinesR t
ValueErrortformattgetR)tTrue(
R*tdestRR-trefstlineRR.t
branch_refttag_ref((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pytget_revision_sha_s 

cC@s�|j}|j||�\}}|dk	rU|j|�}|rH|nd|_|St|�sttjd|�n|jd�s�|S|j	dd|g|j
�d|�|j|dd�}|j|�}|S(	s�
        Resolve a revision to a new RevOptions object with the SHA1 of the
        branch, tag, or ref if found.

        Args:
          rev_options: a RevOptions object.
        s:Did not find branch or tag '%s', assuming revision or ref.srefs/tfetchs-qR'Rt
FETCH_HEADN(targ_revRDR)tmake_newtbranch_nameRtloggertwarningRRtto_argstget_revision(R*R?R3trev_optionsRRt	is_branch((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pytresolve_revision�s$		
cC@s|s
tS|j|�|kS(s�
        Return whether the current commit hash equals the given name.

        Args:
          dest: the repository directory.
          name: a string name.
        (RRM(R*R?tname((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pytis_commit_id_equal�s	cC@s*|j�}tjdt|�|t|��|jdd||g�|jr|j|||�}t|dd�}|dkr�|j
||j�sddg|j�}|j|d|�qq|j|�|krdj
|�}dd|d	|g}|j|d|�qn|j|�dS(
NsCloning %s%s to %sRs-qRItcheckoutR's	origin/{}s-bs--track(t
to_displayRJtinfoRRRRRPtgetattrR)RRRLR/R<tupdate_submodules(R#R?R3RNtrev_displayRItcmd_argsttrack_branch((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pyt	fetch_new�s"	cC@sV|jdd|gd|�ddg|j�}|j|d|�|j|�dS(Ntconfigsremote.origin.urlR'RSs-q(RRLRW(R#R?R3RNRY((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pytswitch�scC@s�|j�td�kr7|jdddgd|�n|jddgd|�|j|||�}dddg|j�}|j|d|�|j|�dS(Ns1.9.0REs-qs--tagsR'tresets--hard(R%R"RRPRLRW(R#R?R3RNRY((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pytupdate�scC@s�|jdddgdddtd|�}|j�}y|d}Wntk
r]t�nXx'|D]}|jd	�re|}PqeqeW|jd
�d}|j�S(s�
        Return URL of the first remote encountered.

        Raises RemoteNotFoundError if the repository does not have a remote
        url configured.
        R\s--get-regexpsremote\..*\.urlR&iRR'isremote.origin.url t (i(RRR:t
IndexErrorRRR R((R*R+tstdouttremotestfound_remotetremoteR3((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pytget_remote_url�s



cC@s@|dkrd}n|jd|gdtd|�}|j�S(NRs	rev-parseRR'(R)RRR((R*R+Rtcurrent_rev((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pyRMs
	cC@s�|jddgdtd|�j�}tjj|�sQtjj||�}ntjj|d�}|}x]tjjtjj|d��s�|}tjj|�}||krot	j
d|�dSqoWt||�r�dStjj
||�S(Ns	rev-parses	--git-dirRR's..ssetup.pysGCould not find setup.py for directory %s (tried all parent directories)(RRR(tosR6tisabsR!texiststdirnameRJRKR)Rtrelpath(R*R+tgit_dirtroot_dirt
orig_locationt
last_location((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pytget_subdirectorys"$cC@sXt|�\}}}}}|jd�r�|t|jd�� }|tj|�jdd�jd�}t|||||f�}|jd�d}	||	 t||	||||f�}nd|kr*d|ks�t	�|jdd	�}t
t|�j|�\}}
}|jd
d�}n!t
t|�j|�\}}
}||
|fS(s9
        Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'.
        That's required because although they use SSH they sometimes don'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.
        tfileR0s\t+is://sfile:sgit+s
git+ssh://sssh://R(
turlsplitR4Rtlstripturllib_requestturl2pathnametreplacet
urlunsplittfindtAssertionErrortsuperRtget_url_rev_and_auth(R*R3tschemetnetlocR6tquerytfragmenttinitial_slashestnewpatht
after_plusRt	user_pass((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pyR}+s"

 !!cC@sKtjjtjj|d��s%dS|jdddddgd|�dS(Ns.gitmodulest	submoduleR_s--inits--recursives-qR'(RhR6RjR!R(R*R+((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pyRWMs
!cC@srtt|�j|�rtSy-|jdgd|dtdd�}|SWn"tk
rmtjd|�tSXdS(Ns	rev-parseR'RR8R9sKcould not determine if %s is under git control because git is not available(	R|Rtcontrols_locationR>RRRRJtdebug(R*R+tr((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pyR�Vs		
	(sgitsgit+https	git+httpssgit+sshsgit+gitsgit+file(sGIT_DIRs
GIT_WORK_TREEN(t__name__t
__module__RQRkt	repo_nametschemest
unset_environtdefault_arg_revtstaticmethodRR%tclassmethodR/R2RDRPRRR[R]R_RfR)RMRqR}RWR�(((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pyR!s.	
	#(			"	($t
__future__Rtloggingtos.pathRhtretpip._vendor.packaging.versionRR"tpip._vendor.six.moves.urllibturllib_parseRRvtpip._internal.exceptionsRtpip._internal.utils.compatRtpip._internal.utils.miscRRtpip._internal.utils.temp_dirRt pip._internal.vcs.versioncontrolRR	R
RtRyt	getLoggerR�RJtcompileRRRtregister(((s4/tmp/pip-install-ewDPok/pip/pip/_internal/vcs/git.pyt<module>s&			�F