
    6hz                    x   S SK Jr  S SKrS SKJrJrJr  SSKJr  SSK	J
r
JrJrJrJrJrJr  SSKJrJr  \(       a  SSK	Jr  \R.                  " S	5      r\R2                  " S
SS9r\R6                  r\c  \R8                  rO\R8                  rSrS rSrSr Sr! " S S5      r" " S S\"5      r#\b   " S S\"5      r#gg)    )annotationsN)OptionalTYPE_CHECKINGTuple   )_)errorpathutilpolicytestingtxnutiltypelibutil)docketv2)uiparsersdirstateT)pyo3i      c                  :   \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'   S	\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   SrSr          S(S jrS)S jr	S*S jr
S+S jrS,S jrS rS rS rS rS  r S-   S.S! jjr\S/S" j5       rS# rS$ rS% rS,S& jrS'rg)0_dirstatemapcommon:   zy
Methods that are identical for both implementations of the dirstatemap
class, with and without Rust extensions enabled.
bool_use_dirstate_v2typelib.NodeConstants_nodeconstantsuimod.ui_uibytes_root	_filenameint_nodelen_dirtyparentsz"Optional[docketmod.DirstateDocket]_docket_write_modezOptional[bool]_pendingmodeOptional[typelib.CacheStat]identityNc                :   XPl         X@l        Xl        X l        X0l        SU l        SU l        S U l        SU l        S U l	        UR                  SS5      nUS:X  a  [        U l        O/US:X  a  [        U l        OUS:X  a  [        U l        O[        U l        S U l        g )	Ns   dirstate   Fs   devels   dirstate.v2.data_update_modes   autos   force-appends	   force-new)r   r   r    _openerr"   r#   r%   _parentsr&   r'   configWRITE_MODE_AUTOr(   WRITE_MODE_FORCE_APPENDWRITE_MODE_FORCE_NEWr)   )selfr   openerrootnodeconstantsuse_dirstate_v2
write_modes          7/usr/lib/python3/dist-packages/mercurial/dirstatemap.py__init___dirstatemapcommon.__init__Q   s     !0+
$"YYx)HI
 .D?*6D<'3D  /D !    c                   U R                   R                  U R                  5      nUR                  S5      (       d  UR                  S5      (       a  [        R
                  " 5       $  [        R                  " U5      $ ! [         a     g f = f)Ns   https://s   http://)r.   joinr#   
startswithr   uncacheable_cachestat	cachestatFileNotFoundError)r4   paths     r:   _get_current_identity(_dirstatemapcommon._get_current_identityq   sl    ||  0??;''4??:+F+F--//	>>$''  		s   (A> >
B
Bc                    S[        U 5      ;  a  gU R                  c  gU R                  R                  5       (       d  gU R                  5       nUc  gUR                  5       (       d  gXR                  :g  $ )Nr+   T)varsr+   	cacheablerE   )r4   current_identitys     r:   may_need_refresh#_dirstatemapcommon.may_need_refresh{   so    T$Z'== }}&&(( 557#))++ ==00r=   c                    U R                     g)z5Loads the underlying data, if it's not already loadedN_mapr4   s    r:   preload_dirstatemapcommon.preload   s	    		r=   c                8    U R                   R                  X5      $ N)rO   get)r4   keydefaults      r:   rU   _dirstatemapcommon.get   s    yy}}S**r=   c                ,    [        U R                  5      $ rT   )lenrO   rP   s    r:   __len___dirstatemapcommon.__len__   s    499~r=   c                ,    [        U R                  5      $ rT   iterrO   rP   s    r:   __iter___dirstatemapcommon.__iter__   s    DIIr=   c                    XR                   ;   $ rT   rN   )r4   rV   s     r:   __contains___dirstatemapcommon.__contains__   s    iir=   c                     U R                   U   $ rT   rN   )r4   items     r:   __getitem___dirstatemapcommon.__getitem__   s    yyr=   c                   [         R                  " U R                  U R                  U R                  5      u  pU R
                  b?  U R
                  U:w  a/  UR                  5         [        R                  " [        S5      5      eX l        U$ )Ns1   working directory state may be changed parallelly)
r   
trypendingr"   r.   r#   r)   closer	   Abortr   )r4   fpmodes      r:   _opendirstatefile$_dirstatemapcommon._opendirstatefile   sm    %%djj$,,O(T->->$-FHHJ++FG  !	r=   c                J   U R                  5       n[        R                  " U R                  S5         U R	                  5        nUR                  U5      nSSS5        [        R                  " U R                  S5        UW4$ ! , (       d  f       N3= f! [         a    Sn NDf = f)zread the content of the file used as "entry point" for the dirstate

Return a (identity, data) tuple. The identity can be used for cache
validation and concurrent changes detection and must be set as
`self.identity` if `data` is preserved.
s   dirstate.pre-read-fileNr=   s   dirstate.post-docket-read-file)rE   r   wait_on_cfgr    ro   readrC   )r4   sizer+   rm   datas        r:   _readdirstatefile$_dirstatemapcommon._readdirstatefile   s     --/ 	DHH&?@	'')Rwwt} *
 	DHH&GH~ *)  	D	s/   B BB 
