
    	^cc                        d dl Z d dlZd dlZd dlZddlmZ ddlmZ ddlm	Z	 ddl
mZmZmZmZmZmZmZ ddlmZ  ej        d          Zd	Zd
 Zd Z eede          Zd Zd Zd Z e            \  ZZd Zd Z d Z! eedd          p	 e!            Z"dZ#dZ$d Z%dZ&dZ'de'dz   z  dz
  Z(d Z)d Z*d Z+ eede+          Z+d Z,d Z-g d Z.d!Z/d"Z0d#Z1 ej2        d$          Z3d% Z4d& Z5d'Z6d(Z7d)Z8d*Z9d+Z:dZ;d,Z<e6e:z  Z=e6e;z  Z>e7e:z  Z?e7e;z  Z@e8e:z  ZAe8e;z  ZBe9ZC G d- d.          ZD G d/ d0eD          ZE G d1 d2          ZF G d3 d4ejG                  ZH G d5 d6eD          ZIdS )7    N   )_)getattr)hex)	changelogerrormanifestpolicypycompatutilvfs)hashutilparsersi@B c                 v   |dS t          |           } |                     d          r. || t          d          t          d                              S |                     d          r8|                    | t          d          t          d                              S t	          j        d| z            )zparses a fncache entry and returns whether the entry is tracking a path
    matched by matcher or not.

    If matcher is None, returns TrueNT   data/   .i   meta/s   /00manifest.is   cannot decode path %s)	decodedir
startswithlenvisitdirr   ProgrammingError)pathmatchers     1/usr/lib/python3/dist-packages/mercurial/store.py_matchtrackedpathr   "   s     tT??Dx   NwtCMMSZZK78999		"	" NS]]c:J6K6K5K%K LMMM

 !9D!@
A
AA    c                 ~    |                      dd                               dd                               dd          S )aM  
    >>> _encodedir(b'data/foo.i')
    'data/foo.i'
    >>> _encodedir(b'data/foo.i/bla.i')
    'data/foo.i.hg/bla.i'
    >>> _encodedir(b'data/foo.i.hg/bla.i')
    'data/foo.i.hg.hg/bla.i'
    >>> _encodedir(b'data/foo.i\ndata/foo.i/bla.i\ndata/foo.i.hg/bla.i\n')
    'data/foo.i\ndata/foo.i.hg/bla.i\ndata/foo.i.hg.hg/bla.i\n'
       .hg/   .hg.hg/   .i/   .i.hg/   .d/   .d.hg/replacer   s    r   
_encodedirr(   5   s8     	Wj))		#	#		#	#r   	encodedirc                     d| vr| S |                      dd                               dd                               dd          S )z
    >>> decodedir(b'data/foo.i')
    'data/foo.i'
    >>> decodedir(b'data/foo.i.hg/bla.i')
    'data/foo.i/bla.i'
    >>> decodedir(b'data/foo.i.hg.hg/bla.i')
    'data/foo.i.hg/bla.i'
    r   r$   r#   r"   r!   r    r%   r'   s    r   r   r   J   sH     dY''	F	#	#	W	%	%r   c               #      K   d dD             } t          d          D ]}|V  t          dd          D ]}|V  | D ]}|V  dS )zcharacters that are problematic for filesystems

    * ascii escapes (0..31)
    * ascii hi (126..255)
    * windows specials

    these characters will be escaped by encodefunctions
    c                 ,    g | ]}t          |          S  )ord.0xs     r   
