8889841có “tÆ_c@@s‡ddlmZddlZddlZddlZddlmZddl mZ ddl m Z ddl mZmZddlmZmZddlmZddlmZdd lmZdd lmZmZmZmZer'dd lmZm Z dd lm!Z!dd lm"Z"m#Z#ne j$Z$e j%Z%ej&e'ƒZ(ej)dƒZ*d„Z+defd„ƒYZ,ej-e,ƒdS(i(tabsolute_importN(tparse(trequest(t BadCommandtSubProcessError(t display_paththide_url(t make_command(t TempDirectory(tMYPY_CHECK_RUNNING(tRemoteNotFoundErrortVersionControlt!find_path_to_setup_from_repo_roottvcs(tOptionaltTuple(t HiddenText(tAuthInfot RevOptionss^[a-fA-F0-9]{40}$cC@sttj|ƒƒS(N(tboolt HASH_REGEXtmatch(tsha((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pytlooks_like_hash*stGitcB@s eZdZdZdZdZdZd Zed „ƒZ d „Z d „Z e d„ƒZ d„Ze d„ƒZe d„ƒZe d„ƒZd„Zd„Zd„Ze d„ƒZe dd„ƒZe d„ƒZe d„ƒZe d„ƒZe d„ƒZRS(tgits.gittclonesgit+https git+httpssgit+sshsgit+gitsgit+filetGIT_DIRt GIT_WORK_TREEtHEADcC@s|gS(N((trev((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pytget_base_rev_args:scC@se|jt|ƒƒ\}}|js(tS|j||jƒsAtSt|j||jƒdƒ}| S(Ni(tget_url_rev_optionsRRtFalsetis_commit_id_equalRtget_revision_sha(tselfturltdestt_t rev_optionstis_tag_or_branch((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pytis_immutable_rev_checkout>s cC@spd}|jdgƒ}|j|ƒrD|t|ƒjƒd}nd}dj|jdƒd ƒ}t|ƒS(Ns git version tversionitt.i(t run_commandt startswithtlentsplittjoint parse_version(R$t VERSION_PFXR+((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pytget_git_versionOscC@sWdddg}|j|ddd|ƒ}|jƒ}|jdƒrS|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_returncodesitcwds refs/heads/(iN(R.tstripR/R0tNone(tclstlocationtargstoutputtref((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pytget_current_branch\s  c C@ss|jdƒs|d}ntddƒB}|j|jd|ƒ|jdddd|gd |jƒWd QXd S( s@Export the Git repository at the url to the destination locationt/tkindtexportR%scheckout-indexs-as-fs--prefixR7N(tendswithRtunpacktpathR.(R$R;R%ttemp_dir((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pyRBqs c C@sd}y|jd|gd|ƒ}Wntk r8nXi}xc|jƒjƒD]O}y|jƒ\}}Wn&tk r–tdj|ƒƒ‚nX|||t branch_refttag_ref((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pyR#~s&     cC@s×|j}|j||ƒ\}}|dk rU|j|ƒ}|rH|nd|_|St|ƒsttjd|ƒn|jdƒs‡|S|j t dd||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-qR7Rt FETCH_HEADN( targ_revR#R9tmake_newt branch_nameRtloggertwarningR/R.Rtto_argst get_revision(R:R&R%R(RRt is_branch((sF/opt/alt/python35/lib/python3.5/site-packages/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. (R!RX(R:R&tname((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pyR"Ós cC@s)|jƒ}tjd||t|ƒƒ|jtdd||ƒƒ|jr|j|||ƒ}t|ddƒ}|dkrÆ|j ||jƒstdd|j ƒƒ}|j|d|ƒqq|j |ƒ|krdj |ƒ}dd|d |g}|j|d|ƒqn|j|ƒdS( NsCloning %s%s to %sRs-qRTtcheckoutR7s origin/{}s-bs--track(t to_displayRUtinfoRR.RRRZtgetattrR9R"RWR?RItupdate_submodules(R$R&R%R(t rev_displayRTtcmd_argst track_branch((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pyt fetch_newâs    cC@s[|jtdd|ƒd|ƒtdd|jƒƒ}|j|d|ƒ|j|ƒdS(Ntconfigsremote.origin.urlR7R\s-q(R.RRWR`(R$R&R%R(Rb((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pytswitchs cC@s¤|jƒtdƒkr7|jdddgd|ƒn|jddgd|ƒ|j|||ƒ}tddd|jƒƒ}|j|d|ƒ|j|ƒdS(Ns1.9.0RPs-qs--tagsR7tresets--hard(R5R3R.RZRRWR`(R$R&R%R(Rb((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pytupdate scC@sŸ|jdddgdd d|ƒ}|jƒ}y|d}Wntk rWt‚nXx'|D]}|jdƒr_|}Pq_q_W|jd ƒd}|jƒS( s¢ Return URL of the first remote encountered. Raises RemoteNotFoundError if the repository does not have a remote url configured. Res --get-regexpsremote\..*\.urlR6iR7isremote.origin.url t (i(R.RGt IndexErrorR R/R1R8(R:R;tstdouttremotest found_remotetremoteR%((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pytget_remote_urls     cC@s:|dkrd}n|jd|gd|ƒ}|jƒS(NRs rev-parseR7(R9R.R8(R:R;Rt current_rev((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pyRX5s   cC@sy|jddgd|ƒjƒ}tjj|ƒsKtjj||ƒ}ntjjtjj|dƒƒ}t||ƒS(s~ Return the path to setup.py, relative to the repo root. Return None if setup.py is in the repo root. s rev-parses --git-dirR7s..(R.R8tosREtisabsR2tabspathR (R:R;tgit_dirt repo_root((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pytget_subdirectory>s !c C@sFt|ƒ\}}}}}|jdƒrÄ|t|jdƒƒ }|tj|ƒjddƒjdƒ}t|||||fƒ}|jdƒd} || t|| ||||fƒ}nd|kr|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. tfileR@s\t+is://sgit+s git+ssh://sssh://R,( turlsplitRCR0tlstripturllib_requestt url2pathnametreplacet urlunsplittfindtsuperRtget_url_rev_and_auth( R:R%tschemetnetlocREtquerytfragmenttinitial_slashestnewpatht after_plusRt user_pass((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pyRMs    !!cC@sKtjjtjj|dƒƒs%dS|jdddddgd|ƒdS(Ns .gitmodulest submoduleRhs--inits --recursives-qR7(RqREtexistsR2R.(R:R;((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pyR`ps !cC@s–tt|ƒj|ƒ}|r"|Sy%|jddgd|dtƒ}Wn3tk rktjd|ƒdSt k r|dSXt j j |j dƒƒS(Ns rev-parses--show-toplevelR7tlog_failed_cmdsKcould not determine if %s is under git control because git is not availables (R€Rtget_repository_rootR.R!RRUtdebugR9RRqREtnormpathtrstrip(R:R;tloctr((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pyRys     (Rsgit+https git+httpssgit+sshsgit+gitsgit+file(RRN(t__name__t __module__R[tdirnamet repo_nametschemest unset_environtdefault_arg_revt staticmethodRR*R5t classmethodR?RBR#RZR"RdRfRhRoR9RXRvRR`R(((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pyR.s0   (-  # (.t __future__Rtloggingtos.pathRqtretpip._vendor.packaging.versionRR3tpip._vendor.six.moves.urllibt urllib_parseRR{tpip._internal.exceptionsRRtpip._internal.utils.miscRRtpip._internal.utils.subprocessRtpip._internal.utils.temp_dirRtpip._internal.utils.typingR t pip._internal.vcs.versioncontrolR R R R ttypingRRRRRRyR~t getLoggerR“RUtcompileRRRtregister(((sF/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/vcs/git.pyts0   "   ÿ`