Ñò
•èRc           @   s¿   d  d k  Z  d  d k Z d  d k Z d  d k l Z d  d k l Z l Z d  d k l	 Z	 l
 Z
 d  d k l Z d  d k l Z l Z e i Z e i Z d e
 f d „  ƒ  YZ e	 i e ƒ d S(	   iÿÿÿÿN(   t   call_subprocess(   t   display_patht   rmtree(   t   vcst   VersionControl(   t   logger(   t   url2pathnamet   urlparset   Gitc           B   s¤   e  Z d  Z d Z d Z d Z d Z d	 Z d d
 „ Z	 d „  Z
 d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   t   gits   .gitt   clones   git+https	   git+httpss   git+sshs   git+gits   git+files   git-clone.txtss   # This was a Git repo; to make it a repo again run:
git init
git remote add origin %(url)s -f
git checkout %(rev)s
c      
   O   sî   | oÇ t  | ƒ \ } } } } } | i d ƒ o˜ | t | i d ƒ ƒ  }	 |	 t | ƒ i d d ƒ i d ƒ }
 t | | |
 | | f ƒ } | i d ƒ d } | |  t | | | |
 | | f ƒ } qÎ n t t	 |  ƒ i
 | | | Ž d  S(   Nt   filet   /s   \t   +i   (   t   urlsplitt   endswitht   lent   lstripR   t   replacet
   urlunsplitt   findt   superR   t   __init__(   t   selft   urlt   argst   kwargst   schemet   netloct   patht   queryt   fragmentt   initial_slashest   newpatht
   after_plus(    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyR      s    %/c         C   sÍ   d  } } x¼ | i ƒ  D]® } | i ƒ  p | i ƒ  i d ƒ o q n t i d | ƒ } | o | i d ƒ i ƒ  } n t i d | ƒ } | o | i d ƒ i ƒ  } n | o | o | | f Sq Wd S(   Nt   #s$   git\s*remote\s*add\s*origin(.*)\s*-fi   s   ^git\s*checkout\s*-q\s*(.*)\s*(   NN(   t   Nonet
   splitlinest   stript
   startswitht   ret   searcht   group(   R   t   contentR   t   revt   linet	   url_matcht	   rev_match(    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyt   parse_vcs_bundle_file%   s    
 $c         C   s‡   t  i d d ƒ } |  i | ƒ zV | i d ƒ p | d } n t |  i d d d d | g d |  i d	 t d
 | ƒWd t | ƒ Xd S(   s@   Export the Git repository at the url to the destination locations   -exports   pip-R   s   checkout-indexs   -as   -fs   --prefixt   filter_stdoutt   show_stdoutt   cwdN(	   t   tempfilet   mkdtempt   unpackR   R    t   cmdt   _filtert   FalseR   (   R   t   locationt   temp_dir(    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyt   export4   s    c         C   sd   |  i  | ƒ } d | } | | j o | | g S| | j o | | g St i d | ƒ | Sd S(   s¶   Check the revision options before checkout to compensate that tags
        and branches may need origin/ as a prefix.
        Returns the SHA1 of the branch or tag if found.
        s	   origin/%ss5   Could not find a tag or branch '%s', assuming commit.N(   t   get_refsR   t   warn(   R   R,   t   destt   rev_optionst	   revisionst
   origin_rev(    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyt   check_rev_optionsA   s    
c         C   sP   t  |  i d d | g d | ƒt  |  i d d g | d | ƒ|  i | ƒ d  S(   Nt   configs   remote.origin.urlR3   t   checkouts   -q(   R    R7   t   update_submodules(   R   R?   R   R@   (    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyt   switchS   s
    c         C   st   t  |  i d d g d | ƒ| o |  i | d | | ƒ } n t  |  i d d d g | d | ƒ|  i | ƒ d  S(   Nt   fetchs   -qR3   i    t   resets   --hard(   R    R7   RC   RF   (   R   R?   R@   (    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyt   update[   s
    #c         C   s
  |  i  ƒ  \ } } | o | g } d | } n d g } d } |  i | | | | ƒ o® t i d | | t | ƒ f ƒ t |  i d d | | g ƒ |  i | ƒ | oZ |  i | | | ƒ } |  i	 | ƒ i
 | d ƒ p$ t |  i d d g | d	 | ƒqqn d  S(
   Ns    (to %s)s   origin/mastert    s   Cloning %s%s to %sR
   s   -qi    RE   R3   (   t   get_url_revt   check_destinationR   t   notifyR   R    R7   RF   RC   t   get_revisionR'   (   R   R?   R   R,   R@   t   rev_display(    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyt   obtaine   s    		 c         C   s.   t  |  i d d g d t d | ƒ} | i ƒ  S(   NRD   s   remote.origin.urlR2   R3   (   R    R7   R9   R&   (   R   R:   R   (    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyt   get_urlx   s    c         C   s.   t  |  i d d g d t d | ƒ} | i ƒ  S(   Ns	   rev-parset   HEADR2   R3   (   R    R7   R9   R&   (   R   R:   t   current_rev(    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyRO   ~   s    !c         C   sÿ   t  |  i d g d t d | ƒ} h  } xÑ | i ƒ  i ƒ  D]½ } | i d d ƒ \ } } | i ƒ  } d	 } | i d ƒ o | t d ƒ } nI | i d ƒ o | t d ƒ } n% | i d ƒ o | t d ƒ } n | d	 j	 o | i ƒ  | | <q: q: W| S(
   s=   Return map of named refs (branches or tags) to commit hashes.s   show-refR2   R3   t    i   s   refs/remotes/s   refs/heads/s
   refs/tags/N(	   R    R7   R9   R&   R%   t   splitR$   R'   R   (   R   R:   t   outputt   rvR-   t   committ   reft   ref_name(    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyR=   ƒ   s"     c   
      C   sÕ   |  i  | ƒ } | i ƒ  i d ƒ p d | } n | i ƒ  i d d ƒ d } | p d  S|  i | ƒ } |  i | ƒ } t d „  | i	 ƒ  Dƒ ƒ } | | j o d | | | f }	 n d | }	 d	 | | |	 f S(
   Ns   git:s   git+t   -i   i    c         s   s%   x |  ] \ } } | | f Vq Wd  S(   N(    (   t   .0RZ   RY   (    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pys	   <genexpr>¡   s   	 s   %s-%ss   %s-devs   %s@%s#egg=%s(
   RR   t   lowerR'   t   egg_nameRV   R$   RO   R=   t   dictt   items(
   R   t   distR:   t	   find_tagst   repot   egg_project_nameRT   t   refst   names_by_committ   full_egg_name(    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyt   get_src_requirement–   s    
c         C   s•   d |  i  j o` d |  i  j p t ‚ |  i  i d d ƒ |  _  t t |  ƒ i ƒ  \ } } | i d d ƒ } n t t |  ƒ i ƒ  \ } } | | f S(   s;  
        Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'.
        That's required because although they use SSH they sometimes doesn't
        work with a ssh:// scheme (e.g. Github). But we need a scheme for
        parsing. Hence we remove it again afterwards and return it as a stub.
        s   ://s   file:s   git+s
   git+ssh://s   ssh://RK   (   R   t   AssertionErrorR   R   R   RL   (   R   R   R,   (    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyRL   «   s    c         C   sP   t  i i t  i i | d ƒ ƒ p d  St |  i d d d d d g d | ƒd  S(   Ns   .gitmodulest	   submoduleRJ   s   --inits   --recursives   -qR3   (   t   osR   t   existst   joinR    R7   (   R   R:   (    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyRF   ¼   s    "(   s   gits   git+https	   git+httpss   git+sshs   git+gits   git+fileN(   t   __name__t
   __module__t   namet   dirnamet	   repo_namet   schemest   bundle_filet   guideR$   R   R0   R<   RC   RG   RJ   RQ   RR   RO   R=   Ri   RL   RF   (    (    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyR      s&   					
						(   R4   R(   t   os.pathRl   t   pip.utilR    R   R   t   pip.vcsR   R   t   pip.logR   t   pip.backwardcompatR   R   R   R   R   t   register(    (    (    sG   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vcs/git.pyt   <module>   s   		µ