<listcomp>z_reserved.<locals>.<listcomp>e   s    000a3q66000r   z\:*?"<>|    ~      N)range)winreservedr1   s     r   	_reservedr8   \   s       10<000K2YY  3__     r   c                  ,  	 d} t           j        }t          t          |t	          d                              }t          t	          t          d          t          d          dz                       }d |D             t                      D ]}d|z   ||          <   |t          |           gz   D ].}|  ||                                          z    ||          <   /i 	                                D ]
\  }}|	|<   	fdfd	fd
fS )a  
    >>> enc, dec = _buildencodefun()

    >>> enc(b'nothing/special.txt')
    'nothing/special.txt'
    >>> dec(b'nothing/special.txt')
    'nothing/special.txt'

    >>> enc(b'HELLO')
    '_h_e_l_l_o'
    >>> dec(b'_h_e_l_l_o')
    'HELLO'

    >>> enc(b'hello:world?')
    'hello~3aworld~3f'
    >>> dec(b'hello~3aworld~3f')
    'hello:world?'

    >>> enc(b'the\x07quick\xADshot')
    'the~07quick~adshot'
    >>> dec(b'the~07quick~adshot')
    'the\x07quick\xadshot'
       _      A   Zr   c                     i | ]}||S r-   r-   r/   s     r   
<dictcomp>z#_buildencodefun.<locals>.<dictcomp>   s    ###QAq###r      ~%02xc              3      K   d}|t          |           k     r[t          dd          D ].}	 | |||z                     V  ||z  } n# t          $ r Y +w xY wt          |t          |           k     Yd S d S )Nr   r      )r   r6   KeyError)sildmaps      r   decodez_buildencodefun.<locals>.decode   s      #a&&jj1a[[  qQU|,,,,FAE   D  #a&&jjjjjjs   A
AAc                 ~     d                      fdt          t                               D                       S )Nr   c                 6    g | ]}||d z                     S )r   r-   )r0   ccmaprD   s     r   r2   z5_buildencodefun.<locals>.<lambda>.<locals>.<listcomp>   s*    FFF1D1q1u9.FFFr   )joinr6   r   rD   rL   s   `r   <lambda>z!_buildencodefun.<locals>.<lambda>   s8    #((FFFFFc!ffFFFGG r   c                 Z    d                     t           |                               S )Nr   )rM   list)rD   rH   s    r   rO   z!_buildencodefun.<locals>.<lambda>   s!    #((4q		??++ r   )	r   bytechrrQ   mapr6   r.   r8   loweritems)
exchrasciistrcapitalsr1   kvrL   rH   rG   s
          @@@r   _buildencodefunr\   n   sB   0 	ADCeCjj))**HE#d))SYY]3344H##(###D[[ % % 1TT!WWQ  , ,DDGGMMOO+TT!WWD

  1Q     	HGGG++++ r   c                 :    t          t          |                     S )z~
    >>> encodefilename(b'foo.i/bar.d/bla.hg/hi:world?/HELLO')
    'foo.i.hg/bar.d.hg/bla.hg.hg/hi~3aworld~3f/_h_e_l_l_o'
    )_encodefnamer)   rD   s    r   encodefilenamer`      s    
 	!%%%r   c                 :    t          t          |                     S )z~
    >>> decodefilename(b'foo.i.hg/bar.d.hg/bla.hg.hg/hi~3aworld~3f/_h_e_l_l_o')
    'foo.i/bar.d/bla.hg/hi:world?/HELLO'
    )r   _decodefnamer_   s    r   decodefilenamerc      s    
 \!__%%%r   c                  X   t           j        fdt          d          D             t                      D ]} d| z   |           <   t          t	          d          t	          d          dz             D ]+}  |                                            |           <   ,fd}|S )z
    >>> f = _buildlowerencodefun()
    >>> f(b'nothing/special.txt')
    'nothing/special.txt'
    >>> f(b'HELLO')
    'hello'
    >>> f(b'hello:world?')
    'hello~3aworld~3f'
    >>> f(b'the\x07quick\xADshot')
    'the~07quick~adshot'
    c                 :    i | ]} |           |          S r-   r-   )r0   r1   rW   s     r   r?   z(_buildlowerencodefun.<locals>.<dictcomp>   s+    111DDGGTT!WW111r   r;   r@   r<   r=   r   c                 j    d                     fdt          j        |           D                       S )Nr   c                      g | ]
}|         S r-   r-   )r0   rK   rL   s     r   r2   z=_buildlowerencodefun.<locals>.lowerencode.<locals>.<listcomp>   s    BBBQaBBBr   )rM   r   iterbytestrrN   s    r   lowerencodez)_buildlowerencodefun.<locals>.lowerencode   s5    xxBBBB(*>q*A*ABBBCCCr   )r   rR   r6   r8   r.   rT   )r1   ri   rL   rW   s     @@r   _buildlowerencodefunrj      s     D1111eCjj111D[[ % % 1TT!WW3t99c$ii!m,, ( (QTT!WWD D D D D r   ri   )s   auxs   cons   prns   nul)s   coms   lptc                 b   t          |           D ]\  }}|s	|r5|d         dv r+dt          |dd                   z  |dd         z   }|| |<   n|                    d          }|dk    rt          |          }|dk    r|dd         t          v s3|d	k    rd|dd	         d
k    rV|dd	         dk    rH|dd         t
          v r7dt          |dd                   z  }|dd         |z   |dd         z   }|| |<   |d         dv r(|dd         dt          |dd                   z  z   | |<   | S )a  
    Encodes filenames containing names reserved by Windows or which end in
    period or space. Does not touch other single reserved characters c.
    Specifically, c in '\:*?"<>|' or ord(c) <= 31 are *not* encoded here.
    Additionally encodes space or period at the beginning, if dotencode is
    True. Parameter path is assumed to be all lowercase.
    A segment only needs encoding if a reserved name appears as a
    basename (e.g. "aux", "aux.foo"). A directory or file named "foo.aux"
    doesn't need encoding.

    >>> s = b'.foo/aux.txt/txt.aux/con/prn/nul/foo.'
    >>> _auxencode(s.split(b'/'), True)
    ['~2efoo', 'au~78.txt', 'txt.aux', 'co~6e', 'pr~6e', 'nu~6c', 'foo~2e']
    >>> s = b'.com1com2/lpt9.lpt4.lpt1/conprn/com0/lpt0/foo.'
    >>> _auxencode(s.split(b'/'), False)
    ['.com1com2', 'lp~749.lpt4.lpt1', 'conprn', 'com0', 'lpt0', 'foo~2e']
    >>> _auxencode([b'foo. '], True)
    ['foo.~20']
    >>> _auxencode([b' .foo'], True)
    ['~20.foo']
    r      . r@   r   N   .   rB      9   1   )	enumerater.   findr   _winres3_winres4)r   	dotencoderE   nrF   ecs         r   