BB B B"!B"c                   U R                   (       d  U R                  (       d  [        R                  " S5      eU R	                  5       u  U l        nUS:X  d$  UR                  [        R                  5      (       a:  [        R                  R                  XR                  5      U l         U R                   $ [        R                  " S5      eU R                   $ )Ns'   dirstate only has a docket in v2 formatr=   s   dirstate is not in v2 format)r'   r   r	   ProgrammingErrorrv   r+   r@   	docketmodV2_FORMAT_MARKERDirstateDocketparser   CorruptedDirstate)r4   ru   s     r:   r   _dirstatemapcommon.docket   s    ||((,,>  #'"8"8":DM4s{dooi.H.HII(77==-- 
 || --.MNN||r=   c                   S nSnU[         :  aE  US-  n U R                  R                  U R                  R	                  5       5      nU[         :  a  ME  Uc(  U[         :  d   eSnX2-  n[        R                  " U5      eU R                  R                  U R                  R	                  5       5      $ ! [
         a
    S U l         N}f = f)Nr   r   s-   dirstate read race happened %d times in a row)	V2_MAX_READ_ATTEMPTSr.   rs   r   data_filenamerC   r'   r	   rl   )r4   ru   attemptsmsgs       r:   _read_v2_data _dirstatemapcommon._read_v2_data   s    --MH$||(()B)B)DE	 -- <3333BCOC++c""||  !:!:!<== % $  $$s   3B2 2CCc                  ^ ^	  T R                   n[        R                  R                  T R                  5       [        U5      U5      nUb0  UR                  UR                  :X  a  [        R                  " S5      eUR                  5       m	T R                  R                  T	U5        Ub  UR                  T	SS9  UR                  UR                  5       5        UR                  5         Ubl  UR                  (       a[  UR                  5       m	Ub  UR                  T	SS9  SU	U 4S jjnU(       a!  SUR                  -   nUR!                  X5        OU" 5         UT l        g ! [        R                   a    S n GNif = f)Ns   dirstate docket name collision   plainlocationc                :   > TR                   R                  T5      $ rT   )r.   unlink)_trr   r4   s    r:   <lambda>7_dirstatemapcommon.write_v2_no_append.<locals>.<lambda>  s    dll&9&9-&Hr=   s   dirstate-v2-clean-rT   )r   r	   r~   rz   r|   with_new_uuidparentsrZ   uuidry   r   r.   write	addbackup	serializerk   addpostcloser'   )
r4   trstmetapacked
old_docket
new_docketr   categoryr   s
   `        @r:   write_v2_no_append%_dirstatemapcommon.write_v2_no_append   s8   	J --;;LLNCK

 !joo&H(()JKK"002=&1>LLL: 	%%'(

 !joo&446M~]X>HF0:??B1!M && 		 J		s   E   E:9E:c                `   U R                   (       dU  U R                  (       a4   U R                    U R                  R                  U l         U R                   $ U R                  5         U R                   $ ! [        R
                   a&  nU R                  U5         S nAU R                   $ S nAff = frT   )r/   r   r   r   r	   r~   _v1_parents)r4   es     r:   r   _dirstatemapcommon.parents  s    }}$$8KK
 %)KK$7$7DM }}   "}} .. ($$Q'' }}(s   A3 3B-B((B-c                   U R                   S-  nU R                  U5      u  p4[        U5      nXR:X  a0  US U R                    X@R                   SU R                   -   4U l        g US:X  a2  U R                  R
                  U R                  R
                  4U l        g S nUb  [        S5      n[        R                  " [        S5      U5      e)Nr   r   s/   falling back to dirstate-v1 from v2 also faileds(   working directory state appears damaged!)	r%   rv   rZ   r/   r   nullidr   r	   rl   )r4   from_v2_exceptionread_len	_identityr   lhints          r:   r   _dirstatemapcommon._v1_parents+  s    ==1$..x8	G=?T]]#==1t}}#45DM !V##**##**DM
 D ,KL++=> r=   )r&   r'   r#   r   r%   r.   r/   r)   r"   r    r   r(   r+   )
r   r   r6   r!   r7   r   r8   r   returnNoner   r*   )r   r   )r   r   rT   ))rt   r$   r   z)Tuple[Optional[typelib.CacheStat], bytes])r   zdocketmod.DirstateDocket)__name__
__module____qualname____firstlineno____doc____annotations__rO   copymapr;   rE   rK   rQ   rU   r[   r`   rc   rg   ro   rv   propertyr   r   r   r   r   __static_attributes__ r=   r:   r   r   :   s    
 ))	MLM//  )) DG!! 	!
 -! ! 
!@1&+ 
  
3>  >&)"Zr=   r   c                     \ rS rSrSr\S 5       r\S 5       rS rS r	\	r
S rS rSS	 jrS
 rS r\SS j5       rS S jrS!S jr\S 5       r\S 5       rS rS r\S 5       r\S 5       r     S"S jrS rS rS rS rS rS rSr g)#dirstatemapiB  a\  Map encapsulating the dirstate's contents.

The dirstate contains the following state:

- `identity` is the identity of the dirstate file, which can be used to
  detect when changes have occurred to the dirstate file.

- `parents` is a pair containing the parents of the working copy. The
  parents are updated by calling `setparents`.

- the state map maps filenames to tuples of (state, mode, size, mtime),
  where state is a single character representing 'normal', 'added',
  'removed', or 'merged'. It is read by treating the dirstate as a
  dict.  File state is updated by calling various methods (see each
  documentation for details):

  - `reset_state`,
  - `set_tracked`
  - `set_untracked`
  - `set_clean`
  - `set_possibly_dirty`

- `copymap` maps destination filenames to their source filename.

The dirstate also provides the following views onto the state:

- `filefoldmap` is a dict mapping normalized filenames to the denormalized
  form that they appear as in the dirstate.

- `dirfoldmap` is a dict mapping normalized directory names to the
  denormalized form that they appear as in the dirstate.
c                H    0 U l         U R                  5         U R                   $ rT   )rO   rs   rP   s    r:   rO   dirstatemap._mapf  s    			yyr=   c                @    0 U l         U R                    U R                   $ rT   )r   rO   rP   s    r:   r   dirstatemap.copymapl  s    		||r=   c                   U R                   R                  5         U R                  R                  5         U R                  U R                  R
                  U R                  R
                  5        [        R                  " U S5        [        R                  " U S5        [        R                  " U S5        [        R                  " U S5        g )N   _dirs   _alldirss   filefoldmap
   dirfoldmap)rO   clearr   
setparentsr   r   r   clearcachedpropertyrP   s    r:   r   dirstatemap.clearr  s    		++22D4G4G4N4NO  x0  {3  ~6  }5r=   c                6    U R                   R                  5       $ rT   rO   itemsrP   s    r:   r   dirstatemap.items{  s    yy  r=   c              #     #    U R                  5        H5  u  p#X#R                  UR                  UR                  UR                  4v   M7     g7f)zm
Return an iterator of (filename, state, mode, size, mtime) tuples

`all` is unused when Rust is not enabled
N)r   statern   rt   mtime)r4   allfilenamerf   s       r:   
debug_iterdirstatemap.debug_iter  s8      #jjlNHZZDIItzzJJ +s   AAc                6    U R                   R                  5       $ rT   )rO   keysrP   s    r:   r   dirstatemap.keys  s    yy~~r=   c                   X4U l         SU l        0 nU(       am  U R                  R                  5        HO  u  pVUR                  (       d  M  U R
                  R                  US 5      nU(       a  XtU'   UR                  5         MQ     U$ NT)r/   r&   rO   r   p2_infor   popdrop_merge_data)r4   p1p2fold_p2copiesfssources           r:   r   dirstatemap.setparents  sn    !		)999!\\--a6F$*q	%%' * r=   c                   U R                   (       a:   U R                    U R                  R                  (       d  g U R                  5       nOU R                  5       u  U l        nU(       d  g [        [        S5      (       a&  [        R                  [        U5      S-  5      U l        U R                   (       a|   U R                    U R                  R                  nU R                  R                  n[        R                   " ["        R$                  5      nU" U R                  U R&                  X5        OB[        R                   " [        R$                  5      nU" U R                  U R&                  U5      nU R(                  (       d  U R*                  " U6   U R                  R,                  U l        U R                  R.                  U l        U R                  R0                  U l        g ! [        R
                   a    U R                  5       u  U l        n GNf = f! [        R
                   aE    [        R                   " [        R$                  5      nU" U R                  U R&                  U5      n Nf = f)Ndict_new_presizedG   )r   r   r   r   r	   r~   rv   r+   hasattrr   r   rZ   rO   r   tree_metadatar   nogcr   parse_dirstater   r&   r   rc   rg   rU   )r4   r   pr   r   s        r:   rs   dirstatemap.read  s     *
 {{'''') $ 6 6 8DM2 7/00  11#b'R-@DI   
B KK''{{00!%2+<+<!=tyy$,,A!YYw'='=>Ntyy$,,;A!!OOQ !II22990099==q ** =$($:$:$<!r=L ** @!%7+A+A!B"499dllB?@s$   G( 9H (,HHAI43I4c                h   U R                   (       a@  [        R                  " U R                  U R                  5      u  p4U R                  XXC5        OZ[        R                  U R                  U R                  U R                  5       5      nUR                  U5        UR                  5         SU l
        g NF)r   r   pack_dirstaterO   r   r   r   r   r   rk   r&   )r4   r   r   r   r   s        r:   r   dirstatemap.write  s{      ++DIIt||DLF##BD9**		4<<F HHVHHJ"r=   c                2    U R                     U R                  $ )a  A cache identifier for the state of the file as data were read

This must always be set with the object returned from
`self._readdirstatefile()`. assigning another value later will break
some security mechanism and can lead to misbehavior when concurrent
operation are run.
rO   r+   rP   s    r:   r+   dirstatemap.identity  s     			}}r=   Nc                    Ub  UR                   (       a+  SU R                  ;   a  U R                  R                  U5        Uc-  SU R                  ;   a  U R                  R                  U5        ggg)z,increment the dirstate counter if applicableN_dirs_alldirs)removed__dict__r   addpathr   )r4   r   	old_entrys      r:   
_dirs_incrdirstatemap._dirs_incr  s[     !2!2&JJx(t}}!<MM!!(+ "=r=   c                   Ubo  SU R                   ;   a,  UR                  (       d  U R                  R                  U5        SU R                   ;   a"  U(       d  U R                  R                  U5        O2U(       a+  SU R                   ;   a  U R                  R                  U5        SU R                   ;   a3  [        R                  " U5      nU R                  R                  US5        gg)z,decrement the dirstate counter if applicableNr   r   filefoldmap)
r   r   r   delpathr   r   r   normcaser   r   )r4   r   r   remove_variantnormeds        r:   
_dirs_decrdirstatemap._dirs_decr  s     $--'	0A0A

""8,T]]*>%%h/
dmm ;MM!!(+DMM)]]8,F  . *r=   c                V    [         R                  nU" U R                  [        R                  [        R
                  5      $ ! [         a     Of = f0 n[        R                  nU R                  R                  5        H"  u  pEUR                  (       a  M  XBU" U5      '   M$     SUS'   U$ )UReturns a dictionary mapping normalized case paths to their
non-normalized versions.
   .)
r   make_file_foldmaprO   r   normcasespecnormcasefallbackAttributeErrorr   r   r   )r4   makefilefoldmapr   r   namer   s         r:   r   dirstatemap.filefoldmap  s    
	%77O #		4,,d.C.C   		 ==yy(GD999$((4.! ) $s   A 
AAc                d    0 n[         R                  nU R                   H  nX1U" U5      '   M     U$ rT   )r   r   r   r4   r   r   r  s       r:   
dirfoldmapdirstatemap.dirfoldmap$  s/    ==JJD $htn r=   c                    XR                   ;   $ )zW
Returns True if the dirstate contains a tracked (not removed) file
in this directory.
)r   r4   ds     r:   hastrackeddirdirstatemap.hastrackeddir,  s    
 JJr=   c                    XR                   ;   $ )zV
Returns True if the dirstate contains a file (tracked or removed)
in this directory.
)r   r  s     r:   hasdirdirstatemap.hasdir3  s    
 MM!!r=   c                @    [         R                  " U R                  SS9$ )NT)only_trackedr
   dirsrO   rP   s    r:   r   dirstatemap._dirs:  s    }}TYYT::r=   c                B    [         R                  " U R                  5      $ rT   r  rP   s    r:   r   dirstatemap._alldirs>  s    }}TYY''r=   c                l   U R                   R                  US5        U(       dJ  U(       dC  U(       d<  U R                  R                  U5      nU R	                  U5        U R                  XS9  gU R                  R                  U5      nU R                  X5        [        UUUUUS9nXR                  U'   g)a8  Set a entry to a given state, diregarding all previous state

This is to be used by the part of the dirstate API dedicated to
adjusting the dirstate after a update/merge.

note: calling this might result to no entry existing at all if the
dirstate map does not see any point at having one for this file
anymore.
N)r   )
wc_tracked
p1_trackedr   has_meaningful_mtimeparentfiledata)r   r   rO   rU   _drop_entryr  r   DirstateItem)	r4   r   r"  r#  r   r$  r%  r   entrys	            r:   reset_statedirstatemap.reset_stateD  s    ( 	4(g		h/IX&OOHO:IIMM(+	,!!!5)
 $		(r=   c                Z   SnU R                  U5      nUc,  U R                  U5        [        SS9nX0R                  U'   SnU$ UR                  (       d6  U R                  X5        UR                  5         U R                  X5        SnU$ UR                  5         U R                  X5        U$ )NFT)r"  )rU   r   r'  rO   trackedset_tracked_refresh_entryset_possibly_dirty)r4   r   newr(  s       r:   r-  dirstatemap.set_trackedk  s    "=OOH% E #(IIhC 
 OOH,0C 
 $$&0
r=   c                   U R                  U5      nUc  gU R                  XUR                  (       + S9  UR                  (       d  U R                  R                  US5        UR                  5         U R                  X5        g)z4Mark a file as no longer tracked in the dirstate mapNF)r   r   T)rU   r  addedr   r   r   set_untrackedr.  r4   r   r(  s      r:   r4  dirstatemap.set_untracked  se    =OOA5;;OO==  D)!)r=   c                    X   nU[         -  nUR                  X#U5        U R                  X5        U R                  R	                  US5        g)z$mark a file as back to a clean stateN)	rangemask	set_cleanr.  r   r   )r4   r   rn   rt   r   r(  s         r:   r9  dirstatemap.set_clean  sC    iE*H,4(r=   c                N    X   nUR                  5         U R                  X5        g)z<record that the current state of the file on disk is unknownN)r/  r.  )r4   r   r(  s      r:   r/  dirstatemap.set_possibly_dirty  s#      "H,r=   c                `    UR                   (       d  U R                  R                  US5        gg)z record updated state of an entryN)any_trackedrO   r   r5  s      r:   r.  dirstatemap._refresh_entry  s"      IIMM!T" !r=   c                t    U R                   R                  US5        U R                  R                  US5        g)zremove any entry for file f

