
    	^c[7                       d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ ddlm	Z	 ddl
mZmZmZmZmZ ddlmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z&m'Z(m)Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1mZm2Z2m3Z3m4Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z<m=Z=m>Z?m@Z@mAZAmBZBmCZDmEZE ddlFmGZGmBZH dd	lImJZJmKZKmLZLmMZM dd
lNmOZPmQZRmSZT e&jU        ZUeBjV        ZVeBjW        ZW eX            ZY G d de9jZ                  Z[ G d de[          Z\ G d de[          Z] G d de]          Z^ G d de]          Z_ G d de[          Z`d Za G d deBjb                  Zc G d deBjb                  Zdd Zed Zfh dZgegh                    dh          Zi eHjj        eGjk                   G d  d!                      Zl eHjj        eGjm                   G d" d#eGjn                              Zo eHjj        eGjp                   G d$ d%eo                      Zq eX            Zrd& Zsd' ZtdFd(ZudFd)Zvd* Zwd+ Zxd, Zyd- Zzd. Z{d/ Z|d0 Z}d1 Z~ eHjj        eGj                   G d2 d3                      Z eHjj        eGj                   G d4 d5                      Zd6 ZeGj        d7 feGj        d8 fgZ eHjj        eGj                   G d9 d:                      Zd; Zd< ZdGd=Zd> ZdFd?Zd@ ZdA ZdB ZdC ZdGdDZdE ZdS )H    N)futures   )_)binhexnullrevsha1nodeconstantsshort)delattrgetattr),	bookmarks	branchmapbundle2bundlecacheschangegroupcolorcommitcontextdirstatedirstateguard	discoveryencodingerrorexchange
extensionsfileloghooklockmatch
mergestate	mergeutil
namespaces
narrowspecobsoletepathutilphasespushkeypycompatrcutilrepoviewrequirementsrevlogrevset
revsetlangscmutilsparsestoresubrepoutiltagstransactiontxnutilutilvfswireprototypes)
repositoryr6   )hashutilprocutil
stringutilurlutil)concurrency_checker	constantssidedatac                   .     e Zd ZdZd fd	Z fdZ xZS )_basefilecachezHAll filecache usage on repo are done for logic that should be unfilteredNc                     || S |                                 }	 |j        | j                 S # t          $ r Y nw xY wt	          t
          |                               ||          S N)
unfiltered__dict__snameKeyErrorsuperrB   __get__selfrepotypeunfi	__class__s       5/usr/lib/python3/dist-packages/mercurial/localrepo.pyrJ   z_basefilecache.__get__l   sp    <K  	=,, 	 	 	D	^T**224>>>s   - 
::c                 z    t          t          |                               |                                |          S rD   )rI   rB   setrE   )rL   rM   valuerP   s      rQ   rS   z_basefilecache.setw   s-    ^T**..t/@/@%HHH    rD   )__name__
__module____qualname____doc__rJ   rS   __classcell__rP   s   @rQ   rB   rB   i   se        RR	? 	? 	? 	? 	? 	?I I I I I I I I IrU   rB   c                   (     e Zd ZdZ fdZd Z xZS )repofilecachez3filecache for files in .hg but outside of .hg/storec                      t          t          |           j        |  |D ]}t                              |df           d S )N   plain)rI   r]   __init___cachedfilesaddrL   pathspathrP   s      rQ   r`   zrepofilecache.__init__~   sR    +mT""+U33 	/ 	/DdH-....	/ 	/rU   c                 6    |j                             |          S rD   )r7   joinrL   objfnames      rQ   rg   zrepofilecache.join   s    w||E"""rU   rV   rW   rX   rY   r`   rg   rZ   r[   s   @rQ   r]   r]   {   sM        ==/ / / / /
# # # # # # #rU   r]   c                   (     e Zd ZdZ fdZd Z xZS )
storecachez filecache for files in the storec                      t          t          |           j        |  |D ]}t                              |df           d S )NrU   )rI   rm   r`   ra   rb   rc   s      rQ   r`   zstorecache.__init__   sQ    (j$(%00 	* 	*DdC[))))	* 	*rU   c                 ,    |                     |          S rD   )sjoinrh   s      rQ   rg   zstorecache.join   s    yyrU   rk   r[   s   @rQ   rm   rm      sM        *** * * * *
             rU   rm   c                   (     e Zd ZdZ fdZd Z xZS )changelogcachezfilecache for the changelogc                     t          t          |                                            t                              d           t                              d           d S )N   00changelog.irU   )   00changelog.nrU   )rI   rr   r`   ra   rb   rL   rP   s    rQ   r`   zchangelogcache.__init__   sO    nd##,,...0111011111rU   c                     |                      |d          g}|j        j        j                            dd          r)|                    |                      |d                     |S )Nru      persistent-nodemapFrv   rg   r1   openeroptionsgetappendrL   ri   rd   s      rQ   tracked_pathszchangelogcache.tracked_paths   s`    3 01129#''(=uEE 	;LL3(899:::rU   rV   rW   rX   rY   r`   r   rZ   r[   s   @rQ   rr   rr      sM        %%2 2 2 2 2
      rU   rr   c                   (     e Zd ZdZ fdZd Z xZS )manifestlogcachezfilecache for the manifestlogc                     t          t          |                                            t                              d           t                              d           d S )N)   00manifest.irU   )   00manifest.nrU   )rI   r   r`   ra   rb   rw   s    rQ   r`   zmanifestlogcache.__init__   sP    %%..000/000/00000rU   c                     |                      |d          g}|j        j        j                            dd          r)|                    |                      |d                     |S )Nr   ry   Fr   rz   r   s      rQ   r   zmanifestlogcache.tracked_paths   s^    30019#''(=uEE 	:LL388999rU   r   r[   s   @rQ   r   r      sM        ''1 1 1 1 1
      rU   r   c                   (     e Zd ZdZ fdZd Z xZS )mixedrepostorecachez2filecache for a mix files in .hg/store and outsidec                 v     t          t          |           j        |  t                              |           d S rD   )rI   r   r`   ra   update)rL   pathsandlocationsrP   s     rQ   r`   zmixedrepostorecache.__init__   s<     	2!4((13DEE-.....rU   c                     |\  }}|dk    r|j                             |          S |dk    rt          j        d|z            |                    |          S )Nr_   rU   s   unexpected location: %s)r7   rg   r   ProgrammingErrorrp   )rL   ri   fnameandlocationrj   locations        rQ   rg   zmixedrepostorecache.join   sd    *xx7<<&&&3,.9   99U###rU   rk   r[   s   @rQ   r   r      sM        <</ / / / /	$ 	$ 	$ 	$ 	$ 	$ 	$rU   r   c                 v    |                                  j                            |d          }|sdS |j        dfS )z{check if a repo has already cached "name" filecache-ed property

    This returns (cachedobj-or-None, iscached) tuple.
    NNFT)rE   
_filecacher}   ri   )rM   name
cacheentrys      rQ   isfilecachedr      s@    
 ""-11$==J {>4rU   c                   $     e Zd ZdZd fd	Z xZS )unfilteredpropertycachez0propertycache that apply to unfiltered repo onlyNc                     |                                 }||u r(t          t          |                               |          S t	          || j                  S rD   )rE   rI   r   rJ   r   r   rK   s       rQ   rJ   zunfilteredpropertycache.__get__   sL      4<<0$77??EEEtTY'''rU   rD   )rV   rW   rX   rY   rJ   rZ   r[   s   @rQ   r   r      sC        ::( ( ( ( ( ( ( ( ( (rU   r   c                       e Zd ZdZd ZdS )filteredpropertycachez1propertycache that must take filtering in accountc                 H    t                               || j        |           d S rD   )object__setattr__r   )rL   ri   rT   s      rQ   
cachevaluez filteredpropertycache.cachevalue   s"    3	511111rU   N)rV   rW   rX   rY   r    rU   rQ   r   r      s)        ;;2 2 2 2 2rU   r   c                 H    |t          |                                           v S )z?check if a repo has an unfilteredpropertycache value for <name>)varsrE   )rM   r   s     rQ   hasunfilteredcacher      s    4))****rU   c                 F     t          j                    fd            }|S )z@decorate method that always need to be run on unfiltered versionc                 @     |                                  g|R i |S rD   )rE   )rM   argskwargsorigs      rQ   wrapperz!unfilteredmethod.<locals>.wrapper   s-    tDOO%%7777777rU   )	functoolswraps)r   r   s   ` rQ   unfilteredmethodr      s:     _T8 8 8 8 8 NrU   >      known   lookup   unbundle	   branchmap	   getbundle   pushkeys   changegroupsubsetc                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )localcommandexecutorc                 0    || _         d| _        d| _        d S r   )_peer_sent_closed)rL   peers     rQ   r`   zlocalcommandexecutor.__init__   s    

rU   c                     | S rD   r   rL   s    rQ   	__enter__zlocalcommandexecutor.__enter__      rU   c                 .    |                                   d S rD   )close)rL   exctypeexcvalueexctbs       rQ   __exit__zlocalcommandexecutor.__exit__  s    

rU   c                    | j         rt          j        d          | j        rt          j        d          t	          | j        t          j        |                    }t          j	                    }	  |di t          j
        |          }|                    |           n># t          $ r1 t          j        |t          j                    dd                     Y nw xY w|S )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)rL   commandr   fnfresults         rQ   callcommandz localcommandexecutor.callcommand	  s    : 	(D   < 	(=   TZ!9!9::N	!R33(,T2233F LL      	F 	F 	F.q#,..2DEEEEE	F
 s   2B" "8CCc                     d| _         d S NT)r   r   s    rQ   sendcommandsz!localcommandexecutor.sendcommands#  s    


rU   c                     d| _         d S r   )r   r   s    rQ   r   zlocalcommandexecutor.close&  s    rU   N)	rV   rW   rX   r`   r   r   r   r   r   r   rU   rQ   r   r      sn          
      4      rU   r   c                        e Zd ZdZd fd	Zd Zd Zd Zd Zd Z	d	 Z
d
 Zd ZddZ	 	 	 	 ddZd Zd Zd Zd Zd Zd Zd Zd Z xZS )	localpeerz8peer for a local repo; reflects only the most recent APINc                 r   t          t          |                                            |t                                          }|                    d          | _        |j        | _        |j        r,t          j
        |          }|                    d|z              |                    |          | _        d S )N   serveds   exp-wanted-sidedata=)rI   r   r`   
moderncapscopyfiltered_repoui_wanted_sidedatar   format_remote_wanted_sidedatarb   _restrictcapabilities_caps)rL   rM   caps	formattedrP   s       rQ   r`   zlocalpeer.__init__.  s    i'')))<??$$D]]9--
'  	:=dCCIHH,y8999//55


rU   c                 4    | j                                         S rD   )r   urlr   s    rQ   r   zlocalpeer.url>  s    z~~rU   c                     | j         S rD   )r   r   s    rQ   localzlocalpeer.localA  
    zrU   c                     | S rD   r   r   s    rQ   r   zlocalpeer.peerD  r   rU   c                     dS r   r   r   s    rQ   canpushzlocalpeer.canpushG      trU   c                 8    | j                                          d S rD   )r   r   r   s    rQ   r   zlocalpeer.closeJ  s    
rU   c                 4    | j                                         S rD   )r   r   r   s    rQ   r   zlocalpeer.branchmapQ  s    z##%%%rU   c                     | j         S rD   )r   r   s    rQ   capabilitieszlocalpeer.capabilitiesT  r   rU   c                 J    | j                             t          j                  S rD   )r   tryreadr   CB_MANIFEST_FILEr   s    rQ   clonebundleszlocalpeer.clonebundlesW  s    z!!,"?@@@rU   c                     d||t          j        |          t          j        |          t          j        |          fz  S )z+Used to test argument passing over the wire   %s %s %s %s %sr(   bytestrrL   onetwothreefourfives         rQ   debugwireargszlocalpeer.debugwireargsZ  D     U##T""T""$
 
 	
rU   c                     t          j        | j        |f||||d|d         }t          j        |          }t          j        |          rt          j        | j        |          S t          j        d|d           S )N)headscommon
bundlecapsremote_sidedatar      01)
r   getbundlechunksr   r6   chunkbufferbundle2requestedr   getunbundlerr   r   )	rL   sourcer  r  r  r  r   chunkscbs	            rQ   	getbundlezlocalpeer.getbundled  s     )J
 !+
 
 
 
  f%%$Z00 	= '444+E2t<<<rU   c                 4    | j                                         S rD   )r   r  r   s    rQ   r  zlocalpeer.heads  s    z!!!rU   c                 6    | j                             |          S rD   )r   knownrL   nodess     rQ   r  zlocalpeer.known  s    z&&&rU   c                 6    | j                             |          S rD   )r   listkeys)rL   	namespaces     rQ   r  zlocalpeer.listkeys  s    z""9---rU   c                 6    | j                             |          S rD   )r   lookuprL   keys     rQ   r  zlocalpeer.lookup  s    z  %%%rU   c                 <    | j                             ||||          S rD   )r   r'   )rL   r  r  oldnews        rQ   r'   zlocalpeer.pushkey  s    z!!)S#s;;;rU   c                 D    t          j        t          d                    )Ns.   cannot perform stream clone against local peer)r   Abortr   r   s    rQ   
stream_outzlocalpeer.stream_out  s    k!MNNOOOrU   c                 *   	 	 t          j        | j        |d          }t          j        | j        ||d|          }t          j        |d          r@t          j        |                                          }t          j
        | j        |          }|S # t          $ r}t          |dd          }|rt          j        | j        j                  }|D ]}	|                    |	           t          j        |                                          }t          j
        | j        |          }
t          j        | j        |
            d}~ww xY w# t           j        $ r9}t!          j        t'          d          t)          j        |                    d}~ww xY w)zPapply a bundle on a repo

        This function handles the repo locking itself.Ns   pushs	   getchunks_bundle2salvagedoutputr   s   push failed:)r   
readbundler   unbundler   r6   safehasattrr	  	getchunksr   r  r   r   bundle20addpartprocessbundler   	PushRacedResponseErrorr   r<   forcebytestr)rL   bundler  r   retstreamexcoutputbundleroutbs              rQ   r%  zlocalpeer.unbundle  s   	!,TWfdCC'
FE7CPP#C66 @ "-cmmoo>>F!.tw??C
    !&>CC 9%.tz}==G% - -,,,,!-g.?.?.A.ABBF,TWf==A)$*a888!"  	 	 	%/""J$;C$@$@  	s1   BB 
EB&EEE
 
F4FFc                      t          |           S rD   )r   r   s    rQ   commandexecutorzlocalpeer.commandexecutor  s    #D)))rU   rD   NNN)NNNN)rV   rW   rX   rY   r`   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r'   r!  r%  r7  rZ   r[   s   @rQ   r   r   *  sp       BB6 6 6 6 6 6              & & &  A A A
 
 
 
 = = = =8" " "' ' '. . .& & &< < <P P P# # #R* * * * * * *rU   r   c                   :     e Zd ZdZ fdZd Zd Zd Zd Z xZ	S )locallegacypeerzcpeer extension which implements legacy methods too; used for tests with
    restricted capabilitiesc                 f    t          t          |                               |t                     d S )N)r   )rI   r:  r`   
legacycaps)rL   rM   rP   s     rQ   r`   zlocallegacypeer.__init__  s,    ot$$--d-DDDDDrU   c                 6    | j                             |          S rD   )r   between)rL   pairss     rQ   r>  zlocallegacypeer.between  s    z!!%(((rU   c                 6    | j                             |          S rD   )r   branchesr  s     rQ   rA  zlocallegacypeer.branches  s    z""5)))rU   c                     t          j        | j        || j                                                  }t	          j        | j        |d|          S N)missingrootsancestorsofr  )r   outgoingr   r  r   makechangegroup)rL   r  r  rF  s       rQ   r   zlocallegacypeer.changegroup  sK    %JU
8H8H8J8J
 
 
 *4:xOOOrU   c                 r    t          j        | j        ||          }t          j        | j        |d|          S rC  )r   rF  r   r   rG  )rL   basesr  r  rF  s        rQ   changegroupsubsetz!locallegacypeer.changegroupsubset  s=    %JU
 
 
 *4:xOOOrU   )
rV   rW   rX   rY   r`   r>  rA  r   rJ  rZ   r[   s   @rQ   r:  r:    s         E E E E E
) ) )* * *P P PP P P P P P PrU   r:  c                 f   |                      d                              d          }t          j        |v r't	          j        |                     |                    }t          j        |d          }|	                                s)t          j        t          d          |j        z            |S )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   normpathrg   vfsmodr7   existsr   	RepoErrorr   base)hgvfsr+   
sharedpath	sharedvfss       rQ   _getsharedvfsr[    s     M**11%88J2lBB]5::j#9#9::

:555I 
oBCCn
 
 	
 rU   c                 v    |r| j         n| j        }t           |d                                                    S )zreads the require file present at root of this vfs
    and return a set of requirements

    If allowmissing is True, we suppress FileNotFoundError if raised   requires)r   rO  rS   
splitlines)r7   allowmissingrO  s      rQ   _readrequiresr`    s:     '43;;CHDttK  ++--...rU   c                    |                                  }| j         |_         t          j        |dd          }|                    d          }t          j        |d          }d}d}|                                s	 |                                 nU# t          $ r Y nIt          $ r=}	t          j	        t          d          |t          j        |	          fz            d}	~	ww xY wt          j        t          d          |z            t          |d          }
t          j        |
v pt          j        |
v }d}|r8t%          ||
          }t          j        |                    d	                    }n't          j        |                    d	                    }t          d
          }t          j        |
v r|rt          j        t          |d          vr|                    dd          }|                    dd          }|                    dd          }|dv r#ddlm} |                    ||||
|||           n:|dk    r#t          j	        t          d          |          t          j	        t          d          |z  |          |
t          |d          z  }
n|rt          |d          }t          j        |v r|                    dd          }|                    dd          }|                    dd          }|dv r"ddlm} |                    ||||
|||           nO|dk    r#t          j	        t          d          |          t          j	        t          d          |z  |          t5          ||||
|          r:t7          ||||
           t9          j        |           t9          j        |           d t9          j        |          D             }t?          |          }tA          |
|           tC          ||
           tE                      }|r<|j#        }|                    d          }|$                    tJ          j&                   n|j#        }|                    d          }|                    d          }tO          |
|d           }|j(        |_(        |j        }tS          ||
|          |_*        t          j+        |
v st          j,        |
v r>|$                    tJ          j-                   |.                    tJ          j/                   t          j        |d          }|j(        |_(        t          j        |d          }|j(        |_(        g }i }t`          D ]l\  }}  |            |||
||||||j*        |||||           }tc          |td                    st          j3        d!|z            |4                    |           mtk          j6        d"|j#        d#                    to          |
                    fz            } te          | tq          |          i           }! |!| |||||
|||||||$          S )%ae  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
expandpathrN     .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-allowrh  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.c                 "    h | ]\  }}|j         S r   rV   .0nms      rQ   	<setcomp>z&makelocalrepository.<locals>.<setcomp>  s    MMM41aAJMMMrU      cache   wcachec                 .    t          j        | d          S )NTre  )rT  r7   )rW  s    rQ   <lambda>z%makelocalrepository.<locals>.<lambda>  s    VZ4888 rU   )r   intentsr+   featureswdirvfsrX  r1   storevfsstoreoptionscachevfs	wcachevfsextensionmodulenames
extrastatebaseclassess   unable to construct type for %ss   derivedrepo:%s<%s>   ,)baseuir   origrootr{  rX  r+   supportedrequirementsrY  r1   r~  r  rz  ry  )9r   rT  r7   rg   isdirstatFileNotFoundError
ValueErrorr   r   r   r<   r-  rV  r`  rQ  SHARED_REQUIREMENTrR  r[  SHARESAFE_REQUIREMENT
configboolconfig rj  downgrade_share_to_non_safeupgrade_share_to_safeloadhgrcafterhgrcloadr   loadall
populateuigathersupportedrequirementsensurerequirementsrecognizedensurerequirementscompatiblerS   rW  rb   r9   REPO_FEATURE_SHARED_STORAGE	makestore
createmoderesolvestorevfsoptionsr|   REVLOGV2_REQUIREMENTCHANGELOGV2_REQUIREMENTREPO_FEATURE_SIDE_DATAdiscardREPO_FEATURE_STREAM_CLONEREPO_INTERFACES
isinstancerN   r   r~   r(   r   sortedtuple)"r  re   ry  r   r{  hgpathrX  sharedrZ  er+   r|  rm  mismatch_warnmismatch_configmismatch_verbose_upgraderj  sourcerequiresr  r  rz  storebasepath	cachepath
wcachepathr1   r~  r  rI  r  ifacer   typr   clss"                                     rQ   makelocalrepositoryr    s{   > 
BkBG j$>>>G \\&!!FJvD111EFI ;;== D	JJLLLL  	 	 	D 	 	 	+())T:3J13M3M,NN  	 oa :;;dBCCC --L*l: 	G6,F  H 4!%66	:innX6677:ejj2233 OPPD,<< /	;5 D112 2 MM? M !ii: O (*}}J( ($  #   &%%%%%33 #!,    !H,,kMNN   
 k! 
 &&     M(E:::LL	 +&y%880NBB ii2NOOOMM; M (*}}F( ($  #   &%%%%%-- #!,    !H,,kK      kQ  &	&
     GUL)<< "b'5,7772b!!! NM:3H3L3LMMM7;; !/DEEE !\222$ uuH  )!NN8,,	Z;<<<<
JJx((	I&&J
 88 E
 'EyH-b,IIH 	,<<2lBBZ6777=>>> z)$777H*H
:D999I +I EJ$  	r bbdd%!)!5!
 
 
" #t$$ 	(2U:   	S
 ?tyy9M9M/N/N OO D tU5\\2
&
&C3!3    s   <B 
C#	C#&8CC#c                    t          j                    sdS d}t          j        |v rE|rC	 |                     |                    d          |j                   d}n# t          $ r Y nw xY w	 |                     |                    d          |j                   d}n# t          $ r Y nw xY w	 |                     |                    d          |j                   d}n# t          $ r Y nw xY w|S )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_hgrcrQ  r  
readconfigrg   rW  IOError)r   r{  rX  r+   rZ  r/  s         rQ   r  r  P  s*    !! u
C,<<<	MM)..11	MGGGCC 	 	 	D	
ejj))===   
ejj!3447<HHH    Js5   1A 
A('A(,1B 
B+*B+/1C! !
C.-C.c                     dgdgdgd}t          |                                          D ]>\  }}||vr
|D ]1}|                     d|          s|                     d|dd           2?d	S )
aQ  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
   extensionsrU   s   autoload)r  N)r  items	hasconfig	setconfig)r   r{  rX  r+   autoextensionsrequirementnamesr   s           rQ   r  r  z  s     % N %^%9%9%;%;<< K KUl** 	K 	KD<<t44 K]D#kJJJ	K	K KrU   c                    t          t          j                  }d t          j        |           D             }t          D ]}|j        |v r || |           t          j        D ]}t          j        |         }|                                rc|	                                rO|
                    d|z             |                                dk    r|
                    t          j                   |S )z6Determine the complete set of recognized requirements.c                 "    h | ]\  }}|j         S r   ro  rp  s      rQ   rt  z.gathersupportedrequirements.<locals>.<setcomp>  s    @@@daqz@@@rU      exp-compression-%s   zstd)rS   localrepository_basesupportedr   featuresetupfuncsrW   r6   compengines	availablerevlogheaderrb   r   rQ  REVLOG_COMPRESSION_ZSTD)r   	supportedmodulesr   r   engines         rQ   r  r    s     O233I A@j&;B&?&?@@@G  =G##Br9   G G!$' 	G&"5"5"7"7 	GMM/$6777{{}}''oEFFFrU   c                    t                      }| D ][}||v r|r|dd                                         s!t          j        t	          d                    |                    |           \|rSt          j        t	          d          d                    t          |                    z  t	          d                    dS )	a  Validate 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 informationrl  N)rS   isalnumr   RequirementErrorr   rb   rg   r  )r+   r  missingr  s       rQ   r  r    s     eeG# ! !)## 	M+ac"2":":"<"< 	M(+J)K)KLLLK     
$KLLiiw(()( 
 
 
 	

 
rU   c                     t           j        |v r-t          j        s#t	          j        t          d                    dS dS )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)rQ  SPARSE_REQUIREMENTr0   enabledr   rV  r   )r   r+   s     rQ   r  r    sR     	*l:: 	; o1 
 
 	
 	;:::rU   c                     t           j        | v rGt           j        | v r$t           j        | v }t	          j        |||          S t	          j        ||          S t	          j        ||          S )z,Construct a storage object for a repository.)rQ  STORE_REQUIREMENTFNCACHE_REQUIREMENTDOTENCODE_REQUIREMENTstoremodfncachestoreencodedstore
basicstore)r+   re   vfstype	dotencodes       rQ   r  r    sf    (L88.,>>'=MI(w	BBB$T7333tW---rU   c                 `   i }t           j        |v rd|d<   |                     dd          }|||d<   t           j        |v st           j        |v r%|                    t          | ||                     nd|d<   t           j        |v rd|d<   n!|                     d	d
          }d}||v rd|d<   |S )zResolve the options to pass to the store vfs opener.

    The returned dict is used to influence behavior of the storage layer.
    T   treemanifest   formats   manifestcachesizeNs   revlogv0   changeset-sidedatas   copies-storage   experimentals   copies.write-to)s   changeset-onlys   compatibilitys   extra)	rQ  TREEMANIFEST_REQUIREMENT	configintREVLOGV1_REQUIREMENTr  r   resolverevlogstorevfsoptionsCOPIESSDC_REQUIREMENTr  )r   r+   rz  r|   manifestcachesizewritecopiestocopiesextramodes          rQ   r  r    s    
 G/<??#'  Y0DEE$(9$% 	,<</<??3BhOOPPPP#,<<%:!""		/3EFF?O++)1G%&NrU   c                 N   i }i |d<   t           j        |v rd|d<   t           j        |v rd|d<   t           j        |v rd|d<   t           j        |v rd|d<   |                     dd          }|||d<   |                     d
d          }||d<   |                     dd          |d<   |                     d
d          }||d<   |                     d
d          }d}|r|                     d
d          }|t          j        |            }||d<   ||d<   | 	                    dd          }	d|	k    r|	|d<   | 	                    dd          }
|
|
|d<   |                     dd          }t          |                     dd                    }| 	                    dd          }||d<   ||d<   ||d <   t           j        |v }||d!<   |rd|d<   d	}|rt          j        }|                     dd"|          }|||d"<   |D ]>}|j        } |d#          s |d$          r|                    d%d&          d&         |d'<   ?|                     d
d(          |d)<   |d)         Ad|d)         cxk    rd*k    s.n t#          d+          }t%          j        ||d)         z            |                     d
d,          |d-<   |d-         Ad|d-         cxk    rd.k    s.n t#          d/          }t%          j        ||d-         z            t           j        |v rd|d0<   |                     dd1          rd|d1<   t           j        |v r|                     d
d2          }|d3vrk|                     d
d2          }t#          d4          }|                     ||z             | j        s%|                     t#          d5          |z             |}t#          d6          }t#          d7          }t2          j        sc|d8k    rAd9|z   d:z   }|                     |           | j        sd;|z   d<z   }|                     |           |d=k    rt%          j        ||>          d|d?<   t           j        |v r|                     d
d@          }|d3vrk|                     d
d@          }t#          dA          }|                     ||z             | j        s%|                     t#          d5          |z             |}t#          dB          }t#          dC          }t8          j        sc|d8k    rAd9|z   d:z   }|                     |           | j        sd;|z   d<z   }|                     |           |d=k    rt%          j        ||>          |                     d
dD          rd|dE<   |                     dFd?          rd|dG<   |S )Hz+Resolve opener options specific to revlogs.s   flagprocessorsT   revlogv1   revlogv2s   changelogv2s   generaldeltar  s   chunkcachesizeN   storages#   revlog.optimize-delta-parent-choices   deltabothparentss   debugs   revlog.debug-deltas   debug-deltas   revlog.issue6528.fix-incomings   issue6528.fix-incomings   revlog.reuse-external-deltaFs"   revlog.reuse-external-delta-parents	   lazydeltas   lazydeltabaser  s   maxdeltachainspanr   s   mmapindexthresholds   sparse-reads   sparse-read.density-thresholds   sparse-read.min-gap-sizes   with-sparse-reads   sparse-read-density-thresholds   sparse-read-min-gap-size   sparse-revlogs   maxchainlens   revlog-compression-s   exp-compression-   -   s
   compengines   revlog.zlib.levels
   zlib.level	   s8   invalid value for `storage.revlog.zlib.level` config: %ds   revlog.zstd.levels
   zstd.level   s8   invalid value for `storage.revlog.zstd.level` config: %ds   enableellipsiss
   rust.indexs#   revlog.persistent-nodemap.slow-path)rh     warnrk  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 detailsr  s	   warning: rM     (s   )
rk  rl  ry   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)rQ  r  r  r  GENERALDELTA_REQUIREMENTr  r  r/   gddeltaconfigconfigbytesfloatr  SPARSEREVLOG_REQUIREMENTrevlogconstSPARSE_REVLOG_MAX_CHAIN_LENGTH
startswithsplitr   r   r   NARROW_REQUIREMENTNODEMAP_REQUIREMENTconfig_defaultwarnquietr,   HAS_FAST_PERSISTENT_NODEMAPDIRSTATE_V2_REQUIREMENTr   HAS_FAST_DIRSTATE_V2)r   r+   rz  r|   chunkcachesizedeltabothparents	issue6528	lazydeltalazydeltabase	chainspanmmapindexthresholdwithsparsereadsrdensitythressrmingapsizesparserevlogmaxchainlenrprefixmsg	slow_pathdefaultrm  s                         rQ   r  r    s    G!#G+|;;#+|;;#.,>>"&/<??#'  \\)->??N!%3!"}}:  $4G  mmH6KLLGNj*JKKI)2G%&j*HIIIM 
=
 
 #1"555%GL -G0DEEII~~(1$%9NOO%);%&]]?NCCN
		/#CDD N >>/3NOOL#1G 0>G,-+7G'(";|KL ,G (#' K A!@,,y.+FFK"- 9 9
 6()) 	9VV4G-H-H 	9%&WWT1%5%5a%8GM"\\*6JKKGM})W]+0000q0000OPPC+cGM$::;;;\\*6JKKGM})W]+1111r1111OPPC+cGM$::;;;)\99%)!"	}}_m44 &!%*l::II>
 
	 999''B G I C GGC)O$$$8 M@AAGKLLLI$
 
 
 
 1 	2G##"S(50x "$;/DGGDMMMH$$k#D1111)-%&.,>>IIj*BCC	999''
4LMMGOPPCGGC)O$$$8 M@AAGKLLLI$
 
 L
 
 , 	2G##"S(50x "$;/DGGDMMMH$$k#D1111	}}Z!BCC 3.2*+	}}X455 /*.&'NrU   c                      t           S )z6Produce a type conforming to ``ilocalrepositorymain``.)r  )r   s    rQ   makemainr!    s    rU   c                       e Zd ZdZd ZdS )revlogfilestoragez File storage when using revlogs.c                 t    |                     d          r
|dd          }t          j        | j        |          S N   /r   )r  r   svfsrL   re   s     rQ   filezrevlogfilestorage.file  s7    ??4   	8Dty$///rU   NrV   rW   rX   rY   r)  r   rU   rQ   r#  r#    s)        **0 0 0 0 0rU   r#  c                       e Zd ZdZd ZdS )revlognarrowfilestoragez1File storage when using revlogs and narrow files.c                     |                     d          r
|dd          }t          j        | j        || j                  S r%  )r  r   narrowfilelogr'  _storenarrowmatchr(  s     rQ   r)  zrevlognarrowfilestorage.file  s=    ??4   	8D$TYd6LMMMrU   Nr*  r   rU   rQ   r,  r,    s.        ;;N N N N NrU   r,  c                     |                     t          j                   |                     t          j                   t          j        | v rt          S t          S )z=Produce a type conforming to ``ilocalrepositoryfilestorage``.)rb   r9    REPO_FEATURE_REVLOG_FILE_STORAGEr  rQ  r  r,  r#  )r+   rz  r   s      rQ   makefilestorager2    sF    LL<===LL5666)\99&&  rU   c                      t           S rD   )r!  r   rU   rQ   rx  rx    s    h rU   c                      t           S rD   )r2  r   rU   rQ   rx  rx    s    _ rU   c                      e Zd ZdZej        ej        ej        ej        ej	        ej
        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        hZh dZ	 ddZd Zd Zd Zd Zd	 Z e!d
             Z"e!d             Z#d Z$d Z%d Z&ddZ' e(dddd          d             Z)d Z*e!d             Z+ e,dd          d             Z- e,d          d             Z. e/            d             Z0 e1            d             Z2 e3d          d             Z4d  Z5d! Z6 e,e7j8                  d"             Z9 e,e7j8                  d#             Z: e,e7j8                  d$             Z;dd&Z<d' Z=e>d(             Z?e>d)             Z@eAd*             ZBe!d+             ZCd, ZDd- ZEd. ZFeFZGd/ ZHd0 ZId1 ZJd2 ZKdd3ZLd4 ZMdd5ZNeOd6             ZPd7 ZQd8 ZRd9 ZSd: ZTd; ZUd< ZVd= ZWeAd>             ZXd? ZYdd@ZZdA Z[dB Z\dC Z]dD Z^dE Z_dF Z`dG ZadH ZbddIZcddJZddK ZeddLZfdM ZgdN Zhe>dO             Zie>dP             ZjdQ ZkdR ZlddSZmdT ZndU ZoddVZpdW ZqdX ZreAdY             ZsdZ Ztdd[ZueAd\             Zvd] ZweAdd^            Zxd_ Zyd` Zzda Z{ddbZ|dc Z}eAdd             Z~de Zdf ZddhZddiZdj Zdk Zdl ZeA	 	 	 	 	 	 	 ddn            ZeAddo            ZeAdp             ZeAdq             Z	 	 	 	 	 	 	 ddsZdt Zdu Zdv ZddwZddxZdy Zdz Zd{ Ze>d|             Zd} Zd~ ZddZd Zd Z	 ddZdS )r  aQ  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.
    >      bisect.stater     cache/   dirstater]  Nc                    || _         || _        || _        || _        |j        | _        || _        |j        | _        || _        t          | _
        | j
        j        | _        || _        || _        |	| _        |
| _        || _        || _        d| _        | j                            dd          s| j                            dd          r)|                     | j        j                  | j        _        g | _        t/          j        | j                   | j        j        | _        | j        j        | _        | j        j        | _        | j                            dd          s| j                            dd          rwt;          j        | j        d          r4|                     | j        j        j                  | j        j        _        n)|                     | j        j                  | j        _        d| _         tC          j"                    | _#        d| _$        i | _%        i | _&        dx| _'        x| _(        | _)        i | _*        i | _+        g | _,        t[          j-                    | _.        i | _/        i | _0        tc          j2        |          | _3        d| _4        tj          j6        | j        v rd| _4        to                      | _8        i | _9        tu          j;        |            dS )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.
        Nr     all-warnings   check-lockss   vfsFr  )<r  r   r  wvfsrW  r  r7   re   r+   r	   nodeconstantsnullidr  rY  r1   r~  r  rz  
filternamer  _getvfswardaudit_phasedefaultsr   setupspathr'  rg   rp   r6   r&  _getsvfsward_dirstatevalidatewarnedr   BranchMapCache_branchcaches_revbranchcache_filterpats_datafilters	_transref_lockref	_wlockrefr   filteredrevcache_postdsstatusr"   r  _sparsesignaturecache_sparsematchercacher*   extrafilter_extrafilteridfilecopiesmoderQ  r  rS   r   _sidedata_computerssidedatamodset_sidedata_spec_for_repo)rL   r  r   r  r{  rX  r+   r  rY  r1   r~  r  rz  ry  s                 rQ   r`   zlocalrepository.__init__*  s   H  	L	J	(.(/.$
 " 7h88 	>DG<N<Nn=
 =
 	> "--dhn==DHN !DGZ_
JN	Z_
7h88 	EDG<N<Nn=
 =
 	E 	622 E&*&7&7	8K&L&L	##"&"3"3DIO"D"D	',$&577#:>>>  !#    *,,
 &("#% &2266"0D4EEE"7D ##% .t44444rU   c                 D     t          j                   d fd	}|S )zbuild a ward for self.vfsNc                       |          }             }|*t          j        |d          rt          j        |d          sd S |dv rd S                      |j                  r t	          |j                  dz   d                                d          r"d}|j                            | z  dd	
           d}t           fd|D                       r;|                    |j	                   |j                            d z  dd
           n\|                    |j
                  B	j        D ]}                     |          r d S |j                            d z  dd
           |S )Nmodes	   _wlockref   _lockrefN   rs   rbr   r7  s2   accessing cache with vfs instead of cachevfs: "%s"   s	   cache-vfs)
stacklevelr  )s   journal.s   undo.s   strip-backup/r7  c              3   B   K   | ]}                     |          V  d S rD   )r  )rq  r  re   s     rQ   	<genexpr>z@localrepository._getvfsward.<locals>.checkvfs.<locals>.<genexpr>  s/      KKv4??6**KKKKKKrU      write with no lock: "%s"r;  s   write with no wlock: "%s")r6   r&  r  re   lenr   	develwarnany_currentlockrM  rN  _wlockfreeprefix)
re   r\  r/  rM   r  vfs_path_prefixesr  origfuncrrefrL   s
   `      rQ   checkvfsz-localrepository._getvfsward.<locals>.checkvfs  s   (4d+++C466D'l;; 'k::  ***ty)) 2C	NNQ.001y)) QK!!#*<!PPP! KKKK9JKKKKK $$T]33;G%%3d:#$- &   
 ""4>22: #3  Fv.. !!047 ) "   
 JrU   rD   weakrefref)rL   rk  rm  rl  s   `` @rQ   r@  zlocalrepository._getvfsward  sD    {4  +	 +	 +	 +	 +	 +	 +	 +	Z rU   c                 @    t          j        |           dfd	}|S )zbuild a ward for self.svfsNc                 X    | |          }             }|t          j        |d          sd S |dv rd S |                     |j                  r| t	          |j                  dz   d          } |                    |j                  |j                            d| z  d           |S )Nr[  r]  r^  r   rd     )ra  )	r6   r&  r  rY  re  rh  rM  r   rf  )re   r\  r/  rM   rk  rl  s       rQ   	checksvfsz/localrepository._getsvfsward.<locals>.checksvfs  s    (4d+++C466D|4#3D+#F#F|***t// 8C0014667  //7!!/$61 "    JrU   rD   rn  )rL   rk  rt  rl  s    ` @rQ   rE  zlocalrepository._getsvfsward  s>    {4  	 	 	 	 	 	 	  rU   c                 .    |                                   d S rD   )_writecachesr   s    rQ   r   zlocalrepository.close  s    rU   c                 J    | j         r| j                                          d S d S rD   )rI  writer   s    rQ   rv  zlocalrepository._writecaches  s2     	) &&(((((	) 	)rU   c                 ~   | j                             dd          rgt          |          }t          j        t          j        | d                    }|                    dt                              |          z              | j                             dd          r|                    t          j
                   |S )Nr  s   bundle2-advertises   client)roles   bundle2=s   narrow)r   r  rS   r   
encodecapsgetrepocapsrb   urlreqquoter8   	NARROWCAP)rL   r   capsblobs      rQ   r   z%localrepository._restrictcapabilities  s    7o/CDD 	;t99D)#Dy999 H HH[6<<#9#99:::7oy99 	/HH^-...rU   c                 B    t          j        | j        | j                  S )N)callbackr%   pathauditorr  _checknestedr   s    rQ   auditorzlocalrepository.auditor#  s     #DI8IJJJJrU   c                 F    t          j        | j        | j        dd          S )NFT)r  realfscachedr  r   s    rQ   nofsauditorzlocalrepository.nofsauditor)  s,     #I 1%
 
 
 	
rU   c                    |                     | j                  sdS |t          | j                  dz   d         }t          j        |          }| d         }t          j        |          }|r~d                    |          }||j        v rJ||k    rdS |                    |          }|	                    |t          |          dz   d                   S |
                                 |~dS )z/Determine if path is a legal nested repository.Fr   Nr&  T)r  r  re  r6   pconvert	splitpathrg   substatesubchecknestedpop)rL   re   subpathnormsubpathctxpartsr  r  s           rQ   r  zlocalrepository._checknested1  s    ty)) 	5s49~~)++,mG,,& 4jw'' 		YYu%%F%%[((4''&//C??73v;;?3D3D+EFFF		  		 urU   c                      t          |           S rD   )r   r   s    rQ   r   zlocalrepository.peerW  s    rU   c                     | S )zaReturn unfiltered version of the repository

        Intended to be overwritten by filtered repo.r   r   s    rQ   rE   zlocalrepository.unfilteredZ  s	     rU   c                     | j         d|vr|dz   | j         z   }t          j        |                                 j                  } || ||          S )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".
        N   %)rT  r*   newtyperE   rP   )rL   r   visibilityexceptionsr  s       rQ   r   zlocalrepository.filtered`  sZ     *t4/?/?$;!44Dt00:;;s43444rU   )	   bookmarksr_   )s   bookmarks.currentr_   )r  rU   rt   c                 R    |                                   t          j        |           S rD   )_refreshchangelogr   bmstorer   s    rQ   
_bookmarkszlocalrepository._bookmarksr  s(    n 	    &&&rU   c                 \    dt          |           v r|                                 | `dS dS dS )z7make sure the in memory changelog match the on-disk one	changelogN)r   currenttransactionr  r   s    rQ   r  z!localrepository._refreshchangelog  s;    $t**$$)@)@)B)B)J %$)J)JrU   c                     | j         j        S rD   )r  activer   s    rQ   _activebookmarkzlocalrepository._activebookmark  s    %%rU   
   phaserootsru   c                 6    t          j        | | j                  S rD   )r&   
phasecacherB  r   s    rQ   _phasecachezlocalrepository._phasecache  s     t':;;;rU   s   obsstorec                 6    t          j        | j        |           S rD   )r$   r  r   r   s    rQ   obsstorezlocalrepository.obsstore  s    !$'4000rU   c                     | j                                          | j                            t	          j        | j                  t          j        | j	        d                    S )N	   changelog)concurrencychecker)
r   prefetch_parentsr1   r  r5   mayhavependingr  revlogcheckerget_checkerr   )rM   s    rQ   r  zlocalrepository.changelog  sY     	&&(((z##"49--,8,OO $ 
 
 	
rU   c                 B    | j                             | | j                  S rD   )r1   manifestlogr/  r   s    rQ   r  zlocalrepository.manifestlog  s    z%%dD,BCCCrU   r8  c                 *    |                                  S rD   )_makedirstater   s    rQ   r   zlocalrepository.dirstate  s    !!###rU   c           
           d}t          j                   r fd}t          j        }t          j        }| j        v }| j        v }t          j         j         j         j	         j
        | j        ||          S )z3Extension point for wrapping the dirstate per-repo.Nc                  ,    t          j                   S rD   )r0   matcherr   s   rQ   rx  z/localrepository._makedirstate.<locals>.<lambda>  s    FN4$8$8 rU   )use_tracked_hint)r0   
use_sparserQ  r  DIRSTATE_TRACKED_HINT_V1r+   r   r7   r   r  _dirstatevalidater=  )rL   sparsematchfnv2_reqthuse_dirstate_v2r  s   `     rQ   r  zlocalrepository._makedirstate  s    T"" 	98888M 85 D$55!22 HGI"-	
 	
 	
 		
rU   c                     	 | j                             |           |S # t          j        $ rO | j        s>d| _        | j                            t          d          t          |          z             | j	        cY S w xY w)NTs-   warning: ignoring unknown working parent %s!
)
r  revr   LookupErrorrF  r   r
  r   r
   r>  rL   nodes     rQ   r  z!localrepository._dirstatevalidate  s    
	Nt$$$K  	 	 	/ /3,GHHDkk"   ;	s    AA<;A<c                 *    t          j        |           S )zdmatcher patterns for this repository's narrowspec

        A tuple of (includes, excludes).
        )r#   loadr   s    rQ   
narrowpatszlocalrepository.narrowpats  s     t$$$rU   c                     t           j        | j        vrt          j                    S | j        \  }}t          j        | j        ||          S N)includeexclude)	rQ  r  r+   matchmodalwaysr  r#   r   r  rL   r  r  s      rQ   r/  z!localrepository._storenarrowmatch  sG    -T5FFF?$$$?	7GLLLLrU   c                     t           j        | j        vrt          j                    S t          j        |            | j        \  }}t          j        | j	        ||          S r  )
rQ  r  r+   r  r  r#   checkworkingcopynarrowspecr  r   r  r  s      rQ   _narrowmatchzlocalrepository._narrowmatch  sX    -T5FFF?$$$-d333?	7GLLLLrU   Fc                 *   |r|ro| j                                         sVt          j        |                                          }t          j        | j         |g          }t          j        ||          S t          j        || j                   S | j         S )a  matcher 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.
        )r  r  r  exactfilesunionmatcherintersectmatchers)rL   r   includeexactemnms        rQ   narrowmatchzlocalrepository.narrowmatch
  s      	H =D$5$<$<$>$> = ^EKKMM22*D,=r+BCC1%<<<-eT5FGGG  rU   c                 ^    t          j        | ||           |                     d           d S )NTclearfilecache)r#   save
invalidate)rL   newincludesnewexcludess      rQ   setnarrowpatszlocalrepository.setnarrowpats  s0    k;777t,,,,,rU   c                     dt           | j        j        ft           t           | j        j        f| j        t           | j        fiS )N   null)r   r=  r>  r   s    rQ   _quick_access_changeid_nullz+localrepository._quick_access_changeid_null!  s<     gt189gt189K'4;/
 	
rU   c                    | j                                         }|                                 j        }| j                                        D ]}|| j        k    r|j                            |          }|+||f}|||<   |||<   |	                    |          D ]1}|t          k    r|                    |          }||f}|||<   |||<   2| j                                        }|| j        k    r||         |d<   |S )N   .)r  r   rE   r  r   parentsr>  indexget_rev
parentrevsr   r  p1)	rL   quickclr  r  pairr  rr  p1nodes	            rQ   _quick_access_changeid_wcz)localrepository._quick_access_changeid_wc)  s    05577__(M))++ 	  	 Dt{""(""4((C{ ;DE#JE$K]]3''    <<GGAJJ1vaa  !!##T[  -E$KrU   c                 <    dt          |           v r
| j        d= d S d S )Nr  )r   rF   r   s    rQ   !_quick_access_changeid_invalidatez1localrepository._quick_access_changeid_invalidateH  s,    &$t**449::: 54rU   c                 D    | j         t          j        v r| j        S | j        S )zan helper dictionnary for __getitem__ calls

        This contains a list of symbol we can recognise right away without
        further processing.
        )r?  r*   filter_has_wcr  r  r   s    rQ   _quick_access_changeidz&localrepository._quick_access_changeidM  s&     ?h44411//rU   c           	          |t          j                   S t          |t           j                  r|S t          |t                    r5 fdt          |                    t                                D             S  j        	                    |          }||\  }}t          j
         ||d          S |dk    rI j                                        } j                            |          }t          j
         ||          S 	 t          |t                    r j                            |          }|}n|dk    rG j                                        }                                 j                            |          }nnt          |           j        j        k    r	 |} j                            |          }n2# t*          j        $ r t/          |          } t0          $ r                                  r`|                                 j                                        v r3t7          d          }t+          j        |t;          |          z            t/          |          } w xY wt          |          d j        j        z  k    r*t=          |          } j                            |          }n8t+          j        d|tA          j!        tE          |                    fz            t          j
         ||          S # t*          j#        t*          j        f$ r7 t+          j$        t7          d	          tA          j!        |          z            tJ          t0          f$ r7 t+          j&        t7          d
          tA          j!        |          z            t*          j'        $ r t          j                   cY S w xY w)Nc                 <    g | ]}|j         j        v|         S r   )r  filteredrevs)rq  irL   s     rQ   
<listcomp>z/localrepository.__getitem__.<locals>.<listcomp>b  s7       DN777 Q777rU   F)maybe_filtered   tipr  s*   working directory has unknown parent '%s'!r  s$   unsupported changeid '%s' of type %ss   filtered revision '%s'   unknown revision '%s')(r   
workingctxr  basectxslicerangeindicesre  r  r}   	changectxr  tipr  intr  r   r  rE   r=  nodelenr   FilteredLookupErrorr   r  r   r  r   r   r
   r   r   r(   r   rN   FilteredIndexErrorFilteredRepoLookupError
IndexErrorRepoLookupErrorWdirUnsupported)rL   changeidquick_accessr  r  r  s   `     rQ   __getitem__zlocalrepository.__getitem__X  s   %d+++h00 	O h&& 	    0 0T ; ;<    266x@@#$IC$T3UKKKKv>%%''D.$$T**C$T35552	,(C(( $~**844T!! }''))oo''155d;;X$"4"<<<#D.,,X66CC0   "8}}H"    

A$(9(9(B(J(J(L(LLL MNN#k#h*?@@@"8}}H X!d&8&@"@@@8}}n((..,;!1$x..!A!ABC  
 $T3555(%*CD 	 	 	/+,,x/?/I/II   K( 	 	 	'*++h.>x.H.HH   $ 	, 	, 	,%d+++++	,s.   BL %G L B-I00BL B9OOc                 D    	 | |          dS # t           j        $ r Y dS w xY w)z!True if the given changeid existsTF)r   r  )rL   r  s     rQ   __contains__zlocalrepository.__contains__  s:    	NN4$ 	 	 	55	s    c                     dS r   r   r   s    rQ   __nonzero__zlocalrepository.__nonzero__  r   rU   c                 R    |                                  }t          |j                  S rD   )rE   re  r  )rL   rO   s     rQ   __len__zlocalrepository.__len__  s!      4>"""rU   c                 *    t          | j                  S rD   )iterr  r   s    rQ   __iter__zlocalrepository.__iter__  s    DN###rU   c                 `    t          j        |g|R  } t          j        |          |           S )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)rL   exprr   trees       rQ   revszlocalrepository.revs  s7     "4/$///'v!$''---rU   c              '   @   K    | j         |g|R  D ]}| |         V  dS )aV  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"  )rL   r   r   r  s       rQ   rS   zlocalrepository.set  sD       4'$''' 	 	Aq'MMMM	 	rU   c                 h   |dgk    rt          j        t          g          S |dgk    r7| j                            d          }|t          j        |d         g          S |r0t          j        | j        |t          j        |           |          }nt          j        d||          } ||           S )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}``.
        r  r  Nr   )r  
