ž 7’ReΌc@sΓddlZddlZddlZddlZddlmZddlmZmZddlm Z ddl m Z m Z ddl mZddlmZGdd „d e ƒZe jeƒdS( iN(ucall_subprocess(u display_pathurmtree(ulogger(uvcsuVersionControl(u path_to_url(u ConfigParsercBsΌ|EeZdZdZdZdZd!ZdZd Zd d „Z d d „Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zd S("u Mercurialuhgu.hgucloneuhg+httpuhg+httpsuhg+sshuhg+static-httpu hg-clone.txtug# This was a Mercurial repo; to make it a repo again run: hg init hg pull %(url)s hg update -r %(rev)s cCsΓd}}x²|jƒD]€}|jƒ s|jƒjdƒrEqntjd|ƒ}|ru|jdƒjƒ}ntjd|ƒ}|r₯|jdƒjƒ}n|r|r||fSqWdS(Nu#uhg\s*pull\s*(.*)\s*iu^hg\s*update\s*-r\s*(.*)\s*(NN(uNoneu splitlinesustripu startswithureusearchugroup(uselfucontentuurlurevulineu url_matchu rev_match((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyuparse_vcs_bundle_files " uMercurial.parse_vcs_bundle_filecCs`tjddƒ}|j|ƒz/t|jd|gd|jddd|ƒWdt|ƒXdS( u?Export the Hg repository at the url to the destination locationu-exportupip-uarchiveu filter_stdoutu show_stdoutucwdNF(utempfileumkdtempuunpackucall_subprocessucmdu_filteruFalseurmtree(uselfulocationutemp_dir((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyuexport%s uMercurial.exportc CsΪtjj||jdƒ}tjƒ}yJ|j|ƒ|jdd|ƒt|dƒ}|j |ƒ|j ƒWnBt tj fk r΅t jƒd}tjd||fƒYn!Xt|jddg|d |ƒdS( Nuhgrcupathsudefaultuwiu/Could not switch Mercurial repository to %s: %suupdateu-qucwd(uosupathujoinudirnameu ConfigParseruSafeConfigParserureadusetuopenuwriteucloseuOSErroruNoSectionErrorusysuexc_infouloggeruwarnucall_subprocessucmd(uselfudestuurlu rev_optionsu repo_configuconfigu config_fileue((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyuswitch0s   uMercurial.switchcCs@t|jddgd|ƒt|jddg|d|ƒdS(Nupullu-qucwduupdate(ucall_subprocessucmd(uselfudestu rev_options((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyuupdateAsuMercurial.updatecCsΈ|jƒ\}}|r.|g}d|}n g}d}|j||||ƒr΄tjd||t|ƒfƒt|jddd||gƒt|jddg|d|ƒndS( Nu (to revision %s)uuCloning hg %s%s to %sucloneu --noupdateu-quupdateucwd(u get_url_revucheck_destinationuloggerunotifyu display_pathucall_subprocessucmd(uselfudestuurlurevu rev_optionsu rev_display((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyuobtainFs   uMercurial.obtaincCsRt|jddgddd|ƒjƒ}|j|ƒrHt|ƒ}n|jƒS(Nu showconfigu paths.defaultu show_stdoutucwdF(ucall_subprocessucmduFalseustripu_is_local_repositoryu path_to_url(uselfulocationuurl((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyuget_urlTs uMercurial.get_urlcCs―t|jdgddd|ƒ}g}x{|jƒD]m}tjd|ƒ}|r4|jdƒ}|jdƒ}d|kr‘|j|jƒ|jƒfƒq‘q4q4Wt |ƒS( Nutagsu show_stdoutucwdu([\w\d\.-]+)\s*([\d]+):.*$iiutipF( ucall_subprocessucmduFalseu splitlinesureusearchugroupuappendustripudict(uselfulocationutagsutag_revsulineu tags_matchutagurev((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyu get_tag_revs\s )uMercurial.get_tag_revscCs―t|jdgddd|ƒ}g}x{|jƒD]m}tjd|ƒ}|r4|jdƒ}|jdƒ}d|kr‘|j|jƒ|jƒfƒq‘q4q4Wt |ƒS( Nubranchesu show_stdoutucwdu([\w\d\.-]+)\s*([\d]+):.*$iiudefaultF( ucall_subprocessucmduFalseu splitlinesureusearchugroupuappendustripudict(uselfulocationubranchesu branch_revsulineubranches_matchubranchurev((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyuget_branch_revsis )uMercurial.get_branch_revscCs.t|jddgddd|ƒjƒ}|S(Nuparentsu--template={rev}u show_stdoutucwdF(ucall_subprocessucmduFalseustrip(uselfulocationucurrent_revision((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyu get_revisionvsuMercurial.get_revisioncCs.t|jddgddd|ƒjƒ}|S(Nuparentsu--template={node}u show_stdoutucwdF(ucall_subprocessucmduFalseustrip(uselfulocationucurrent_rev_hash((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyuget_revision_hash|suMercurial.get_revision_hashc Csτ|j|ƒ}|jƒjdƒs1d|}n|jƒjddƒd}|sWdS|j|ƒ}|j|ƒ}|j|ƒ}|j |ƒ} ||krΆd|||f} n-|| krΩd|| |f} n d|} d||| fS( Nuhg:uhg+u-iiu%s-%su%s-devu %s@%s#egg=%s( uget_urluloweru startswithuegg_nameusplituNoneu get_revisionuget_revision_hashu get_tag_revsuget_branch_revs( uselfudistulocationu find_tagsurepouegg_project_nameu current_revucurrent_rev_hashutag_revsu branch_revsu full_egg_name((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyuget_src_requirement‚s     uMercurial.get_src_requirementN(uhguhg+httpuhg+httpsuhg+sshuhg+static-http(u__name__u __module__u __qualname__unameudirnameu repo_nameuschemesu bundle_fileuguideuparse_vcs_bundle_fileuexportuswitchuupdateuobtainuget_urlu get_tag_revsuget_branch_revsu get_revisionuget_revision_hashuget_src_requirement(u __locals__((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyu Mercurial s"       u Mercurial(uosutempfileureusysupip.utilucall_subprocessu display_pathurmtreeupip.loguloggerupip.vcsuvcsuVersionControlu pip.downloadu path_to_urlupip.backwardcompatu ConfigParseru Mercurialuregister(((u*/tmp/pip-zej_zi-build/pip/vcs/mercurial.pyus    Š