
    	^c}	                     \    d dl mZmZmZ ej        Z G d d          Z G d d          ZdS )    )hgsshpeerutilc                        e Zd Zd Zd Zd ZdS )connectionpoolc                 :    || _         t                      | _        d S N)_repodict_pool)selfrepos     D/usr/lib/python3/dist-packages/hgext/remotefilelog/connectionpool.py__init__zconnectionpool.__init__   s    
VV


    c                    | j                             |          }|t                      }|| j         |<   d }t          |          dk    r]	 |                                }|j        }t          |t                    r|j        	                                d }n# t          $ r Y nw xY w|at          j        | j        j        i |          }t          j        |d          r G fdd|j                  |_        t#          ||          }|S )Nr   _cleanupc                   $     e Zd Zd fd	Z xZS )"connectionpool.get.<locals>.mypeerNc                     t          j        | d          r| j                                         t	          |                                           S )Npipee)r   safehasattrr   closesuperr   )r   warn	__class__mypeers     r   r   z+connectionpool.get.<locals>.mypeer._cleanup/   sJ      +D':: / J,,...$VT22;;===r   r	   )__name__
__module____qualname__r   __classcell__)r   r   s   @r   r   r   .   sC        > > > > > > > > > > >r   r   )r   getlistlenpoppeer
isinstance
_sshv1peer_subprocesspoll
IndexErrorr   r
   uir   r   r   
connection)r   pathpathpoolconnr&   r   s        @r   r"   zconnectionpool.get   s3   :>>$''vvH'DJtx==1||~~ydJ// $',,..:#    <74:="d33Dj11 (> > > > > > >T^ > > > "(h--Ds   AB 
B%$B%c                 z    | j                                         D ] }|D ]}|                                 |d d = !d S r	   )r   valuesr   )r   r/   r0   s      r   r   zconnectionpool.close=   sT    
))++ 	 	H   

	 	r   N)r   r   r    r   r"   r    r   r   r   r      sB          $ $ $L    r   r   c                   &    e Zd Zd Zd Zd Zd ZdS )r-   c                 "    || _         || _        d S r	   )r   r&   )r   poolr&   s      r   r   zconnection.__init__E   s    
			r   c                     | S r	   r3   r   s    r   	__enter__zconnection.__enter__I   s    r   c                 j    || j                             |            d S |                                  d S r	   )r   appendr   )r   typevalue	tracebacks       r   __exit__zconnection.__exit__L   s6     <Jd#####JJLLLLLr   c                 p    t          j        | j        d          r| j                                         d S d S )Ncleanup)r   r   r&   rA   r8   s    r   r   zconnection.closeU   s=    DIy11 	 I	  	 r   N)r   r   r    r   r9   r?   r   r3   r   r   r-   r-   D   sP                       r   r-   N)	mercurialr   r   r   	sshv1peerr(   r   r-   r3   r   r   <module>rD      s             
/ / / / / / / /d                   r   