localalias)r%  )r-   basesetr   r  r}   matchanyr   lookupfn)rL   specsuserr%  
quick_datars  s         rQ   anyrevszlocalrepository.anyrevs  s     WI>7),,,TF??488>>J%~z!}o666 	Dt,,%	  AA e
CCCAqwwrU   c                     d| j         z   S )Ns   file:r  r   s    rQ   r   zlocalrepository.url  s    $)##rU   c                 6    t          j         | j        | ||fi |S )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   )rL   r   throwr   s       rQ   r   zlocalrepository.hook  s$     y$e<<t<<<rU   c                 v     G d d          } |            }|                                  \  |_        |_        |S )zMReturns a tagscache object that contains various tags related
        caches.c                       e Zd Zd ZdS )-localrepository._tagscache.<locals>.tagscachec                 >    d x| _         | _        d x| _        | _        d S rD   )r3   tagtypesnodetagscachetagslistr   s    rQ   r`   z6localrepository._tagscache.<locals>.tagscache.__init__  s%     -10	DM599"T]]]rU   N)rV   rW   rX   r`   r   rU   rQ   	tagscacher2    s#        : : : : :rU   r7  )	_findtagsr3   r4  )rL   r7  caches      rQ   
_tagscachezlocalrepository._tagscache  sT    		: 		: 		: 		: 		: 		: 		: 		: 	%)^^%5%5"
ENrU   c                    i }| j         j        r|                                 \  }}n| j        j        }| j         j        }|                                D ]2\  }}	  ||           |||<   # t          j        t          f$ r Y /w xY w|S )zreturn a mapping of tag to node)
r  r  r8  r:  r3   r  r  r   r  r  )rL   tr3   ttr  kvs          rQ   r3   zlocalrepository.tags  s    >& 	(~~''HD""?'Dn JJLL 	 	DAqA!%z2   s   A**BBc                    t          j        | j        |           }d |D             }t          j        | j        | ||           i }|                                D ]*\  }\  }}|| j        k    r||t          j        |          <   +| j        	                                |d<   d |                                D             }||fS )au  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.c                     i | ]}|d S )s   globalr   )rq  tags     rQ   
<dictcomp>z-localrepository._findtags.<locals>.<dictcomp>6  s    666sC666rU   r   c                 >    i | ]\  }}t          j        |          |S r   )r   tolocal)rq  r   rT   s      rQ   rC  z-localrepository._findtags.<locals>.<dictcomp>C  s6     
 
 
.;tUHT""E
 
 
rU   )
tagsmodfindglobaltagsr   readlocaltagsr  r>  r   rE  r  r  )rL   alltagsr4  r3   r   r  hists          rQ   r8  zlocalrepository._findtags%  s     ($7766g666dgtWh??? $+MMOO 	4 	4 T<D$t{""/3X%d++,~))++V
 