_auxencoderz      se   , $ 6 61 	 	13q1v;;&122.ADGGtABwwFFQ1RaR5H,,QacFdNNacFdNNbqbEX%% AacF+acFRK!ABB%'QR5E>>fx#af++55DGKr   x      rB   c                    t          t          j        |                                                     }t	          | dd                                        d          }t          ||          }|d         }t          j        	                    |          \  }}g }d}	|d d         D ]w}
|
d t                   }|d         dv r|d d         dz   }|	dk    rt          |          }n"|	dz   t          |          z   }|t          k    r n|                    |           |}	xd                    |          }t          |          dk    r|dz  }d|z   |z   |z   }t          t          |          z
  }|dk    r|d |         }d|z   |z   |z   |z   }|S )	N      /rn   r   rl   r:   r   s   dh/)r   r   sha1digestri   splitrz   osr   splitext_dirprefixlenr   _maxshortdirslenappendrM   _maxstorepathlen)r   rw   r   lepartsbasename_rootextsdirssdirslenpdtdirsres	spaceleftfillers                    r   _hashencoder     s   t$$++--..F	T!""X			$	$T	*	*Br9%%ERyH!!(++JE3EH3B3Z  n}nR5E>>#2#Aq==AAA1s1vv%A###Q99UD
4yy1}}
4-&
 3
