
    6h                        S SK Jr  S SKJrJr  SSKJrJr   " S S\R                  5      r	 " S S\R                  5      r
 " S	 S
5      rg)    )annotations)hexsha1nodeconstants   )	basestoreshallowutilc                     ^  \ rS rSrU 4S jrSS jr\R                  R                  SS j5       r	\R                  R                  S 5       r
S rS rSS jrS	 rS
rU =r$ )unionmetadatastore   c                   > [         TU ]  " U0 UD6  Xl        UR                  S5      U l        UR                  SS5      U l        g )N
writestoreallowincompleteF)super__init__storesgetr   r   )selfargskwargs	__class__s      C/usr/lib/python3/dist-packages/hgext/remotefilelog/metadatastore.pyr   unionmetadatastore.__init__   s@    $)&) **\2
  &zz*;UC    c                Z  ^^	 Tc
  [        5       mUT;   a  / $ 0 m	U	U4S jnX4/nU(       aT  UR                  5       u  pg T	R                  U R                  XgTS95        U" Xg5      nUR	                  U5        U(       a  MT  T	$ ! [
         a    U R                  (       d  e Xg4X4:X  a  e  N2f = f)nReturns as many ancestors as we're aware of.

return value: {
   node: (p1, p2, linknode, copyfrom),
   ...
}
c                  > X4/n/ n[        5       nU(       a  UR                  5       u  pVXV4U;   a  M"  UR                  XV45        TR                  U5      nU(       d  UR	                  XV45        M`  Uu  ppU[
        R                  :w  a"  UT;  a  UR	                  U=(       d    U U45        U	[
        R                  :w  a  U	T;  a  UR	                  X	45        U(       a  M  U$ N)setpopaddr   appendr   nullid)curnamecurnodequeuemissingseennamenodevaluep1p2linknodecopyfrom	ancestorsknowns               r   traverse1unionmetadatastore.getancestors.<locals>.traverse(   s     '(EG5D"YY[
<4'$&!d+NND<0-2**111boLL("5gr!:;*111boLL'/ % Nr   r0   )r   r   update_getpartialancestorsextendKeyErrorr   )
r   r(   r)   r0   r1   r&   r#   r$   
newmissingr/   s
      `     @r   getancestorsunionmetadatastore.getancestors   s     =EE5=I		. <.&{{}G  --ge-L &g7
z* g"   ++%$5 6s   8B %B*)B*c                    U R                    H  n UR                  XUS9s  $    [        U[        U5      45      e! [         a     M;  f = f)Nr3   )r   r9   r7   r   )r   r(   r)   r0   stores        r   r5   'unionmetadatastore._getpartialancestorsS   sU    [[E))$E)BB ! c$i())  s   ;
A	A	c                    U R                    H  n UR                  X5      s  $    [        U[        U5      45      e! [         a     M<  f = fr   )r   getnodeinfor7   r   )r   r(   r)   r<   s       r   r?   unionmetadatastore.getnodeinfo]   sP    [[E((44 ! c$i())  s   <
A
	A
c                    [        S5      e)Ns5   cannot add content only to remotefilelog contentstoreRuntimeErrorr   r(   r)   datas       r   r    unionmetadatastore.addg   s    D
 	
r   c                d    UnU R                    H  nU(       d  M  UR                  U5      nM     U$ r   )r   
getmissing)r   keysr&   r<   s       r   rH   unionmetadatastore.getmissingl   s1    [[Ew**73 ! r   c                L    U R                    H  nUR                  X5        M     g r   )r   
markledger)r   ledgeroptionsr<   s       r   rL   unionmetadatastore.markledgers   s    [[EV- !r   c                    U R                    Vs/ s H  oR                  5       PM     nn[        R                  " U6 $ s  snf r   )r   
getmetricsr   sumdicts)r   smetricss      r   rQ   unionmetadatastore.getmetricsw   s4    +/;;7;a<<>;7##W-- 8s   =)r   r   r   r   )__name__
__module____qualname____firstlineno__r   r9   r   baseunionstore	retriabler5   r?   r    rH   rL   rQ   __static_attributes____classcell__)r   s   @r   r
   r
      sh    	D8t ''* (* ''* (*

.. .r   r
   c                  *    \ rS rSrSS jrS rS rSrg)remotefilelogmetadatastore|   Nc                T    U R                  X5      n[        R                  " U5      nU$ )r   )_getdatar   ancestormap)r   r(   r)   r0   rE   r/   s         r   r9   'remotefilelogmetadatastore.getancestors}   s(     }}T(++D1	r   c                *    U R                  X5      U   $ r   r9   r   r(   r)   s      r   r?   &remotefilelogmetadatastore.getnodeinfo         ,T22r   c                    [        S5      e)Ns7   cannot add metadata only to remotefilelog metadatastorerB   )r   r(   r)   parentsr-   s        r   r    remotefilelogmetadatastore.add   s    F
 	
r    r   )rV   rW   rX   rY   r9   r?   r    r\   rm   r   r   r_   r_   |   s    
3
r   r_   c                  @    \ rS rSrS rS
S jrS rS rS rS
S jr	S	r
g)remotemetadatastore   c                    X l         X0l        g r   _fileservice_shared)r   uifileserviceshareds       r   r   remotemetadatastore.__init__   s    'r   Nc                    U R                   R                  U[        U5      4/SSSS9  U R                  R	                  XUS9$ )NTF)force	fetchdatafetchhistoryr3   )rs   prefetchr   rt   r9   )r   r(   r)   r0   s       r   r9    remotemetadatastore.getancestors   sL    ""CItu4 	# 	
 ||((5(AAr   c                *    U R                  X5      U   $ r   rf   rg   s      r   r?   remotemetadatastore.getnodeinfo   ri   r   c                    [        S5      e)Ns   cannot add to a remote storerB   rD   s       r   r    remotemetadatastore.add   s    :;;r   c                    U$ r   rm   )r   rI   s     r   rH   remotemetadatastore.getmissing   s    r   c                    g r   rm   )r   rM   rN   s      r   rL   remotemetadatastore.markledger   s    r   rr   r   )rV   rW   rX   rY   r   r9   r?   r    rH   rL   r\   rm   r   r   ro   ro      s!    B3<r   ro   N)
__future__r   mercurial.noder   r    r   r   rZ   r
   r_   ro   rm   r   r   <module>r      sC    "l.11 l.^
!4!4 
, r   