?G~~?O?O
 
 
 hrU   c                 @    | j         j                            |          S )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:  r4  r}   )rL   tagnames     rQ   tagtypezlocalrepository.tagtypeH  s     '++G444rU   c                 4   | j         j        sg }|                                                                 D ]5\  }}|                    | j                            |          ||f           6d t          |          D             | j         _        | j         j        S )z)return a list of tags ordered by revisionc                     g | ]
\  }}}||fS r   r   )rq  r  r<  rr  s       rQ   r  z,localrepository.tagslist.<locals>.<listcomp>Y  s"    'H'H'H71aA'H'H'HrU   )r:  r6  r3   r  r~   r  r  r  )rL   lr<  rr  s       rQ   r6  zlocalrepository.tagslistS  s    ' 	IA		))++ 8 81$.,,Q//A67777'H'HfQii'H'H'HDO$''rU   c                 f   | j         j        si }| j         j                                        D ].\  }}|                    |g                               |           /|                                D ]}|                                 || j         _        | j         j                            |g           S )z&return the tags associated with a node)	r:  r5  r3   r  
setdefaultr~   valuessortr}   )rL   r  r5  r<  rr  r3   s         rQ   nodetagszlocalrepository.nodetags]  s    , 	:M,2244 : :1((B//66q9999%,,..  		,9DO),00r:::rU   c                 6    | j                             |          S )z;return the list of bookmarks pointing to the specified node)r  r  r  s     rQ   nodebookmarkszlocalrepository.nodebookmarksh  s    $$T***rU   c                     | j         |          S )zkreturns a dictionary {branch: [branchheads]} with branchheads
        ordered by increasing revision number)rH  r   s    rQ   r   zlocalrepository.branchmapl  s     !$''rU   c                 t    | j         s+t          j        |                                           | _         | j         S rD   )rI  r   revbranchcacherE   r   s    rQ   rZ  zlocalrepository.revbranchcacheq  s4    # 	O#,#;DOO<M<M#N#ND ##rU   c                 V    |                                                      ||           d S rD   )rZ  setdata)rL   r  changelogrevisions      rQ   register_changesetz"localrepository.register_changesetw  s+    %%c+<=====rU   c                     	 |                                                      |          S # t          $ r* |s$t          j        t          d          |z            Y dS w xY w)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   	branchtiprH   r   r  r   )rL   branchignoremissings      rQ   r`  zlocalrepository.branchtipz  sn    	>>##--f555 	 	 	  +A.D,E,E,NOOO		s   &) 0AAc                     t          j        | |                                          }|$t          j        t          d          |z            |S )Nr  )r/   	revsymbolr  r   r  r   )rL   r  r  s      rQ   r  zlocalrepository.lookup  sI     s++0022<'*B(C(Cc(IJJJrU   c                     |                                                      |          r|S t          j        | |                                          S rD   )r   	hasbranchr/   rd  ra  r  s     rQ   lookupbranchzlocalrepository.lookupbranch  sF    >>%%c** 	J s++22444rU   c                     | j         }|j        j        }|j        }g }|D ]+} ||          }|d u p||v  }|                    |           ,|S rD   )r  r  r  r  r~   )	rL   r  r  r  r   r   rr  r  resps	            rQ   r  zlocalrepository.known  sj    ^("? 	  	 A