&C 3s88+I1}}*9*%tmf$v-3Jr   c                     t          |           } t          |                               d          }d                    t	          ||                    }t          |          t          k    rt          | |          }|S )ae  encodes path with a length limit

    Encodes all paths that begin with 'data/', according to the following.

    Default encoding (reversible):

    Encodes all uppercase letters 'X' as '_x'. All reserved or illegal
    characters are encoded as '~xx', where xx is the two digit hex code
    of the character (see encodefilename).
    Relevant path components consisting of Windows reserved filenames are
    masked by encoding the third character ('aux' -> 'au~78', see _auxencode).

    Hashed encoding (not reversible):

    If the default-encoded path is longer than _maxstorepathlen, a
    non-reversible hybrid hashing of the path is done instead.
    This encoding uses up to _dirprefixlen characters of all directory
    levels of the lowerencoded path, but not more levels than can fit into
    _maxshortdirslen.
    Then follows the filler followed by the sha digest of the full path.
    The filler is the beginning of the basename of the lowerencoded path
    (the basename is everything after the last path separator). The filler
    is as long as possible, filling in characters from the basename until
    the encoded path has _maxstorepathlen characters (or all chars of the
    basename have been taken).
    The extension (e.g. '.i' or '.d') is preserved.

    The string 'data/' at the beginning is replaced with 'dh/', if the hashed
    encoding was used.
    r   )r)   r^   r   rM   rz   r   r   r   )r   rw   efr   s       r   _hybridencoder   0  sk    > T??D	d			!	!$	'	'B
))Jr9--
.
.C
3xx"""$	**Jr   c                 N   t          |           }t          |           t          k    rt          |d          S t	          |                              d          }d                    t          |d                    }t          |          t          k    rt          |d          S |S )NTr   )r)   r   r   r   r^   r   rM   rz   )r   der   r   s       r   _pathencoder   W  s    	4B
4yy###2t$$$	b					%	%B
))Jr4((
)
)C
3xx"""2t$$$Jr   
pathencodec                 "    t          | d          S NF)r   )fs    r   _plainhybridencoder   e  s    E"""r   c                     	 |                                  j        }dt          j         z  d|z  k    rd }n# t          $ r d }Y nw xY w|S )Ni  )statst_moder   umaskOSError)r   modes     r   	_calcmoder   i  s^    xxzz!TZKUT\22D   Ks   25 AA)	   bookmarks
   narrowspec   data   meta   00manifest.d   00manifest.i   00changelog.d   00changelog.i
   phaseroots   obsstore   requires)r   s   i.tmpcensored)s   .idxs   .ds   .dat   .n   .nds   .sdas   d.tmpcensored)r   r   s   .*undo\.[^/]+\.(nd?|i)$c                 D    |t           j        k    rd S t          |           S N)r   S_IFREGrevlog_type)r   kindsts      r   	is_revlogr     s     t|tq>>r   c                     |                      t                    rt          S |                      t                    r-t          }|                      t
                    r
