
    6h[I                      S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	r	S SK
Jr  S SKJrJr  SSKJr  SSKJrJrJrJrJr  SSKJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r(J)r*J+r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r8J9r9J:r:J;r;J<r<J=r=J>r?J@r@JArBJCrCJDrDJErEJFrGJHrH  SS	KIJJrK  SS
KLJMrM  SSKNJOrO  SSKPJQrQJRrRJSrSJTrT  SSKUJVrWJXrYJZr[  \(R                  r\\ER                  r]\ER                  r^\R                  " S5      r`\a" 5       rb " S S\<R                  5      rd " S S\d5      re " S S\d5      rf " S S\f5      rg " S S\f5      rh " S S\d5      riS rj " S S\ER                  5      rl " S S\ER                  5      rmS  rnS! ro1 S"krp\pR                  S#15      rr " S$ S%\OR                  5      rt " S& S'\OR                  \OR                  5      rw " S( S)\w\OR                  5      ry\a" 5       rzS* r{SHSIS+ jjr| SH     SJS, jjr}S- r~S. rS/ rS0 rS1 rS2 rS3 rS4 r " S5 S6\OGR                  5      r " S7 S8\OGR                  5      rS9 r\OGR                  S: 4\OGR                  S; 4/r\r\GR                  (       a  \OGR                  \OGR                  /r " S< S=\5      rSKS> jrSLSIS? jjrSMS@ jrSHSA jrSB rSC rSD rSE rSLSISF jjrSG rg)N    )annotationsN)futures)OptionalSet   )_)binhexnullrevsha1nodeconstantsshort)+	bookmarks	branchmapbundle2bundlecacheschangegroupcolorcommitcontextdirstate	discoveryencodingerrorexchange
extensionsfileloghooklockmatch
mergestate	mergeutil
namespaces
narrowspecobsoletepathutilphasespolicypushkeypycompatrepoviewrequirementsrevlogrevset
revsetlangscmutilsparsestoresubrepoutiltagstransactiontxnutilutilvfswireprototypes)	rev_cache)rcutil)
repository)hashutilprocutil
stringutilurlutil)concurrency_checker	constantssidedatas+   ^((dirstate|narrowspec.dirstate).*|branch$)c                  <   ^  \ rS rSrSrSU 4S jjrU 4S jrSrU =r$ )_basefilecacher   zHAll filecache usage on repo are done for logic that should be unfilteredc                   > Uc  U $ UR                  5       n UR                  U R                     $ ! [         a     Of = f[        TU ]  X25      $ N)
unfiltered__dict__snameKeyErrorsuper__get__selfrepotypeunfi	__class__s       5/usr/lib/python3/dist-packages/mercurial/localrepo.pyrM   _basefilecache.__get__u   sR    <K 	==,, 		wt**s   1 
>>c                @   > [         TU ]  UR                  5       U5      $ rG   )rL   setrH   )rO   rP   valuerS   s      rT   rW   _basefilecache.set   s    w{4??,e44     rG   )	__name__
__module____qualname____firstlineno____doc__rM   rW   __static_attributes____classcell__rS   s   @rT   rD   rD   r   s    R	+5 5rZ   rD   c                  2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )repofilecache   z3filecache for files in .hg but outside of .hg/storec                `   > [         TU ]  " U6   U H  n[        R                  US45        M     g )N   plainrL   __init___cachedfilesaddrO   pathspathrS   s      rT   rj   repofilecache.__init__   s-    % DdH-. rZ   c                8    UR                   R                  U5      $ rG   )r7   joinrO   objfnames      rT   rr   repofilecache.join   s    ww||E""rZ   r[   	r\   r]   r^   r_   r`   rj   rr   ra   rb   rc   s   @rT   re   re      s    =/
# #rZ   re   c                  2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )
storecache   z filecache for files in the storec                `   > [         TU ]  " U6   U H  n[        R                  US45        M     g )NrZ   ri   rm   s      rT   rj   storecache.__init__   s,    % DdC[) rZ   c                $    UR                  U5      $ rG   )sjoinrs   s      rT   rr   storecache.join   s    yyrZ   r[   rw   rc   s   @rT   ry   ry      s    **
   rZ   ry   c                  2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )changelogcache   zfilecache for the changelogc                v   > [         TU ]  5         [        R                  S5        [        R                  S5        g )N   00changelog.irZ   )   00changelog.nrZ   ri   rO   rS   s    rT   rj   changelogcache.__init__   s,    0101rZ   c                    U R                  US5      /nUR                  R                  R                  R	                  SS5      (       a!  UR                  U R                  US5      5        U$ )Nr      persistent-nodemapFr   rr   r1   openeroptionsgetappendrO   rt   rn   s      rT   tracked_pathschangelogcache.tracked_paths   sW    3 01299##''(=uEELL3(89:rZ   r[   	r\   r]   r^   r_   r`   rj   r   ra   rb   rc   s   @rT   r   r      s    %2
 rZ   r   c                  2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )manifestlogcache   zfilecache for the manifestlogc                v   > [         TU ]  5         [        R                  S5        [        R                  S5        g )N)   00manifest.irZ   )   00manifest.nrZ   ri   r   s    rT   rj   manifestlogcache.__init__   s,    /0/0rZ   c                    U R                  US5      /nUR                  R                  R                  R	                  SS5      (       a!  UR                  U R                  US5      5        U$ )Nr   r   Fr   r   r   s      rT   r   manifestlogcache.tracked_paths   sU    30199##''(=uEELL389rZ   r[   r   rc   s   @rT   r   r      s    '1
 rZ   r   c                  2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )mixedrepostorecache   z2filecache for a mix files in .hg/store and outsidec                J   > [         TU ]  " U6   [        R                  U5        g rG   )rL   rj   rk   update)rO   pathsandlocationsrS   s     rT   rj   mixedrepostorecache.__init__   s"     	+,-.rZ   c                    Uu  p4US:X  a  UR                   R                  U5      $ US:w  a  [        R                  " SU-  5      eUR	                  U5      $ )Nrh   rZ   s   unexpected location: %s)r7   rr   r   ProgrammingErrorr~   )rO   rt   fnameandlocationru   locations        rT   rr   mixedrepostorecache.join   sW    *x77<<&&3,,.9  99U##rZ   r[   rw   rc   s   @rT   r   r      s    </	$ 	$rZ   r   c                    U R                  5       R                  R                  US5      nU(       d  gUR                  S4$ )zscheck if a repo has already cached "name" filecache-ed property

This returns (cachedobj-or-None, iscached) tuple.
NNFT)rH   
_filecacher   rt   )rP   name
cacheentrys      rT   isfilecachedr      s8    
 "--11$=J>>4rZ   c                  0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )unfilteredpropertycache   z0propertycache that apply to unfiltered repo onlyc                t   > UR                  5       nX1L a  [        TU ]	  U5      $ [        X0R                  5      $ rG   )rH   rL   rM   getattrr   rN   s       rT   rM   unfilteredpropertycache.__get__   s2     <7?4((tYY''rZ   r[   rG   )r\   r]   r^   r_   r`   rM   ra   rb   rc   s   @rT   r   r      s    :( (rZ   r   c                      \ rS rSrSrS rSrg)filteredpropertycache   z1propertycache that must take filtering in accountc                D    [         R                  XR                  U5        g rG   )object__setattr__r   )rO   rt   rX   s      rT   
cachevalue filteredpropertycache.cachevalue   s    3		51rZ   r[   N)r\   r]   r^   r_   r`   r   ra   r[   rZ   rT   r   r      s
    ;2rZ   r   c                :    U[        U R                  5       5      ;   $ )z?check if a repo has an unfilteredpropertycache value for <name>)varsrH   )rP   r   s     rT   hasunfilteredcacher      s    4)***rZ   c                F   ^  [         R                  " T 5      U 4S j5       nU$ )z@decorate method that always need to be run on unfiltered versionc                8   > T" U R                  5       /UQ70 UD6$ rG   )rH   )rP   argskwargsorigs      rT   wrapper!unfilteredmethod.<locals>.wrapper   s    DOO%7777rZ   )	functoolswraps)r   r   s   ` rT   unfilteredmethodr      s'     __T8 8 NrZ   >      known   lookup   pushkey   unbundle	   branchmap	   getbundles   changegroupsubsetc                  8    \ rS rSrS rS rS rS rS rS r	Sr
g	)
localcommandexecutori  c                ,    Xl         SU l        SU l        g r   )_peer_sent_closed)rO   peers     rT   rj   localcommandexecutor.__init__  s    

rZ   c                    U $ rG   r[   rO   s    rT   	__enter__localcommandexecutor.__enter__      rZ   c                $    U R                  5         g rG   )close)rO   exctypeexcvalueexctbs       rT   __exit__localcommandexecutor.__exit__  s    

rZ   c                   U R                   (       a  [        R                  " S5      eU R                  (       a  [        R                  " S5      e[	        U R
                  [        R                  " U5      5      n[        R                  " 5       n U" S0 [        R                  " U5      D6nUR                  U5        U$ ! [         a1    [        R                  " U[        R                  " 5       SS  5         U$ f = f)Ns1   callcommand() cannot be used after sendcommands()s*   callcommand() cannot be used after close()r   r[   )r   r   r   r   r   r   r)   sysstrr   Future	strkwargs
set_result	Exceptionfuture_set_exception_infosysexc_info)rO   commandr   fnfresults         rT   callcommand localcommandexecutor.callcommand  s    ::((D  <<((=  TZZ!9:NN	!3(,,T23F LL   	F..q#,,.2DE 	Fs   B> >7C98C9c                    SU l         g NT)r   r   s    rT   sendcommands!localcommandexecutor.sendcommands+  s	    
rZ   c                    SU l         g r   )r   r   s    rT   r   localcommandexecutor.close.  s	    rZ   )r   r   r   N)r\   r]   r^   r_   rj   r   r   r   r   r   ra   r[   rZ   rT   r   r     s     
4rZ   r   c                     ^  \ rS rSrSrSU 4S jjrS rS rS rS r	SS jr
S	 rS
 rS rSS jr    SS jrS rS rS rS rS rS rS rS rSrU =r$ )	localpeeri2  z8peer for a local repo; reflects only the most recent APIc                n  > [         TU ]  UR                  X4S9  Uc  [        R	                  5       nU(       a  UR                  S5      U l        OUR                  S5      U l        UR                  (       a*  [        R                  " U5      nUR                  SU-   5        UR                  U5      U l        g )Nro   remotehidden   served.hidden   serveds   exp-wanted-sidedata=)rL   rj   ui
moderncapscopyfiltered_repo_wanted_sidedatar   format_remote_wanted_sidedatarl   _restrictcapabilities_caps)rO   rP   capsro   r   	formattedrS   s         rT   rj   localpeer.__init__5  s    tG<??$D'78DJy1DJ  ==dCIHH,y89//5
rZ   c                6    U R                   R                  5       $ rG   )r  urlr   s    rT   r  localpeer.urlF  s    zz~~rZ   c                    U R                   $ rG   )r  r   s    rT   locallocalpeer.localI      zzrZ   c                    gr   r[   r   s    rT   canpushlocalpeer.canpushL      rZ   c                8    U R                   R                  5         g rG   )r  r   r   s    rT   r   localpeer.closeO  s    

rZ   c                    U R                   $ rG   )r  r   s    rT   capabilitieslocalpeer.capabilitiesV  r  rZ   c                6    U R                   R                  5       $ rG   )r  r   r   s    rT   r   localpeer.branchmap]  s    zz##%%rZ   c                    [         erG   )NotImplementedError)rO   ro   s     rT   get_cached_bundle_inline"localpeer.get_cached_bundle_inline`  s    !!rZ   c                B    [         R                  " U R                  5      $ rG   )r   get_manifestr  r   s    rT   clonebundleslocalpeer.clonebundlesd  s    ((44rZ   c                    SUU[         R                  " U5      [         R                  " U5      [         R                  " U5      4-  $ )z+Used to test argument passing over the wire   %s %s %s %s %sr)   bytestrrO   onetwothreefourfives         rT   debugwireargslocalpeer.debugwireargsg  D     U#T"T"$
 
 	
rZ   c                *   [         R                  " U R                  U4UUUUS.UD6S   n[        R                  " U5      n[         R
                  " U5      (       a!  [        R                  " U R                  U5      $ [        R                  " SUS 5      $ )N)headscommon
bundlecapsremote_sidedatar      01)
r   getbundlechunksr  r6   chunkbufferbundle2requestedr   getunbundlerr   r   )	rO   sourcer4  r5  r6  r7  r   chunkscbs	            rT   	getbundlelocalpeer.getbundleq  s     ))JJ
 !+
 
  f%$$Z00 ''44++E2t<<rZ   c                6    U R                   R                  5       $ rG   )r  r4  r   s    rT   r4  localpeer.heads  s    zz!!rZ   c                8    U R                   R                  U5      $ rG   )r  knownrO   nodess     rT   rE  localpeer.known  s    zz&&rZ   c                8    U R                   R                  U5      $ rG   )r  listkeys)rO   	namespaces     rT   rJ  localpeer.listkeys  s    zz""9--rZ   c                8    U R                   R                  U5      $ rG   )r  lookuprO   keys     rT   rN  localpeer.lookup  s    zz  %%rZ   c                :    U R                   R                  XX45      $ rG   )r  r(   )rO   rK  rP  oldnews        rT   r(   localpeer.pushkey  s    zz!!)#;;rZ   c                @    [         R                  " [        S5      5      e)Ns.   cannot perform stream clone against local peer)r   Abortr   r   s    rT   
