î “Re¼ ã @ sà d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z m Z d d l m Z d d l m Z m Z d d l m Z d d l m Z Gd d „ d e ƒ Z e j e ƒ d S) é N)Úcall_subprocess)Údisplay_pathÚrmtree)Úlogger)ÚvcsÚVersionControl)Úpath_to_url)ÚConfigParserc @ s¸ e Z d Z d Z d Z d Z d! Z d Z d Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d S)"Ú MercurialÚhgz.hgÚcloneúhg+httpúhg+httpsúhg+sshúhg+static-httpzhg-clone.txtzg# This was a Mercurial repo; to make it a repo again run: hg init hg pull %(url)s hg update -r %(rev)s c C sà d } } x² | j ƒ D]¤ } | j ƒ s | j ƒ j d ƒ rE q n t j d | ƒ } | ru | j d ƒ j ƒ } n t j d | ƒ } | r¥ | j d ƒ j ƒ } n | r | r | | f Sq Wd S)Nú#zhg\s*pull\s*(.*)\s*é z^hg\s*update\s*-r\s*(.*)\s*)NN)Ú splitlinesÚstripÚ startswithÚreÚsearchÚgroup)ÚselfÚcontentÚurlÚrevÚlineÚ url_matchÚ rev_match© r ú,/tmp/pip-ztkk0jow-build/pip/vcs/mercurial.pyÚparse_vcs_bundle_file s "zMercurial.parse_vcs_bundle_filec C s` t j d d ƒ } | j | ƒ z/ t | j d | g d | j d d d | ƒWd t | ƒ Xd S) z?Export the Hg repository at the url to the destination locationz-exportzpip-ÚarchiveÚ filter_stdoutÚshow_stdoutFÚcwdN)ÚtempfileÚmkdtempÚunpackr ÚcmdÚ_filterr )r ÚlocationÚtemp_dirr r r! Úexport% s zMercurial.exportc C sÚ t j j | | j d ƒ } t j ƒ } yJ | j | ƒ | j d d | ƒ t | d ƒ } | j | ƒ | j ƒ WnB t t j f k rµ t j ƒ d } t j d | | f ƒ Yn! Xt | j d d g | d | ƒd S) NÚhgrcÚpathsÚdefaultÚwr z/Could not switch Mercurial repository to %s: %sÚupdatez-qr&