§
    	^µc'  ã                   óŒ   — d Z ddlmZ ddlmZmZ ddlmZmZ ddl	m
Z
mZmZ ej        Zej        Z G d„ de
j
        ¦  «        Zd	S )
z4remote largefile store; the base class for wirestoreé    )Ú_)ÚerrorÚutil)Ú
stringutilÚurlutilé   )Ú	basestoreÚlfutilÚ
localstorec                   óX   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zˆ xZS )Úremotestorez)a largefile store accessed over a networkc                 óÆ   •— t          t          | ¦  «                             |||¦  «         d | _        |�,t	          j        | j        | j        | j        ¦  «        | _        d S d S )N)Úsuperr   Ú__init__Ú_lstorer   ÚuiÚrepo)Úselfr   r   ÚurlÚ	__class__s       €ú>/usr/lib/python3/dist-packages/hgext/largefiles/remotestore.pyr   zremotestore.__init__"   sZ   ø€ Ý�k˜4Ñ Ô ×)Ò)¨"¨d°CÑ8Ô8Ð8ØˆŒØÐÝ%Ô0°´¸$¼)ÀTÄYÑOÔOˆDŒLˆLˆLð Ðó    c                 ó2  — |                       ||¦  «        r=t          j        t          d¦  «        |t	          j        | j        ¦  «        fz  ¦  «        ‚| j                             t          d¦  «        |t	          j        | j        ¦  «        fz  ¦  «         d S )Ns0   remotestore: could not put %s to remote store %ss'   remotestore: put %s to remote store %s
)	Úsendfiler   ÚAbortr   r   Úhidepasswordr   r   Údebug)r   ÚsourceÚhashs      r   Úputzremotestore.put(   sœ   € Ø�=Š=˜ Ñ&Ô&ð 	Ý”+ÝÐEÑFÔFØ�7Ô/°´Ñ9Ô9Ð:ñ;ñô ð ð 	Œ�ŠÝÐ9Ñ:Ô:Ø•wÔ+¨D¬HÑ5Ô5Ð6ñ7ñ	
ô 	
ð 	
ð 	
ð 	
r   c                 ód   — d„ |                       |¦  «                             ¦   «         D ¦   «         S )Nc                 ó"   — i | ]\  }}||d k    “ŒS )r   © )Ú.0ÚhÚss      r   ú
<dictcomp>z&remotestore.exists.<locals>.<dictcomp>4   s2   € ð 
ð 
ð 
á��Að ˆq�AŠvð
ð 
ð 
r   )Ú_statÚitems©r   Úhashess     r   Úexistszremotestore.exists3   s;   € ð
ð 
àŸ*š* VÑ,Ô,×2Ò2Ñ4Ô4ð
ñ 
ô 
ð 	
r   c                 ój  — | j                              d||fz  ¦  «         	 t          j        | j         |¦  «        5 }|                      ||¦  «        cd d d ¦  «         S # 1 swxY w Y   d S # t
          $ r=}t          j        t          d¦  «        |t          j
        |¦  «        fz  ¦  «        ‚d }~ww xY w)Ns   remotestore: sendfile(%s, %s)
s'   remotestore: could not open file %s: %s)r   r   r
   ÚhttpsendfileÚ_putÚIOErrorr   r   r   r   Úforcebytestr)r   Úfilenamer   ÚfdÚes        r   r   zremotestore.sendfile:   s  € ØŒ�ŠÐ8¸HÀdÐ;KÑKÑLÔLÐLð	ÝÔ$ T¤W¨hÑ7Ô7ð +¸2Ø—y’y  rÑ*Ô*ð+ð +ð +ð +ñ +ô +ð +ð +ð +ð +ð +ð +øøøð +ð +ð +ð +ð +ð +øåð 	ð 	ð 	Ý”+ÝÐ<Ñ=Ô=Ø�ZÔ4°QÑ7Ô7Ð8ñ9ñô ð øøøøð	øøøs:   ¡A+ »AÁA+ ÁA"Á"A+ Á%A"Á&A+ Á+
B2Á58B-Â-B2c           	      óè  — 	 |                       |¦  «        }nÇ# t          j        $ r3}t          j        ||| j        t          j        |¦  «        ¦  «        ‚d }~wt          j        $ r:}t          j
        dt          j        | j        ¦  «        |j        fz  ¦  «        ‚d }~wt          $ r3}t          j        ||| j        t          j        |¦  «        ¦  «        ‚d }~ww xY wt          j        ||¦  «        S )Ns   %s: %s)Ú_getÚurlerrÚ	httperrorr	   Ú
StoreErrorr   r   r1   Úurlerrorr   r   r   r   Úreasonr0   r
   Úcopyandhash)r   Útmpfiler2   r   Úchunksr4   s         r   Ú_getfilezremotestore._getfileE   s  € ð	Ø—Y’Y˜t‘_”_ˆFˆFøÝÔð 	ð 	ð 	õ Ô&Ø˜$ ¤­*Ô*AÀ!Ñ*DÔ*Dñô ð øøøøõ Œð 	ð 	ð 	õ ”+Ø�WÔ1°$´(Ñ;Ô;¸Q¼XÐFÑFñô ð øøøøõ ð 	ð 	ð 	ÝÔ&Ø˜$ ¤­*Ô*AÀ!Ñ*DÔ*Dñô ð øøøøð	øøøõ
 Ô! &¨'Ñ2Ô2Ð2s,   ‚ ˜C§.AÁCÁ'5BÂCÂ).CÃCc                 óX   ‡— | j                              |¦  «        Šˆfd„|D ¦   «         }|S )Nc                 ó$   •— g | ]}‰|         ¯