stream_outlocalpeer.stream_out  s    kk!MNOOrZ   c                     [         R                  " U R                  US5      n[         R                  " U R                  XSU5      n[        US5      (       aE  [        R                  " UR                  5       5      n[        R                  " U R                  U5      nU$ ! [         a  n[        USS5      nU(       a  [        R                  " U R                  R                  5      nU H  n	UR                  U	5        M     [        R                  " UR                  5       5      n[        R                  " U R                  U5      n
[        R                  " U R                  U
5        e SnAff = f! [         R"                   a9  n[         R$                  " ['        S5      [(        R*                  " U5      5      eSnAff = f)zHapply a bundle on a repo

This function handles the repo locking itself.Ns   push	getchunks_bundle2salvagedoutputr[   s   push failed:)r   
readbundler   unbundler  hasattrr6   r:  r[  r   r<  r   r   bundle20addpartprocessbundler   	PushRacedResponseErrorr   r>   forcebytestr)rO   bundler4  r  retstreamexcoutputbundleroutbs              rT   r^  localpeer.unbundle  sS   	!,,TWWfdC''

F7CP3,, "--cmmo>F!..tww?C
  !&>C%..tzz}}=G%,  &!--g.?.?.ABF,,TWWf=A))$**a8!"  	%%/"J$;$;C$@ 	s1   BB   
E.*B?E))E..E1 1F>4F99F>c                    [        U 5      $ rG   )r   r   s    rT   commandexecutorlocalpeer.commandexecutor  s    #D))rZ   )r  r  NNF)returnz
Set[bytes]NNN)NNNN)r\   r]   r^   r_   r`   rj   r  r  r  r   r  r   r   r$  r0  r@  r4  rE  rJ  rN  r(   rX  r^  rp  ra   rb   rc   s   @rT   r   r   2  sz    B6" &"5
 =8"'.&<P#R* *rZ   r   c                  H   ^  \ rS rSrSrS	U 4S jjrS rS rS rS r	Sr
U =r$ )
locallegacypeeri  z_peer extension which implements legacy methods too; used for tests with
restricted capabilitiesc                ,   > [         TU ]  U[        X#S9  g )N)r	  ro   r   )rL   rj   
legacycaps)rO   rP   ro   r   rS   s       rT   rj   locallegacypeer.__init__  s    z 	 	
rZ   c                8    U R                   R                  U5      $ rG   )r  between)rO   pairss     rT   r{  locallegacypeer.between  s    zz!!%((rZ   c                8    U R                   R                  U5      $ rG   )r  branchesrF  s     rT   r  locallegacypeer.branches  s    zz""5))rZ   c                    [         R                  " U R                  XR                  R                  5       S9n[        R
                  " U R                  USU5      $ N)missingrootsancestorsofr8  )r   outgoingr  r4  r   makechangegroup)rO   rG  r=  r  s       rT   r   locallegacypeer.changegroup  sE    %%JJU

8H8H8J
 **4::xOOrZ   c                    [         R                  " U R                  XS9n[        R                  " U R                  USU5      $ r  )r   r  r  r   r  )rO   basesr4  r=  r  s        rT   changegroupsubset!locallegacypeer.changegroupsubset  s8    %%JJU
 **4::xOOrZ   r[   r   )r\   r]   r^   r_   r`   rj   r{  r  r   r  ra   rb   rc   s   @rT   rv  rv    s)    
)*PP PrZ   rv  c                d   U R                  S5      R                  S5      n[        R                  U;   a%  [        R
                  " U R                  U5      5      n[        R                  " USS9nUR                  5       (       d,  [        R                  " [        S5      UR                  -  5      eU$ )zreturns the vfs object pointing to root of shared source
repo for a shared repository

hgvfs is vfs pointing at .hg/ of current repo (shared one)
requirements is a set of requirements of current repo (shared one)

   sharedpath   
T)realpaths1   .hg/sharedpath points to nonexistent directory %s)readrstriprequirementsmodRELATIVE_SHARED_REQUIREMENTr6   normpathrr   vfsmodr7   existsr   	RepoErrorr   base)hgvfsr+   
sharedpath	sharedvfss       rT   _getsharedvfsr    s     M*11%8J22lB]]5::j#9:


:5IooBCnn
 	
 rZ   c                   U R                  5       nU R                   Ul         [        R                  " USSS9nUR                  S5      n[        R                  " USS9nSnSnUR	                  5       (       d3   UR                  5         [        R                  " [        S5      U-  5      e[        R                  " US5      n
[         R"                  U
;   =(       d    [         R$                  U
;   nSnU(       a1  ['        Xj5      n[        R                  " UR                  S	5      5      nO%[        R                  " UR                  S	5      5      n[        S
5      n[         R(                  U
;   a  U(       a  [         R(                  [        R                  " US5      ;  a  UR+                  SS5      nUR-                  SS5      nUR+                  SS5      nUS;   a  SSKJn  UR3                  UUUU
UUU5        GO1US:X  a  [        R                  " [        S5      US9e[        R                  " [        S5      U-  US9eU
[        R                  " US5      -  n
OU(       a  [        R                  " US5      n[         R(                  U;   a  UR-                  SS5      nUR+                  SS5      nUR+                  SS5      nUS;   a  SSKJn  UR5                  UUUU
UUU5        OEUS:X  a  [        R                  " [        S5      US9e[        R                  " [        S5      U-  US9e[7        X4XjU5      (       a8  [9        X4Xj5        [:        R<                  " U5        [:        R>                  " U5        [:        R:                  " U5       VVs1 s H  u  nnUR@                  iM     nnn[C        U5      n[E        U
U5        [G        X:5        [I        5       nU(       a=  URJ                  nUR                  S5      nURM                  [N        RP                  5        OURJ                  nUR                  S5      nUR                  S5      n[S        U
US 5      nURT                  Ul*        UR                  n[W        X:U5      Ul,        [         RZ                  U
;   d  [         R\                  U
;   a>  URM                  [N        R^                  5        URa                  [N        Rb                  5        [        R                  " USS9nURT                  Ul*        [        R                  " USS9nURT                  Ul*        / n0 n[d         Hg  u  nn U " 5       " UUU
UUUUUURX                  UUUUUS9n![g        U![h        5      (       d  [        Rj                  " S U-  5      eURm                  U!5        Mi     [n        Rp                  " S!URJ                  S"R                  [s        U
5      5      4-  5      n"[i        U"[u        U5      0 5      n#U#" U UUUUU
UUUUUUUS#9$ ! [         a     GN[         a=  n	[        R                  " [        S5      U[        R                  " U	5      4-  5      eSn	A	ff = fs  snnf )$a	  Create a local repository object.

Given arguments needed to construct a local repository, this function
performs various early repository loading functionality (such as
reading the ``.hg/requires`` and ``.hg/hgrc`` files), validates that
the repository can be opened, derives a type suitable for representing
that repository, and returns an instance of it.

The returned object conforms to the ``repository.completelocalrepository``
interface.

The repository type is derived by calling a series of factory functions
for each aspect/interface of the final repository. These are defined by
``REPO_INTERFACES``.

Each factory function is called to produce a type implementing a specific
interface. The cumulative list of returned types will be combined into a
new type and that type will be instantiated to represent the local
repository.

The factory functions each receive various state that may be consulted
as part of deriving a type.

Extensions should wrap these factory functions to customize repository type
creation. Note that an extension's wrapped function may be called even if
that extension is not loaded for the repo being constructed. Extensions
should check if their ``__name__`` appears in the
``extensionmodulenames`` set passed to the factory function and no-op if
not.
T
expandpathr     .hgcacheauditedFNs   invalid path %s: %ss   repository %s not found   stores?   see `hg help config.format.use-share-safe` for more informations   shares"   safe-mismatch.source-not-safe.warns   safe-mismatch.source-not-safes-   safe-mismatch.source-not-safe:verbose-upgrade)s   downgrade-allow   allows   downgrade-abortr   upgrade   aborts4   share source does not support share-safe requirementhintsf   share-safe mismatch with source.
Unrecognized value '%s' of `share.safe-mismatch.source-not-safe` set.s   safe-mismatch.source-safes   safe-mismatch.source-safe.warns)   safe-mismatch.source-safe:verbose-upgrade)s   upgrade-allowr  s   upgrade-abortsW   version mismatch: source uses share-safe functionality while the current share does notsb   share-safe mismatch with source.
Unrecognized value '%s' of `share.safe-mismatch.source-safe` set.   cache   wcachec                ,    [         R                  " U SS9$ )NTr  )r  r7   )r  s    rT   <lambda>%makelocalrepository.<locals>.<lambda>  s    VZZ48rZ   )r   intentsr+   featureswdirvfsr  r1   storevfsstoreoptionscachevfs	wcachevfsextensionmodulenames
extrastatebaseclassess   unable to construct type for %ss   derivedrepo:%s<%s>   ,)baseuir   origrootr  r  r+   supportedrequirementsr  r1   r  r  r  r  );r  r  r7   rr   isdirstatFileNotFoundError
ValueErrorr   rW  r   r>   re  r  r/   readrequiresr  SHARED_REQUIREMENTr  r  SHARESAFE_REQUIREMENT
configboolconfig r  downgrade_share_to_non_safeupgrade_share_to_safeloadhgrcafterhgrcloadr   loadall
populateuir\   gathersupportedrequirementsensurerequirementsrecognizedensurerequirementscompatiblerW   r  rl   r;   REPO_FEATURE_SHARED_STORAGE	makestore
createmoderesolvestorevfsoptionsr   REVLOGV2_REQUIREMENTCHANGELOGV2_REQUIREMENTREPO_FEATURE_SIDE_DATAdiscardREPO_FEATURE_STREAM_CLONEREPO_INTERFACES
isinstancerQ   r   r   r)   r   sortedtuple)$r  ro   r  r   r  hgpathr  sharedr  er+   r  r  mismatch_warnmismatch_configmismatch_verbose_upgrader  sourcerequiresnmr  r  r  storebasepath	cachepath
wcachepathr1   r  r  r  r  ifacer   typr   clss$                                       rT   makelocalrepositoryr    s   > 
BkkBG jj$>G \\&!FJJvD1EFI ;;==	JJL ooa :;dBCC''t4L**l: 	G66,F  H!%6	::innX67::ejj23 OPD,,<55''	489 MM?M !ii:O (*}}J($  #  &33 #!, !H,kkMN 
 kk!
 &&   G005AAL	 --i?00NB ii2NOOMM;M (*}}F($  #  &-- #!, !H,kkK   kkQ &	&
   U)<<b572b! 4>3H3H3LM3L41aAJJ3LM7; !/DE !2$ uH !NN8,	Z;;<

JJx(	I&J
 8E
 ''EyyH-bIH 	,,<22lBZ667==> zz)$7H**H

:D9I ++I EJ$	r d%!))!5!
" #t$$((2U:  	S3 %< ??tyy9M/N OOD tU5\2
&C!3  u ! 	 	++()T:3J3J13M,NN 	N Ns$   8X Y#
Y 	Y #8YY c                   [         R                  " 5       (       d  gSn[        R                  U;   a3  U(       a,   U R	                  UR                  S5      UR                  S9  Sn U R	                  UR                  S5      UR                  S9  Sn U R	                  UR                  S5      UR                  S9  SnU$ ! [         a     Nff = f! [         a     NJf = f! [         a     U$ f = f)a  Load hgrc files/content into a ui instance.

This is called during repository opening to load any additional
config files or settings relevant to the current repository.

Returns a bool indicating whether any additional configs were loaded.

Extensions should monkeypatch this function to modify how per-repo
configs are loaded. For example, an extension may wish to pull in
configs from alternate files or sources.

sharedvfs is vfs object pointing to source repo if the current one is a
shared one
F   hgrcrootTs   hgrc-not-shared)r:   use_repo_hgrcr  r  
readconfigrr   r  OSError)r   r  r  r+   r  rg  s         rT   r  r  O  s    * !!
C,,<	MM)..1	MGC
ejj)=
ejj!347<<H J  		    Js5   +B? &+C +C ?
CC
CC
C-,C-c           	         S/S/S/S.n[        UR                  5       5       H@  u  pVXS;  a  M  U H.  nU R                  SU5      (       a  M  U R                  SUSSS9  M0     MB     g	)
a=  Perform additional actions after .hg/hgrc is loaded.

This function is called during repository loading immediately after
the .hg/hgrc file is loaded and before per-repo extensions are loaded.

The function can be used to validate configs, automatically add
options (including extensions) based on requirements, etc.
   git
   largefiles   lfs)r  r  r  s
   extensionsrZ   s   autoload)r=  N)r  items	hasconfig	setconfig)r   r  r  r+   autoextensionsrequirementnamesr   s           rT   r  r    so     %N %^%9%9%;<*D<<t44]D#kJ 	 =rZ   c                <   [        [        R                  5      n[        R                  " U 5       VVs1 s H  u  p#UR                  iM     nnn[
         H  nUR                  U;   d  M  U" X5        M     [        R                   H  n[        R                  U   nUR                  5       (       d  M-  UR                  5       (       d  MD  UR                  SU-  5        UR                  5       S:X  d  Mn  UR                  [        R                  5        M     U$ s  snnf )z6Determine the complete set of recognized requirements.   exp-compression-%s   zstd)rW   localrepository_basesupportedr   r\   featuresetupfuncsr]   r6   compengines	availablerevlogheaderrl   r   r  REVLOG_COMPRESSION_ZSTD)r   	supportedr  r  modulesr   r   engines           rT   r  r    s     O223I '1&;&;B&?@&?daqzz&?G@==G#r  
   !!$'&"5"5"7"7MM/$67{{}'oEEF !  As   Dc                h   [        5       nU  HY  nX1;   a  M
  U(       a  USS R                  5       (       d  [        R                  " [	        S5      5      eUR                  U5        M[     U(       aB  [        R                  " [	        S5      SR                  [        U5      5      -  [	        S5      S9eg)	zValidate that a set of local requirements is recognized.

Receives a set of requirements. Raises an ``error.RepoError`` if there
exists any requirement in that set that currently loaded code doesn't
recognize.

Returns a set of supported requirements.
r   r   s   .hg/requires file is corrupts:   repository requires features unknown to this Mercurial: %s    sJ   see https://mercurial-scm.org/wiki/MissingRequirement for more informationr  N)rW   isalnumr   RequirementErrorr   rl   rr   r  )r+   r  missingr  s       rT   r  r    s     eG##+a"2":":"<"<((+J)KLLK  $ $$KLiiw()(
 	
 rZ   c                    [         R                  U;   a5  [        R                  (       d  [        R
                  " [        S5      5      egg)a  Validates that a set of recognized requirements is mutually compatible.

Some requirements may not be compatible with others or require
config options that aren't enabled. This function is called during
repository opening to ensure that the set of requirements needed
to open a repository is sane and compatible with config options.

Extensions can monkeypatch this function to perform additional
checking.

``error.RepoError`` should be raised on failure.
sf   repository is using sparse feature but sparse is not enabled; enable the "sparse" extensions to accessN)r  SPARSE_REQUIREMENTr0   enabledr   r  r   )r   r+   s     rT   r  r    sA     	**l:oo1
 	
  	;rZ   c                    [         R                  U ;   aT  [         R                  U ;   a*  [         R                  U ;   n[        R
                  " XU5      $ [        R                  " X5      $ [        R                  " X5      $ )z,Construct a storage object for a repository.)r  STORE_REQUIREMENTFNCACHE_REQUIREMENTDOTENCODE_REQUIREMENTstoremodfncachestoreencodedstore
basicstore)r+   ro   vfstype	dotencodes       rT   r  r    sc    ((L8..,>'==MI((	BB$$T33t--rZ   c                r   0 n[         R                  U;   a  SUS'   U R                  SS5      nUb  XCS'   [         R                  U;   d  [         R                  U;   a  UR                  [        XU5      5        OSUS'   [         R                  U;   a  SUS'   U$ U R                  SS	5      nS
nXV;   a  SUS'   U$ )z|Resolve the options to pass to the store vfs opener.

The returned dict is used to influence behavior of the storage layer.
T   treemanifest   formats   manifestcachesizes   revlogv0   changeset-sidedatas   copies-storage   experimentals   copies.write-to)s   changeset-onlys   compatibilitys   extra)	r  TREEMANIFEST_REQUIREMENT	configintREVLOGV1_REQUIREMENTr  r   resolverevlogstorevfsoptionsCOPIESSDC_REQUIREMENTr  )r   r+   r  r   manifestcachesizewritecopiestocopiesextramodes          rT   r  r    s    
 G//<?#'  Y0DE$(9$% 	,,<//<?3BhOP#,,<%:!" N 		/3EF?+)1G%&NrZ   c                   0 n0 US'   [         R                  " 5       =oCS'   [         R                  " 5       =oSS'   [         R                  " 5       =ocS'   [        R
                  U;   a  SUS'   [        R                  U;   a  SUS'   [        R                  U;   a  SUS'   U R                  S	S
5      nXsS'   [        R                  U;   a  SUS'   U R                  SS5      nUb  Xl        [        R                  " U S5      n	U	[        R                  :  a)  SUl        SUl        U	[        R"                  :  a  SUl        U R                  SS5      Ul        U R                  SS5      Ul        U R                  SS5      Ul        U R                  SS5      n
XS'   U R                  SS5      nSnU(       a0  U R                  SS5      nUc  [        R*                  " U 5      (       + nXl        Xl        U R1                  S	S5      nSU::  a  Xl        [4        R6                  " 5       nU R                  SS U5      (       a  U R1                  SS!5      Ul        U R                  S	S"5      n[;        U R=                  S	S#5      5      nU R1                  S	S$5      nXl        UUl         UUl!        [        RD                  U;   nUUl#        U(       a  SUS'   SUl        SnU(       a  [H        RJ                  nU R                  SS%U5      nUb  UUl&        U HE  nURN                  nU" S&5      (       d  U" S'5      (       d  M+  URQ                  S(S)5      S)   Ul)        MG     U R                  SS*5      nUb3  SUs=::  a  S+::  d&  O  [U        S,5      n[V        RX                  " UU-  5      eUURZ                  S-'   U R                  SS.5      nUb3  SUs=::  a  S/::  d&  O  [U        S05      n[V        RX                  " UU-  5      eUURZ                  S1'   [        R\                  U;   a  SUl/        U R                  S	S25      (       a  SUS2'   [        R`                  U;   Ga%  U R=                  SS35      nUS4:X  a  U R=                  SS55      nUS6;  aa  U Rc                  SS55      n[U        S75      nU Re                  UU-  5        U Rf                  (       d  U Re                  [U        S85      U-  5        Un[U        S95      n[U        S:5      n[         Rh                  (       dd  US;:X  aC  S<U-   S=-   nU Re                  U5        U Rf                  (       d  S>U-   S?-   nU Re                  U5        US@:X  a  [V        RX                  " UUSA9eSUSB'   [        Rj                  U;   Ga   U R=                  SSC5      nUS4:X  a  U R=                  SS55      nUS6;  aa  U Rc                  SS55      n[U        SD5      nU Re                  UU-  5        U Rf                  (       d  U Re                  [U        S85      U-  5        Un[U        SE5      n[U        SF5      n[l        Rn                  (       dd  US;:X  aC  S<U-   S=-   nU Re                  U5        U Rf                  (       d  S>U-   S?-   nU Re                  U5        US@:X  a  [V        RX                  " UUSA9eU R                  SSG5      (       a  SUSH'   U R                  SISB5      (       a  SUSJ'   U$ )Kz+Resolve opener options specific to revlogs.s   flagprocessorss   feature-configs   data-configs   delta-configT   revlogv1   revlogv2s   changelogv2r!  s   changelog-v2.compute-ranks   changelogv2.compute-ranks   generaldeltar  s   chunkcachesizeNs   memoryi'     
      storages#   revlog.optimize-delta-parent-choices5   revlog.delta-parent-search.candidate-group-chunk-sizes   debugs   revlog.debug-deltas   revlog.issue6528.fix-incomings   issue6528.fix-incomings   revlog.reuse-external-deltaFs"   revlog.reuse-external-delta-parents   maxdeltachainspanr   s   revlog.mmap.indexs    revlog.mmap.index:size-thresholds   sparse-reads   sparse-read.density-thresholds   sparse-read.min-gap-sizes   maxchainlens   revlog-compression-s   exp-compression-   -   s   revlog.zlib.level	   s8   invalid value for `storage.revlog.zlib.level` config: %ds
   zlib.levels   revlog.zstd.level   s8   invalid value for `storage.revlog.zstd.level` config: %ds
   zstd.levels
   rust.indexs#   revlog.persistent-nodemap.slow-path   defaults   all-slow-path)r     warnr  sM   unknown value for config "storage.revlog.persistent-nodemap.slow-path": "%s"
s"   falling back to default value: %s
sQ   accessing `persistent-nodemap` repository without associated fast implementation.s@   check `hg help config.format.use-persistent-nodemap` for detailsr5  s	   warning: r     (s   )
r  r  r   s   dirstate-v2.slow-paths7   unknown value for config "dirstate-v2.slow-path": "%s"
sJ   accessing `dirstate-v2` repository without associated fast implementation.s9   check `hg help config.format.use-dirstate-v2` for detailss   revlog.persistent-nodemap.mmaps   persistent-nodemap.mmap   devels   devel-force-nodemap)8r,   FeatureConfig
DataConfigDeltaConfigr  r$  r  r  r  GENERALDELTA_REQUIREMENTr#  chunk_cache_sizer/   get_resource_profileRESOURCE_MEDIUMuncompressed_cache_countuncompressed_cache_factorRESOURCE_HIGHdelta_both_parentscandidate_group_chunk_sizedebug_deltagddeltaconfig
lazy_deltalazy_delta_baseconfigbytesmax_deltachain_spanr6   has_mmap_populatemmap_index_thresholdfloatr  with_sparse_readsr_density_thresholdsr_min_gap_sizeSPARSEREVLOG_REQUIREMENTsparse_revlogrevlogconstSPARSE_REVLOG_MAX_CHAIN_LENGTHmax_chain_len
startswithsplitcompression_enginer   r   rW  compression_engine_optionsNARROW_REQUIREMENTenable_ellipsisNODEMAP_REQUIREMENTconfig_defaultwarnquietHAS_FAST_PERSISTENT_NODEMAPDIRSTATE_V2_REQUIREMENTr   HAS_FAST_DIRSTATE_V2)r   r+   r  r   feature_configdata_configdelta_configcmp_rankchunkcachesizememory_profile	issue6528	lazydeltalazydeltabase	chainspanhas_populatewithsparsereadsrdensitythressrmingapsizesparserevlogmaxchainlenrprefix
zlib_levelmsg
zstd_level	slow_pathdefaultr  s                               rT   r%  r%    s    G!#G282F2F2HHN./,2,=,=,??K.).4.@.@.BBL?+++|;#++|;#..,>"&==2NO/7+,//<?#'  \\)->?N!'5$11"i@N000/5,01-W22246K1&(mm:'L# /1ll@/L+  "}}X7LMLj*JKI)2%&j*HIIM=
   ' 5 5b 99M'#0 0DEII~+4())+L	}}Z!5|DD+->>/,
(
 ]]?NCN
		/#CDN >>/3NOL#1 '5K$".K";;|KL!-L#' '+$K!@@,,y.+FK%0"
 ())V4G-H-H01a0@0CN-  j*>?JZ$1$OPC++cJ.//?IN--m<j*>?JZ%2%OPC++cJ.//?IN--m<))\9)-&	}}_m44!%**l:II>
	 
"		*.>?I99''
4DEGIC GGC)O$88@AGKLI$
 
 11G#"S(50xx$;/DGGDMH$kk#D11)-%&..,>IIj*BC	
"		*.>?I99''
4DEGOPCGGC)O$88@AGKLI$
 L
 ,,G#"S(50xx$;/DGGDMH$kk#D11	}}Z!BCC.2*+	}}X455*.&'NrZ   c                     [         $ )z6Produce a type conforming to ``ilocalrepositorymain``.)r  )r   s    rT   makemainrz    s    rZ   c                      \ rS rSrSrS rSrg)revlogfilestoragei  z File storage when using revlogs.c                    UR                  S5      (       a  USS  nU R                  5       S L=(       d     [        R                  " U R                  5      n[
        R
                  " U R                  XS9$ N   /r   )	try_split)rU  currenttransactionr5   mayhavependingr  r   svfsrO   ro   r  s      rT   filerevlogfilestorage.file  sb    ??4  8D ##%T1 1%%dii0 	
 tyy$DDrZ   r[   Nr\   r]   r^   r_   r`   r  ra   r[   rZ   rT   r|  r|    s    *	ErZ   r|  c                      \ rS rSrSrS rSrg)revlognarrowfilestoragei  z1File storage when using revlogs and narrow files.c                    UR                  S5      (       a  USS  nU R                  5       S L=(       d     [        R                  " U R                  5      n[
        R                  " U R                  XR                  US9$ r~  )	rU  r  r5   r  r  r   narrowfilelogr  _storenarrowmatchr  s      rT   r  revlognarrowfilestorage.file  sq    ??4  8D ##%T1 1%%dii0 	 $$IIt33y
 	
rZ   r[   Nr  r[   rZ   rT   r  r    s
    ;

rZ   r  c                    UR                  [        R                  5        UR                  [        R                  5        [        R
                  U ;   a  [        $ [        $ )z=Produce a type conforming to ``ilocalrepositoryfilestorage``.)rl   r;    REPO_FEATURE_REVLOG_FILE_STORAGEr  r  rY  r  r|  )r+   r  r   s      rT   makefilestorager    s@    LL<<=LL556))\9&&  rZ   c                     [         $ rG   )rz  r[   rZ   rT   r  r    s    hrZ   c                     [         $ rG   )r  r[   rZ   rT   r  r    s    _rZ   c                  F   \ rS rSrSr\R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                   \R"                  \R$                  \R&                  \R(                  \R*                  \R,                  \R.                  \R0                  \R2                  1r1 Skr S           SS jjrS rS r\S 5       r S	 r!S
 r"S r#\S 5       r$\S 5       r%S r&SS jr'S r(SS jr)\*" SSSS5      S 5       r+S r,\S 5       r-\." SS5      S 5       r/\." S5      S 5       r0\1" 5       S 5       r2\3" 5       S 5       r4\5S  5       r6S! r7S" r8\." \9Rt                  5      S# 5       r;\." \9Rt                  5      S$ 5       r<\." \9Rt                  5      S% 5       r=SS& jr>S' r?\5S( 5       r@\5S) 5       rA\BS* 5       rC\S+ 5       rDS, rES- rFS. rG\GrHS/ rIS0 rJSS1 jrKSS2 jrLSSS3 jjrMSS4 jrNSS5 jrO\PS6 5       rQS7 rRS8 rSS9 rTS: rUS; rVS< rWS= rX\BS> 5       rYS? rZSS@ jr[SA r\SB r]SC r^SD r_SE r`SF raSG rbSSH jrcSSI jrdSSSJ jjreSSK jrfSSSL jjrgSM rhSN ri\5SO 5       rj\5SP 5       rkSQ rlSSR jrm S       SSS jjrnSST jroSU rpSSV jrqSW rrSX rs\BSY 5       rtSZ ruSS[ jrv\BS\ 5       rwS] rx\BSS^ j5       ryS_ rzS` r{Sa r|SSb jr}Sc r~\BSd 5       r SSe jrSf rSSg jrSSh jrSi rSj rSk rSl r\B       SSm j5       r\BSSn j5       r\BSo 5       r\BSp 5       r       SSq jrSr rSs rSt rSSu jrSSv jrSw rSx rSy r\5Sz 5       rS{ rS| rSS} jrS~ rS r SS jrSrg)r  i  a)  Main class for representing local repositories.

All local repositories are instances of this class.

Constructed on its own, instances of this class are not usable as
repository objects. To obtain a usable repository object, call
``hg.repository()``, ``localrepo.instance()``, or
``localrepo.makelocalrepository()``. The latter is the lowest-level.
``instance()`` adds support for creating new repositories.
``hg.repository()`` adds more extension integration, including calling
``reposetup()``. Generally speaking, ``hg.repository()`` should be
used.
>   r     cache/   requires   bisect.stateNc                   Xl         X l        X0l        X@l        UR                  U l        XPl        UR                  U l        X`l        [        U l
        U R                  R                  U l        Xpl        Xl        Xl        Xl        Xl        Xl        SU l        U R                  R'                  SS5      (       d!  U R                  R'                  SS5      (       a4  U R)                  U R                  R*                  5      U R                  l        / U l        [.        R0                  " U R                  5        U R                  R                  U l        U R                  R                  U l        U R                  R6                  U l        U R                  R'                  SS5      (       d!  U R                  R'                  SS5      (       a  [;        U R4                  S5      (       aI  U R=                  U R4                  R                  R*                  5      U R4                  R                  l        O4U R=                  U R4                  R*                  5      U R4                  l        SU l        [@        RB                  " 5       U l"        SU l#        0 U l$        0 U l%        S=U l&        =U l'        U l(        0 U l)        0 U l*        SU l+        / U l,        SU l-        SU l.        [^        R^                  " 5       U l0        0 U l1        0 U l2        [f        Rh                  " U5      U l5        SU l6        [n        Rp                  U R                  ;   a  SU l6        [s        5       U l:        0 U l;        [x        Rz                  " U 5        g)a  Create a new local repository instance.

Most callers should use ``hg.repository()``, ``localrepo.instance()``,
or ``localrepo.makelocalrepository()`` for obtaining a new repository
object.

Arguments:

baseui
   ``ui.ui`` instance that ``ui`` argument was based off of.

ui
   ``ui.ui`` instance for use by the repository.

origroot
   ``bytes`` path to working directory root of this repository.

wdirvfs
   ``vfs.vfs`` rooted at the working directory.

hgvfs
   ``vfs.vfs`` rooted at .hg/

requirements
   ``set`` of bytestrings representing repository opening requirements.

supportedrequirements
   ``set`` of bytestrings representing repository requirements that we
   know how to open. May be a supetset of ``requirements``.

sharedpath
   ``bytes`` Defining path to storage base directory. Points to a
   ``.hg/`` directory somewhere.

store
   ``store.basicstore`` (or derived) instance providing access to
   versioned storage.

cachevfs
   ``vfs.vfs`` used for cache files.

wcachevfs
   ``vfs.vfs`` used for cache files related to the working copy.

features
   ``set`` of bytestrings defining features/capabilities of this
   instance.

intents
   ``set`` of system strings indicating what this repo will be used
   for.
Nr7     all-warnings   check-locksr7   Fr   )>r  r   r  wvfsr  r  r7   ro   r+   r   nodeconstantsnullidr  r  r1   r  r  r  
filternamer  _getvfswardaudit_phasedefaultsr   setupspathr  rr   r~   r_  _getsvfsward_dirstatevalidatewarnedr   BranchMapCache_branchcaches_revbranchcache_filterpats_datafilters	_transref_lockref	_wlockrefr   filteredrevcache	_dirstate_postdsstatus_pending_narrow_pats_pending_narrow_pats_dirstater"   r  _sparsesignaturecache_sparsematchercacher*   extrafilter_extrafilteridfilecopiesmoder  r&  rW   r  _sidedata_computerssidedatamodset_sidedata_spec_for_repo)rO   r  r   r  r  r  r+   r  r  r1   r  r  r  r  s                 rT   rj   localrepository.__init__U  s   H  	LL	JJ	(.((//.$
 " 77h88DGG<N<Nn=
 =
 "--dhhnn=DHHN !DGGZZ__
JJNN	ZZ__
77h88DGG<N<Nn=
 =
 tyy%((&*&7&7		8K8K&L		#"&"3"3DIIOO"D		',$&557#:>>>  !#$(!-1*  **,
 &("#% &2226"00D4E4EE"7D ##% ..t4rZ   c                L   ^ ^^ [         R                  " T 5      mSUUU 4S jjnU$ )zbuild a ward for self.vfsc                  >^  T" T US9nT" 5       nUb"  [        US5      (       a  [        US5      (       d  g US;   a  g T R                  UR                  5      (       a  T [        UR                  5      S-   S  m T R                  S5      (       a   SnUR                  R                  UT -  SS	S
9  Sn[        U 4S jU 5       5      (       a<  UR                  UR                  5      c  UR                  R                  ST -  SSS
9  U$ UR                  UR                  5      cI  T	R                   H  nT R                  U5      (       d  M    g    UR                  R                  ST -  SSS
9  U$ )Nmoder  r  N   rs   rbr   r  s2   accessing cache with vfs instead of cachevfs: "%s"   s	   cache-vfs)
stacklevelr  )s   journal.s   undo.s   strip-backup/r  c              3  F   >#    U  H  nTR                  U5      v   M     g 7frG   )rU  ).0rs  ro   s     rT   	<genexpr>@localrepository._getvfsward.<locals>.checkvfs.<locals>.<genexpr>  s     K9Jv4??6**9Js   !   write with no lock: "%s"r  s   write with no wlock: "%s")r_  rU  ro   lenr   	develwarnany_currentlockr  r  _wlockfreeprefix)
ro   r  rg  rP   ru  vfs_path_prefixesrs  origfuncrrefrO   s
   `      rT   checkvfs-localrepository._getvfsward.<locals>.checkvfs  sh   4d+C6Dt[11tZ00**tyy))C		NQ.01y))K!!#*<!P! K9JKKK$$T]]3;GG%%3d:#$- & " J ""4>>2: #33Fv.. 4 !!047 ) " 
 JrZ   rG   weakrefref)rO   r  r  r  s   `` @rT   r  localrepository._getvfsward  s#    {{4 +	 +	Z rZ   c                H   ^^ [         R                  " U 5      mSUU4S jjnU$ )zbuild a ward for self.svfsc                B  > T" XS9nT" 5       nUb  [        US5      (       d  g US;   a  g U R                  UR                  5      (       a  U [        UR                  5      S-   S  n UR	                  UR
                  5      c  UR                  R                  SU -  SS9  U$ )Nr  r  r  r   r  r-  )r  )r_  rU  r  r  r  r  r   r  )ro   r  rg  rP   r  r  s       rT   	checksvfs/localrepository._getsvfsward.<locals>.checksvfs+  s    4+C6D|74#<#<**t//C01467  /7!!/$61 "  JrZ   rG   r  )rO   r  r  r  s    ` @rT   r  localrepository._getsvfsward'  s#    {{4 	 	  rZ   c                J    U R                   U R                  U R                   S.$ )N)rZ   rh   r  r  r7   r   s    rT   vfs_maplocalrepository.vfs_map=  s#     hhii
 	
rZ   c                $    U R                  5         g rG   )_writecachesr   s    rT   r   localrepository.closeE  s    rZ   c                \    U R                   (       a  U R                   R                  5         g g rG   )r  writer   s    rT   r  localrepository._writecachesH  s"      &&(  rZ   c                ~   U R                   R                  SS5      (       a[  [        U5      n[        R                  " [        R
                  " U SS95      nUR                  S[        R                  U5      -   5        U R                   R                  SS5      (       a  UR                  [        R                  5        U$ )Nr!  s   bundle2-advertises   client)roles   bundle2=s   narrow)r   r  rW   r   
encodecapsgetrepocapsrl   urlreqquoter8   	NARROWCAP)rO   r	  capsblobs      rT   r  %localrepository._restrictcapabilitiesL  s    77o/CDDt9D))##Dy9H HH[6<<#99:77oy99HH^--.rZ   c                T    [         R                  " U R                  U R                  S9$ )N)callbackr%   pathauditorr  _checknestedr   s    rT   auditorlocalrepository.auditorZ  s!     ##DII8I8IJJrZ   c                X    [         R                  " U R                  U R                  SSS9$ )NFT)r  realfscachedr  r   s    rT   nofsauditorlocalrepository.nofsauditor`  s*     ##II 1 1%
 	
rZ   c                   UR                  U R                  5      (       d  gU[        U R                  5      S-   S n[        R                  " U5      nU S   n[        R
                  " U5      nU(       ap  SR                  U5      nXdR                  ;   a7  Xc:X  a  gUR                  U5      nUR                  U[        U5      S-   S 5      $ UR                  5         U(       a  Mp  g)z/Determine if path is a legal nested repository.Fr   Nr  T)rU  r  r  r6   pconvert	splitpathrr   substatesubchecknestedpop)rO   ro   subpathnormsubpathctxpartsrs  r  s           rT   r  localrepository._checknestedh  s    tyy))s499~)+,mmG,& 4jw'YYu%F%(''&/C??73v;?3D+EFF		 e rZ   c                    [        XUS9$ )Nr   )r   )rO   ro   r   s      rT   r   localrepository.peer  s    ,
 	
rZ   c                    U $ )zYReturn unfiltered version of the repository

Intended to be overwritten by filtered repo.r[   r   s    rT   rH   localrepository.unfiltered  s	     rZ   c                    U R                   b  SU;  a  US-   U R                   -   n[        R                  " U R                  5       R                  5      nU" XU5      $ )a  Return a filtered version of a repository

The `name` parameter is the identifier of the requested view. This
will return a repoview object set "exactly" to the specified view.

This function does not apply recursive filtering to a repository. For
example calling `repo.filtered("served")` will return a repoview using
the "served" view, regardless of the initial view used by `repo`.

In other word, there is always only one level of `repoview` "filtering".
   %)r  r*   newtyperH   rS   )rO   r   visibilityexceptionsr  s       rT   r  localrepository.filtered  sV     *t4/?$;!4!44Dt0::;4344rZ   )	   bookmarksrh   )s   bookmarks.currentrh   )r  rZ   r   c                N    U R                  5         [        R                  " U 5      $ rG   )_refreshchangelogr   bmstorer   s    rT   
_bookmarkslocalrepository._bookmarks  s"    n 	   &&rZ   c                L    S[        U 5      ;   a  U R                  5       c  U ?ggg)z7make sure the in memory changelog match the on-disk one	changelogN)r   r  r  r   s    rT   r  !localrepository._refreshchangelog  s*    $t*$)@)@)B)J *K$rZ   c                .    U R                   R                  $ rG   )r  activer   s    rT   _activebookmarklocalrepository._activebookmark  s    %%%rZ   s
   phaserootsr   c                B    [         R                  " X R                  5      $ rG   )r&   
phasecacher  r   s    rT   _phasecachelocalrepository._phasecache  s      ':':;;rZ   s   obsstorec                D    [         R                  " U R                  U 5      $ rG   )r$   r  r   r   s    rT   obsstorelocalrepository.obsstore  s    !!$''400rZ   c                    U R                   R                  5         U R                  R                  [        R
                  " U R                  5      [        R                  " U R                  S5      S9$ )N	   changelog)concurrencychecker)
r   prefetch_parentsr1   r  r5   r  r  revlogcheckerget_checkerr   )rP   s    rT   r  localrepository.changelog  sV     	&&(zz##""499-,88,O $ 
 	
rZ   c                L    U R                   R                  X R                  5      $ rG   )r1   manifestlogr  r   s    rT   r+  localrepository.manifestlog  s    zz%%d,B,BCCrZ   c                    U R                   c!  U R                  5       U l         U R                   $ U R                   R                  5         U R                   $ rG   )r  _makedirstaterefreshr   s    rT   r   localrepository.dirstate  sD    >>!!//1DN ~~ NN""$~~rZ   c                `  ^  Sn[         R                  " T 5      (       a  U 4S jn[        R                  n[        R                  nUT R
                  ;   nUT R
                  ;   n[        R                  " T R                  T R                  T R                  T R                  UT R                  UUS9$ )z3Extension point for wrapping the dirstate per-repo.Nc                 0   > [         R                  " T 5      $ rG   )r0   matcherr   s   rT   r  /localrepository._makedirstate.<locals>.<lambda>  s    FNN4$8rZ   )use_tracked_hint)r0   
use_sparser  r`  DIRSTATE_TRACKED_HINT_V1r+   r   r7   r   r  _dirstatevalidater  )rO   sparsematchfnv2_reqthuse_dirstate_v2r5  s   `     rT   r.  localrepository._makedirstate  s    T""8M 8855 D$5$55!2!22  HHGGII""-	
 		
rZ   c                   Sn U R                   R                  U5        U(       a  U$ U R                  (       d7  SU l        U R                  R                  [        S5      [        U5      -  5        U R                  $ ! [        R                   aa    U R	                  5       cK  U R                  5          U R                   R                  U5         N! [        R                   a    Sn  Nf = fSn Nf = f)NTFs-   warning: ignoring unknown working parent %s!
)r  revr   LookupErrorcurrentlock
invalidater  r   r]  r   r   r  )rO   nodeokays      rT   r8  !localrepository._dirstatevalidate#  s    	NNt$$ K///3,GHDk" ;;5    	 !)!!NN&&t,(( ! D! !	s/   A< <5C12CC)%C1(C))C10C1c                P    U R                   nUc  [        R                  " U 5      nU$ )zTmatcher patterns for this repository's narrowspec

A tuple of (includes, excludes).
)r  r#   load)rO   vals     rT   
narrowpatslocalrepository.narrowpatsC  s'     '';//$'C
rZ   c                    [         R                  U R                  ;  a  [        R                  " 5       $ U R
                  u  p[        R                  " U R                  XS9$ N)includeexclude)	r  rY  r+   matchmodalwaysrI  r#   r   r  rO   rM  rN  s      rT   r  !localrepository._storenarrowmatchO  sF    --T5F5FF??$$??		7LLrZ   c                    [         R                  U R                  ;  a  [        R                  " 5       $ [
        R                  " U 5        U R                  u  p[
        R                  " U R                  XS9$ rL  )
r  rY  r+   rO  rP  r#   checkworkingcopynarrowspecrI  r   r  rQ  s      rT   _narrowmatchlocalrepository._narrowmatchV  sT    --T5F5FF??$$--d3??		7LLrZ   c                l   U(       a  U(       a{  U R                   R                  5       (       d\  [        R                  " UR	                  5       5      n[        R
                  " U R                   U/5      n[        R                  " X5      $ [        R                  " XR                   5      $ U R                   $ )zmatcher corresponding the the repo's narrowspec

If `match` is given, then that will be intersected with the narrow
matcher.

If `includeexact` is True, then any exact matches from `match` will
be included even if they're outside the narrowspec.
)rU  rP  rO  exactfilesunionmatcherintersectmatchers)rO   r   includeexactemnms        rT   narrowmatchlocalrepository.narrowmatch^  s     D$5$5$<$<$>$> ^^EKKM2**D,=,=r+BC11%<<--e5F5FGG   rZ   c                P    [         R                  " XU5        U R                  SS9  g NT)clearfilecache)r#   saverB  )rO   newincludesnewexcludess      rT   setnarrowpatslocalrepository.setnarrowpatsq  s    ;7t,rZ   c                    S[         U R                  R                  4[         [         U R                  R                  4U R                  [         U R                  40$ )N   null)r   r  r  r   s    rT   _quick_access_changeid_null+localrepository._quick_access_changeid_nullu  sL     gt11889gt11889KK'4;;/
 	
rZ   c                   U R                   R                  5       nU R                  5       R                  nU R                  R                  5        H  nX0R                  :X  a  M  UR                  R                  U5      nUc  M4  XC4nXQU'   XQU'   UR                  U5       H+  nU[        :X  a  M  UR                  U5      nXg4nXQU'   XQU'   M-     M     U R                  R                  5       nXR                  :w  a  X   US'   U$ )N   .)rk  r  rH   r  r   parentsr  indexget_rev
parentrevsr   rC  p1)	rO   quickclrC  r?  pairrr  r  p1nodes	            rT   _quick_access_changeid_wc)localrepository._quick_access_changeid_wc}  s     00557__((MM))+D{{"((""4(C{ ;D#J$K]]3'<GGAJvaa ( ,( !!#[[ -E$KrZ   c                >    S[        U 5      ;   a  U R                  S	 g g )Nrx  )r   rI   r   s    rT   !_quick_access_changeid_invalidate1localrepository._quick_access_changeid_invalidate  s     &$t*49: 5rZ   c                n    U R                   [        R                  ;   a  U R                  $ U R                  $ )zan helper dictionnary for __getitem__ calls

This contains a list of symbol we can recognise right away without
further processing.
)r  r*   filter_has_wcrx  rk  r   s    rT   _quick_access_changeid&localrepository._quick_access_changeid  s.     ??h444111///rZ   c           	        Uc  [         R                  " U 5      $ [        U[         R                  5      (       a  U$ [        U[        5      (       aN  [        UR                  [        U 5      5      6  Vs/ s H"  nX R                  R                  ;  d  M  X   PM$     sn$ U R                  R                  U5      nUb  Uu  pE[         R                  " XUSS9$ US:X  aL  U R                  R                  5       nU R                  R                  U5      n[         R                  " XU5      $  [        U[        5      (       a  U R                  R!                  U5      nUnGOUS:X  aD  U R"                  R%                  5       nU R'                  5       R                  R                  U5      nO[        U5      U R(                  R*                  :X  a   UnU R                  R                  U5      nO[        U5      SU R(                  R*                  -  :X  a'  [?        U5      nU R                  R                  U5      nO8[,        R@                  " SU[B        RD                  " [G        U5      5      4-  5      e[         R                  " XU5      $ s  snf ! [,        R.                   a    [1        U5      ne [2         az    U R5                  5       (       aX  XR'                  5       R"                  R7                  5       ;   a-  [9        S5      n[,        R:                  " U[=        U5      -  5      e[1        U5      ne f = f! [,        RH                  [,        R.                  4 a7    [,        RJ                  " [9        S5      [B        RD                  " U5      -  5      e[L        [2        4 a7    [,        RN                  " [9        S	5      [B        RD                  " U5      -  5      e[,        RP                   a    [         R                  " U 5      s $ f = f)
NF)maybe_filtered   tiprn  s*   working directory has unknown parent '%s'!r1  s$   unsupported changeid '%s' of type %ss   filtered revision '%s'   unknown revision '%s'))r   
workingctxr  basectxslicerangeindicesr  r  filteredrevsr  r   	changectxtipr?  intrC  r   rs  rH   r  nodelenr   FilteredLookupErrorr
   r@  r  ro  r   rW  r   r	   r   r)   r)  rQ   FilteredIndexErrorFilteredRepoLookupError
IndexErrorRepoLookupErrorWdirUnsupported)rO   changeidiquick_accessr?  rC  ru  s          rT   __getitem__localrepository.__getitem__  sS   %%d++h00O h&&  0 0T ;<<ANN777 <  2266x@#$IC$$TUKKv>>%%'D..$$T*C$$T552	,(C((~~**84T! }}'')oo'1155d;X$"4"4"<"<<#D..,,X6C$ X!d&8&8&@&@"@@8}nn((.,,;!1!1$x.!ABC 
 $$T55q< 00 "8}H"  

$(9(B(B(J(J(LL MN#kk#h*?@@"8}H2 ((%*C*CD 	//+,x/?/?/II  K( 	''*+h.>.>x.HH  $$ 	,%%d++	,s:   2JJ)B!L0 J
 (BL0 
B#L--L0 0CO;:O;c                B     X     g! [         R                   a     gf = f)z!True if the given changeid existsTF)r   r  )rO   r  s     rT   __contains__localrepository.__contains__  s'    	N$$ 		s    c                    gr   r[   r   s    rT   __nonzero__localrepository.__nonzero__  r  rZ   c                L    U R                  5       n[        UR                  5      $ rG   )rH   r  r  rO   rR   s     rT   __len__localrepository.__len__  s     4>>""rZ   c                ,    [        U R                  5      $ rG   )iterr  r   s    rT   __iter__localrepository.__iter__  s    DNN##rZ   c                h    [         R                  " U/UQ76 n[        R                  " U5      " U 5      $ )a  Find revisions matching a revset.

The revset is specified as a string ``expr`` that may contain
%-formatting to escape certain types. See ``revsetlang.formatspec``.

Revset aliases from the configuration are not expanded. To expand
user aliases, consider calling ``scmutil.revrange()`` or
``repo.anyrevs([expr], user=True)``.

Returns a smartset.abstractsmartset, which is a list-like interface
that contains integer revisions.
)r.   spectreer-   makematcher)rO   exprr   trees       rT   revslocalrepository.revs  s/     ""4/$/!!$'--rZ   c              '  L   #    U R                   " U/UQ76  H	  nX   v   M     g7f)a.  Find revisions matching a revset and emit changectx instances.

This is a convenience wrapper around ``revs()`` that iterates the
result and is a generator of changectx instances.

Revset aliases from the configuration are not expanded. To expand
user aliases, consider calling ``scmutil.revrange()``.
N)r  )rO   r  r   rr  s       rT   rW   localrepository.set   s&      4'$'A'M (s   "$c                x   US/:X  a  [         R                  " [        /5      $ US/:X  a8  U R                  R	                  S5      nUb  [         R                  " US   /5      $ U(       a6  [         R
                  " U R                  U[         R                  " U 5      US9nO[         R
                  " SXS9nU" U 5      $ )a  Find revisions matching one of the given revsets.

Revset aliases from the configuration are not expanded by default. To
expand user aliases, specify ``user=True``. To provide some local
definitions overriding user aliases, set ``localalias`` to
``{name: definitionstring}``.
rj  rn  Nr   )rN  
localalias)r  )r-   basesetr   r  r   matchanyr   lookupfn)rO   specsuserr  
quick_datar  s         rT   anyrevslocalrepository.anyrevs,  s     WI>>7),,TF?4488>J%~~z!}o66t,%	A eCAwrZ   c                     SU R                   -   $ )Ns   file:r  r   s    rT   r  localrepository.urlE  s    $))##rZ   c                H    [         R                   " U R                  XU40 UD6$ )zCall a hook, passing this repo instance.

This a convenience method to aid invoking hooks. Extensions likely
won't call this unless they have registered a custom hook or are
replacing code that is expected to call a hook.
)r   r   )rO   r   throwr   s       rT   r   localrepository.hookH  s      yy$e<t<<rZ   c                b     " S S5      nU" 5       nU R                  5       u  Ul        Ul        U$ )zEReturns a tagscache object that contains various tags related
caches.c                      \ rS rSrS rSrg)-localrepository._tagscache.<locals>.tagscacheiX  c                <    S =U l         U l        S =U l        U l        g rG   )r3   tagtypesnodetagscachetagslistr   s    rT   rj   6localrepository._tagscache.<locals>.tagscache.__init__Y  s!     -10	DM599"T]rZ   )r  r3   r  r  N)r\   r]   r^   r_   rj   ra   r[   rZ   rT   	tagscacher  X  s    :rZ   r  )	_findtagsr3   r  )rO   r  caches      rT   
_tagscachelocalrepository._tagscacheQ  s/    		: 		: %)^^%5"
ENrZ   c                L   0 nU R                   R                  (       a  U R                  5       u  p#OU R                  R                  nU R                   R
                  nUR                  5        H  u  pV U" U5        XaU'   M     U$ ! [        R                  [        4 a     M5  f = f)zreturn a mapping of tag to node)
r  r  r  r  r3   r?  r  r   r@  r  )rO   tr3   ttr?  kvs          rT   r3   localrepository.tagsh  s    >>&&~~'HD"??''Dnn  JJLDAA!	 !  %%z2 s   3BB#"B#c                   [         R                  " U R                  U 5      nU Vs0 s H  o"S_M     nn[         R                  " U R                  XU5        0 nUR	                  5        H1  u  nu  pgX`R
                  :w  d  M  Xd[        R                  " U5      '   M3     U R                  R                  5       US'   UR	                  5        VVs0 s H  u  pX[        R                  " U5      U_M     nnnXC4$ s  snf s  snnf )aM  Do the hard work of finding tags.  Return a pair of dicts
(tags, tagtypes) where tags maps tag name to node, and tagtypes
maps tag name to a string like 'global' or 'local'.
Subclasses or extensions are free to add their own tags, but
should be aware that the returned dicts will be retained for the
duration of the localrepo object.s   globalr  )
tagsmodfindglobaltagsr   readlocaltagsr  r  r   tolocalr  r  )	rO   alltagstagr  r3   r   rC  histrX   s	            rT   r  localrepository._findtagsy  s     (($7.56gsNg6dggth? ")--/D,4{{"/3X%%d+, #2 ~~))+V?G~~?O
?OmtHT"E)?O 	 
 ! 7
s   C6#C;c                L    U R                   R                  R                  U5      $ )z
return the type of the given tag. result can be:

'local'  : a local tag
'global' : a global tag
None     : tag does not exist
)r  r  r   )rO   tagnames     rT   tagtypelocalrepository.tagtype  s     ''++G44rZ   c                   U R                   R                  (       d  / nU R                  5       R                  5        H1  u  p#UR	                  U R
                  R                  U5      X#45        M3     [        U5       VVVs/ s H	  u  pBo2U4PM     snnnU R                   l        U R                   R                  $ s  snnnf )z)return a list of tags ordered by revision)r  r  r3   r  r   r  r?  r  )rO   lr  r  rr  s        rT   r  localrepository.tagslist  s    ''A		))+$..,,Q/67 ,>DQi'Hi71Ai'HDOO$''' (Is    B:c                   U R                   R                  (       d  0 nU R                   R                  R                  5        H&  u  p4UR	                  U/ 5      R                  U5        M(     UR                  5        H  nUR                  5         M     X R                   l        U R                   R                  R                  U/ 5      $ )z&return the tags associated with a node)	r  r  r3   r  
setdefaultr   valuessortr   )rO   rC  r  r  r  r3   s         rT   nodetagslocalrepository.nodetags  s    ,,M,,224((B/66q9 5%,,.		 /,9OO),,00r::rZ   c                8    U R                   R                  U5      $ )z;return the list of bookmarks pointing to the specified node)r  r  )rO   rC  s     rT   nodebookmarkslocalrepository.nodebookmarks  s    $$T**rZ   c                     U R                   U    $ )zcreturns a dictionary {branch: [branchheads]} with branchheads
ordered by increasing revision number)r  r   s    rT   r   localrepository.branchmap  s     !!$''rZ   c                    U R                   (       d+  U R                  5       n[        R                  " U5      U l         U R                   $ rG   )r  rH   rev_branch_cacherevbranchcacher  s     rT   r  localrepository.revbranchcache  s6    ##??$D#3#B#B4#HD ###rZ   c                B    U R                  5       R                  X5        g rG   )r  setdata)rO   r?  changelogrevisions      rT   register_changeset"localrepository.register_changeset  s    %%c=rZ   c                     U R                  5       R                  U5      $ ! [         a,    U(       d"  [        R                  " [        S5      U-  5      e gf = f)zreturn the tip node for a given branch

If ignoremissing is True, then this method will not raise an error.
This is helpful for callers that only expect None for a missing branch
(e.g. namespace).

s   unknown branch '%s'N)r   	branchtiprK   r   r  r   )rO   branchignoremissings      rT   r  localrepository.branchtip  sP    	>>#--f55 	 ++A.D,E,NOO		s   ! 3AAc                    [         R                  " X5      R                  5       nUc"  [        R                  " [        S5      U-  5      eU$ )Nr  )r/   	revsymbolrC  r   r  r   )rO   rP  rC  s      rT   rN  localrepository.lookup  sA      +002<''*B(Cc(IJJrZ   c                    U R                  5       R                  U5      (       a  U$ [        R                  " X5      R	                  5       $ rG   )r   	hasbranchr/   r  r  rO  s     rT   lookupbranchlocalrepository.lookupbranch  s9    >>%%c**J  +2244rZ   c                    U R                   nUR                  R                  nUR                  n/ nU H0  nU" U5      nUS L =(       d    Xt;   (       + nUR	                  U5        M2     U$ rG   )r  rp  rq  r  r   )	rO   rG  ru  rq  r  r   r  rr  resps	            rT   rE  localrepository.known  sa    ^^((""??A
AT	2Q]3DMM$  rZ   c                    U $ rG   r[   r   s    rT   r  localrepository.local  r   rZ   c                8    U R                   R                  SSSS9$ )N   phasess   publishT)	untrusted)r   r  r   s    rT   
publishinglocalrepository.publishing  s      ww!!)Z4!HHrZ   c                    U R                  5       (       d  gU R                  5       (       d  gU R                  S5      R                  R                  (       + $ )NFT   visible)r  r  r  r  r  r   s    rT   cancopylocalrepository.cancopy  s>    zz||  ==,66CCCCrZ   c                :    U R                   U R                  :w  a  gg)z2the type of shared repository (None if not shared)r  N)r  ro   r   s    rT   r  localrepository.shared	  s    ??dii'rZ   c                R    U R                   R                  " U R                  U/UQ76 $ rG   )r7   reljoinr  )rO   r   insidefs      rT   wjoinlocalrepository.wjoin	  s"    xx		17w77rZ   c                j    Uc  U R                   nU S    R                  X5        U R                  5         g rG   )r  
setparentsr{  )rO   rs  p2s      rT   r  localrepository.setparents	  s.    :BT
b%..0rZ   c                .    [         R                  " XX#US9$ )z[changeid must be a changeset revision, if specified.
fileid can be a file revision or node.)r  )r   filectx)rO   ro   r  fileidr  s        rT   r  localrepository.filectx	  s     I
 	
rZ   c                6    U R                   R                  5       $ rG   )r   getcwdr   s    rT   r!  localrepository.getcwd	  s    }}##%%rZ   c                8    U R                   R                  X5      $ rG   )r   pathto)rO   r   cwds      rT   r$  localrepository.pathto 	  s    }}##A++rZ   c                t   XR                   ;  Ga  / nU R                  R                  U5       H  u  p4US:X  a  M  [        R                  " U R
                  SU/5      nS nUnU R                  R                  5        H;  u  pUR                  U5      (       d  M  U	nU[        U5      S  R                  5       n  O   U(       d
  S nSUl        [        R                  " U5      S   (       d  Un
U
4S jnSU
R                  -   Ul        UR                  XVU45        M     X R                   U'   U R                   U   $ )N   !rZ   c                .    [         R                  " X5      $ rG   )r=   filter)scr   s      rT   r  -localrepository._loadfilter.<locals>.<lambda>2	  s    0ErZ   commandfilterr1  c                    U" X5      $ rG   r[   )r+  r,  oldfnr   s       rT   r  r-  7	  s    U1[rZ   zcompat-)r  r   configitemsrO  r   r  r  r  rU  r  lstripr\   r)   
getargspecr   )rO   r*  r  patcmdmfr   paramsr   filterfnr0  s              rT   _loadfilterlocalrepository._loadfilter#	  s   )))A GG//7$;^^DIIsSE:&*&7&7&=&=&?ND~~d++%!$SY[!1!8!8!:	 '@
 EB"1BK**2.q1E,1HB"+enn"<BK"&)*' 8( ()V$''rZ   c           	         U Hn  u  pEnU" U5      (       d  M  U R                   R                  SX&=(       d     [        R                  " UR                  5      4-  5        U" X6U R                   XS9n  U$    U$ )Ns   filtering %s through %s
)r   rP   filename)r   debugr)   sysbytesr\   )rO   
filterpatsr<  datar6  r   r5  s          rT   _filterlocalrepository._filter=	  so    %KBC(||0!F(9(9"++(FGH $dN & rZ   c                $    U R                  S5      $ )Ns   encoder9  r   s    rT   _encodefilterpats!localrepository._encodefilterpatsI	      	**rZ   c                $    U R                  S5      $ )Ns   decoderD  r   s    rT   _decodefilterpats!localrepository._decodefilterpatsM	  rG  rZ   c                     X R                   U'   g rG   )r  )rO   r   r*  s      rT   adddatafilterlocalrepository.adddatafilterQ	  s    "($rZ   c                    U R                   R                  U5      (       a  U R                   R                  U5      nOU R                   R                  U5      nU R	                  U R
                  X5      $ rG   )r  islinkreadlinkr  rA  rE  rO   r<  r@  s      rT   wreadlocalrepository.wreadT	  sT    99H%%99%%h/D99>>(+D||D22HCCrZ   c                T   U R                  U R                  X5      nSU;   a  U R                  R                  X!5        O`U R                  R                  " X4SU0UD6  SU;   a  U R                  R                  USS5        OU R                  R                  USS5        [        U5      $ )zpwrite ``data`` into ``filename`` in the working directory

This returns length of written (maybe decoded) data.
   lbackgroundclose   xFT)rA  rI  r  symlinkr  setflagsr  )rO   r<  r@  flagsrV  r   s         rT   wwritelocalrepository.wwrite[	  s     ||D22HC5=IId-IIOO0?CI u}		""8UD9		""8UE:4yrZ   c                :    U R                  U R                  X5      $ rG   )rA  rI  rQ  s      rT   
wwritedatalocalrepository.wwritedatat	  s    ||D22HCCrZ   c                    U R                   (       a  U R                  5       nOSnU(       a  UR                  5       (       a  U$ g)z4return the current transaction or None if non existsN)r  running)rO   trs     rT   r  "localrepository.currenttransactionw	  s/    >>!BB"**,,IrZ   c                  ^^^^^^ U R                   R                  SS5      (       d!  U R                   R                  SS5      (       a2  U R                  U R                  5      c  [        R
                  " S5      eU R                  5       mTb  TR                  TS9$ U R                  R                  S5      (       a'  [        R                  " [        S5      [        S5      S	9eU R                  R                  (       a  S
n[        R
                  " U5      eS[        R                  " 5       [        R                  " 5       4-  n[!        ["        R$                  " U5      R'                  5       5      nSU-   nU R)                  SSTUS9  U R+                  T5        U(       a  UnOU R                   R,                  nU R.                  n[0        R2                  " U 5      mS mU R                   R                  SS5      n	TS:w  a(  U	(       a!  U R4                  R7                  5       mUU4S jmUUUU4S jn
U4S jn[8        R8                  " UU R                  USSS U R:                  R<                  U
U[>        TS9mU RA                  5        H  u  pTRC                  X5        M     [E        U 5      TRF                  S'   [I        5       TRF                  S'   / TRF                  S'   0 TRF                  S'   UTRJ                  S'   TTRJ                  S'   TRF                  TRJ                  S '   TRM                  S!U R:                  RN                  5        UU4S" jnTRM                  S#U5        TRQ                  S$U RS                  T5      5        U4S% jnTRU                  S&U5        TRQ                  S'U RV                  5        [0        R2                  " T5      U l,        [Z        R\                  " U TT5        U R_                  5       bV  U R                  mU R`                  R                  S(5      (       d  TRc                  S)S 5        U4S* jnTRe                  S+U5        T$ ),Nr7  r  r  s   transaction requires locking)r      journals   abandoned transaction founds(   run 'hg recover' to clean up transactionr  z/cannot open a transaction with a dirty dirstates   %.40f#%fs   TXN:s
   pretxnopenT)r  txnnametxnidc                    g rG   r[   )xs    rT   r  -localrepository.transaction.<locals>.<lambda>	  s    drZ   r!  s   hook-track-tags   stripc                  > T" 5       nUc   e[         R                  " UR                  UT5      nUR                  R	                  5       n[         R                  " UR                  X5      n[         R
                  " UR                  XU5      nU(       a@  SU R                  S'   UR                  SSSS9 n[         R                  " Xe5        S S S 5        g g ! , (       d  f       g = f)N   1s	   tag_moveds   changes/tags.changes   wT)
atomictemp)	r  	fnoderevsr   r  headrevsdifftagshookargsr7   	writediff)	tr2rP   	oldfnodesnewheads	newfnodeschangeschangesfileoldheadsreporefs	          rT   	tracktags.localrepository.transaction.<locals>.tracktags	  s    y'''#--dggtXF	>>224#--dggtF	 "**477DYO15CLL./$ " $  ))+?   s   4C
C#c           	       > T" U 5        T" 5       nUc   eSnUR                   R                  " U6 nU(       ab  UR                   R                  " U6 S   nUR                  SS5      nUR                  SS5      (       a  SnOSn[        R
                  " XTXV5        [        R                  " UR                   S	5      (       a  [        TR                  S
   R                  5       5       Hq  u  nu  pTR                  R                  5       n
U
R                  [        R                  " XxU	5      5        UR                  "  SSS0[         R"                  " U
5      D6  Ms     [        R                  " UR                   S5      (       a  UR%                  5       R&                  nTR                  S    H  u  nu  pU H  nTR                  R                  5       n
[)        UR+                  U5      5      nU
R                  [,        R                  " XU	5      5        UR                  "  SSS0[         R"                  " U
5      D6  M     M     UR                  "  SSS0[         R"                  " TR                  5      D6  g)zwill run pre-closing hooksN)r!  s   single-head-per-branchr   s   account-closed-headsFs   public-changes-onlys	   immutabler     pretxnclose-bookmarkr  r  T   pretxnclose-phaser	  )r  )r  )s   pretxnclose)r   r  configsuboptionsr   r/   enforcesingleheadr   hashookr  ry  r  rs  r  r   r   preparehookargsr)   r   rH   r  r
   rC  r&   )ru  rP   singleheadopt
singleheadsingleheadsubaccountclosedr  r   rS  rT  r   ru  r  r?  rC  descr|  rb  r}  s                  rT   validate-localrepository.transaction.<locals>.validate	  s!   $ cN9D###HM++];J $ 8 8- H K - 1 1+U! !$$%;UCC!-J!+J))t] ||DGG%<==(.JJ|,224)$D*3 ;;++-DKK	 9 9$S IJII/" #,,T2) ||DGG%9::__&00(*

9(=$D*3#!{{//1"2773<0F$:$:4c$JK		0"& '006	  $ )> II&*.6.@.@.MrZ   c                   > T" 5       nUc  g U(       a  UR                   R                  S 5        g UR                  SS9  g rb  )r   r  rB  )rb  successrP   r|  s      rT   	releasefn.localrepository.transaction.<locals>.releasefn+
  s;    9D|
  ##D) t4rZ      undoc                     g rG   r[   r[   rZ   rT   r  rj  E
  s    DrZ   )	validatorr  checkambigfilesr      origrepolens
   obsmarkersr	  r  s   txnids   txnnames   changess   flush-fncachec                j   >^ U R                   mUUU4S jnT" 5       nUc   eUR                  U5        g)z@To be run if transaction is successful, will schedule a hook runc           	       > T" 5       nUc   e[         R                  " UR                  S5      (       a  [        TR                  S   R                  5       5      nU Hq  u  nu  pETR                  R                  5       nUR                  [        R                  " X4U5      5        UR                   "  S	SS0[        R                  " U5      D6  Ms     [         R                  " UR                  S5      (       a  UR                  5       R                  n[        TR                  S   S S9nU H  u  n	u  pEU	 H  n
TR                  R                  5       n[        UR!                  U
5      5      nUR                  ["        R                  " XU5      5        UR                   "  S
SS0[        R                  " U5      D6  M     M     UR                   "  SSS0[        R                  " T5      D6  g )N   txnclose-bookmarkr  r  F   txnclose-phaser	  c                    U S   S   $ )Nr   r[   )rr  s    rT   r  Ulocalrepository.transaction.<locals>.txnclosehook.<locals>.hookfunc.<locals>.<lambda>u
  s    QqT!WrZ   )rP  )r  )r  )s   txnclose)r   r  r   r  ry  r  rs  r  r   r   r  r)   r   rH   r  r
   rC  r&   )unused_successrP   	bmchangesr   rS  rT  r   ru  phasemvr  r?  rC  rs  r|  rb  s               rT   hookfuncClocalrepository.transaction.<locals>.txnclosehook.<locals>.hookfuncc
  s   y'''<<)=>> &rzz,'?'E'E'G HI,5(js!{{//1I$=$=d$MN		0"' '006 -6 <<):;;*44B$

9-3DG -4(js#'C#%;;#3#3#5D#&rwws|#4D KK(>(>t#(NO II 1&+ #+"4"4T":	 $( -4 		',080B0B80LrZ   N)rs  
_afterlock)ru  r  rP   rs  r|  rb  s      @rT   txnclosehook1localrepository.transaction.<locals>.txnclosehook[
  s5     ||H!F 9D###OOH%rZ   s   txnclose-hooks   -warm-cachec                   > T" 5       nUc   eUR                   "  SSS0[        R                  " U R                  5      D6  g)z#To be run if transaction is abortedNr  F)s   txnabort)r   r)   r   rs  )ru  rP   r|  s     rT   txnaborthook1localrepository.transaction.<locals>.txnaborthook
  sD    9D###II#(,4,>,>s||,LrZ   s   txnabort-hooks   refresh-filecachestatss   branchr4  c                V   > TR                  5        H  nU R                  USSS9  M     g )NTrh   )hardlinkr   )all_file_names	addbackup)rb  r   dss     rT   backup_dirstate4localrepository.transaction.<locals>.backup_dirstate
  s*    **,A LLTHLE	 -rZ   s   dirstate-backup)3r   r  r  r  r   r   r  nestr  r  r  r   r   _dirtyrandomtimer
   r<   sha1digestr   _writejournalr]  r  r  r  r  rq  r4   r1   r  rk   _journalfilesadd_journalr  ry  rW   rs  addfinalizer  addpostclose_buildcacheupdateraddabort_refreshfilecachestatsr  r/   registersummarycallbackcurrentwlockr7   	setbranchaddvalidator)rO   r  reportr  idbaseharg  rpvfsmapshouldtracktagsr  r  vfs_idro   r  r  r  r  r{  r|  rb  r}  s    `               @@@@@rT   r4   localrepository.transaction	  s   77h88DGG<N<Nn=
 =
   /7,,-LMM$$&>777%% 99J''//01BC   ==AA((++==v&--/0"		-tT	G4 BB++d#D #	'',,/
 8~~..0H@&>	 >	@	5( $$IIJJ!!(
 !..0LFNN6( 1%(Y

>"$'E

=! "

9#%

<  %H"&J"$**J 	')9)9:-	&^ 	'6
 	(?(?(CD	 	$l3 	143N3NO R''b$7  *B88??9--Z.F OO.@	rZ   c                :    U R                   S4U R                  S44$ )Nre     journal.descr  r   s    rT   r  localrepository._journalfiles
  s$    YY
#XX'
 	
rZ   c                n    U R                  5        VVs/ s H  u  pU[        U5      4PM     snn$ s  snnf rG   )r  undoname)rO   r7   ri  s      rT   	undofileslocalrepository.undofiles
  s0    151C1C1EF1Evshqk"1EFFFs   1c                X    U R                   R                  SS[        U 5      U4-  5        g )Nr  s   %d
%s
)r7   r  r  )rO   r  s     rT   r  localrepository._writejournal
  s"    s4y$6G(GHrZ   c           	        U R                  5          U R                  R                  S5      (       a  U R                  R	                  [        S5      5        U R                  n[        R                  " U R                  USU R                  R                  [        S9  U R                  5          S S S 5        gU R                  R                  [        S5      5         S S S 5        g! , (       d  f       g = f)Nre  s%   rolling back interrupted transaction
)r  Ts%   no interrupted transaction available
F)r   r  r  r   statusr   r  r4   rollbackr]  rk   rB  )rO   r  s     rT   recoverlocalrepository.recover
  s    YY[yy
++q!JKL$$IIGGLL$0 ! [ QHIJ [[s   BC$6%C$$
C2c                D   S =p4 U R                  5       nU R                  5       nU R                  R                  S5      (       a  U R	                  X5      [        XC5        $ U R                  R                  [        S5      5         [        XC5        g! [        XC5        f = f)Nr  s"   no rollback information available
r   )	wlockr   r  r  	_rollbackreleaser   r]  r   )rO   dryrunforcer  r   s        rT   r  localrepository.rollback
  s|    		!JJLE99;Dyy((~~f4
 D  QEFGD GD s   AB !$B Bc           	       ^ ^^ T R                   nT R                  R                  5       n T R                  R	                  S5      R                  5       n[        US   5      US   S pn[        U5      S:  a  US   nUS-
  mU(       a"  UR                  (       a  [        S5      TXx4-  n	O[        S5      TU4-  n	[        UU 4S jU 5       5      n
U(       d9  T S   T S   :w  a-  US:X  a'  [        R                  " [        S5      [        S5      S9eUR                  U	5        U(       a  gT R                  5         T R                   nS nU
(       d  ["        n[$        R&                  " T R(                  USUR*                  [,        US9  T R/                  5         T R                  R/                  5         U
(       GaT  T R0                  R2                  R4                  m[7        U4S jT R                  R8                   5       5      (       dc  T R                  R;                  T 5         T R                  R=                  T R>                  5        T R                  RA                  5         S S S 5        [C        T S    R                  5        Vs/ s H  oRE                  5       PM     sn5      n[        U5      S:  a  UR                  [        S5      U-  5        OUR                  [        S5      U-  5        [F        RH                  RK                  T 5        T RM                  5         g! [         a    [        S	5      n	S nS
n
 GNhf = f! , (       d  f       N= fs  snf )Ns	   undo.descr   r   r  r1  s8   repository tip rolled back to revision %d (undo %s: %s)
s4   repository tip rolled back to revision %d (undo %s)
c              3  P   >#    U  H  nTU   R                  5       T:  v   M     g 7frG   )r?  )r  poldtiprO   s     rT   r  ,localrepository._rollback.<locals>.<genexpr>
  s      EWT!W[[]V3Ws   #&s!   rolling back unknown transaction
Trn  r     commits;   rollback of last commit while not checked out may lose datas   use -f to forcer  r  )r  skip_journal_patternc              3  4   >#    U  H  nT" U5      v   M     g 7frG   r[   )r  r  has_nodes     rT   r  r  %  s     >,=qx{{,=s   s3   working directory now based on revisions %d and %d
s+   working directory now based on revision %d
)'r   r   ro  r7   r  
splitlinesr  r  verboser   r  r  r   rW  r  
destroyingr  RE_SKIP_DIRSTATE_ROLLBACKr4   r  r  r]  rk   rB  r  rp  r  all_plchanging_parentsr  r  clearr  r?  mergestatemodr    clean	destroyed)rO   r  r  r   ro  r   oldlenr  detailru  
parentgoner  r  r  r  r  s   `             @@rT   r  localrepository._rollback
  s   WW--'')	88==.99;D&)$q'lDGT6V4yA~aaZF"**( T*+
 LTN# EWEEJ dtF|3	8I++% )*  			###< IIGG(!5	
 	  "~~++44H>DMM,=,=>>> ]]33D9MM,,T[[9MM'') : d4j.@.@.BC.BUUW.BCDG7|a		1 	 		EFP $$**40
 	  	9:CDJ	P :9 Ds%   B%L  A L<ML98L9<
M
c                @   ^ [         R                  " U 5      mU4S jnU$ )zcalled during transaction to build the callback updating cache

Lives on the repository to help extension who might want to augment
this logic. For this purpose, the created transaction is passed to the
method.
c                @   > T" 5       nUc   eUR                  U 5        g rG   )updatecaches)rb  rP   r|  s     rT   updater3localrepository._buildcacheupdater.<locals>.updaterK  s$    9D###b!rZ   r  )rO   newtransactionr  r|  s      @rT   r  "localrepository._buildcacheupdaterA  s     ++d#	"
 rZ   c                   Ub   UR                   R                  S5      S:X  a  gU R                  5       nUc  [        R                  n[        R
                  U;   a  Ub  UR                  S   [        U 5      :  a  U R                  R                  S5        [        R                  U;   nU R                  S5      nU R                  R                  XeS9  U R                  S5      nU R                  R                  XuS9  [        R                  U;   a  U R                  R!                  US	9  [        R"                  U;   a  U R$                  R!                  US	9  U R&                  R)                  5        H\  nUR*                  (       d  M  UR,                  (       d  M)  UR/                  U 5      R1                  5       n	U	c  MM  U	R!                  US	9  M^     [        R2                  U;   aD  UR5                  5       n
UR                   H  nU
R7                  U5        M     U
R9                  5         [        R:                  U;   a*  U S
   R=                  5        H  nUR?                  5         M     [        R@                  U;   a  [B        RD                  " U 5        [        RF                  U;   a  U RI                  5         [        RJ                  U;   a  U R                  S5      RI                  5         [        RL                  U;   ab  [        R                  U;   n[N        RP                  RS                  5        H-  nU R                  U5      nU R                  R                  XS9  M/     U R                  RU                  U 5        g)ar  warm appropriate caches

If this function is called after a transaction closed. The transaction
will be available in the 'tr' argument. This can be used to selectively
update caches relevant to the changes in that transaction.

If 'full' is set, make sure all caches the function knows about have
up-to-date data. Even the ones usually loaded more lazily.

The `full` argument can take a special "post-clone" value. In this case
the cache warming is made after a clone and of the slower cache might
be skipped, namely the `.fnodetags` one. This argument is 5.8 specific
as we plan for a cleaner way to deal with this for 5.9.
Ns   sourcerk  r  s   updating the branch cache
r   )detect_pure_topor   )r4   rn  )+rs  r   rH   r;   CACHES_DEFAULTCACHE_BRANCHMAP_SERVEDry  r  r   r=   CACHE_BRANCHMAP_DETECT_PURE_TOPOr  r  update_diskCACHE_CHANGELOG_CACHEr  update_cachesCACHE_MANIFESTLOG_CACHEr+  r1   walk	is_revlogis_manifestlogget_revlog_instance
get_revlogCACHE_REV_BRANCHr  
branchinfor  CACHE_FULL_MANIFESTro  manifestCACHE_FILE_NODE_TAGSr  
warm_cacheCACHE_TAGS_DEFAULTr3   CACHE_TAGS_SERVEDCACHE_BRANCHMAP_ALLr*   filtertablekeyswrite_dirty)rO   rb  fullcachesrR   dptservedserved_hiddenentrymanifestrevlogrbcrr  r  filtr  s                  rT   r  localrepository.updatecachesR  s     >bkkooi8HD  >..F,,6zRZZ7#d)C<= AAVKy1""..v.L $.> ?""..! /  ++v5NN((R(8--7**r*:*++!&!:!:4!@!K!K!M!-"00R0@ + &&&0%%'C^^q! $IIK))V3Dz))+ , **f4t$((F2IIK''61MM)$))+))V3 ==GC ,,113==.""..x.N 4
 	&&t,rZ   c                    S[        U 5      ;   a  U R                  S	 U R                  R                  5         U R	                  5         U R
                  R                  5         g )Nr  )r   rI   r  r  invalidatevolatilesetsr  r   s    rT   invalidatecaches localrepository.invalidatecaches  sJ    4:%l+  "##%""((*rZ   c                    U R                   R                  5         [        R                  " U 5        U R	                  5         g rG   )r  r  r$   clearobscachesr{  r   s    rT   r!  &localrepository.invalidatevolatilesets  s.    ##%%..0rZ   c                    U R                  5       nSUR                  ;   a+  U R                  R                  (       a   eUR                  S	 gg)ai  Invalidates the dirstate, causing the next call to dirstate
to check if it was modified since the last time it was read,
rereading it if it has.

This is different to dirstate.invalidate() that it doesn't always
rereads the dirstate. Use dirstate.invalidate() if you want to
explicitly read the dirstate again (i.e. restoring it to a previous
known good state).r   N)rH   rI   r   is_changing_anyr  s     rT   invalidatedirstate"localrepository.invalidatedirstate  s@      &}}4444j) 'rZ   c                   U R                  5       n[        U R                  R                  5       5       Hp  nUS:X  a2  U R	                  5       (       a  U R
                  R                  (       a  M;  U(       a  U R                  U	  [        U[        R                  " U5      5        Mr     U R                  5         U R	                  5       (       d  U R                  R                  5         gg! [         a     M  f = f)a  Invalidates both store and non-store parts other than dirstate

If a transaction is running, invalidation of store is omitted,
because discarding in-memory changes might cause inconsistency
(e.g. incomplete fncache causes unintentional failure, but
redundant one doesn't).
r$  N)rH   listr   r  r  r  is_delayingdelattrr)   r   AttributeErrorr"  r1   )rO   rc  rH   r  s       rT   rB  localrepository.invalidate  s     __&
doo**,-A\!++--NN..
 OOA&
 
HOOA$67% .* 	&&(( JJ'')	 ) " s    C))
C76C7c                D    U R                  5         U R                  5         g)zqFully invalidates both store and non-store parts, causing the
subsequent operation to reread any outside changes.N)rB  r)  r   s    rT   invalidatealllocalrepository.invalidateall  s     	!rZ   c                    U R                   R                  5        HB  u  p#[        R                  " U5      nUS:X  d  X R                  ;  a  M2  UR                  5         MD     g)z>Reload stats of cached files so that they are flagged as validr   N)r   r  r)   r   rI   r/  )rO   rb  r  ces       rT   r  &localrepository._refreshfilecachestats  sG     __**,EA"AJ!=="8JJL	 -rZ   c                   SnSn	U(       a8  U R                   R                  SS5      nU R                   R                  SS5      n	U R                   R                  SS5      n
U R                   R                  SS5      nU(       d  S nUc)  [        R
                  " U R                   UUUU	UUUU
US9
nU$ [        R                  " U R                   UUUUUUU
S	9nU$ )
Nr      uis   timeouts   timeout.warns   signal-safe-lockr7  s   lock-wait-sync-file)r  	acquirefnr  
signalsafedevel_wait_sync_file)r  r9  r  r:  )r   r#  r  r  lockmodtrylock
steal_lock)rO   r7   locknamewaitr  r9  r  
steal_fromtimeoutwarntimeoutr:  	sync_filer  s                rT   _locklocalrepository._lock  s     gg''z:G''++E?CKWW''/BC
GGNN8-CD	I##%%.A0  ""##%	A rZ   c                    U R                   U R                  4 HJ  nU=(       a    U" 5       nU(       d  M  UR                  (       d  M/  UR                  R	                  U5          g   U" S5        g)zadd a callback to be run when the repository is fully unlocked

The callback will be executed when the outermost lock is released
(with wlock being higher level than 'lock').TN)r  r  heldpostreleaser   )rO   r  r  r  s       rT   r  localrepository._afterlock*  sQ    
 NNDMM2CAqQVVV$$X.	 3 TNrZ   c           
     v   U R                  U R                  5      nUb-  Ub  Sn[        R                  " U5      eUR	                  5         U$ Uc  U R                  SSS9  U R                  U R                  SUSU R                  [        S5      U R                  -  US9n[        R                  " U5      U l        U$ )	a  Lock the repository store (.hg/store) and return a weak reference
to the lock. Use this before modifying the store (e.g. committing or
stripping). If you are opening a transaction, get a lock as well.)

If both 'lock' and 'wlock' must be acquired, ensure you always acquires
'wlock' first to avoid a dead-lock hazard.


The steal_from argument is  used during local clone when reloading a
repository. If we could remove the need for this during copy clone, we
could remove this function.
Nz#cannot steal lock if already lockeds   prelockTr  s   locks   repository %sr7   r?  r@  r  r9  r  rA  )r  r  r   r   r   r   rE  r  rB  r   r  r  r  )rO   r@  rA  r  ru  s        rT   r   localrepository.lock7  s     dmm,=%;,,S11FFHHIIjI-JJ		oo#$t}}4!  
  ArZ   c           
       ^  T R                  T R                  5      nUb-  Ub  Sn[        R                  " U5      eUR	                  5         U$ Uc  T R                  SSS9  U(       ay  T R                  R                  SS5      (       d!  T R                  R                  SS5      (       a7  T R                  T R                  5      b  T R                  R                  S5        U 4S	 jnT R                  T R                  S
UUT R                  [        S5      T R                  -  US9n[        R                   " U5      T l        U$ )a  Lock the non-store parts of the repository (everything under
.hg except .hg/store) and return a weak reference to the lock.

Use this before modifying files in .hg.

If both 'lock' and 'wlock' must be acquired, ensure you always acquires
'wlock' first to avoid a dead-lock hazard.

The steal_from argument is  used during local clone when reloading a
repository. If we could remove the need for this during copy clone, we
could remove this function.
z$cannot steal wlock if already lockeds   prewlockTrL  r7  r  r  s   "wlock" acquired after "lock"c                   > TR                   R                  (       a8  Sn TR                  R                  U 5        TR                   R	                  5         OSTR                   R
                  (       a  Sn TR                  R                  U 5        TR                   R                  S 5        TR                  5       nSUR                  ;   a  UR                  S	 g g )Ns1   wlock release in the middle of a changing parentss   dirty dirstate on wlock releaser   )	r   r(  r   r  rB  r  r  rH   rI   )ru  rR   rO   s     rT   unlock%localrepository.wlock.<locals>.unlockz  s    }},,J!!#&((*==''<CGG%%c*##D)??$DT]]*MM*- +rZ   s   wlocks   working directory of %srM  )r  r  r   r   r   r   r   r  r  r  rE  r7   r)  r   r  r  r  )rO   r@  rA  r  ru  rQ  s   `     rT   r  localrepository.wlockZ  s    dnn-=%<,,S11FFHHIIkI. GGx99ww!!(N;;  /;!!"BC	. JJ---.>!  
 !QrZ   c                F    Uc  gU" 5       nUb  UR                   (       d  gU$ )3Returns the lock if it's held, or None if it's not.N)rH  )rO   lockrefr  s      rT   r  localrepository._currentlock  s$    ?I9AFFrZ   c                8    U R                  U R                  5      $ )z4Returns the wlock if it's held, or None if it's not.)r  r  r   s    rT   r  localrepository.currentwlock  s      00rZ   c                8    U R                  U R                  5      $ )rU  )r  r  r   s    rT   rA  localrepository.currentlock  s      //rZ   c                   UR                  5       (       d  UR                  5       (       GaA  [        UR                  UR                  -   UR
                  -   5      nUR                  5        H  nU R                  R                  U5      nUS:X  d  Xe;   d  XaR                  ;   a  M:  XcR                  ;   a  U" U[        S5      5        U R                  R                  U5      (       d$  UR                  5       R                  U5      (       a;  US-   nU H  nUR!                  U5      (       d  M    M     U" U[        S5      5        M  X`R                  ;  d  M  U" U[        S5      5        M     gg)z2check for commit arguments that aren't committablern  s   file not found!r  s   no match under directory!s   file not tracked!N)isexactrs  rW   modifiedaddedremovedrY  r   	normalizer  deletedr   r  r  rs  hasdirrU  )	rO   wctxr   r  failmatchedr   dr6  s	            rT   checkcommitpatterns#localrepository.checkcommitpatterns  s   ==??ellnn&//FLL86>>IJG[[]MM++A.9]]0B&A01299??1%%)9)9!)<)<DA%==++! & Q"> ?@mm+A234 # -rZ   c                h	  ^ ^^^ Uc  0 nS nU(       d  [         R                  " 5       nU(       d  Xl        T R                  5          T R	                  5          T S   n	[        U	R                  5       5      S:  n
U(       d;  U
(       a4  UR                  5       (       d  [        R                  " [        S5      5      eT R                  XES9nU(       a%  UR                  R                  UR                  5        [        R                  " T R                   XXES9u  pnU(       d  T R#                  XX5        [$        R&                  " T XX#U5      n[(        R*                  R-                  T 5      n[.        R0                  " U5        UR3                  5       (       a^  T R                   R5                  SS5      (       d=  T R                   R7                  S	5        UR9                  5          SSS5        SSS5        gU
(       a4  UR;                  5       (       a  [        R                  " [        S
5      5      eU(       a  U" T X5      Ul        XR<                  :g  nT R?                  UR<                  5      nU(       a  [@        RB                  " T 5      n[E        U5       H~  nU	RG                  U5      nT R                   R                  [        S5      U" [        RH                  " U5      5      -  5        URK                  UR<                  X#5      nUU   S   U4UU'   M     [        RL                  " T U5        T RN                  R                  5       u  nn[Q        U5      UT RR                  :g  =(       a    [Q        U5      =(       d    Ssmm T RU                  SSTTS9  T RW                  S5         T RY                  US5      m[Z        R\                  " T UU/T5        UR_                  T5        UR9                  5         SSS5        SSS5        SSS5        UUUU 4S jnT Rc                  U5        T$ ! , (       d  f       N:= f!   U(       aN  T R                   Ra                  [        S5      U-  5        T R                   Ra                  [        S5      U-  5        e = f! , (       d  f       N= f! , (       d  f       N= f)zAdd a new revision to current repository.

Revision information is gathered from the working directory,
match can be used to filter the committed files. If editor is
supplied, it is called to get a commit message.
Nc                6    [         R                  " SX4-  5      e)Ns   %s: %s)r   
InputError)r   ru  s     rT   re  $localrepository.commit.<locals>.fail  s    ""9x#788rZ   r   sB   cannot partially commit a merge (do not specify files or patterns))r   r  )r  r8  s   allowemptycommits(   nothing to commit, clearing merge state
s&   cannot commit merge with missing filess   committing subrepository %s
r   rZ   s	   precommitT)r  parent1parent2r  s!   note: commit message saved in %s
s6   note: use 'hg commit --logfile %s --edit' to reuse it
c                ~   > TR                   R                  T5      (       a  TR                  S[        T5      TTS9  g g )Nr  )rC  rn  ro  )r  hasnoder   r
   )r  hookp1hookp2rg  rO   s    rT   
commithook*localrepository.commit.<locals>.commithook7  s=     ~~%%c**		CHff   +rZ   )2rO  rP  badr  r   r  ro  r   rW  r   r  r^  extendr  r2   	precommitr   rh  r   workingcommitctxr  r    r  r!   checkunresolvedisemptyr  r=  resetrb  _textsavecommitmessager/   getuipathfnr  r  
subrelpathr   
writestater   r
   r  r   r4   	commitctxr   r   markcommittedr  r  )rO   textr  dater   r  editorextrare  rd  merger  subs
commitsubsnewstatecctxmseditedmsg_pathuipathfnr+  r  srrs  r  rt  rr  rs  rg  s   `                         @@@rT   r   localrepository.commit  s   " =E	9 OO%EI ZZ\499;:D'!+EU5<<>>kk>  [[u[:F&&LL
 *5)>)>u*&Dh
 ((fC++fDD ))..t4B%%b) ||~~dgg&8&8*' ' JK
Q '\\T kk!$M"NOO#D$5
ZZ'F
 --djj9H "..t4
+A((1+CGGNN:;";#9#9##>?@ DJJ;B#+A;q>2"6HQK , &&tX6]]**,FB WrT[['8'DSW'KNFF		 ff   %%i0..t4C$$TB8S9&&s+HHJ 1S '\z	 	 	
#
; 10GGMM?@8K GGMM8 #	# w ';\\sj   R#FR"R#3FR#P7$AP&2P7:R#&
P40P73R4P77ARR
R 	R##
R1c                ,    [         R                  " XX#S9$ )N)r   origctx)r   r  )rO   r  r   r  s       rT   r  localrepository.commitctxB  s    HHrZ   c                Z    S[        U 5      ;   a  U R                  R                  U 5        gg)a  Inform the repository that nodes are about to be destroyed.
Intended for use by strip and rollback, so there's a common
place for anything that has to be done before destroying history.

This is mostly useful for saving state that is in memory and waiting
to be flushed when the current lock is released. Because a call to
destroyed is imminent, the repo will be invalidated causing those
changes to stay in memory (waiting for the next unlock), or vanish
completely.
r  N)r   r  r  r   s    rT   r  localrepository.destroyingF  s)     DJ&""4( 'rZ   c                D    U R                  5         U R                  5         g)zInform the repository that nodes have been destroyed.
Intended for use by strip and rollback, so there's a common
place for anything that has to be done after destroying history.
N)r  rB  r   s    rT   r  localrepository.destroyedX  s     	 	rZ   c                ,    X   R                  X#XEXg5      $ )z3a convenience method that calls node1.status(node2))r  )rO   node1node2r   ignoredr  unknownlistsubreposs           rT   r  localrepository.statusm  s      {!!''
 	
rZ   c                :    U R                   R                  U5        g)a  Add a callback to run within the wlock, at the point at which status
fixups happen.

On status completion, callback(wctx, status) will be called with the
wlock held, unless the dirstate has changed from underneath or the wlock
couldn't be grabbed.

Callbacks should not capture and use a cached copy of the dirstate --
it might change in the meanwhile. Instead, they should access the
dirstate via wctx.repo().dirstate.

This list is emptied out after each status run -- extensions should
make sure it adds to this list each time dirstate.status is called.
Extensions should also make sure they don't call this for statuses
that don't involve the dirstate.
N)r  r   )rO   pss     rT   addpostdsstatuslocalrepository.addpostdsstatus|  s    ( 	!!"%rZ   c                    U R                   $ )zAUsed by workingctx to get the list of post-dirstate-status hooks.r  r   s    rT   postdsstatuslocalrepository.postdsstatus  s    !!!rZ   c                "    U R                   SS2	 g)z7Used by workingctx to clear post-dirstate-status hooks.Nr  r   s    rT   clearpostdsstatus!localrepository.clearpostdsstatus  s    q!rZ   c                   UcF  U R                   n[        UR                  5       5      nU Vs/ s H  oBR                  U5      PM     sn$ U R                   R	                  U5      n[        XPR                   R                  SS9$ s  snf )NT)rP  reverse)r  reversedrq  rC  r4  r  r?  )rO   startru  rq  r?  r4  s         rT   r4  localrepository.heads  sk    =B.H,45HSGGCLH55$$U+e!3!3TBB	 6s   Bc           	     X   Uc  U S   R                  5       nU R                  5       nUR                  U5      (       d  / $ [        [	        UR                  XS95      5      nUbB  [        U R                  R                  U/U5      S   5      nU Vs/ s H  owU;   d  M
  UPM     nnU$ s  snf )a.  return a (possibly filtered) list of heads for the given branch

Heads are returned in topological order, from newest to oldest.
If branch is None, use the dirstate branch.
If start is not None, return only heads reachable from start.
If closed is True, return heads that are marked as closed as well.
N)closedr1  )	r  r   r   r,  r  branchheadsrW   r  nodesbetween)rO   r  r  r  r  bheadsfbheadshs           rT   r  localrepository.branchheads  s     >$Z&&(F>>#!!&))Ihx33F3JKL$..55ugvFqIJG!'8A<aF8 9s   	B'B'c                *   U(       d  U R                   R                  5       /n/ nU Hh  nUn U R                   R                  U5      nUS   U R                  :w  d  US   U R                  :X  a  UR	                  XCUS   US   45        Mc  US   nMd     U$ )Nr   r   )r  r  ro  r  r   )rO   rG  rm  r  r  r  s         rT   r  localrepository.branches  s    ^^'')*EAANN**1-Q44;;&!A$$++*=HHaAaD!A$/0aD   rZ   c                $   / nU H  u  p4U/ SpvnSnXT:w  ae  XPR                   :w  aV  U R                  R                  U5      S   n	Xx:X  a  UR                  U5        US-  nU	nUS-  nXT:w  a  XPR                   :w  a  MV  UR                  U5        M     U$ )Nr   r   r1  )r  r  ro  r   )
rO   r|  rr  topbottomr  r  r  r   r  s
             rT   r{  localrepository.between  s     KC2q!AA+!{{"2NN**1-a06HHQKAAQ +!{{"2 HHQK ! rZ   c                    g)zExtensions can override this function if additional checks have
to be performed before pushing, or call it if they override push
command.
Nr[   )rO   pushops     rT   	checkpushlocalrepository.checkpush  s    rZ   c                ,    [         R                  " 5       $ )zxReturn util.hooks consists of a pushop with repo, remote, outgoing
methods, which are called before pushing changesets.
)r6   hooksr   s    rT   prepushoutgoinghooks$localrepository.prepushoutgoinghooks  s    
 zz|rZ   c                  ^ ^^^^^	  T R                  5       n0 nUb  UR                  UR                  5        [        R                  " U5      nTUS'   TUS'   TUS'   TUS'   T R
                  " SSS0UD6  T R                  R                  S
TT4-  5        [        R                  " T TTTT5      m	UUUUU	U 4S jnT R                  U5        T	$ ! [        R                   as  nT R                  R                  [        S5      U-  5        UR                  (       a1  T R                  R                  [        S5      UR                  -  5         S nAg	S nAff = f)NrK  rP  rS  rT  r  Ts   pushkey-abort: %s
s   (%s)
Fs   pushing key for "%s:%s"
c           	     .   > TR                  STTTTTS9  g )Nr   )rK  rP  rS  rT  rg  )r   )r  rP  rK  rT  rS  rg  rO   s    rT   runhook(localrepository.pushkey.<locals>.runhook  s&    II#  rZ   )s
   prepushkey)r  r   rs  r)   r   r   r   	HookAbortr   	write_errr   r  r=  r(   pushr  )