|t          z  }|S d S r   )endswithREVLOG_FILES_MAIN_EXTFILEFLAGS_REVLOG_MAINREVLOG_FILES_OTHER_EXTFILETYPE_FILELOG_OTHERREVLOG_FILES_VOLATILE_EXTFILEFLAGS_VOLATILE)r   r   s     r   r   r     sc     	zz'(( $$	
*	+	+ "::/00 	$##A4r   i    i   i   i   rr   i   c                   f    e Zd ZdZd Zd Zd ZddZd ZddZ	d	 Z
dd
Zd Zd Zd Zd Zd ZdS )
basicstorez&base class for local repository storesc                      ||          }|j         | _        t          |          | _        | j        |_        || _        t          j        |t                    | _        | j        | _	        d S r   )
baser   r   
createmoderawvfsvfsmod	filtervfsr)   r   openerselfr   vfstyper   s       r   __init__zbasicstore.__init__  sV    gdmmH	#C..#C33hr   c                 6    | j         dz   t          |          z   S Nr   )r   r)   r   r   s     r   rM   zbasicstore.join  s    y4)A,,..r   c                 >   | j         }|r|d|z   z  }t          | j                   dz   }g }| j                            |          r|g}| j        j        }|r|                                } ||d          D ]\  }	}
}|dz   |	z   }t          |	|
|          }|Gt          j        ||d                   }|	                    |t          |          |j        f           h|
t          j        k    r|r|	                    |           ||                                 |S )z%yields (revlog_type, unencoded, size)r   r   T)r   N)r   r   r   isdirreaddirpopr   r   pconvertr   r   st_sizer   S_IFDIRsort)r   relpathrecurser   striplenrF   visitr   r   r   r   r   fprl_typerx   s                  r   _walkzbasicstore._walk  s:   y 	#D7N"Dty>>A%;T"" 	)FEk)G 	)IIKK#*714#8#8#8 ) )KAtRTAB'444G* M"XYY-88'9Q<<!DEEEE--'-R(((  	) 	
r   Nc                 :    t          j         | j        ||          S )N)
trypendingconcurrencychecker)r   r   )r   r   r   s      r   r   zbasicstore.changelog  s'    "H!1
 
 
 	
r   c                 x    t          j        |j        | j                  }t          j        | j        |||          S r   )r	   manifestrevlognodeconstantsr   manifestlog)r   repostorenarrowmatch	rootstores       r   r   zbasicstore.manifestlog  s3    +D,>II	#DHdI?OPPPr   c              #      K   |                      dd          |                      dd          z   }|D ]\  }}}t          |z  ||fV  dS )a4  Like walk, but excluding the changelog and root manifest.

        When [undecodable] is None, revlogs names that can't be
        decoded cause an exception. When it is provided, it should
        be a list and the filenames that can't be decoded are added
        to it instead. This is very rarely needed.r   Tr   N)r   FILEFLAGS_FILELOG)r   r   undecodablefilesr   urD   s          r   	datafileszbasicstore.datafiles  sh       

