3

Q'ícÛã@s¦ddlmZddlZddlZddlZyddlmZWnek
rPddl	ZYnXddl
mZmZddl
mZmZddlmZejeƒZGdd„deƒZejeƒdS)	é)Úabsolute_importN)Úparse)ÚrmtreeÚdisplay_path)ÚvcsÚVersionControl)Úpath_to_urlcszeZdZdZdZdZdZd ‡fdd„	Zd
d„Zdd„Z	dd„Z
dd„Z‡fdd„Zdd„Z
dd„Zdd„Zdd„Z‡ZS)!ÚBazaarÚbzrz.bzrÚbranchúbzr+httpú	bzr+httpsúbzr+sshúbzr+sftpúbzr+ftpúbzr+lpNcsDtt|ƒj|f|ž|Žttddƒr@tjjdgƒtjjdgƒdS)NÚ
uses_fragmentÚlp)Úsuperr	Ú__init__ÚgetattrÚurllib_parserÚextendÚnon_hierarchical)ÚselfÚurlÚargsÚkwargs)Ú	__class__©ú-/tmp/pip-build-l_bcah40/pip/pip/vcs/bazaar.pyrszBazaar.__init__cCsRtjddƒ}|j|ƒtjj|ƒr*t|ƒz|jd|g|ddWdt|ƒXdS)zU
        Export the Bazaar repository at the url to the destination location
        z-exportzpip-ÚexportF)ÚcwdÚshow_stdoutN)ÚtempfileÚmkdtempÚunpackÚosÚpathÚexistsrÚrun_command)rÚlocationÚtemp_dirrrr r!&s
z
Bazaar.exportcCs|jd|g|ddS)NÚswitch)r")r*)rÚdestrÚrev_optionsrrr r-5sz
Bazaar.switchcCs|jddg||ddS)NÚpullz-q)r")r*)rr.r/rrr Úupdate8sz
Bazaar.updatecCsl|jƒ\}}|r"d|g}d|}ng}d}|j||||ƒrhtjd||t|ƒƒ|jddg|||gƒdS)Nz-rz (to revision %s)ÚzChecking out %s%s to %srz-q)Úget_url_revÚcheck_destinationÚloggerÚinforr*)rr.rÚrevr/Úrev_displayrrr Úobtain;s

z
Bazaar.obtaincs,tt|ƒjƒ\}}|jdƒr$d|}||fS)Nzssh://zbzr+)rr	r3Ú
startswith)rrr7)rrr r3Ls
zBazaar.get_url_revcCsl|jdgd|d}xT|jƒD]H}|jƒ}x:dD]2}|j|ƒr.|j|ƒd}|j|ƒr\t|ƒS|Sq.WqWdS)Nr6F)r#r"úcheckout of branch: úparent branch: é)r;r<)r*Ú
splitlinesÚstripr:ÚsplitÚ_is_local_repositoryr)rr+ÚurlsÚlineÚxÚreporrr Úget_urlSs

zBazaar.get_urlcCs|jdgd|d}|jƒdS)NÚrevnoF)r#r"r=éÿÿÿÿ)r*r>)rr+Úrevisionrrr Úget_revision`szBazaar.get_revisioncCsT|j|ƒ}|sdS|jƒjdƒs(d|}|jƒjddƒd}|j|ƒ}d|||fS)Nzbzr:zbzr+ú-r=rz%s@%s#egg=%s)rFÚlowerr:Úegg_namer@rJ)rÚdistr+rEÚegg_project_nameÚcurrent_revrrr Úget_src_requirementes

zBazaar.get_src_requirementcCsdS)z&Always assume the versions don't matchFr)rr.r/rrr Ú
check_versionoszBazaar.check_version)r
rr
rrrr)N)Ú__name__Ú
__module__Ú__qualname__ÚnameÚdirnameÚ	repo_nameÚschemesrr!r-r1r9r3rFrJrQrRÚ
__classcell__rr)rr r	s

r	)Ú
__future__rÚloggingr'r$ÚurllibrrÚImportErrorÚurlparseÚ	pip.utilsrrÚpip.vcsrrÚpip.downloadrÚ	getLoggerrSr5r	Úregisterrrrr Ú<module>s
_