AT	2Q(]3DMM$rU   c                     | S rD   r   r   s    rQ   r   zlocalrepository.local  r   rU   c                 <    | j                             ddd          S )N   phasess   publishT)	untrusted)r   r  r   s    rQ   
publishingzlocalrepository.publishing  s!     w!!)Z4!HHHrU   c                     |                                  sdS |                                 sdS |                     d          j        j         S )NFT   visible)r   rn  r   r  r  r   s    rQ   cancopyzlocalrepository.cancopy  sI    zz|| 	5   	4==,,6CCCrU   c                 *    | j         | j        k    rdS dS )z2the type of shared repository (None if not shared)rg  N)rY  re   r   s    rQ   r  zlocalrepository.shared  s    ?di''8trU   c                 4     | j         j        | j        |g|R  S rD   )r7   reljoinr  )rL   r   insidefs      rQ   wjoinzlocalrepository.wjoin  s#    tx	17w7777rU   c                 x    || j         }| d                              ||           |                                  d S rD   )r>  
setparentsr  )rL   r  p2s      rQ   rx  zlocalrepository.setparents  s@    :BT
b"%%%..00000rU   c                 4    t          j        | ||||          S )zcchangeid must be a changeset revision, if specified.
        fileid can be a file revision or node.)r  )r   filectx)rL   re   r  fileidr  s        rQ   r{  zlocalrepository.filectx  s(     $&I
 
 
 	
rU   c                 4    | j                                         S rD   )r   getcwdr   s    rQ   r~  zlocalrepository.getcwd  s    }##%%%rU   c                 8    | j                             ||          S rD   )r   pathto)rL   r   cwds      rQ   r  zlocalrepository.pathto  s    }##As+++rU   c                 @   || j         vrg }| j                            |          D ]\  }}|dk    rt          j        | j        d|g          }d }|}| j                                        D ]G\  }}	|                    |          r-|	}|t          |          d          
                                } nH|s