rO   rK  rP  rS  rT  rb  rs  ri  r  rg  s
   `````    @rT   r(   localrepository.pushkey  s%   	((*BH~,))(3H$-H[!!HUO!HUO!HUOII<4<8< 	2i5EEFll4Cc:	 	 	 
'  	GGa 67#=>xx!!!I,"9:		s   A.C E"A)EEc                    U R                  SSUS9  U R                  R                  SU-  5        [        R                  " X5      nU R                  SXS9  U$ )Ns   prelistkeysT)r  rK  s   listing keys for "%s"
s   listkeys)rK  r  )r   r   r=  r(   r,  )rO   rK  r  s      rT   rJ  localrepository.listkeys  sM    		.		B09<=d.		+	BrZ   c                    SUU[         R                  " U5      [         R                  " U5      [         R                  " U5      4-  $ )z+used to test argument passing over the wirer'  r(  r*  s         rT   r0  localrepository.debugwireargs  r2  rZ   c                    U R                  SS5      n UR                  U5        UR                  5         U R                  UR                  [        U R                  5      S-   S  5      $ ! UR                  5         f = f)Ns   last-message.txts   wbr   )r7   r  r   r$  r   r  r  )rO   r  fps      rT   r~  !localrepository.savecommitmessage  sa    XX)51	HHTNHHJ{{2773tyy>A#5#7899 HHJs   A) )A;c                    [         R                  U R                  ;  a  g U R                  R	                  [
        R                  " U5      5        g rG   )r;   r  r  r  rl   r)   r)  )rO   categorys     rT   register_wanted_sidedata(localrepository.register_wanted_sidedata!  s6    ,,DMMA!!("2"28"<=rZ   c                   U[         R                  ;  a#  [        S5      n[        R                  " Xq-  5      e[
        R                  " U5      nX R                  R                  U/ 5      ;   nU(       a*  U(       d#  [        S5      n[        R                  " Xr-  5      eU(       a*  U(       d#  [        S5      n[        R                  " Xr-  5      eU R                  R                  U0 5        X4U4U R                  U   U'   g )Ns   unexpected revlog kind '%s'.s<   cannot register a sidedata computer twice for category '%s'.sK   cannot replace a sidedata computer that isn't registered for category '%s'.)
rR  	ALL_KINDSr   r   r   r)   r)  r  r   r  )	rO   kindr  r  computerrZ  replaceru  already_registereds	            rT   register_sidedata_computer*localrepository.register_sidedata_computer'  s     {,,,34C((44##H-%)A)A)E)EdB)OOgOC ((88-&C ((88  ++D"548E3J  &x0rZ   )*r  r  r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  ro   r+   r  r  r~   r  r1   r  r  r   r7   r  r  rG   )r  bytesr  
vfsmod.vfsr  r  r  r  r  r  r  r  r   )r  r  )FN)r  r  )rs  r  )F)r   r  r  r  rs  r  rt  ro   r  )r   r  r%  zOptional[bytes]rs  r  )r<  r  rs  r  )r<  r  r@  r  rZ  r  rs  r  )r<  r  r@  r  rs  r  )FF)NFN)TN)rZ   NNNFNN)rn  NNFFFFrr  )r\   r]   r^   r_   r`   r  ARCHIVED_PHASE_REQUIREMENTBOOKMARKS_IN_STORE_REQUIREMENTr  r&  r7  r`  r  r  r;  INTERNAL_PHASE_REQUIREMENTr[  r  r$  r  r  r  r  rP  r  r"  r  r  rj   r  r  propertyr  r   r  r  r  r  r  r   rH   r  r   r  r  r  ry   r  r!  r   r  r   r+  r   r   r.  r8  r#   FILENAMErI  r  rU  r_  rg  rk  rx  r   r{  r  r  r  r  __bool__r  r  r  rW   r  r  r   r   r  r3   r  r  r  r  r  r   r  r  r  rN  r  rE  r  r  r  r  r  r  r  r!  r$  r9  rA  rE  rI  rL  rR  r[  r^  r  r4   r  r  r  r  r  r  r  r  r"  r!  r)  rB  r2  r  rE  r  r   r  r  r  rA  rh  r   r  r  r  r  r  r  r  r4  r  r  r{  r  r  r(   rJ  r0  r~  r  r  ra   r[   rZ   rT   r  r    s    	2266//--00//--++0022++33,,,,**--**00))00)N2< ]5 	]5
 ]5 ]5 ]5 ]5 ]5~1f, 
 
)	 K K
 
 
$L

5$  (	2'2'h
 & & /0< 1< 1 1 
 
 D D  
*@ 
##$	 %	 
##$M %M 
##$M %M!&- 
 
  < ; ; 0 0M,^ H#
$. 
2$=  ,"! F	5(	;+(
 $ $> 5	I
D81
&,(4
 + + + +)D   	 
2D	zx	
G I I$! T Tl" T- T-l+1
*#*J"    .`!F9v105,  C CJ I I ) )"  , 
&,""C*&  B
:> >CKrZ   r  c                    [         R                  R                  U 5      u  pUR                  S5      (       d   e[         R                  R	                  XR                  SSS5      5      $ )Nre  r  r   )osro   rV  rU  rr   r  )r   r  r   s      rT   r  r  >  sK    r"JD??:&&&&77<<ll:wBCCrZ   c                   ^ ^^ SSK Jn  [        R                  " U5      mU(       a  [	        T TUS9  UUU 4S jnU" 5       nUR                  Xv5      nU$ )Nr   r  
createoptsc                    > [        TTT S9$ )N)r  )r  )r  	localpathr   s   rT   
repo_makerinstance.<locals>.repo_makerL  s    "2y'BBrZ   )r  r  r?   urllocalpathcreaterepositorymay_auto_upgrade)	r   ro   creater  r  r  r  rP   r  s	   `  `    @rT   instancer  D  sI    $$T*IY:>C <D##D5DKrZ   c                    gr   r[   )ro   s    rT   islocalr  T  s    rZ   c                d    [        U=(       d    0 5      nSU;  a  U R                  SS5      US'   U$ )zPopulate the default creation options for a repository.