7D))DJJw,E,EE 	0 	0IQ1$q(!Q/////	0 	0r   c              #     K   t          |                     dd                    }|D ]_\  }}}|                    d          rt          |z  ||fV  +|                    d          rt          |z  ||fV  Pt
          |z  ||fV  `d S )Nr   Fs   00changelogs
   00manifest)reversedr   r   FILEFLAGS_CHANGELOGFILEFLAGS_MANIFESTLOGFILETYPE_OTHER)r   r   r   r   rD   s        r   topfileszbasicstore.topfiles  s      C//00 	1 	1IQ1||N++ 1*Q.155555m,, 1,q0!Q77777%)1a00000	1 	1r   c              #   x   K   |                      |          D ]}|V  |                                 D ]}|V  dS )zreturn file related to data storage (ie: revlogs)

        yields (file_type, unencoded, size)

        if a matcher is passed, storage files of only those tracked paths
        are passed with matches the matcher
        N)r   r   )r   r   r1   s      r   walkzbasicstore.walk  sZ       (( 	 	AGGGG 	 	AGGGG	 	r   c                     t           S r   _datar   s    r   copylistzbasicstore.copylist  s    r   c                     d S r   r-   r   trs     r   writezbasicstore.write      r   c                     d S r   r-   r   s    r   invalidatecacheszbasicstore.invalidatecaches"  r  r   c                     d S r   r-   r   fns     r   markremovedzbasicstore.markremoved%  r  r   c                     d                     d|f          }| j                            |dz             rdS |                    d          s|dz   }| j                            |          S )!Checks if the store contains pathr   r   r   T)rM   r   existsr   r   r   s     r   __contains__zbasicstore.__contains__(  sg    yy'4))8??4%<(( 	4}}T"" 	$;Dxt$$$r   r   NN)__name__
__module____qualname____doc__r   rM   r   r   r   r   r   r   r  r  r  r  r  r-   r   r   r   r     s        00  / / /  .
 
 
 
Q Q Q	0 	0 	0 	0	1 	1 	1           	% 	% 	% 	% 	%r   r   c                   2     e Zd Zd Zd fd	Zd Zd Z xZS )encodedstorec                      ||dz             }|j         | _        t          |          | _        | j        |_        || _        t          j        |t                    | _        | j        | _	        d S )N   /store)
r   r   r   r   r   r   r   r`   r   r   r   s       r   r   zencodedstore.__init__5  s]    gdY&''H	#C..#C88hr   Nc              #   T  K   t          t          |                                           D ]|\  }}}	 t          |          }nM# t          $ r@ |&t          d          |z  }t          j        |          |                    |           Y `w xY wt          ||          su|||fV  }d S )Ns   undecodable revlog name %s)
superr  r   rc   rC   r   r   StorageErrorr   r   )	r   r   r   r   f1sizef2msg	__class__s	           r   r   zencodedstore.datafilesC  s       t44>>@@ 	 	KAr4#B''   &9::R?C,S111&&r***H %R11 R+	 	s   AABBc                 6    | j         dz   t          |          z   S r   )r   r`   r   s     r   rM   zencodedstore.joinR  s    y4."3"333r   c                 .    ddgd t           D             z   S )Nr   r   c                     g | ]}d |z   S s   store/r-   r0   r   s     r   r2   z)encodedstore.copylist.<locals>.<listcomp>V  s    1O1O1OA)a-1O1O1Or   r   r   s    r   r  zencodedstore.copylistU  s"    -.1O1O1O1O1OOOr   r  )r  r  r  r   r   rM   r  __classcell__)r"  s   @r   r  r  4  sq               4 4 4P P P P P P Pr   r  c                   H    e Zd Zd ZddZddZd Zd Zd Zd Z	d	 Z
d
 ZdS )fncachec                 V    || _         d | _        d| _        t                      | _        d S r   )r   entries_dirtysetaddls)r   r   s     r   r   zfncache.__init__\  s&    UU


r   Nc                 B    | j         |                     |           dS dS )zread the fncache file if not already read.

        If the file on disk is corrupted, raise. If warn is provided,
        warn and keep going instead.N)r,  _load)r   warns     r   ensureloadedzfncache.ensureloadedc  s,    
 <JJt  r   c           	         d| _         	 |                     dd          }n$# t          $ r t                      | _        Y dS w xY wt                      | _        d}t          t          j        |j        t                    d          D ]~}||z  }	 |
                    d          }| j                            t          |d|dz                                                                 ||dz   d         }o# t          $ r Y {w xY w|rCt          d	          }|r ||dz              n#t!          j        |t          d
                    |                     ||           |                                 dS )z&fill the entries from the fncache fileF   fncache   rb)r   Nr      