d }d|_        t          j        |          d         s|}
|
fd}d|
j        z   |_        |                    |||f           || j         |<   | j         |         S )N   !rU   c                 ,    t          j        | |          S rD   )r;   filter)scr   s      rQ   rx  z-localrepository._loadfilter.<locals>.<lambda>  s    10E0E rU   commandfilterr  c                      || |          S rD   r   )r  r  oldfnr   s       rQ   rx  z-localrepository._loadfilter.<locals>.<lambda>  s    UU1a[[ rU   zcompat-)rJ  r   configitemsr  r   r  rK  r  r  re  lstriprV   r(   
getargspecr~   )rL   r  rP  patcmdmfr   paramsr   filterfnr  s              rQ   _loadfilterzlocalrepository._loadfilter  sS   )))A G//77 + +S$;;^DIsSE::&*&7&=&=&?&?  ND(~~d++ %!$SYY[[!1!8!8!:!:  2EEB"1BK*2..q1 =E,1HHHB"+en"<BK"b&)****'(DV$''rU   c                     |D ]`\  }}} ||          rO| j                             d||pt          j        |j                  fz              |||| j         | |          } na|S )Ns   filtering %s through %s
)r   rM   filename)r   debugr(   sysbytesrV   )rL   
filterpatsr  datar  r   r  s          rQ   _filterzlocalrepository._filter  s    % 	 	KBCr(|| 0!F(9"+(F(FGH   r$dXNNN rU   c                 ,    |                      d          S )Ns   encoder  r   s    rQ   _encodefilterpatsz!localrepository._encodefilterpats      	***rU   c                 ,    |                      d          S )Ns   decoder  r   s    rQ   _decodefilterpatsz!localrepository._decodefilterpats  r  rU   c                     || j         |<   d S rD   )rK  )rL   r   r  s      rQ   adddatafilterzlocalrepository.adddatafilter  s    "($rU   c                     | j                             |          r| j                             |          }n| j                             |          }|                     | j        ||          S rD   )r<  islinkreadlinkrO  r  r  rL   r  r  s      rQ   wreadzlocalrepository.wread  s]    9H%% 	,9%%h//DD9>>(++D||D2HdCCCrU   c                 >   |                      | j        ||          }d|v r| j                            ||           nS | j        j        ||fd|i| d|v r| j                            |dd           n| j                            |dd           t          |          S )zwrite ``data`` into ``filename`` in the working directory

        This returns length of written (maybe decoded) data.
           lbackgroundclose   xFT)r  r  r<  symlinkrx  setflagsre  )rL   r  r  flagsr  r   s         rQ   wwritezlocalrepository.wwrite	  s    
 ||D2HdCC5==IdH----DIO$ 0?CI   u}}	""8UD9999	""8UE:::4yyrU   c                 :    |                      | j        ||          S rD   )r  r  r  s      rQ   
wwritedatazlocalrepository.wwritedata	  s    ||D2HdCCCrU   c                 r    | j         r|                                  }nd}|r|                                r|S dS )z4return the current transaction or None if non existsN)rL  running)rL   trs     rQ   r  z"localrepository.currenttransaction	  sC    > 	!!BBB 	"**,, 	ItrU   c                 
     j                             dd          s j                             dd          r.                      j                  t	          j        d                                                                         S  j        	                    d          r0t	          j
        t          d          t          d          	          d
t          j                    t          j                    fz  }t          t          j        |                                                    }d|z   }                     dd|                                           d                                  D             }|r|}n j         j        } j         j        d}t/          j                   d  j                             dd          }	dk    r!|	r j                                        fdfd}
 fd}t7          j        | j        |ddt9          |           j        j        |
|t>                    tA                     j!        d<   tE                      j!        d<   g j!        d<   i j!        d<   |j#        d<   j#        d<   j!        j#        d <   $                    d! j        j%                   fd"}$                    d#|           &                    d$ '                                         fd%}(                    d&|           &                    d' j)                   t/          j                   _*        tW          j,                    S )(Nr  r:  r;  s   transaction requires locking)r      journals   abandoned transaction founds(   run 'hg recover' to clean up transactionrl  s   %.40f#%fs   TXN:s
   pretxnopenT)r/  txnnametxnidc                 8    g | ]\  }}||t          |          fS r   undonamerq  r7   xs      rQ   r  z/localrepository.transaction.<locals>.<listcomp>=	  s)    LLLVS!CHQKK(LLLrU   )r_   rg  c                     d S rD   r   )r  s    rQ   rx  z-localrepository.transaction.<locals>.<lambda>f	  s    d rU   r  s   hook-track-tags   stripc                                 }|J t          j        |j        |          }|j                                        }t          j        |j        ||          }t          j        |j        |||          }|rRd| j        d<   |                    ddd          5 }t          j        ||           d d d            d S # 1 swxY w Y   d S d S )N   1s	   tag_moveds   changes/tags.changes   wT)
atomictemp)	rF  	fnoderevsr   r  headrevsdifftagshookargsr7   	writediff)	tr2rM   	oldfnodesnewheads	newfnodeschangeschangesfileoldheadsreporefs	          rQ   	tracktagsz.localrepository.transaction.<locals>.tracktagsn	  s>   wyy'''#-dgtXFF	>2244#-dgtXFF	 "*47D)YOO @15CL./$ "   @$  )+w???@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @@ @s   CC	Cc           	      x    |                         }|J d} |j         j        | }|r^ |j         j        | d         }|                    dd          }|                    dd          rd}nd}t	          j        || ||           t          j        |j         d	          rt          j	        d
         
                                          D ]l\  }\  }}	j                                        }
|
                    t          j        |||	                      |j        	 dddit!          j        |
           mt          j        |j         d          r|                                j        }j	        d         D ]\  }\  }}	|D ]}j                                        }
t)          |                    |                    }|
                    t-          j        |||	                      |j        	 dddit!          j        |
            |j        	 dddit!          j        j                   dS )zwill run pre-closing hooksN)r  s   single-head-per-branchr   s   account-closed-headsFs   public-changes-onlys	   immutablerp     pretxnclose-bookmarkr  r/  T   pretxnclose-phaserl     pretxnclose)r  )r  )r  )r   r  configsuboptionsr}   r/   enforcesingleheadr   hashookr  r  r  r  r   r   r   preparehookargsr(   r   rE   r  r   r  r&   )r  rM   singleheadopt
singleheadsingleheadsubaccountclosedr?  r   r  r  r   r  r"  r  r  descr  r  r  s                  rQ   validatez-localrepository.transaction.<locals>.validate	  s   $ IcNNN799D###HM++];J  8 8- H K - 1 1+U! ! !$$%;UCC ,!-JJ!+J)#t]J   |DG%<== 
(.J|,2244) ) 	 	$D*3 ;++--DKK	 9$S I IJJJDI/ " #,T22   
 |DG%9:: __&&0(*
9(= 	 	$D*3#  !{//11"2773<<00F$:4c$J$JKKK!	0 "& '066   	 DI &*.6.@.M.M    rU   c                                 }|d S |r|j                             d            d S t          j        d           t          j        d           |j                             d d           |                    d           d S )N   journal.narrowspec   journal.narrowspec.dirstate   journal.dirstateTr  )r   rx  r#   restorebackuprestorewcbackupr  )r  successrM   r  rL   s      rQ   	releasefnz.localrepository.transaction.<locals>.releasefn	  s    799D|
  5 ##D))))) (/DEEE*41OPPP++D2EFFFt44444rU      undo)	validatorr  checkambigfilesr      origrepolens
   obsmarkersrl  r  s   txnids   txnnames   changess   flush-fncachec                 l    | j         fd}             }|J |                    |           dS )z@To be run if transaction is successful, will schedule a hook runc           	                      }|J t          j        |j        d          rt          j        d                                                   }|D ]l\  }\  }}j                                        }|                    t          j
        |||                      |j         	 d
ddit          j        |           mt          j        |j        d          r|                                j        }t          j        d         d           }|D ]\  }	\  }}|	D ]}
j                                        }t          |                    |
                    }|                    t#          j
        |||                      |j         	 dddit          j        |            |j         	 dddit          j                   d S )N   txnclose-bookmarkr  r/  F   txnclose-phaserl  c                     | d         d         S )Nr   r   )r  s    rQ   rx  zUlocalrepository.transaction.<locals>.txnclosehook.<locals>.hookfunc.<locals>.<lambda>
  s    QqT!W rU   )r     txnclose)r  )r  )r  )r   r  r   r  r  r  r  r   r   r   r  r(   r   rE   r  r   r  r&   )unused_successrM   	bmchangesr   r  r  r   r  phasemvr"  r  r  r  r  r  s               rQ   hookfunczClocalrepository.transaction.<locals>.txnclosehook.<locals>.hookfunc	  s*   wyy'''<)=>> 	 &rz,'?'E'E'G'G H HI,5  (jsC!{//11I$=dC$M$MNNN!	0 "' '066    <):;; **4B$