A dictionary of explicitly requested creation options can be passed
in. Missing keys will be populated.
   backendr/  s   new-repo-backend)dictr  )r   r  s     rT   defaultcreateoptsr  X  s7     j&B'J#!#:7J!K
:rZ   c                8   [        5       nUR                  (       d  U$ [        XS9n[        X5       H*  nU[        R
                  ;   d  M  UR                  U5        M,     UR                   H*  nU[        R
                  ;  d  M  UR                  U5        M,     U$ )zclone the requirements of a local repo for a local clone

The store requirements are unchanged while the working copy requirements
depends on the configuration
r  )rW   r+   r  newreporequirementsr  WORKING_DIR_REQUIREMENTSrl   )r   r  srcrepotarget_requirementsrr  s        rT   clone_requirementsr  g  s     % #""2=J 0888##A& 1 !!O<<<##A& " rZ   c                   SU;  a  [         R                  " S5      eUS   S:w  a%  [         R                  " [        S5      US   -  5      e[        R
                  1nU R                  SS5      (       a  UR                  [        R                  5        U R                  SS5      (       aU  UR                  [        R                  5        U R                  SS5      (       a  UR                  [        R                  5        U R                  SS	5      nU HZ  nU[        R                  ;   d  M  [        R                  U   nUR                  5       (       d  MC  UR                  5       (       d  MZ    OB   [         R                  " [        S
5      SR!                  S U 5       5      -  [        S5      S9eUS:X  a  UR                  S5        OUS:w  a  UR                  SU-  5        ["        R$                  " U 5      (       aU  UR                  [        R&                  5        U R                  SS5      (       a  UR                  [        R(                  5        U R                  SS5      (       a  UR                  [        R*                  5        U R                  SS5      (       a>  UR                  [        R,                  5        UR                  [        R.                  5        U R                  SS5      (       a  UR                  [        R0                  5        U R3                  SS5      nUS:X  a  UR                  [        R,                  5        U R3                  SS5      nUS:X  a>  UR5                  [        R
                  5        UR                  [        R6                  5        U R                  SS5      (       a  UR                  [        R8                  5        U R                  SS5      (       a  UR                  [        R:                  5        UR=                  S5      (       a  UR                  [        R>                  5        UR=                  S5      (       a  UR                  S5        U R                  SS5      (       a  UR                  [        R@                  5        [B        RD                  " S S!S"9S#LnU R                  SS$U5      (       a  UR                  [        RF                  5        U R                  SS%5      (       a  UR                  [        RH                  5        S&U;   a  [K        US&   RL                  5      n	[        RH                  U	;  a  U	nOI[K        5       n
U H1  nU[        RN                  ;   a  M  X;   a  M   U
R                  U5        M3     X*-  nX)-  nUR=                  S'5      (       a   UR                  [        RP                  5        OUR                  [        RR                  5        U R                  SS(5      (       aa  U RU                  SS)5      n[        S*5      n[        S+5      nUS,:w  a  U RW                  X-  US9  U$ UR                  [        RX                  5        U$ )-zDetermine the set of requirements for a new local repository.

Extensions can wrap this function to specify custom requirements for
new repositories.
r  sF   backend key not present in createopts; was defaultcreateopts() called?r+  sC   unable to determine repository requirements for storage backend: %sr  s   usestores
   usefncaches	   dotencodes   revlog-compressionsI   compression engines %s defined by format.revlog-compression not available   , c              3  ,   #    U  H
  nS U-  v   M     g7f)s   "%s"Nr[   )r  r  s     rT   r  &newreporequirements.<locals>.<genexpr>  s     :k1ks   s;   run "hg debuginstall" to list available compression enginesr  r   s   revlog-compression-zstds   zlibr  s   sparse-revlogs   use-dirstate-v2s"   exp-use-copies-side-data-changesetr!  r  s   exp-use-changelog-v2s*   enable-unstable-format-and-corrupt-my-datar,  s   use-internal-phases   exp-archived-phase   narrowfilesr  s   bookmarks-in-storer,   T)pyo3Ns   use-persistent-nodemap   use-share-safe
   sharedrepo   sharedrelatives   use-dirstate-tracked-hints!   use-dirstate-tracked-hint.versions)   ignoring unknown tracked key version: %d
s<   see `hg help config.format.use-dirstate-tracked-hint-versionr   )-r   r   rW  r   r  r$  r  rl   r  r  r  
configlistr6   r  r  r  rr   r/   gdinitconfigr;  rP  r`  r  r&  r"  r  r  r  r  r  r   rY  r  r'   
importrustr[  r  rW   r+   r  r  r  r#  r]  r7  )r   r  r+   r  
compenginer
  changelogv2revlogv2persistent_nodemap_defaultsource_requirementsto_dropreqversionru  r  s                  rT   r   r   }  sU    #$$/
 	

 *,kk' $	%
 	
 $889L	}}Y,,::;==M22_@@A}}Y55  !F!FG--	+@AK!
)))%%j1F!!f&9&9&;&;	 " kk; jj:k::	;
 '

 
	
 W34	w	.;<BAAB==$455_EEF 
}}Y 233@@A 
}}Y EFF@@A>>?	}}_o66AAB))I'>?KCC@@Ayy+6H@@_AAB==>	}}Y 566CCD 
}}Y 566CCD~~n%%;;<~~f 	}}Y 566GGH 	(.d:  
}},.H  	<<= 
}}Y 122>>? 
"!*]";"H"HI008KK /L eG#/BBB-C  $ #L/L>>+,,_HHI_??@	}}Y <==,,y*NO=>K
 a<GGCMG-  _EEFrZ   c                6   [        5       n[        R                  U;  a  [        R                  U;   a9  U R	                  [        S5      5        UR                  [        R                  5        [        R                  U;   d  [        R                  U;   a  [        R                  " [        S5      5      e[        R                  U;   aR  U R                  SS5      (       a  [        S5      nU R	                  U5        UR                  [        R                  5        U$ )zChecks compatibility of repository requirements enabled and disabled.

Returns a set of requirements which needs to be dropped because dependend
requirements are not enabled. Also warns users about itsv   ignoring enabled 'format.bookmarks-in-store' config beacuse it is incompatible with disabled 'format.usestore' config
s\   cannot create shared repository as source was created with 'format.usestore' config disabledr  r  sr   ignoring enabled 'format.use-share-safe' config because it is incompatible with disabled 'format.usestore' config
)rW   r  r  r  r]  r   rl   r  r  r   rW  r  r  )r   r+   droppedru  s       rT   checkrequirementscompatr    s     eG((<99\IGG4 KKFFG ..,>::lJ++?  00L@||I'899!
 KK==>NrZ   c                n    1 SknUR                  5        VVs0 s H  u  p4X2;  d  M  X4_M     snn$ s  snnf )a  Filters a dict of repo creation options against options that are known.

Receives a dict of repo creation options and returns a dict of those
options that we don't know how to handle.

This function is called as part of repository creation. If the
returned dict contains any items, repository creation will not
be allowed, as it means there was a request to create a repository
with options not recognized by loaded code.

Extensions can wrap this function to filter out creation options
they know how to handle.
>   r  r  r  r	     shareditemsr     shallowfilestore)r  )r   r  rE  r  r  s        rT   filterknowncreateoptsr  C  s8    E (--/B/TQ1>DAD/BBBs   11c                   Ub  Ub  Sn[         R                  " U5      e0 nO[        XS9n[        X5      n[	        U[
        5      (       d  [         R                  " S5      eU(       aB  [         R                  " [        S5      SR                  [        U5      5      -  [        S5      S9e[        XS9nU[        X5      -  n[        R                  " US	S	S
9n[        R                  " UR                  S5      5      nUR                  5       (       a"  [         R                  " [        S5      U-  5      eSU;   ae  US   R                   nUR#                  S5      (       a@   [$        R&                  R)                  XR*                  5      n[,        R.                  " U5      nUR                  5       (       d  UR9                  5         UR;                  S	S9  SU;  a  UR=                  S5        UR=                  S5        [>        R@                  U;   n
U
(       a)  SU;  a#  UR=                  S5        URC                  SS5        [D        RF                  " U5      u  p[D        RH                  " X{5        U(       a@  SU;  a:  [        R                  " UR                  S5      S	S9n[D        RH                  " X5        SU;   a  URK                  SW5        UR#                  S5      (       a3  SR                  [        US   5      5      S-   nURK                  SU5        gg! [0        [2        4 a7  n	[         R                  " [        S5      [4        R6                  " U	5      S9eSn	A	ff = f)a  Create a new repository in a vfs.

``path`` path to the new repo's working directory.
``createopts`` options for the new repository.
``requirement`` predefined set of requirements.
                (incompatible with ``createopts``)

The following keys for ``createopts`` are recognized:

backend
   The storage backend to use.
lfs
   Repository will be created with ``lfs`` requirement. The lfs extension
   will automatically be loaded when the repository is accessed.
narrowfiles
   Set up repository to support narrow file storage.
sharedrepo
   Repository object from which storage should be shared.
sharedrelative
   Boolean indicating if the path to the shared repo should be
   stored as relative. By default, the pointer to the "parent" repo
   is stored as an absolute path.
shareditems
   Set of items to share to the new repository (in addition to storage).
shallowfilestore
   Indicates that storage for files should be shallow (not all ancestor
   revisions are known).
Ns/   cannot specify both createopts and requirementsr  s-   filterknowncreateopts() did not return a dictsB   unable to create repository because of unknown creation option: %sr  s#   is a required extension not loaded?r  Tr  r  s   repository %s already existsr  r  s   cannot calculate relative path)
notindexedr  r  r  r   s9      dummy changelog to prevent using the old repo layoutr  r  r  r  s   shared)&r   r   r  r  r  r  rW  r   rr   r  r   r  r  r7   r  r  r  r   r  ro   relpathr  r6   r  r  r  r>   re  makedirsmakedirmkdirr  r  r   r/   filterrequirementswriterequiresr  )r   ro   r  r+   ru  unknownoptsr  r  r  r  	has_storewcreqstorereqr  r  s                  rT   r  r  ^  s   < !DC((--
&rA
+B;+t,,((@  +++ **VK01	2
 =>  +2E/AAjj$>GJJw||F+,E||~~ooa ?@4GHH
".99
>>+,,	WW__ZD
!]]:6
 >>	MMTM"J&H	KK	11\AI]*4H 		
 00>OE%'
 M3::ejj2Fh1 
"M:.~~n%%F:n#=>?%GIv& &e Z(  kk78#003 s   ?L M$2MMc                f    U R                  5          " S S5      n[        R                  U SU5        g)z9Poison a repository instance so it can no longer be used.c                       \ rS rSrS rS rSrg),poisonrepository.<locals>.poisonedrepositoryi  c                d    US:X  a  [         R                  X5      $ [        R                  " S5      e)Nr   s/   repo instances should not be used after unshare)r   __getattribute__r   r   )rO   items     rT   r0  =poisonrepository.<locals>.poisonedrepository.__getattribute__  s0    w..t::((B rZ   c                    g rG   r[   r   s    rT   r   2poisonrepository.<locals>.poisonedrepository.close  s    rZ   r[   N)r\   r]   r^   r_   r0  r   ra   r[   rZ   rT   poisonedrepositoryr.    s    		rZ   r5  rS   N)r   r   r   )rP   r5  s     rT   poisonrepositoryr6    s,     	JJL
 
 t[*<=rZ   rG   r  )r  r  r  r  r  zOptional[vfsmod.vfs])r   r  rs  r  )NN)ro   r  rs  bool)
__future__r   r   r  r  rer   r  typingr  
concurrentr   r   r   i18nr   rC  r	   r
   r   r   r   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r<  r   rO  r    r  r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r  r,   r-   r.   r/   r0   r1   r  r2   r3   r  r4   r5   r6   r7   r  r8   	branchingr9   r  configurationr:   
interfacesr;   utilsr<   r=   r>   r?   revlogutilsr@   r'  rA   rR  rB   r  r  urlerrr  compiler  rW   rk   	filecacherD   re   ry   r   r   r   r   propertycacher   r   r   r   r  unionrx  ipeercommandexecutorr   r   ipeercommandsr   ipeerlegacycommandsrv  r  r  r  r  r  r  r  r  r  r  r%  rz  ilocalrepositoryfilestorager|  r  r  ilocalrepositorymainr  r   _localrepo_base_classesTYPE_CHECKINGr  r  r  r  r  r  r   r  r  r  r6  r[   rZ   rT   <module>rN     s   #  	  	 
    
  , , , , , , , , , , , ,\ "   //		JJ2  u5W&& 5$	#N 	#	  	 Z z $. $* (d00 (2D.. 2+

 345
*::: *ZW*
!9!9 W*xPi!?!? PN E 2{F
 '+-- -
 $-`K60
>
4	.$Nzz
E
>> E
jDD 
 !" $$&67++-DE
 ! 	''..^$K- ^$KBID ,Xv(VC6{'|>rZ   