ó
T³úVc           @   s¢   d  d l  m Z d  d l m Z m Z d  d l Z d  d l Z d  d l Z e j j	 ƒ  e j
 j d ƒ Z d „  Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(	   iÿÿÿÿ(   t   util(   t   SubversionExceptiont   PoolNc         C   s	  d d l  } | j j |  ƒ | j j |  ƒ | j j |  ƒ | j j |  ƒ | j j |  ƒ g } t | j d d ƒ } | rÅ x{ d D]? } x6 d D]. } | | | |  ƒ } | rŒ | j
 | ƒ qŒ qŒ Wq Wn1 t j | j d ƒ rö | j
 | j j |  ƒ ƒ n  | j j | |  ƒ S(   s*   Create a Subversion authentication baton. iÿÿÿÿNt'   svn_auth_get_platform_specific_providert   gnome_keyringt   keychaint   kwallett   windowst   simplet   ssl_client_cert_pwt   ssl_server_trustt   get_windows_simple_provider(   R   R   R   R   (   R   R	   R
   (   t
   svn.clientt   clientt   get_simple_providert   get_username_providert!   get_ssl_client_cert_file_providert$   get_ssl_client_cert_pw_file_providert"   get_ssl_server_trust_file_providert   getattrt   coret   Nonet   appendR    t   safehasattrR   t   svn_auth_open(   t   poolt   svnt	   providerst   getprovidert   namet   typet   p(    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyt   _create_auth_baton"   s"    	t   NotBranchErrorc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyR!   >   s   t   SvnRaTransportc           B   s<   e  Z d  Z d d d „ Z d e f d „  ƒ  YZ d „  Z RS(   s;   
    Open an ra connection to a Subversion repository.
    t    c         C   s‡  t  ƒ  |  _ | |  _ d |  _ d |  _ | d  k sI t j t j	 d ƒ rXt j
 j |  j ƒ |  _
 t |  j ƒ } t r· t j j | t j j |  j ƒ t j j | t j j |  j ƒ n  | |  j
 _ t |  j
 _ y( t j
 j |  j |  j
 |  j ƒ |  _	 Wqƒt k
 rT} | j \ } } | t j j t j j t j j f k rNt | ƒ ‚ n  ‚  qƒXn+ | |  _	 t j	 j |  j	 |  j j d ƒ ƒ d  S(   NR%   t   reparentt   utf8(   R   R   t   svn_urlt   usernamet   passwordR   R    R   R   t   raR   t   create_contextR    t   FalseR   t   svn_auth_set_parametert   SVN_AUTH_PARAM_DEFAULT_USERNAMEt   SVN_AUTH_PARAM_DEFAULT_PASSWORDt
   auth_batont
   svn_configt   configt   open_ra_sessionR   t   argst   SVN_ERR_RA_ILLEGAL_URLt"   SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILEDt   SVN_ERR_BAD_URLR!   R&   t   encode(   t   selft   urlR+   t   abt   xxx_todo_changemet   instt   num(    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyt   __init__E   s6    			"				
	t   Reporterc           B   sM   e  Z d  „  Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z RS(   c         C   s   | \ |  _  |  _ d  S(   N(   t	   _reportert   _baton(   R:   t   reporter_data(    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyR@   f   s    c         C   s,   t  j j |  j |  j | | | | | ƒ d  S(   N(   R   R+   t   reporter2_invoke_set_pathRB   RC   (   R:   t   patht   revnumt   start_emptyt
   lock_tokenR   (    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyt   set_pathi   s    c         C   s#   t  j j |  j |  j | | ƒ d  S(   N(   R   R+   t   reporter2_invoke_delete_pathRB   RC   (   R:   RF   R   (    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyt   delete_pathm   s    c      	   C   s/   t  j j |  j |  j | | | | | | ƒ d  S(   N(   R   R+   t   reporter2_invoke_link_pathRB   RC   (   R:   RF   R;   t   revisionRH   RI   R   (    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyt	   link_pathq   s    c         C   s    t  j j |  j |  j | ƒ d  S(   N(   R   R+   t   reporter2_invoke_finish_reportRB   RC   (   R:   R   (    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyt   finish_reportw   s    c         C   s    t  j j |  j |  j | ƒ d  S(   N(   R   R+   t   reporter2_invoke_abort_reportRB   RC   (   R:   R   (    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyt   abort_report{   s    N(	   R"   R#   R@   R   RJ   RL   RO   RQ   RS   (    (    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyRA   e   s   	c         O   s(   |  j  t j j |  j | | | | Ž ƒ S(   N(   RA   R   R+   t	   do_update(   R:   RG   RF   R5   t   kwargs(    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyRT      s    N(   R"   R#   t   __doc__R   R@   t   objectRA   RT   (    (    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyR$   A   s    (   t	   mercurialR    t   svn.coreR   R   t   svn.raR   R   R+   t
   initializeR   t   svn_config_get_configR   R2   R    R!   RW   R$   (    (    (    s;   /usr/lib/python2.7/dist-packages/hgext/convert/transport.pyt   <module>   s   	