9-3D3D  G -4 	 	(jsC#'  C#%;#3#3#5#5D#&rwws||#4#4D KK(>tS#(N(NOOO%DI 1 &+ #+"4T":":   	 	 ',080B80L0L    rU   N)r  
_afterlock)r  r  rM   r  r  r  s      @rQ   txnclosehookz1localrepository.transaction.<locals>.txnclosehook	  sb     |H! ! ! ! ! ! !F 799D###OOH%%%%%rU   s   txnclose-hooks   -warm-cachec                 r                 }|J  |j         	 dddit          j        | j                   dS )z#To be run if transaction is abortedN   txnabortr/  F)r  )r   r(   r   r  )r  rM   r  s     rQ   txnaborthookz1localrepository.transaction.<locals>.txnaborthook)
  s_    799D###DI #(,4,>s|,L,L    rU   s   txnabort-hooks   refresh-filecachestats)-r   r  rh  rM  r   r   r  nestr'  rU  rV  r   randomtimer   r:   sha1digestr   _writejournal_journalfilesr
  r7   ro  rp  r  r  r4   
aftertransr1   r  ra   re  r  rS   r  addfinalizerx  addpostclose_buildcacheupdateraddabort_refreshfilecachestatsrL  r/   registersummarycallback)rL   r  reportidbasehar  renamesrpvfsmapshouldtracktagsr  r  r  r  r  r  r  r  s   ``            @@@@rQ   r4   zlocalrepository.transaction&	  s   7h88 	NDG<N<Nn=
 =
 	N   //7,-LMMM$$&&>777%%% 9J'' 	/011BCC   
 ==v&&--//00"		-tT	GGG4   LLt7I7I7K7KLLL 	BBB H	::+d##D #N	',,/
 
 8~..00H@ @ @ @ @ @&>	 >	 >	 >	 >	 >	 >	 >	@	5 	5 	5 	5 	5 	50 $IwJ!(
 
 
 &)YY
>"$'EE
=! "
9#%
<  %H"&J"$*J 	')9:::-	& -	& -	& -	& -	& -	&^ 	'666
 	(?(?(C(CDDD	 	 	 	 	 	$l333 	143NOOO R'b$777	rU   c                 B   | j         df| j         df| j        df| j        dff}g }| j                            d          }||                    | j        |f           | j        df| j        dft          j        |           df| j         dff}|t          |          z   |z   S )	Nr  r  r  r     journal.branch   journal.desc   journal.bookmarks   journal.phaseroots)r'  r7   r   data_backup_filenamer~   r   bookmarksvfsr  )rL   firstmiddledirstate_dataends        rQ   r  zlocalrepository._journalfiles9
  s    Y
#Y-.X56X*+	
 ::;NOO$MM48]3444X()X'#D))+?@Y-.	
 uV}}$s**rU   c                 >    d |                                  D             S )Nc                 6    g | ]\  }}|t          |          fS r   r  r  s      rQ   r  z-localrepository.undofiles.<locals>.<listcomp>M
  s'    FFFvsAhqkk"FFFrU   )r  r   s    rQ   	undofileszlocalrepository.undofilesL
  s"    FF1C1C1E1EFFFFrU   c                 R   | j                             d d           t          j        | d           t          j        | d           | j                            dt          j        | j                                                              | j                            ddt          |           |fz             t          j        |           }|                    d|                    d                     | j                            d	| j                            d
                     d S )Nr  r  r  r  r  s   %d
%s
r  r  r  r  )r   
savebackupr#   savewcbackupr7   rx  r   	fromlocalra  re  r   r  r   r'  )rL   r  r  s      rQ   r   zlocalrepository._writejournalO
  s     ':;;;&DEEEd$9:::x1$-2F2F2H2HII	
 	
 	
 	s4yy$6G(GHHH -d33 ,"6"6|"D"D	
 	
 	
 		-ty/@/@/O/OPPPPPrU   c                    |                                  5  | j                            d          r| j                            t          d                     | j        | j        d}t          j        | j        |d| j        j	        t                     |                                  	 d d d            dS | j        	                    t          d                     	 d d d            dS # 1 swxY w Y   d S )Nr  s%   rolling back interrupted transaction
)rU   r_   r  Ts%   no interrupted transaction available
F)r   r'  rU  r   statusr   r7   r4   rollbackr
  ra   r  )rL   r  s     rQ   recoverzlocalrepository.recover^
  sO   YY[[ 	 	y
++ q!JKKLLL"h  $IGL$0    !!!	 	 	 	 	 	 	 	" QHIIJJJ%	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   BC*5(C**C.1C.c                    d x}x}}	 |                                  }|                                 }| j                            d          r=t	          j        | d          }|                     |||          t          |||           S | j                            t          d                     	 t          |||           dS # t          |||           w xY w)Nr  s   rollbacks"   no rollback information available
r   )
wlockr   r'  rU  r   	_rollbackreleaser   r
  r   )rL   dryrunforcer(  r   dsguards         rQ   r%  zlocalrepository.rollbacks
  s    !%%%w	*JJLLE99;;Dy(( '5dKHH~~feW==
 GT5)))) QEFFGGGGT5)))))GGT5))))s   A-C 'C Cc                    | j         }	 | j                            d                                          }t	          |d                   |d         d }}}t          |          dk    r|d         }|dz
  }	|r|j        rt          d          |	||fz  }
nt          d          |	|fz  }
n!# t          $ r t          d          }
d }Y nw xY w|sH| d	         | d
         k    r6|dk    r0t          j
        t          d          t          d                    |                    |
           |rdS | j                                        }|                                  | j        | j        d}t!          j        | j        |d|j        t&                     t)          j        |           }|                    d          r|                    ddd           | j                            d          r| j                            ddd           |                                  | j        j        j        t9          fd|D                       }|r|                                 t=          j        | d           t=          j         | d           | j                            d d           	 | j                            d          }| j        !                    tE          j#        |                     nL# t          $ r? |                    t          d          | j        $                                z             Y nw xY wtK          d | d                                          D                       }t          |          dk    r&|                    t          d          |z             n%|                    t          d           |z             tL          j'        (                    |            | )                                 dS )!Ns	   undo.descr   r   r`  r  s8   repository tip rolled back to revision %d (undo %s: %s)
s4   repository tip rolled back to revision %d (undo %s)
s!   rolling back unknown transaction
r  r      commits;   rollback of last commit while not checked out may lose datas   use -f to forcerl  )r_   rU   r  r#  s   undo.bookmarksr  T)
checkambigs   undo.phaserootsr  c              3   0   K   | ]} |           V  d S rD   r   )rq  phas_nodes     rQ   rc  z,localrepository._rollback.<locals>.<genexpr>
  s-      ::QXXa[[::::::rU   s   undo.narrowspecs   undo.narrowspec.dirstates   undo.dirstates   undo.branchs>   named branch could not be reset: current branch is still '%s'
c                 6    g | ]}|                                 S r   )r  )rq  r2  s     rQ   r  z-localrepository._rollback.<locals>.<listcomp>
  s     CCCQUUWWCCCrU   s3   working directory now based on revisions %d and %d
s+   working directory now based on revision %d
)*r   r7   rO  r^  r	  re  verboser   r  r   r   r$  r   r  
destroyingr'  r4   r%  r
  ra   r   r  rU  renamer  r  r  r3  rg  r   r#   r  r  	setbranchr   rE  ra  r  mergestatemodr    clean	destroyed)rL   r+  r,  r-  r   r   oldlenr  detailoldtipr  r  r  r  
parentgonera  r3  s                   @rQ   r)  zlocalrepository._rollback
  s]   W	8==..99;;D&)$q'llDGT6TV4yyA~~aaZF #"* #(  T6*+
 L TN#  	 	 	9::CDDD	  	dtF|33	8I8I+%  )**    			# 	1-'')) H4955Ivw	
 	
 	
 	
 !-d33011 	!<D      9.// 	QI/4PPP>'0::::':::::
  	1MMOOO$T+=>>>&t-HIIIM''.>???
~66''(8(@(@AAAA   <  m**,,	-     CCd4j.@.@.B.BCCCDDG7||a		1  	    		EFFP   $**4000
 	qs&   BB) )CC&AK- -AL65L6c                 :    t          j        |           fd}|S )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                 N                 }|J |                     |            d S rD   )updatecaches)r  rM   r  s     rQ   updaterz3localrepository._buildcacheupdater.<locals>.updater
  s4    799D###b!!!!!rU   rn  )rL   newtransactionrC  r  s      @rQ   r  z"localrepository._buildcacheupdater
  s4     +d##	" 	" 	" 	" 	"
 rU   c                 V   | |j                             d          dk    rdS |                                 }|rHd}| j                            |d           t
          j        }|dk    rt
          j        }t
          j        }n|t
          j        }t
          j	        |v r||j
        d         t          |           k     r| j                            d           |                     d	                                           |                     d
                                           | j                            |            t
          j        |v r| j                            |           t
          j        |v r| j                            |           t
          j        |v rG|                                }|j        D ]}|                    |           |                                 t
          j        |v r1| d                                         D ]}|                                 t
          j        |v r2t=          j        | j        ||j                                                    t
          j!        |v r| "                                 t
          j#        |v r'|                     d	          "                                 t
          j$        |v r]tJ          j&        '                                D ]@}	|                     |	          }
|
                                                    |
           ?dS dS )a  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   sourcer  za`full` argument for `repo.updatecaches` is deprecated
(use `caches=repository.CACHE_ALL` instead)s   5.9s
   post-cloner  s   updating the branch cache
r   s   served.hidden)r4   r  )(r  r}   rE   r   
deprecwarnr9   
CACHES_ALLCACHES_POST_CLONECACHES_DEFAULTCACHE_BRANCHMAP_SERVEDr  re  r  r   r   rH  write_delayedCACHE_CHANGELOG_CACHEr  update_cachesCACHE_MANIFESTLOG_CACHEr  CACHE_REV_BRANCHrZ  
branchinforx  CACHE_FULL_MANIFESTr  manifestCACHE_FILE_NODE_TAGSrF  r  r"  CACHE_TAGS_DEFAULTr3   CACHE_TAGS_SERVEDCACHE_BRANCHMAP_ALLr*   filtertablekeys)rL   r  fullcachesrO   r  rbcr  r  filtr   s              rQ   rB  zlocalrepository.updatecaches
  s     >bkooi88HDD F   	/>  GsF+++*F}$$#5*FF^.F,66zRZ7#d))CC<===i((22444.//99;;;"00666+v55N((R(888-77**r*:::&&00%%''C^ " "q!!!!IIKKK)V33Dz))++  *f44dgtT^-@-@-B-BCCC(F22IIKKK'611MM)$$))+++)V33 !,1133 5 5==..""$$**84444 435 5rU   c                     dt          |           v r| j        d= | j                                         |                                  | j                                         d S )Nr:  )r   rF   rH  clearinvalidatevolatilesetsrQ  r   s    rQ   invalidatecachesz localrepository.invalidatecachesB  s_    4::%%l+  """##%%%"((*****rU   c                     | j                                          t          j        |            |                                  d S rD   )rO  r^  r$   clearobscachesr  r   s    rQ   r_  z&localrepository.invalidatevolatilesetsL  s@    ##%%%%%%..00000rU   c                     t          | d          rY| j        j        D ](}	 t          | j        |           # t          $ r Y %w xY wt          |                                 d           dS dS )a  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)r   r   r   r   AttributeErrorrE   )rL   r>  s     rQ   invalidatedirstatez"localrepository.invalidatedirstateQ  s     dJ// 	3]-  DM1----%   DDOO%%z22222	3 	3s   6
