î “ReO ã @ s d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z m Z m Z d d l m Z m Z d d l m Z Gd d „ d e ƒ Z e j e ƒ d S) é N)Úurlparse)Úlogger)ÚrmtreeÚdisplay_pathÚcall_subprocess)ÚvcsÚVersionControl)Úpath_to_urlc sÇ e Z d Z d Z d Z d Z d Z d# Z d Z d ‡ f d d † Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z ‡ f d d † Z d d „ Z d d „ Z d d „ Z d! d" „ Z ‡ S)$ÚBazaarÚbzrz.bzrÚbranchzbzr-branch.txtúbzr+httpú bzr+httpsúbzr+sshúbzr+sftpúbzr+ftpúbzr+lpz[# This was a Bazaar branch; to make it a branch again run: bzr branch -r %(rev)s %(url)s . Nc s[ t t | ƒ j | | | Ž t t d d ƒ rW t j j d g ƒ t j j d g ƒ n d S)NÚ uses_fragmentÚlp)Úsuperr Ú__init__Úgetattrr r ÚextendÚnon_hierarchical)ÚselfÚurlÚargsÚkwargs)Ú __class__© ú)/tmp/pip-ztkk0jow-build/pip/vcs/bazaar.pyr s zBazaar.__init__c C s¿ d } } x® | j ƒ D] } | j ƒ s | j ƒ j d ƒ rE q n t j d | ƒ } | ru | j d ƒ j ƒ } n | | j ƒ d … j ƒ j d d ƒ d } | r | r | | f Sq Wd S)Nú#z^bzr\s*branch\s*-r\s*(\d*)é r )NN)Ú splitlinesÚstripÚ startswithÚreÚsearchÚgroupÚendÚsplit)r Úcontentr ÚrevÚlineÚmatchr r r Úparse_vcs_bundle_file s ",zBazaar.parse_vcs_bundle_filec C s t j d d ƒ } | j | ƒ t j j | ƒ r> t | ƒ n z/ t | j d | g d | d | j d d ƒWd t | ƒ Xd S) zCExport the Bazaar repository at the url to the destination locationz-exportzpip-ÚexportÚcwdÚ filter_stdoutÚshow_stdoutFN) ÚtempfileÚmkdtempÚunpackÚosÚpathÚexistsr r ÚcmdÚ_filter)r ÚlocationÚtemp_dirr r r r0 ) s z Bazaar.exportc C s t | j d | g d | ƒd S)NÚswitchr1 )r r: )r Údestr Úrev_optionsr r r r> 6 s z Bazaar.switchc C s$ t | j d d g | d | ƒd S)NÚpullz-qr1 )r r: )r r? r@ r r r Úupdate9 s z Bazaar.updatec C s | j ƒ \ } } | r1 d | g } d | } n g } d } | j | | | | ƒ rœ t j d | | t | ƒ f ƒ t | j d d g | | | g ƒ n d S)Nz-rz (to revision %s)Ú zChecking out %s%s to %sr z-q)Úget_url_revÚcheck_destinationr Únotifyr r r: )r r? r r, r@ Úrev_displayr r r Úobtain= s z Bazaar.obtainc sA t t | ƒ j ƒ \ } } | j d ƒ r7 d | } n | | f S)Nzssh://zbzr+)r r rD r% )r r r, )r r r rD K s zBazaar.get_url_revc C s˜ t | j d g d d d | ƒ} xp | j ƒ D]b } | j ƒ } xM d D]E } | j | ƒ rG | j | ƒ d } | j | ƒ rˆ t | ƒ S| SqG Wq. Wd S) NÚinfor3 Fr1 úcheckout of branch: úparent branch: r" )rJ rK )r r: r# r$ r% r* Ú_is_local_repositoryr )r r<