3 Pf @sddlmZddlZddlZddlZyddlmZWnek rPddl ZYnXddl m Z m Z ddl mZmZddlmZejeZGdddeZejedS) )absolute_importN)parse)rmtree display_path)vcsVersionControl) path_to_urlcszeZdZdZdZdZdZd fd d Zd dZddZ ddZ ddZ fddZ ddZ ddZddZddZZS)!Bazaarbzrz.bzrbranchbzr+http bzr+httpsbzr+sshbzr+sftpbzr+ftpbzr+lpNcsDtt|j|f||ttddr@tjjdgtjjdgdS)N uses_fragmentZlp)superr __init__getattr urllib_parserextendZnon_hierarchical)selfurlargskwargs) __class__/usr/lib/python3.6/bazaar.pyrs zBazaar.__init__c CsRtjdd}|j|tjj|r*t|z|jd|g|ddWdt|XdS)zU Export the Bazaar repository at the url to the destination location z-exportzpip-exportF)cwd show_stdoutN)tempfileZmkdtempunpackospathexistsr run_command)rlocationZtemp_dirrrrr&s     z Bazaar.exportcCs|jd|g|ddS)Nswitch)r )r')rdestr rev_optionsrrrr)5sz Bazaar.switchcCs|jddg||ddS)NZpullz-q)r )r')rr*r+rrrupdate8sz Bazaar.updatecCsl|j\}}|r"d|g}d|}ng}d}|j||||rhtjd||t||jddg|||gdS)Nz-rz (to revision %s)zChecking out %s%s to %sr z-q) get_url_revZcheck_destinationloggerinforr')rr*rrevr+Z rev_displayrrrobtain;s   z Bazaar.obtaincs,tt|j\}}|jdr$d|}||fS)Nzssh://zbzr+)rr r. startswith)rrr1)rrrr.Ls zBazaar.get_url_revcCsl|jdgd|d}xT|jD]H}|j}x:dD]2}|j|r.|j|d}|j|r\t|S|Sq.WqWdS)Nr0F)r!r checkout of branch: parent branch: )r4r5)r' splitlinesstripr3splitZ_is_local_repositoryr)rr(Zurlslinexreporrrget_urlSs   zBazaar.get_urlcCs|jdgd|d}|jdS)NZrevnoF)r!r r6)r'r7)rr(Zrevisionrrr get_revision`szBazaar.get_revisioncCsT|j|}|sdS|jjds(d|}|jjddd}|j|}d|||fS)Nzbzr:zbzr+-r6rz %s@%s#egg=%s)r=lowerr3Zegg_namer9r?)rZdistr(r<Zegg_project_nameZ current_revrrrget_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__namedirnameZ repo_nameZschemesrrr)r,r2r.r=r?rBrC __classcell__rr)rrr s   r )Z __future__rZloggingr$r"Zurllibrr ImportErrorZurlparseZ pip.utilsrrZpip.vcsrrZ pip.downloadrZ getLoggerrDr/r registerrrrrs   _