AAc                    |                                  }t          | j                                                  D ][}|dk    r	|dk    r!|                                 r| j        j        r0|r| j        |= 	 t          ||           L# t          $ r Y Xw xY w| 	                                 |                                 s| j
        	                                 dS dS )a9  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).
        r8  r  N)rE   listr   rX  r  r  _delayedr   rd  r`  r1   )rL   r  rE   r>  s       rQ   r  zlocalrepository.invalidateb  s    __&&
do**,,-- 	 	AK\!!++-- "N+ "  'OA&
A&&&&!   &&(( 	* J'')))))		* 	*s   6B
BBc                 V    |                                   |                                  dS )zyFully invalidates both store and non-store parts, causing the
        subsequent operation to reread any outside changes.N)r  re  r   s    rQ   invalidateallzlocalrepository.invalidateall  s,     	!!!!!rU   c                     | j                                         D ]=\  }}t          j        |          }|dk    s	|| j        vr)|                                 >dS )z>Reload stats of cached files so that they are flagged as validr   N)r   r  r(   r   rF   refresh)rL   r  r>  ces       rQ   r  z&localrepository._refreshfilecachestats  se     _**,, 	 	EAr""AJ!4="8"8JJLLLL		 	rU   c                     d}d}|r6| j                             dd          }| j                             dd          }| j                             dd          }	t          j        | j         ||||||||		  	        }
|
S )Nr      uis   timeouts   timeout.warns   signal-safe-lock)r  	acquirefnr  
signalsafe)r   r  r  lockmodtrylock)rL   r7   locknamewaitr  rp  r  timeoutwarntimeoutrq  rP  s              rQ   _lockzlocalrepository._lock  s      	Dg''z::G'++E?CCKW''/BCC
OG!

 

 

 rU   c                     | j         | j        fD ]4}|o	 |            }|r$|j        r|j                            |            dS 5 |d           dS )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)rN  rM  heldpostreleaser~   )rL   r  rp  rP  s       rQ   r  zlocalrepository._afterlock  sk    
 NDM2 	 	CA QV $$X...HTNNNNNrU   Tc           
         |                      | j                  }||                                 |S |                     | j        d|d| j        t          d          | j        z            }t          j	        |          | _        |S )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.Ns   locks   repository %s)r7   rt  ru  r  rp  r  )
rh  rM  r   rx  r'  r  r   r  ro  rp  )rL   ru  rP  s      rQ   r   zlocalrepository.lock  s     dm,,=FFHHHHJJ	o#$$t}4  
 
  ArU   c           
           j         r                                  nd}||j        r|                                 |S |rj j                            dd          s j                            dd          r4                      j                   j                            d            fd}                      j	        d|| j
        t          d           j        z            }t          j        |           _         |S )	a8  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.Nr  r:  r;  s   "wlock" acquired after "lock"c                       j                                         r j                                          n j                             d             j        d                                          d S )Nr8  )r   pendingparentchanger  rx  r   rl  r   s   rQ   unlockz%localrepository.wlock.<locals>.unlock  se    }0022 *((****##D)))OK(0022222rU   s   wlocks   working directory of %s)rN  rz  r   r   r  rh  rM  rf  rx  r7   re  r   r  ro  rp  )rL   ru  rP  r  s   `   rQ   r(  zlocalrepository.wlock  s    !%8DNND=QV=FFHHHH  	DGx99	Dw!!(N;;	D   //;!!"BCCC	3 	3 	3 	3 	3 JJH#())DM9
 
 !QrU   c                 8    |dS  |            }||j         sdS |S )z3Returns the lock if it's held, or None if it's not.N)rz  )rL   lockrefrP  s      rQ   rh  zlocalrepository._currentlock  s,    ?4GII9AF94rU   c                 6    |                      | j                  S )z4Returns the wlock if it's held, or None if it's not.)rh  rN  r   s    rQ   currentwlockzlocalrepository.currentwlock
  s      000rU   c                    |                                 s|                                r)t          |j        |j        z   |j        z             }|                                D ]}| j                            |          }|dk    s||v s	||j	        v r0||j
        v r ||t          d                     | j                            |          s'|                                                    |          r;|dz   }|D ]}|                    |          r n ||t          d                     || j        vr ||t          d                     dS dS )z2check for commit arguments that aren't committabler  s   file not found!r&  s   no match under directory!s   file not tracked!N)isexactr  rS   modifiedaddedremovedr  r   	normalizer  deletedr   r<  r  r  hasdirr  )	rL   wctxr   r$  failmatchedr   dr  s	            rQ   checkcommitpatternsz#localrepository.checkcommitpatterns  sx   ==?? 	5ellnn 	5&/FL86>IJJG[[]] 5 5M++A..99WT]0B0B&&DA0112229??1%% 5)9)9!)<)< 5DA% A A==++ "!E" Q"> ? ?@@@dm++DA233444%	5 	55 5rU   rU   c                 l	    |i }d }|st          j                    }|s||_                                         5                                   5   d         }	t          |	                                          dk    }
|s7|
r5|                                s!t          j        t          d                     
                    ||          }|r|j                            |j                   t          j         j        |	|||          \  }}}|s                     |	|||           t%          j         |||||          }t(          j                                       }t/          j        |           |                                rb j                            dd          sG j                            d	           |                                 	 ddd           ddd           dS |
r5|                                r!t          j        t          d
                    |r | ||          |_        ||j        k    }                     |j                  }|rtA          j!                   }tE          |          D ]}|	#                    |          } j        
                    t          d           |t          j$        |                    z             |%                    |j        ||          }||         d         |f||<   t          j&         |            j'                                        \  }}tQ          |          | j)        k    rtQ          |          pdc	  *                    dd            +                    d          5   ,                    |d          t[          j.         ||g           |/                               |                                 ddd           n# 1 swxY w Y   n\#  |rT j        0                    t          d          |z              j        0                    t          d          |z              xY wddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y    fd} 1                    |           S )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                 4    t          j        d| |fz            )Ns   %s: %s)r   
InputError)r   r  s     rQ   r  z$localrepository.commit.<locals>.fail8  s    "93x#7888rU   r   sB   cannot partially commit a merge (do not specify files or patterns))r   r:  )r,  ro  s   allowemptycommits(   nothing to commit, clearing merge state
s&   cannot commit merge with missing filess   committing subrepository %s
r   rU   s	   precommitT)r/  parent1parent2r/  s!   note: commit message saved in %s
s6   note: use 'hg commit --logfile %s --edit' to reuse it
c                     j                                       r(                    dt                               d S d S )Nr/  )r  r  r  )r  hasnoder   r   )r  hookp1hookp2r/  rL   s    rQ   
commithookz*localrepository.commit.<locals>.commithook  s[     ~%%c** 		CHHff       rU   )2r  r  badr(  r   re  r  r   r   r   r$  r  extendr:  r2   	precommitr   r  r   workingcommitctxr9  r    rO  r!   checkunresolvedisemptyr  r  resetr  _textsavecommitmessager/   getuipathfnr  r  
subrelpathr   
writestater   r   r>  r   r4   	commitctxr   r   markcommittedrx  r  )rL   textr*  dater   r,  editorextrar  r  merger$  subs
commitsubsnewstatecctxmseditedmsg_pathuipathfnr  r  srr  ry  r  r  r  r/  s   `                         @@@rQ   r   zlocalrepository.commit$  s0   " =E	9 	9 	9  	&O%%E 	EI ZZ\\ [	 [	499;; [	 [	:D''!+E U 5<<>> k>    [[uE[::F &&L  
 *5)>vuE* * *&D*h
  D((ufdCCC+fdD$ D )..t44B%b))) ||~~ dg&8&8*' '  JKKK


Q[	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	T  P Pk!$M"N"NOOO 6#VD$55
TZ'F
 --dj99H  
7".t44
++ 7 7A((1++CGNN:;;"(;#9##>#>??@   DJd;;B#+A;q>2"6HQKK&tX666]**,,FB WWrT['8'DSWW'KNFF		 ff     %%i00  ..t44C$TB8S999&&s+++HHJJJ               
GMM?@@8K   GMM8  #	#   w[	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	 [	z	 	 	 	 	 	 	 	 	
###
s   RFQ5R0E>Q5/.PAP5PPPP	PQ5AQ&&Q5)R5Q9	9R<Q9	=RRRc                 2    t          j        | |||          S )N)r   origctx)r   r  )rL   r  r   r  s       rQ   r  zlocalrepository.commitctx  s    cHHHHrU   c                 ^    dt          |           v r| j                                         dS dS )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  rx  r   s    rQ   r6  zlocalrepository.destroying  s8     DJJ&&""$$$$$ '&rU   c                     | j                             |            | j                                          |                                  |                                  dS )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  filterunknownrx  rB  r  r   s    rQ   r;  zlocalrepository.destroyed  s\     	&&t,,,    	 	rU   r  c                 B    | |                              ||||||          S )z3a convenience method that calls node1.status(node2))r$  )rL   node1node2r   ignoredr:  unknownlistsubreposs           rQ   r$  zlocalrepository.status  s-     E{!!5'5'<
 
 	
rU   c                 :    | j                             |           dS )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)rP  r~   )rL   pss     rQ   addpostdsstatuszlocalrepository.addpostdsstatus  s!    ( 	!!"%%%%%rU   c                     | j         S )zAUsed by workingctx to get the list of post-dirstate-status hooks.rP  r   s    rQ   postdsstatuszlocalrepository.postdsstatus  s    !!rU   c                     | j         dd= dS )z7Used by workingctx to clear post-dirstate-status hooks.Nr  r   s    rQ   clearpostdsstatusz!localrepository.clearpostdsstatus	  s    qqq!!!rU   c                     |6| j         t                                                    }fd|D             S | j                             |          }t	          || j         j        d          S )Nc                 :    g | ]}                     |          S r   )r  )rq  r  r  s     rQ   r  z)localrepository.heads.<locals>.<listcomp>  s#    555SBGGCLL555rU   T)r  reverse)r  reversedr  r  r  r  )rL   startr  r  r  s       @rQ   r  zlocalrepository.heads  sm    =B..H5555H5555$$U++e!3TBBBBrU   c                 v   || d                                          }|                                 }|                    |          sg S t          t	          |                    ||                              }|=t          | j                            |g|          d                   fd|D             }|S )aV  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)closedr  c                     g | ]}|v |	S r   r   )rq  hfbheadss     rQ   r  z/localrepository.branchheads.<locals>.<listcomp>)  s    888A1<<a<<<rU   )	ra  r   rf  rg  r  branchheadsrS   r  nodesbetween)rL   ra  r  r  rA  bheadsr  s         @rQ   r  zlocalrepository.branchheads  s     >$Z&&((F>>##!!&)) 	Ihx33F63JJKKLL$.55ugvFFqIJJG8888888FrU   c                 (   |s| j                                         g}g }|D ]p}|}	 | j                             |          }|d         | j        k    s|d         | j        k    r&|                    |||d         |d         f           n	|d         }kq|S )NTr   r   )r  r  r  r>  r~   )rL   r  r5  rr  r<  r2  s         rQ   rA  zlocalrepository.branches,  s     	+^''))*E 	 	AAN**1--Q44;&&!A$$+*=*=HHaAaD!A$/000aD rU   c                 &   g }|D ]\  }}|g d}}}d}||k    rc|| j         k    rX| j                            |          d         }	||k    r|                    |           |dz  }|	}|dz  }||k    r|| j         k    X|                    |           |S )Nr   r   r  )r>  r  r  r~   )
rL   r?  r  topbottomrr  rP  r  r   r2  s
             rQ   r>  zlocalrepository.between:  s      	 	KC2q!qAAv++!t{"2"2N**1--a066HHQKKKAAQ v++!t{"2"2 HHQKKKKrU   c                     dS )zExtensions can override this function if additional checks have
        to be performed before pushing, or call it if they override push
        command.
        Nr   )rL   pushops     rQ   	checkpushzlocalrepository.checkpushM  s      rU   c                 (    t          j                    S )zReturn util.hooks consists of a pushop with repo, remote, outgoing
        methods, which are called before pushing changesets.
        )r6   hooksr   s    rQ   prepushoutgoinghooksz$localrepository.prepushoutgoinghooksS  s    
 z||rU   c                    	 	                                   }i }||                    |j                   t          j        |          }|d<   |d<   |d<   |d<     j        dddi| n}# t          j        $ rk} j        	                    t          d          |z             |j        r/ j        	                    t          d	          |j        z             Y d }~d
S d }~ww xY w j                            dfz             t          j                   		 fd}                     |           	S )Nr  r  r  r  
   prepushkeyr/  Ts   pushkey-abort: %s
s   (%s)
Fs   pushing key for "%s:%s"
c                 >                         d           d S )Nr   )r  r  r  r  r/  )r   )r  r  r  r  r  r/  rL   s    rQ   runhookz(localrepository.pushkey.<locals>.runhookn  s:    II#      rU   )r  )r  r   r  r(   r   r   r   	HookAbortr   	write_errr   rm  r  r'   pushr  )
rL   r  r  r  r  r  r  r1  r  r/  s
   `````    @rQ   r'   zlocalrepository.pushkeyZ  s   	((**BH~,,,)(33H$-H[!!HUO!HUO!HUODI<<4<8<<<< 	 	 	Ga 677#=>>>x ;!!!I,,"9:::55555		
 	2i5EEFFFl4Cc::	 	 	 	 	 	 	 	 	 	 	   
s   A)A2 2C,A C''C,c                     |                      dd|           | j                            d|z             t          j        | |          }|                      d||           |S )Ns   prelistkeysT)r/  r  s   listing keys for "%s"
s   listkeys)r  rS  )r   r   r  r'   rg  )rL   r  rS  s      rQ   r  zlocalrepository.listkeys{  sb    		.		BBB09<===dI..		+6	BBBrU   c                     d||t          j        |          t          j        |          t          j        |          fz  S )z+used to test argument passing over the wirer   r   r   s         rQ   r   zlocalrepository.debugwireargs  r  rU   c                 $   |                      dd          }	 |                    |           |                                 n# |                                 w xY w|                     |j        t          | j                  dz   d                    S )Ns   last-message.txts   wbr   )r7   rx  r   r  r   re  r  )rL   r  fps      rQ   r  z!localrepository.savecommitmessage  sw    XX)511	HHTNNNHHJJJJBHHJJJJ{{273ty>>A#5#7#78999s   A Ac                     t           j        | j        vrd S | j                            t          j        |                     d S rD   )r9   r  rz  r   rb   r(   r   )rL   categorys     rQ   register_wanted_sidedataz(localrepository.register_wanted_sidedata  s?    ,DMAAF!!("28"<"<=====rU   c                    |t           j        vr&t          d          }t          j        ||z            t          j        |          }|| j                            |g           v }|r(|s&t          d          }t          j        ||z            |r(|s&t          d          }t          j        ||z            | j        	                    |i            |||f| j        |         |<   d S )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'.)
r  	ALL_KINDSr   r   r   r(   r   rV  r}   rR  )	rL   kindr  rX  computerr  replacer  already_registereds	            rQ   register_sidedata_computerz*localrepository.register_sidedata_computer  s    {,,,344C(t444#H--%)A)E)EdB)O)OO 	9g 	9O C (x888 	9- 	9& C (x888 ++D"55548(E3J &x000rU   rD   r   )FN)Fr8  )FF)NFN)T)rU   NNNFNN)r  NNFFFF)NNF)rV   rW   rX   rY   rQ  ARCHIVED_PHASE_REQUIREMENTBOOKMARKS_IN_STORE_REQUIREMENTr  r  r  r  r  r  r  INTERNAL_PHASE_REQUIREMENTr  rR  r  r  r  r  r  r  r  r  r  ri  r`   r@  rE  r   rv  r   propertyr  r  r  r   rE   r   r   r  r  r  rm   r  r  rr   r  r   r  r]   r   r  r  r#   FILENAMEr  r/  r  r  r  r   r  r  r   r  r  r  r  r  __bool__r  r  r"  rS   r,  r   r   r   r:  r3   r8  rM  r6  rU  rW  r   rZ  r^  r`  r  rg  r  r   rn  rq  r  rv  rx  r{  r~  r  r  r  r  r  r  r  r  r  r  r4   r  r  r   r&  r%  r)  r  rB  r`  r_  re  r  rj  r  rx  r  r   r(  rh  r  r  r   r  r6  r;  r$  r  r  r  r  r  rA  r>  r  r  r'   r  r   r  r  r  r   rU   rQ   r  r    s[
         	26/-0/-+02+3,,*-*0)0)N2  @ Y5 Y5 Y5 Y5v1 1 1f  ,  ) ) )	 	 	 K K XK
 
 
 X