This should also drop associated copy information

The fact we actually need to drop it is the responsability of the caller
N)rO   r   r   r4   r   s     r:   r&  dirstatemap._drop_entry  s*     			aD!r=   )rc   rg   r&   rO   r/   r   rU   r+   Fr   rT   r   FFFTN)!r   r   r   r   r   propertycacherO   r   r   r   	iteritemsr   r   r   rs   r   r+   r   r  r   r  r  r  r   r   r)  r-  r4  r9  r/  r.  r&  r   r   r=   r:   r   r   B  s	   F  
  
6! IK 
 <!|
# 	 	,/  *  " ; ; ( ( !%$N0)-#
"r=   r   c                      \ rS rSr\S 5       rS rSS jr\S 5       r	S r
S rS	 r\rS
 rSS jr\S 5       rS r\S 5       rS rS r\S 5       rS rS rS rS r     SS jrSrg)r   i  c                   U R                   (       a   U R                    U R                  R                  nU R                  5       nU R                  R                  (       d&  Sn[
        R                  R                  5       U l        OtU R                  5       n[
        R                  R                  UU R                  R                  U R                  R                  U R                  R                  U5      U l        U R                  R                  nOU R                  5       nU(       a   U R                   (       d  U R"                  " U6   U R                  R$                  U l        U R                  R&                  U l        U R                  R(                  U l        U R                  $ ! [        R                   a  nU R                  U5      n SnANSnAff = f)z$
Fills the Dirstatemap when called.
r=   N)r   r   r   _get_rust_identityr   rustmodDirstateMap	new_emptyrO   r   new_v2	data_sizer   r	   r~   _v1_mapr&   r   rc   rg   rU   )r4   r   r+   ru   r   s        r:   rO   r     sH    $$2KK
 #kk11G#668H;;++"$+$7$7$A$A$C	#113$+$7$7$>$>  KK11 KK55 KK,,$%	 #kk11G,,.t11) $		 6 6D#yy44Dyy}}DH999 .. ."ll1oG.s   F% %G9GGc                   S nU R                   b  U R                   R                  b  U R                   R                  n[        R                  UR                  UR
                  UR                  UR                  UR                  UR                  UR                  U[        R                     SU[        R                     SS9nU$ )Nr   )rn   devinonlinkuidgidrt   r   
mtime_nsecctime
ctime_nsec)r+   statrJ  DirstateIdentityst_modest_devst_inost_nlinkst_uidst_gidst_sizeST_MTIMEST_CTIME)r4   r+   	stat_infos      r:   rI  dirstatemap._get_rust_identity  s    H}}(T]]-?-?-K MM..	"33"**!((!((#,,!((!(("**#DMM2 #DMM2  4  Or=   Nc                     U R                  5       u  U l        nU R                  5       n[        R                  R                  X#5      u  U l        nU$ ! [         a  nUb  XQee S nAff = frT   )rv   r+   rI  rJ  rK  new_v1rO   OSError)r4   r   ru   r+   r   r   s         r:   rO  dirstatemap._v1_map  so    &*&<&<&>#t224%,%8%8%?%?%O"	7
 N	  $02s   AA 
A(A##A(c                6    U R                   R                  5       $ rT   )rO   r   rP   s    r:   r   r     s    99$$&&r=   c                8    U R                   R                  U5      $ )z
Return an iterator of (filename, state, mode, size, mtime) tuples

`all`: also include with `state == b' '` dirstate tree nodes that
don't have an associated `DirstateItem`.

)rO   r   )r4   r   s     r:   r   r     s     99'',,r=   c                6   U R                   R                  5         U R                  U R                  R                  U R                  R                  5        [
        R                  " U S5        [
        R                  " U S5        [
        R                  " U S5        g )Nr   r   r   )rO   r   r   r   r   r   r   rP   s    r:   r   r     sk    IIOOOO##**D,?,?,F,F $$T84$$T;7$$T=9r=   c                6    U R                   R                  5       $ rT   r   rP   s    r:   r   r     s    99??$$r=   c                ,    [        U R                  5      $ rT   r^   rP   s    r:   r   r     s    		?"r=   c                j    X4U l         SU l        0 nU(       a  U R                  R                  5       nU$ r   )r/   r&   rO   setparents_fixup)r4   r   r   r   r   s        r:   r   r     s2    HDM!%DF335Mr=   c                2    U R                     U R                  $ rT   r   rP   s    r:   r+   r   %  s    II== r=   c                ~   U R                   (       dV  U R                  5       u  p4U R                  R                  X45      nUR	                  U5        UR                  5         SU l        g U R                  n U R                  nUb  UR                  c  [        nU R                  R                  U5      u  pXn	U	(       Ga#  U R                  nUR                  5       n
Ub  UR                  U
SS9  U R!                  U
S5       nUR#                  UR$                  5        UR'                  5       UR$                  :X  d   eUR	                  U5      nUb!  U[)        U5      :X  d   U[)        U5      45       eS S S 5        U=R$                  [)        U5      -  sl        U R                  5       Ul        Xl        UR	                  UR-                  5       5        UR                  5         OU R/                  XX5        [0        R2                  " U S5        SU l        g ! [        R                   a    S n GNf = f! , (       d  f       N= f)NFr   r   s   r+bs   _map)r   r   rO   write_v1r   rk   r&   r(   r   r	   r~   r   r3   write_v2r   r   r.   seekrN  tellrZ   r   r   r   r   r   )r4   r   r   r   r   r   r9   r   r   appendr   rm   writtens                r:   r   r   *  s   ((++B3 
%*"))J ~!41
#'99#5#5j#A F& & 4 4 6 >LLLB\\-8BGGF,,-779(8(8888 hhv.G*&#f+5MV7MM5 9   CK/ !%'+$))+,
''=$$T73!&DE ** & 98s   5H >A1H.H+*H+.
H<c                6    U R                   R                  5       $ )r  )rO   filefoldmapasdictrP   s    r:   r   r  ]  s    
 99..00r=   c                8    U R                   R                  U5      $ rT   )rO   r  r  s     r:   r  r  d      99**1--r=   c                8    U R                   R                  U5      $ rT   )rO   r  r  s     r:   r  r  g  s    99##A&&r=   c                    0 n[         R                  nU R                  R                  5        H  nX1U" U5      '   M     U$ rT   )r   r   rO   tracked_dirsr  s       r:   r  r  j  s8    A}}H		..0$((4.! 1Hr=   c                8    U R                   R                  U5      $ rT   )rO   r-  rA  s     r:   r-  r1  t  s    99((++r=   c                8    U R                   R                  U5      $ rT   )rO   r4  rA  s     r:   r4  r6  w  r|  r=   c                <    U R                   R                  XX45        g rT   )rO   r9  )r4   r   rn   rt   r   s        r:   r9  r:  z  s    II<r=   c                :    U R                   R                  U5        g rT   )rO   r/  rA  s     r:   r/  r<  }  s    II((+r=   c                B    U R                   R                  UUUUUU5      $ rT   )rO   r)  )r4   r   r"  r#  r   r$  r%  s          r:   r)  r*    s-     99(($ r=   )rc   rg   r&   rO   r/   rU   r+   rT   rC  rD  )r   r   r   r   rE  rO   rI  rO  r   r   r   r   r   rF  r   r   r+   r   r   r  r  r  r-  r4  r9  r/  r)  r   r   r=   r:   r   r     s     
%	 
%	N	&		 
	' 
	'	-	:	% 		#
	 
	! 
	!.	'f 
	1 
	1	.	' 
	 
		,	.	=	, !%	r=   )$
__future__r   rY  typingr   r   r   i18nr    r	   r
   r   r   r   r   r   dirstateutilsr   rz   r   r   uimod	importmodr   
importrustrJ  rE  r'  r8  r1   r3   r2   r   r   r   r   r=   r:   <module>r     s    #     
  

9
%


JT
2""
?''L''L	    E EPi"$ i"X `( ` r=   