
    q&f	                     f    d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	  G d dej                        Z
y	)
z store class for local filesystem    )_)open)util   )	basestorelfutilc                   :     e Zd ZdZ fdZd Zd Zd Zd Z xZ	S )
localstorezlocalstore first attempts to grab files out of the store in the remote
    Mercurial repository.  Failing that, it attempts to grab the files from
    the user cache.c                     |j                         | _        t        t        |   ||| j                  j                                y N)localremotesuperr
   __init__url)selfuirepor   	__class__s       =/usr/lib/python3/dist-packages/hgext/largefiles/localstore.pyr   zlocalstore.__init__   s.    llnj$(T4;;??3DE    c                     t        j                  | j                  |      ry t        j                  |t        j                  | j                  |             y r   )r   instorer   link	storepath)r   sourcehashs      r   putzlocalstore.put   s6    >>$++t,FF,,T[[$?@r   c                 ^    i }|D ]%  }t        j                  | j                  |      ||<   ' |S r   )r   r   r   )r   hashesretvalr   s       r   existszlocalstore.exists#   s3     	=D!>>$++t<F4L	=r   c                 2   t        j                  | j                  |      }|s+t        j                  ||| j
                  t        d            t        |d      5 }t        j                  t        j                  |      |      cd d d        S # 1 sw Y   y xY w)Ns   can't get file locallys   rb)r   findfiler   r   
StoreErrorr   r   r   copyandhashr   filechunkiter)r   tmpfilefilenamer   pathfds         r   _getfilezlocalstore._getfile)   s    t{{D1&&$!,E*F  $ 	G"%%d&8&8&<gF	G 	G 	Gs   )BBc                    d}|D ]  \  }}}t        j                  | j                  |      \  }}|s#t        j                  | j                  |      \  }}|s-| j                  j                  t        d      |||fz         d}~|st        j                  |      }	|	|k7  s| j                  j                  t        d      |||fz         d} |S )NFs'   changeset %s: %s references missing %s
Ts)   changeset %s: %s references corrupted %s
)r   findstorepathr   r   r   warnr   hashfile)
r   contentsfilestocheckfailedcsetr)   expectedhashr   r"   
actualhashs
             r   _verifyfileszlocalstore._verifyfiles2   s    ,8 	"(D(L & 4 4TYY MIv$*$8$8KK%!	6 ABXy12 #__Y7
-GGLLGH956 "F'	"( r   )
__name__
__module____qualname____doc__r   r   r"   r,   r7   __classcell__)r   s   @r   r
   r
      s$    FA
Gr   r
   N)r;   mercurial.i18nr   mercurial.pycompatr   	mercurialr    r   r   r
    r   r   <module>rB      s*    '  # 3$$ 3r   