r   s$   fncache does not ends with a newlines3   use 'hg debugrebuildfncache' to rebuild the fncache)hint)r-  r   IOErrorr.  r,  iter	functoolspartialreadfncache_chunksizerindexupdater   
splitlines
ValueErrorr   r   Abort_checkentriesclose)r   r2  r   chunkrK   r   r!  s          r   r1  zfncache._loadk  s   	*511BB 	 	 	55DLFF	
 uui'1BCCSII 		 		AQJELL''##IeGa!eGn$=$=$H$H$J$JKKKa!egg    
  	;<<C 	S5[!!!!k/     	2t$$$





s"   ! AAA&C66
DDc                    d| j         v ry|                    d           t          |          D ]V\  }}|                    d          s:t	          d          |dz   z  }|r ||dz              @t          j        |          UdS dS )z-make sure there is no empty string in entriesr   r   r7  s!   invalid entry in fncache, line %dr   N)r,  seekrs   rstripr   r   rC  )r   r   r2  rx   liner   s         r   rD  zfncache._checkentries  s    $,GGAJJJ$R== - -4{{5)) ->??1q5IA -QY#k!nn,- - -r   c                    | j         r| j        J | j        | j        z  | _        t                      | _        |                    d           |                     ddd          }| j        r=|                    t          d                    | j                  dz                        |	                                 d| _         | j        r|                    d           |                     ddd          }| j        r=|                    t          d                    | j                  dz                        |	                                 d | _        t                      | _        d S d S )Nr5  s   wbT)r   
atomictempr7  Fs   ab)
r-  r,  r/  r.  	addbackupr   r  r)   rM   rE  )r   r  r   s      r   r  zfncache.write  sB   ; 		 <+++<$*4DLDJLL$$$*5TBBB| F5::dl#;#;e#CDDEEEHHJJJDK: 	LL$$$*5TBBBz D5::dj#9#9E#ABBCCCHHJJJDLDJJJ	 	r   c                     | j         |                                  || j         vr| j                            |           d S d S r   )r,  r1  r/  addr
  s     r   rO  zfncache.add  sF    <JJLLLT\!!JNN2 "!r   c                     | j         |                                  || j        v r| j                            |           d S 	 | j                             |           d| _        d S # t
          $ r Y d S w xY wNT)r,  r1  r/  remover-  rC   r
  s     r   rR  zfncache.remove  s    <JJLLLJb!!!F	L###DKKK 	 	 	DD	s   !A% %