$ $ $L    5 5 5 5$  (	 2' 2' 2'h  
 & & X& Z/00< < 10< Z1 1 1 ^
 
 
 D D D ];$ $  $
 
 
*   Z
#$$% % %$% Z
#$$M M %$M Z
#$$M M %$M! ! ! !&- - - 
 
 
   < ; ; ; 0 0 X0M, M, M,^     H# # #
$ $ $. . . 
 
 
   2$ $ $= = = =   ,  "!  !  ! F	5 	5 	5( ( (	; 	; 	;+ + +( ( (
 $ $ $
> > >      5 5 5	 	 	  I I I
D D D  8 8 81 1 1 1
 
 
 
& & &, , , ,( ( (4
 
 
 + + + + + +) ) )D D D   $D D D	 	 	Q Q Q Qf+ + +&G G G Q Q Q  ** * * * Z Z Zx  " O5 O5 O5 O5b+ + +1 1 1
3 3 3""* "* "* "*H" " "     <     .' ' ' 'R  1 1 15 5 5,  C C C CJ I I I I % % %"   B 
 
 
 
& & &," " "" " "C C C C   *    &       B  
 
 
 
: : :> > > >CK K K K K KrU   r  c                 *    d | D             fd}|S )Nc                 ,    g | ]}t          |          S r   )r  )rq  r<  s     rQ   r  zaftertrans.<locals>.<listcomp>  s    +++588+++rU   c                      D ]B\  } }}|                      |           	 |                     ||           3# t          $ r Y ?w xY wd S rD   )	tryunlinkr7  r  )r7   srcdestrenamefiless      rQ   azaftertrans.<locals>.a  sr    ) 	 	NCd MM$

3%%%%$   	 	s   7
AAr   )r  r  r  s     @rQ   r  r    s6    ++U+++K	 	 	 	 	 HrU   c                     t           j                            |           \  }}|                    d          sJ t           j                            ||                    ddd                    S )Nr  r  r   )osre   r  r  rg   r  )r   rW  r   s      rQ   r  r    sW    r""JD$??:&&&&&7<<dll:wBBCCCrU   c                      ddl m} t          j        |          |rt	           |            fd} |            }|                    ||          }|S )Nr   ri  
createoptsc                  (    t                     S )N)ry  )r  )ry  	localpathr   s   rQ   
repo_makerzinstance.<locals>.repo_maker  s    "2y'BBBBrU   )r  rj  r=   urllocalpathcreaterepositorymay_auto_upgrade)	r   re   createry  r	  rj  r  rM   r  s	   `  `    @rQ   instancer    s     $T**I ?Y:>>>>C C C C C C C :<<D##D*55DKrU   c                     dS r   r   )re   s    rQ   islocalr    s    4rU   c                 b    t          |pi           }d|vr|                     dd          |d<   |S )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     rQ   defaultcreateoptsr    s@     j&B''J##!#:7J!K!K
:rU   c                    t                      }|j        s|S t          | |          }t          | |          D ]%}|t          j        v r|                    |           &|j        D ]%}|t          j        vr|                    |           &|S )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  )rS   r+   r  newreporequirementsrQ  WORKING_DIR_REQUIREMENTSrb   )r   r	  srcrepotarget_requirementsr  s        rQ   clone_requirementsr    s     %% # #""2*===J Z00 ' '888##A&&&! ' 'O<<<##A&&&rU   c                    d|vrt          j        d          |d         dk    r*t          j        t          d          |d         z            t          j        h}|                     dd          r|                    t          j                   |                     dd          rT|                    t          j	                   |                     dd          r|                    t          j
                   |                     dd	          }|D ]L}|t          j        v r<t          j        |         }|                                r|                                r nQMt          j        t          d
          d                    d |D                       z  t          d                    |dk    r|                    d           n|dk    r|                    d|z             t#          j        |           rT|                    t          j                   |                     dd          r|                    t          j                   |                     dd          r|                    t          j                   |                     dd          r>|                    t          j                   |                    t          j                   |                     dd          r|                    t          j                   |                     dd          }|dk    r|                    t          j                   |                     dd          }|dk    r>|                    t          j                   |                    t          j                   |                     dd          r|                    t          j                   |                     dd          r|                    t          j                   |                    d          r|                    t          j                   |                    d          r|                    d           |                     dd          r|                    t          j                    |                     dd           r|                    t          j!                   |                     dd!          r|                    t          j"                   d"|v rtG          |d"         j$                  }t          j"        |vr|}nFtG                      }	|D ]+}
|
t          j%        v r|
|v r|	                    |
           ,||	z  }||z  }|                    d#          r |                    t          j&                   n|                    t          j'                   |                     dd$          rt| (                    dd%          }t          d&          }t          d'          }|d(k    r| )                    ||z  |           n|                    t          j*                   |S ))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       K   | ]	}d |z  V  
dS )s   "%s"Nr   )rq  r  s     rQ   rc  z&newreporequirements.<locals>.<genexpr>-  s&      ::1::::::rU   s;   run "hg debuginstall" to list available compression enginesrl  r  s   revlog-compression-zstds   zlibr  r  s   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-stores   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   r   r   rQ  r  r  rb   r  r  r  
configlistr6   r  r  r  rg   r/   gdinitconfigr  r  r  r  r  r  r  r  r  r  r  r}   r  r  r  r  rS   r+   r  rR  r  r  r
  r  )r   r	  r+   r  
compenginer  changelogv2revlogv2source_requirementsto_dropreqversionr  rm  s                 rQ   r  r    s]    ##$/
 
 	

 *,,k'  $	%
 
 	
 $89L	}}Y,, H:;;;==M22 	H_@AAA}}Y55 H  !FGGG--	+@AAK! 
 

)))%j1F!! f&9&9&;&; k;  jj::k:::::	;
 ' 

 

 

 
	
 W34444	w		.;<<<B GABBB==$455 	G_EFFF 
}}Y 233 B@AAA 
}}Y EFF @@AAA>???	}}_o66 CABBB))I'>??KCCC@AAAyy+66H@@@_ABBB=>>>	}}Y 566 ECDDD 
}}Y 566 ECDDD~~n%% =;<<<~~f !   	}}Y 566 IGHHH	}}Y 9:: ><=== 
}}Y 122 @>??? 
""!*]";"HII08KKK /LL eeG# ! !/BBB---C    G#L//L>>+,, 	A_HIIII_?@@@	}}Y <== 	G,,y*NOO=>>K
 
 a<<GGC'MG----_EFFFrU   c                 $   t                      }t          j        |vrt          j        |v rA|                     t          d                     |                    t          j                   t          j        |v st          j        |v r!t          j
        t          d                    t          j        |v rY|                     dd          r$t          d          }|                     |           |                    t          j                   |S )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
)rS   rQ  r  r  r
  r   rb   r  rR  r   r   r  r  )r   r+   droppedr  s       rQ   checkrequirementscompatr0    s    eeG(<<9\IIGG4    KKFGGG .,>>:lJJ+?    0L@@||I'899 ! 
 KK=>>>NrU   c                 L    h dfd|                                 D             S )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.
    >      shallowfilestorer  r  r#  r!     shareditemsr$  c                 $    i | ]\  }}|v	||S r   r   )rq  r>  r?  r  s      rQ   rC  z)filterknowncreateopts.<locals>.<dictcomp>  s$    BBBTQ1E>>Aq>>>rU   )r  )r   r	  r  s     @rQ   filterknowncreateoptsr5    s=      E CBBBZ--//BBBBrU   c                 *   ||d}t          j        |          i }nt          | |          }t          | |          }t	          |t
                    st          j        d          |rSt          j        t          d          d                    t          |                    z  t          d                    t          | |          }|t          | |          z  }t          j        |d	d	
          }t          j        |                    d                    }|                                r$t          j        t          d          |z            d|v r|d         j        }|                    d          r	 t$          j                            ||j                  }t-          j        |          }nN# t0          t2          f$ r:}	t          j        t          d          t5          j        |	                    d}	~	ww xY w|                                s|                                 |                    d	           d|vr|                    d           |                    d           t>          j         |v }
|
r/d|vr+|                    d           |!                    dd           tE          j#        |          \  }}tE          j$        ||           |rBd|vr>t          j        |                    d          d	          }tE          j$        ||           d|v r|%                    d|           |                    d          rCd                    t          |d                             dz   }|%                    d|           dS dS )a7  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?rl  Trb  rd  s   repository %s already existsr#  r$  s   cannot calculate relative path)
notindexedru  rv  rg  ru   s9      dummy changelog to prevent using the old repo layoutre  rL  r3  rM  s   shared)&r   r   r  r5  r  r  r   r   rg   r  r  r0  rT  r7   rU  rV  rY  r}   r  re   relpathrW  r6   r  r  r  r<   r-  makedirsmakedirmkdirrQ  r  r~   r/   filterrequirementswriterequiresrx  )r   re   r	  r+   r  unknownoptsr{  rX  rY  r  	has_storewcreqstorereqr|  r  s                  rQ   r  r    s   < !DC(---

&rjAAA
+B
;;+t,, 	(@    	++  **VK0011	2
 =>>    +2*EEE/LAAAj$>>>GJw||F++,,E||~~ Ioa ?@@4GHHH
"".9
>>+,, 
		W__ZDD
!]:66

Z(    k788#033    >> 	MMTM"""J&&H	KK	1\AI 
]*44H 		
 	
 	
 0>>OE8%'''
  2M33:ejj22FFFh111 
""M:...~~n%% 'F:n#=>>??%GIv&&&&&' 's   >9F8 8H	5G>>Hc                     |                                    G d d          }t                              | d|           dS )z9Poison a repository instance so it can no longer be used.c                       e Zd Zd Zd ZdS ),poisonrepository.<locals>.poisonedrepositoryc                 l    |dk    rt                               | |          S t          j        d          )Nr   s/   repo instances should not be used after unshare)r   __getattribute__r   r   )rL   items     rQ   rF  z=poisonrepository.<locals>.poisonedrepository.__getattribute__g  s9    w..tT:::(B  rU   c                     d S rD   r   r   s    rQ   r   z2poisonrepository.<locals>.poisonedrepository.closeo  s    DrU   N)rV   rW   rX   rF  r   r   rU   rQ   poisonedrepositoryrD  f  s2        	 	 		 	 	 	 	rU   rI  rP   N)r   r   r   )rM   rI  s     rQ   poisonrepositoryrJ  \  sZ     	JJLLL
 
 
 
 
 
 
 
 t[*<=====rU   rD   )NN)r   r  r  r   r  ro  
concurrentr   i18nr   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   rr  r   r  r    r9  r!   r"   r#   r$   r%   r&   r'   r)   r*   r+   rQ  r,   r-   r.   r/   r0   r1   r  r2   r3   rF  r4   r5   r6   r7   rT  r8   
interfacesr9   interfaceutilutilsr:   r;   r<   r=   revlogutilsr>   r  r?   r  r@   rW  r*  urlerrr}  rS   ra   	filecacherB   r]   rm   rr   r   r   r   propertycacher   r   r   r   r   unionr<  implementeripeercommandexecutorr   ipeercommandsr   r   ipeerlegacycommandsr:  r  r[  r`  r  r  r  r  r  r  r  r  r  r!  ilocalrepositoryfilestorager#  r,  r2  ilocalrepositorymainr  r  r  r  r  r  r  r  r  r0  r5  r  rJ  r   rU   rQ   <module>r[     s       				  



                                  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -^       
                     /		
 suuI I I I IW& I I I$	# 	# 	# 	# 	#N 	# 	# 	#	  	  	  	  	  	  	  	     Z       z   $ $ $ $ $. $ $ $*     ( ( ( ( (d0 ( ( (2 2 2 2 2D. 2 2 2+ + +
    
 3455
 ::;;* * * * * * * <;*Z :344Q* Q* Q* Q* Q*
 Q* Q* 54Q*l :9::P P P P Pi P P ;:PJ CEE   2/ / /| | | |~	' ' ' 'TK K K6  0
 
 
>
 
 
4	. 	. 	.$ $ $Nb b bJ  
 :ABB0 0 0 0 0 0 0 CB0 :ABBN N N N N N N CBN! ! !" $&6&67+-D-DE ::;;~"K ~"K ~"K ~"K ~"K ~"K ~"K <;~"KDF  "D D D   "       ,R R Rj( ( (VC C C6{' {' {' {'|> > > > >rU   