|‘ŒS r#   r#   )r$   r   Úexistslocallymaps     €r   ú
<listcomp>z7remotestore._hashesavailablelocally.<locals>.<listcomp>^   s$   ø€ ÐIÐIÐI Ð2BÀ4Ô2HÐI�tÐIÐIÐIr   )r   r,   )r   r+   ÚlocalhashesrB   s      @r   Ú_hashesavailablelocallyz#remotestore._hashesavailablelocally\   s8   ø€ Øœ<×.Ò.¨vÑ6Ô6ÐØIÐIÐIÐI¨ÐIÑIÔIˆØÐr   c                 ó  ‡— d}d„ |D ¦   «         }|                       |¦  «        Š|                      ˆfd„|D ¦   «         ¦  «        }|D ]¶\  }}}|‰v r&|||f}	| j                             ||	g¦  «        }
|
rd}Œ0||         }|r||dk    r/| j                             t          d¦  «        ||fz  ¦  «         d}Œo|dk    r/| j                             t          d¦  «        ||fz  ¦  «         d}Œ¤t          d	|z  ¦  «        ‚Œ·|S )
NFc                 ó   — g | ]\  }}}|‘Œ	S r#   r#   )r$   Úcsetr2   Úexpectedhashs       r   rC   z,remotestore._verifyfiles.<locals>.<listcomp>c   s+   € ð 
ð 
ð 
Ù9˜T 8¨\ˆLð
ð 
ð 
r   c                 ó   •— g | ]}|‰v¯|‘Œ	S r#   r#   )r$   rI   rD   s     €r   rC   z,remotestore._verifyfiles.<locals>.<listcomp>h   s.   ø€ ð ð ð à Ø {Ð2Ð2ð à2Ð2Ð2r   Tr   s"   changeset %s: %s: contents differ
é   s   changeset %s: %s missing
s6   verify failed: unexpected response from statlfile (%r))rE   r(   r   Ú_verifyfilesr   Úwarnr   ÚRuntimeError)r   ÚcontentsÚfilestocheckÚfailedÚexpectedhashesÚstatsrH   r2   rI   ÚfiletocheckÚverifyresultÚstatrD   s               @r   rL   zremotestore._verifyfilesa   s‘  ø€ Øˆð
ð 
Ø=Ið
ñ 
ô 
ˆð ×2Ò2°>ÑBÔBˆØ—
’
ðð ð ð à$2ðñ ô ñ
ô 
ˆð -9ð 	ð 	Ñ(ˆD�(˜LØ˜{Ð*Ð*Ø# X¨|Ð<�Ø#œ|×8Ò8Ø˜{˜mñ ô  �ð  ð "Ø!�Føà˜\Ô*�Øð Ø˜q’y�yØœŸšÝÐDÑEÔEØ# XÐ.ñ/ñô ð ð "&˜˜Ø š˜ØœŸšÝÐ;Ñ<Ô<ÀÀhÐ?OÑOñô ð ð "&˜˜å*ð3Ø59ñ:ñô ð ðð" ˆr   c                 ó    — t          d¦  «        ‚)z1Put file with the given hash in the remote store.ó   abstract method©ÚNotImplementedError)r   r   r3   s      r   r/   zremotestore._putŒ   ó   € å!Ð"4Ñ5Ô5Ð5r   c                 ó    — t          d¦  «        ‚)z/Get a iterator for content with the given hash.rX   rY   )r   r   s     r   r6   zremotestore._get�   r[   r   c                 ó    — t          d¦  «        ‚)z×Get information about availability of files specified by
        hashes in the remote store. Return dictionary mapping hashes
        to return code where 0 means that file is available, other
        values if not.rX   rY   r*   s     r   r(   zremotestore._stat”   s   € õ
 "Ð"4Ñ5Ô5Ð5r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r    r,   r   r?   rE   rL   r/   r6   r(   Ú__classcell__)r   s   @r   r   r      sË   ø€ € € € € Ø3Ð3ðPð Pð Pð Pð Pð	
ð 	
ð 	
ð
ð 
ð 
ð	ð 	ð 	ð3ð 3ð 3ð.ð ð ð
)ð )ð )ðV6ð 6ð 6ð6ð 6ð 6ð6ð 6ð 6ð 6ð 6ð 6ð 6r   r   N)ra   Úmercurial.i18nr   Ú	mercurialr   r   Úmercurial.utilsr   r   Ú r	   r
   r   r7   Úurlreqr   r#   r   r   ú<module>rh      sò   ðð ;Ð :à Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð
ð ð ð ð ð ð ð ð
ð ð ð ð ð ð ð ð ð ð 
Œ€Ø	Œ€ðz6ð z6ð z6ð z6ð z6�)Ô%ñ z6ô z6ð z6ð z6ð z6r   