A32A3c                 `    || j         v rdS | j        |                                  || j        v S rQ  )r/  r,  r1  r
  s     r   r  zfncache.__contains__  s6    4<JJLLLT\!!r   c                 p    | j         |                                  t          | j         | j        z            S r   )r,  r1  r:  r/  r   s    r   __iter__zfncache.__iter__  s.    <JJLLLDL4:-...r   r   )r  r  r  r   r3  r1  rD  r  rO  rR  r  rU  r-   r   r   r*  r*  Y  s             $ $ $ $L
- 
- 
-  *  
 
 
" " "/ / / / /r   r*  c                   (    e Zd Zd ZddZd Zd ZdS )_fncachevfsc                 b    t           j                            | |           || _        || _        d S r   )r   proxyvfsr   r*  encode)r   r   fncrZ  s       r   r   z_fncachevfs.__init__  s,      s+++r      rc                    |                      |          }|dvr|                    d          s|                    d          rk| j        j        d u o| j                            |          }|r%d|v r!| j                            |          j        sd}|s| j                            |            | j        ||g|R i |S )N)r\  r6  r   r   s   r+F)	rZ  r   r*  r,  r   r  r   r   rO  )r   r   r   argskwencodednotloads          r   __call__z_fncachevfs.__call__  s    ++d##}$$OOH%% %)-)B)B %
 l*d2Otxw7O7OG  5D==w1G1G1O=   '  &&&tx3333333r   c                     |r-| j                             |                     |                    S | j                             |          S r   )r   rM   rZ  r  s     r   rM   z_fncachevfs.join  s>     	'8==T!2!23338==&&&r   c                     |                     d          s|                     d          r| j                            |           dS dS )z1generic hook point to lets fncache steer its stewr   r   N)r   r*  rO  r  s     r   register_filez_fncachevfs.register_file  sO    ??8$$ 	#(A(A 	#LT"""""	# 	#r   N)r\  )r  r  r  r   rb  rM   re  r-   r   r   rW  rW    sU          
4 4 4 4"' ' '# # # # #r   rW  c                   L    e Zd Zd Zd Zd ZddZd Zd Zd Z	d	 Z
d
 Zd ZdS )fncachestorec                 F   |rt           }nt          }|| _         ||dz             }|j        | _        | j        dz   | _        t          |          | _        | j        |_        || _        t          |          }|| _	        t          |||          | _        | j        | _        d S )Nr  r   )r   r   rZ  r   r   pathsepr   r   r   r*  rW  r   r   )r   r   r   rw   rZ  r   r[  s          r   r   zfncachestore.__init__  s     	( FF'FgdY&''H	y4'#C..cllsC00hr   c                 <    | j         |                     |          z   S r   )ri  rZ  r   s     r   rM   zfncachestore.join  s    |dkk!nn,,r   c                 @    | j                             |          j        S r   )r   r   r   r  s     r   getsizezfncachestore.getsize	  s    {%%--r   Nc              #   $  K   t          | j                  D ]x}t          ||          s|                     |          }	 t	          |          }|
J |            |t
          z  }|||                     |          fV  i# t          $ r Y uw xY wd S r   )sortedr*  r   rZ  r   r   rl  FileNotFoundError)r   r   r   r   r   r   s         r   r   zfncachestore.datafiles  s      %% 
	 
	A$Q00 QBNN}}a}}}&&DLL,,,,,,,$   
	 
	s    ?B  
BBc                 (    d}ddgd |D             z   S )N)r   r   r   r   s   dhr5  r   r   r   r   r   r   r   r   r   c                     g | ]}d |z   S r&  r-   r'  s     r   r2   z)fncachestore.copylist.<locals>.<listcomp>)  s    1K1K1KA)a-1K1K1Kr   r-   )r   r   s     r   r  zfncachestore.copylist  s+    
 -.1K1K1K1K1KKKr   c                 :    | j                             |           d S r   )r*  r  r  s     r   r  zfncachestore.write+  s    2r   c                 N    d | j         _        t                      | j         _        d S r   )r*  r,  r.  r/  r   s    r   r  zfncachestore.invalidatecaches.  s     # UUr   c                 :    | j                             |           d S r   )r*  rR  r
  s     r   r  zfncachestore.markremoved2  s    Br   c                 ~    |                      |          }	 |                     |           dS # t          $ r Y dS w xY w)NTF)rZ  rl  ro  )r   r   r   s      r   _existszfncachestore._exists5  sO    [[^^	LL4  	 	 	55	s   . 
<<c                     d                     d|f          }|dz   }|| j        v r|                     |          rdS |                    d          s|dz  }| j        D ]/}|                    |          r|                     |          r dS 0dS )r  r   r   r   TF)rM   r*  rv  r   r   )r   r   rV   s      r   r  zfncachestore.__contains__=  s    yy'4))5La4}}T"" 	DLD 	 	A||D!! dll1oo ttur   r  )r  r  r  r   rM   rl  r   r  r  r  r  rv  r  r-   r   r   rg  rg    s          "- - -. . .   L L L$  # # #           r   rg  )Jr;  r   rer   i18nr   r   r   noder    r   r   r	   r
   r   r   r   utilsr   	importmodr   r>  r   r(   r)   r   r8   r\   r^   rb   r`   rc   rj   ri   ru   rv   rz   r   r   r   r   r   r   r   r   r   r   r   r   compileEXCLUDEDr   r   r   r   r   FILEFLAGS_OTHERr   FILEFLAGS_REVLOG_OTHERr   FILETYPE_CHANGELOG_MAINFILETYPE_CHANGELOG_OTHERFILETYPE_MANIFESTLOG_MAINFILETYPE_MANIFESTLOG_OTHERFILETYPE_FILELOG_MAINr   r   r   r  r*  rY  rW  rg  r-   r   r   <module>r     s,       				 				                                          
&
9
%
%  B B B&  $ GG[*55	  $  $7 7 7t -_.. l& & && & &  2 gg}d33M7K7K7M7M ,- - -`  )*Q.   @$ $ $N   gg|[99# # #	 	 		 	 	 2   , 
 2:011             -0EE .1GG 14II 25KK ),AA *-CC  j% j% j% j% j% j% j% j%Z"P "P "P "P "P: "P "P "PJu/ u/ u/ u/ u/ u/ u/ u/p #  #  #  #  #&/  #  #  #FV V V V V: V V V V Vr   