403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /usr/lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/lib64/python3.9/site-packages/mercurial/__pycache__/localrepo.cpython-39.opt-1.pyc
a

�+�b�3�@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
mZmZmZddlmZmZddlmZmZmZmZmZmZmZmZmZmZmZm 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/m0Z0m1Z1m2Z2mZm3Z3m4Z4m5Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z=m>Z>m?Z@mAZAmBZBmCZCmDZEmFZFddlGmHZHmCZIdd	lJmKZKmLZLmMZMmNZNdd
lOmPZQmRZSmTZUe'jVZVeCjWZWeCjXZXeY�ZZGdd�de:j[�Z\Gd
d�de\�Z]Gdd�de\�Z^Gdd�de^�Z_Gdd�de^�Z`Gdd�de\�Zadd�ZbGdd�deCjc�ZdGdd�deCjc�Zedd�Zfdd �Zghd!�Zheh�id"h�ZjeI�keHjl�Gd#d$�d$em��ZneI�keHjo�Gd%d&�d&eHjp��ZqeI�keHjr�Gd'd(�d(eq��ZseY�Ztd)d*�Zud+d,�Zvdbd-d.�Zwdcd/d0�Zxd1d2�Zyd3d4�Zzd5d6�Z{d7d8�Z|d9d:�Z}d;d<�Z~d=d>�Zd?d@�Z�eI�keHj��GdAdB�dBem��Z�eI�keHj��GdCdD�dDem��Z�dEdF�Z�eHj�dGdH�feHj�dIdH�fgZ�eI�keHj��GdJdK�dKem��Z�dLdM�Z�dNdO�Z�dddPdQ�Z�dRdS�Z�dedTdU�Z�dVdW�Z�dXdY�Z�dZd[�Z�d\d]�Z�dfd^d_�Z�d`da�Z�dS)g�)�absolute_importN�)�_)�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)�
repositoryr5)�hashutil�procutil�
stringutil�urlutil)�concurrency_checker�	constants�sidedatacs.eZdZdZd�fdd�	Z�fdd�Z�ZS)�_basefilecachezHAll filecache usage on repo are done for logic that should be unfilteredNcsH|dur|S|��}z|j|jWSty4Yn0tt|��||�S�N)�
unfiltered�__dict__Zsname�KeyError�superr@�__get__��self�repo�type�unfi��	__class__��9/usr/lib64/python3.9/site-packages/mercurial/localrepo.pyrFmsz_basefilecache.__get__cstt|��|��|�SrA)rEr@�setrB)rHrI�valuerLrNrOrPxsz_basefilecache.set)N)�__name__�
__module__�__qualname__�__doc__rFrP�
__classcell__rNrNrLrOr@jsr@cs(eZdZdZ�fdd�Zdd�Z�ZS)�
repofilecachez3filecache for files in .hg but outside of .hg/storecs,tt|�j|�|D]}t�|df�qdS)N�plain)rErW�__init__�_cachedfiles�add�rH�paths�pathrLrNrOrYszrepofilecache.__init__cCs|j�|�SrA)r6�join�rH�obj�fnamerNrNrOr_�szrepofilecache.join�rRrSrTrUrYr_rVrNrNrLrOrW|srWcs(eZdZdZ�fdd�Zdd�Z�ZS)�
storecachez filecache for files in the storecs,tt|�j|�|D]}t�|df�qdS)N�)rErdrYrZr[r\rLrNrOrY�szstorecache.__init__cCs
|�|�SrA)�sjoinr`rNrNrOr_�szstorecache.joinrcrNrNrLrOrd�srdcs(eZdZdZ�fdd�Zdd�Z�ZS)�changelogcachezfilecache for the changelogcs&tt|���t�d�t�d�dS)N��
00changelog.ire)�
00changelog.nre)rErgrYrZr[�rHrLrNrOrY�s
zchangelogcache.__init__cCs6|�|d�g}|jjj�dd�r2|�|�|d��|S)Nri�persistent-nodemapFrj�r_r0�opener�options�get�append�rHrar]rNrNrO�
tracked_paths�szchangelogcache.tracked_paths�rRrSrTrUrYrsrVrNrNrLrOrg�srgcs(eZdZdZ�fdd�Zdd�Z�ZS)�manifestlogcachezfilecache for the manifestlogcs&tt|���t�d�t�d�dS)N)�00manifest.ire)�00manifest.nre)rErurYrZr[rkrLrNrOrY�s
zmanifestlogcache.__init__cCs6|�|d�g}|jjj�dd�r2|�|�|d��|S)NrvrlFrwrmrrrNrNrOrs�szmanifestlogcache.tracked_pathsrtrNrNrLrOru�srucs(eZdZdZ�fdd�Zdd�Z�ZS)�mixedrepostorecachez2filecache for a mix files in .hg/store and outsidecstt|�j|�t�|�dSrA)rErxrYrZ�update)rHZpathsandlocationsrLrNrOrY�szmixedrepostorecache.__init__cCs@|\}}|dkr|j�|�S|dkr2t�d|��|�|�SdS)NrXresunexpected location: %s)r6r_r�ProgrammingErrorrf)rHraZfnameandlocationrb�locationrNrNrOr_�s�zmixedrepostorecache.joinrcrNrNrLrOrx�srxcCs$|��j�|d�}|sdS|jdfS)z{check if a repo has already cached "name" filecache-ed property

    This returns (cachedobj-or-None, iscached) tuple.
    N�NFT)rB�
_filecacherpra)rI�nameZ
cacheentryrNrNrO�isfilecached�srcs"eZdZdZd�fdd�	Z�ZS)�unfilteredpropertycachez0propertycache that apply to unfiltered repo onlyNcs,|��}||ur tt|��|�St||j�SrA)rBrEr�rFrr~rGrLrNrOrF�szunfilteredpropertycache.__get__)N)rRrSrTrUrFrVrNrNrLrOr��sr�c@seZdZdZdd�ZdS)�filteredpropertycachez1propertycache that must take filtering in accountcCst�||j|�dSrA)�object�__setattr__r~)rHrarQrNrNrO�
cachevalue�sz filteredpropertycache.cachevalueN)rRrSrTrUr�rNrNrNrOr��sr�cCs|t|���vS)z?check if a repo has an unfilteredpropertycache value for <name>)�varsrB)rIr~rNrNrO�hasunfilteredcache�sr�cst����fdd��}|S)z@decorate method that always need to be run on unfiltered versioncs�|��g|�Ri|��SrA)rB)rI�args�kwargs��origrNrO�wrapper�sz!unfilteredmethod.<locals>.wrapper)�	functools�wraps)r�r�rNr�rO�unfilteredmethod�sr�>s	branchmap�pushkeyslookupsunbundles	getbundlesknownschangegroupsubsetc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�localcommandexecutorcCs||_d|_d|_dSr|)�_peer�_sent�_closed)rH�peerrNrNrOrY�szlocalcommandexecutor.__init__cCs|SrArNrkrNrNrO�	__enter__szlocalcommandexecutor.__enter__cCs|��dSrA)�close)rH�exctypeZexcvalue�exctbrNrNrO�__exit__szlocalcommandexecutor.__exit__c	Cs�|jrt�d��|jr t�d��t|jt�|��}tj�	�}z|fit�
|���}Wn*ty~t�|t
��dd��Yn0|�|�|S)Ns1callcommand() cannot be used after sendcommands()s*callcommand() cannot be used after close()r)r�rrzr�rr�r'�sysstrZfuturesZFuture�	strkwargs�	ExceptionZfuture_set_exception_info�sys�exc_infoZ
set_result)rHZcommandr��fn�f�resultrNrNrO�callcommand
s ��

z localcommandexecutor.callcommandcCs
d|_dS�NT)r�rkrNrNrO�sendcommands$sz!localcommandexecutor.sendcommandscCs
d|_dSr�)r�rkrNrNrOr�'szlocalcommandexecutor.closeN)	rRrSrTrYr�r�r�r�r�rNrNrNrOr��sr�cs�eZdZdZd)�fdd�	Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zd*dd�Z
d+dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Z�ZS),�	localpeerz8peer for a local repo; reflects only the most recent APINcs`tt|���|durt��}|�d�|_|j|_|jrPt	�
|�}|�d|�|�|�|_
dS)N�servedsexp-wanted-sidedata=)rEr�rY�
moderncaps�copy�filtered�_repo�ui�_wanted_sidedatarZformat_remote_wanted_sidedatar[�_restrictcapabilities�_caps)rHrI�caps�	formattedrLrNrOrY/s
zlocalpeer.__init__cCs
|j��SrA)r��urlrkrNrNrOr�?sz
localpeer.urlcCs|jSrA)r�rkrNrNrO�localBszlocalpeer.localcCs|SrArNrkrNrNrOr�Eszlocalpeer.peercCsdSr�rNrkrNrNrO�canpushHszlocalpeer.canpushcCs|j��dSrA)r�r�rkrNrNrOr�Kszlocalpeer.closecCs
|j��SrA)r�r
rkrNrNrOr
Rszlocalpeer.branchmapcCs|jSrA)r�rkrNrNrO�capabilitiesUszlocalpeer.capabilitiescCs|j�tj�SrA)r��tryreadrZCB_MANIFEST_FILErkrNrNrO�clonebundlesXszlocalpeer.clonebundlescCs$d||t�|�t�|�t�|�fS)z+Used to test argument passing over the wire�%s %s %s %s %s�r'�bytestr�rHZoneZtwoZthreeZfourZfiverNrNrO�
debugwireargs[s�zlocalpeer.debugwireargsc	KsXtj|j|f||||d�|��d}t�|�}t�|�rFt�|j|�St	�d|d�SdS)N)�heads�common�
bundlecaps�remote_sidedatar�01)
rZgetbundlechunksr�r5�chunkbufferZbundle2requestedr�getunbundlerr�r)	rH�sourcer�r�r�r�r��chunks�cbrNrNrO�	getbundlees"	����	

zlocalpeer.getbundlecCs
|j��SrA)r�r�rkrNrNrOr��szlocalpeer.headscCs|j�|�SrA)r��known�rH�nodesrNrNrOr��szlocalpeer.knowncCs|j�|�SrA)r��listkeys)rH�	namespacerNrNrOr��szlocalpeer.listkeyscCs|j�|�SrA)r��lookup�rH�keyrNrNrOr��szlocalpeer.lookupcCs|j�||||�SrA)r�r&)rHr�r��old�newrNrNrOr&�szlocalpeer.pushkeycCst�td���dS)Ns.cannot perform stream clone against local peer)r�AbortrrkrNrNrO�
stream_out�szlocalpeer.stream_outc
Cs z�zTt�|j|d�}t�|j||d|�}t�|d�rPt�|���}t	�
|j|�}|WWSty�}zjt|dd�}|r�t	�
|jj�}|D]}	|�|	�q�t�|���}t	�
|j|�}
t	�|j|
��WYd}~n
d}~00Wn>tj�y}z"t�td�t�|���WYd}~n
d}~00dS)zPapply a bundle on a repo

        This function handles the repo locking itself.Nspushs	getchunksZ_bundle2salvagedoutputrNspush failed:)rZ
readbundler��unbundler�r5�safehasattrr�Z	getchunksrr�r�rZbundle20ZaddpartZ
processbundlerZ	PushRacedZ
ResponseErrorrr;�forcebytestr)rHZbundler�r��ret�stream�exc�outputZbundler�out�brNrNrOr��s,�zlocalpeer.unbundlecCst|�SrA)r�rkrNrNrO�commandexecutor�szlocalpeer.commandexecutor)N)NNN)NNNN)rRrSrTrUrYr�r�r�r�r�r
r�r�r�r�r�r�r�r�r&r�r�r�rVrNrNrLrOr�+s0

�
)r�cs@eZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Z�Z	S)�locallegacypeerzcpeer extension which implements legacy methods too; used for tests with
    restricted capabilitiescstt|�j|td�dS)N)r�)rEr�rY�
legacycaps)rHrIrLrNrOrY�szlocallegacypeer.__init__cCs|j�|�SrA)r��between)rH�pairsrNrNrOr��szlocallegacypeer.betweencCs|j�|�SrA)r��branchesr�rNrNrOr��szlocallegacypeer.branchescCs*tj|j||j��d�}t�|j|d|�S�N)ZmissingrootsZancestorsofr�)r�outgoingr�r�r�makechangegroup)rHr�r�r�rNrNrOr�s�zlocallegacypeer.changegroupcCs$tj|j||d�}t�|j|d|�Sr�)rr�r�rr�)rH�basesr�r�r�rNrNrO�changegroupsubset�s�z!locallegacypeer.changegroupsubset)
rRrSrTrUrYr�r�rr�rVrNrNrLrOr��sr�cCsX|�d��d�}tj|vr*t�|�|��}tj|dd�}|�	�sTt
�td�|j
��|S)z�returns 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_REQUIREMENTr5�normpathr_�vfsmodr6�existsr�	RepoErrorr�base)�hgvfsr*�
sharedpath�	sharedvfsrNrNrO�
_getsharedvfs�s
��r�c
CsXzt|�d����}Wn<tyR}z$|r6|jtjks8�t�}WYd}~n
d}~00|S)z�reads the require file present at root of this vfs
    and return a set of requirements

    If allowmissing is True, we suppress ENOENT if raised�requiresN)rPr��
splitlines�IOError�errno�ENOENT)r6Zallowmissingr*�erNrNrO�
_readrequiress
r�c!CsZ|��}|j|_tj|ddd�}|�d�}tj|dd�}d}d}|��s�z|��Wnpty�}	z|	jtjkrr�WYd}	~	nHd}	~	0t	y�}	z(t
�td�|t
�|	�f��WYd}	~	n
d}	~	00t
�td�|��t|d�}
tj|
vp�tj|
v}d}|�rt||
�}t�|�d	��}nt�|�d	��}td
�}tj|
v�r�|�r�tjt|d�v�r�|�dd�}
|�dd
�}|dv�r�ddlm}|�||||
||
�n4|dk�r�t
jtd�|d��nt
jtd�||d��n|
t|d�O}
n�|�rvt|d�}tj|v�rv|�dd�}|�dd�}
|dv�rBddlm}|�||||
||
�n4|dk�r`t
jtd�|d��nt
jtd�||d��t||||
|��r�t||||
�t�|�t� |�dd�t�|�D�}t!|�}t"|
|�t#||
�t$�}|�r|j%}|�d�}|�&t'j(�n|j%}|�d�}|�d�}t)|
|dd��}|j*|_*|j}t+||
|�|_,tj-|
v�sbtj.|
v�rz|�&t'j/�|�0t'j1�tj|dd�}|j*|_*tj|dd�}|j*|_*g}i}t2D]V\}}|�|||
||||||j,|||||d �}t3|t4��s�t
�5d!|��|�6|��q�t7�8d"|j%d#�t9|
��f�}t4|t:|�i�} | ||||||
|||||||d$�
S)%aeCreate 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�Z
expandpathr��.hg�ZcacheauditedFNsinvalid path %s: %ssrepository %s not found�stores?see `hg help config.format.use-share-safe` for more informationsshares"safe-mismatch.source-not-safe.warnssafe-mismatch.source-not-safe)sdowngrade-allow�allowsdowngrade-abortr)�upgrade�aborts4share source does not support share-safe requirement��hintsfshare-safe mismatch with source.
Unrecognized value '%s' of `share.safe-mismatch.source-not-safe` set.ssafe-mismatch.source-safessafe-mismatch.source-safe.warn)s
upgrade-allowrs
upgrade-abortsWversion mismatch: source uses share-safe functionality while the current share does notsbshare-safe mismatch with source.
Unrecognized value '%s' of `share.safe-mismatch.source-safe` set.cSsh|]\}}|j�qSrN�rR��.0�n�mrNrNrO�	<setcomp>�rez&makelocalrepository.<locals>.<setcomp>�cache�wcachecSstj|dd�S)NTr)r�r6)r�rNrNrO�<lambda>�rez%makelocalrepository.<locals>.<lambda>)r��intentsr*�features�wdirvfsr�r0�storevfsZstoreoptions�cachevfs�	wcachevfs�extensionmodulenames�
extrastateZbaseclassessunable to construct type for %ssderivedrepo:%s<%s>�,)
�baseuir��origrootrr�r*�supportedrequirementsr�r0rrrr);r�r�r6r_�isdir�stat�OSErrorr�r��
ValueErrorrr�rr;r�r�r�r��SHARED_REQUIREMENTr�r��SHARESAFE_REQUIREMENT�
configbool�config�rZdowngrade_share_to_non_safeZupgrade_share_to_safe�loadhgrc�
afterhgrcloadrZloadallZ
populateui�gathersupportedrequirements�ensurerequirementsrecognized�ensurerequirementscompatiblerPr�r[r8ZREPO_FEATURE_SHARED_STORAGE�	makestore�
createmode�resolvestorevfsoptionsro�REVLOGV2_REQUIREMENT�CHANGELOGV2_REQUIREMENT�REPO_FEATURE_SIDE_DATA�discard�REPO_FEATURE_STREAM_CLONE�REPO_INTERFACES�
isinstancerJrzrqr'r��sorted�tuple)!rr^rr�rZhgpathr��sharedr�r�r*rrZ
mismatch_warnZmismatch_configrZsourcerequiresrrrZ
storebasepathZ	cachepathZ
wcachepathr0rrr�rZifacer��typr~�clsrNrNrO�makelocalrepositorys\
�

�
�����
�
����

�
�
�����






�������r9cCs�t��sdSd}tj|vrP|rPz|j|�d�|jd�d}WntyNYn0z|j|�d�|jd�d}Wnty�Yn0z|j|�d�|jd�d}Wnty�Yn0|S)aLoad 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��rootTshgrc-not-shared)r(Z
use_repo_hgrcr�r!Z
readconfigr_r�r�)r�rr�r*r�r�rNrNrOr%Os(r%cCs^dgdgdgd�}t|���D]:\}}||vr0q|D]"}|�d|�s4|jd|ddd�q4qd	S)
aQPerform 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
extensionsresautoload)r�N)r4�items�	hasconfigZ	setconfig)r�rr�r*Zautoextensions�requirement�namesr~rNrNrOr&ys
�r&cCs�ttj�}dd�t�|�D�}tD]}|j|vr"|||�q"tjD]D}tj|}|��rB|�	�rB|�
d|�|��dkrB|�
tj
�qB|S)z6Determine the complete set of recognized requirements.cSsh|]\}}|j�qSrNrrrNrNrOr�rez.gathersupportedrequirements.<locals>.<setcomp>�exp-compression-%s�zstd)rP�localrepository�_basesupportedr�featuresetupfuncsrSr5�compengines�	available�revlogheaderr[r~r�ZREVLOG_COMPRESSION_ZSTD)r��	supported�modulesr�r~�enginerNrNrOr'�s



r'cCsrt�}|D]:}||vrq
|r,|dd���s:t�td���|�|�q
|rntjtd�d�t|��td�d��dS)	aValidate 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.
    rrs.hg/requires file is corrupts:repository requires features unknown to this Mercurial: %s� sJsee https://mercurial-scm.org/wiki/MissingRequirement for more informationrN)rP�isalnumrZRequirementErrorrr[r_r4)r*rL�missingrBrNrNrOr(�s 	���r(cCs"tj|vrtjst�td���dS)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.
    sfrepository is using sparse feature but sparse is not enabled; enable the "sparse" extensions to accessN)r��SPARSE_REQUIREMENTr/Zenabledrr�r)r�r*rNrNrOr)�s����r)cCsDtj|vr8tj|vr,tj|v}t�|||�St�||�St�||�S)z,Construct a storage object for a repository.)r��STORE_REQUIREMENT�FNCACHE_REQUIREMENT�DOTENCODE_REQUIREMENT�storemodZfncachestoreZencodedstoreZ
basicstore)r*r^ZvfstypeZ	dotencoderNrNrOr*�s


r*cCs�i}tj|vrd|d<|�dd�}|dur2||d<tj|vsFtj|vrZ|�t|||��nd|d<tj|vrvd|d<n |�d	d
�}d}||vr�d|d<|S)
z�Resolve the options to pass to the store vfs opener.

    The returned dict is used to influence behavior of the storage layer.
    T�treemanifest�formatsmanifestcachesizeNsrevlogv0�changeset-sidedatascopies-storage�experimentalscopies.write-to)schangeset-onlys
compatibilitysextra)	r��TREEMANIFEST_REQUIREMENT�	configint�REVLOGV1_REQUIREMENTr-ry�resolverevlogstorevfsoptions�COPIESSDC_REQUIREMENTr#)r�r*rroZmanifestcachesizeZ
writecopiestoZcopiesextramoderNrNrOr,�s&
��

r,cCs�i}i|d<tj|vrd|d<tj|vr0d|d<tj|vrBd|d<tj|vrTd|d<|�dd�}|d	urp||d<|�d
d�}||d<|�d
d
�}||d<|�d
d�}d}|r�|�d
d�}|d	ur�t�|�}||d<||d<|�	dd�}	d|	kr�|	|d<|�	dd�}
|
d	u�r|
|d<|�dd�}t
|�dd��}|�	dd�}
||d<||d<|
|d<tj|v}||d<|�rvd|d<d	}|�r�t
j}|�dd|�}|d	u�r�||d<|D]4}|j}|d ��s�|d!��r�|�d"d#�d#|d$<�q�|�d
d%�|d&<|d&d	u�r6d|d&k�rd'k�s6ntd(�}t�||d&��|�d
d)�|d*<|d*d	u�r�d|d*k�rpd+k�s�ntd,�}t�||d*��tj|v�r�d|d-<|�dd.��r�d|d.<tj|v�r�|�d
d/�}|d0v�r|�d
d/�}td1�}|�||�|j�s|�td2�|�|}td3�}td4�}tj�s�|d5k�rnd6|d7}|�|�|j�snd8|d9}|�|�|d:k�r�tj||d;��d|d<<tj|v�r^|�d
d=�}|d0v�r�|�d
d=�}td>�}|�||�|j�s�|�td2�|�|}td?�}td@�}tj�s^|d5k�rFd6|d7}|�|�|j�sFd8|d9}|�|�|d:k�r^tj||d;��|�d
dA��rtd|dB<|�dCd<��r�d|dD<|S)Ez+Resolve opener options specific to revlogs.sflagprocessorsT�revlogv1�revlogv2schangelogv2sgeneraldeltarXschunkcachesizeN�storages#revlog.optimize-delta-parent-choicesdeltabothparentssrevlog.issue6528.fix-incomingsissue6528.fix-incomingsrevlog.reuse-external-deltaFs"revlog.reuse-external-delta-parents	lazydeltas
lazydeltabaserZsmaxdeltachainspanrsmmapindexthresholdssparse-readssparse-read.density-thresholdssparse-read.min-gap-sizeswith-sparse-readssparse-read-density-thresholdssparse-read-min-gap-size�
sparse-revlogsmaxchainlensrevlog-compression-sexp-compression-�-�s
compenginesrevlog.zlib.levels
zlib.level�	s8invalid value for `storage.revlog.zlib.level` config: %dsrevlog.zstd.levels
zstd.level�s8invalid value for `storage.revlog.zstd.level` config: %dsenableellipsiss
rust.indexs#revlog.persistent-nodemap.slow-path)r�warnrsMunknown value for config "storage.revlog.persistent-nodemap.slow-path": "%s"
s"falling back to default value: %s
sQaccessing `persistent-nodemap` repository without associated fast implementation.s@check `hg help config.format.use-persistent-nodemap` for detailsrhs	warning: r��(s)
rrrlsdirstate-v2.slow-paths7unknown value for config "dirstate-v2.slow-path": "%s"
sJaccessing `dirstate-v2` repository without associated fast implementation.s9check `hg help config.format.use-dirstate-v2` for detailssrevlog.persistent-nodemap.mmapspersistent-nodemap.mmap�develsdevel-force-nodemap)r�r]r-r.�GENERALDELTA_REQUIREMENTr\r"r.Z
gddeltaconfigZconfigbytes�floatr#�SPARSEREVLOG_REQUIREMENT�revlogconstZSPARSE_REVLOG_MAX_CHAIN_LENGTH�
startswith�splitrrr��NARROW_REQUIREMENT�NODEMAP_REQUIREMENTZconfig_default�warn�quietr+ZHAS_FAST_PERSISTENT_NODEMAP�DIRSTATE_V2_REQUIREMENTrZHAS_FAST_DIRSTATE_V2)r�r*rroZchunkcachesizeZdeltabothparentsZ	issue6528Z	lazydeltaZ
lazydeltabaseZ	chainspanZmmapindexthresholdZwithsparsereadZsrdensitythresZsrmingapsizeZsparserevlogZmaxchainlen�r�prefix�msgZ	slow_path�defaultrrNrNrOr^s



��

�

�
����




��



r^cKstS)z6Produce a type conforming to ``ilocalrepositorymain``.)rF)r�rNrNrO�makemain�srzc@seZdZdZdd�ZdS)�revlogfilestoragez File storage when using revlogs.cCs$|�d�r|dd�}t�|j|�S�N�/r)ror�svfs�rHr^rNrNrO�file�s
zrevlogfilestorage.fileN�rRrSrTrUr�rNrNrNrOr{�sr{c@seZdZdZdd�ZdS)�revlognarrowfilestoragez1File storage when using revlogs and narrow files.cCs(|�d�r|dd�}t�|j||j�Sr|)rorZ
narrowfilelogr~�_storenarrowmatchrrNrNrOr��s
zrevlognarrowfilestorage.fileNr�rNrNrNrOr��sr�cKs.|�tj�|�tj�tj|vr&tStSdS)z=Produce a type conforming to ``ilocalrepositoryfilestorage``.N)r[r8Z REPO_FEATURE_REVLOG_FILE_STORAGEr1r�rqr�r{)r*rr�rNrNrO�makefilestorage�s

r�cCstSrA)rzrNrNrNrOr�rercCstSrA)r�rNrNrNrOr�rec@s�eZdZdZejejejejej	ej
ejejej
ejejejejejejejejejejhZhd�Zd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Ze dd��Z!e dd��Z"dd�Z#dd�Z$dd�Z%d�dd�Z&e'dddd�d d!��Z(d"d#�Z)e d$d%��Z*e+d&d'�d(d)��Z,e+d*�d+d,��Z-e.�d-d.��Z/e0�d/d0��Z1e2d1�d2d3��Z3d4d5�Z4d6d7�Z5e+e6j7�d8d9��Z8e+e6j7�d:d;��Z9e+e6j7�d<d=��Z:d�d?d@�Z;dAdB�Z<e=dCdD��Z>e=dEdF��Z?e@dGdH��ZAe dIdJ��ZBdKdL�ZCdMdN�ZDdOdP�ZEeEZFdQdR�ZGdSdT�ZHdUdV�ZIdWdX�ZJd�dYdZ�ZKd[d\�ZLd�d]d^�ZMeNd_d`��ZOdadb�ZPdcdd�ZQdedf�ZRdgdh�ZSdidj�ZTdkdl�ZUdmdn�ZVe@dodp��ZWdqdr�ZXd�dsdt�ZYdudv�ZZdwdx�Z[dydz�Z\d{d|�Z]d}d~�Z^dd��Z_d�d��Z`d�d��Zad�d�d��Zbd�d�d��Zcd�d��Zdd�d�d��Zed�d��Zfd�d��Zge=d�d���Zhe=d�d���Zid�d��Zjd�d��Zkd�d�d��Zld�d��Zmd�d��Zn�dd�d��Zod�d��Zpd�d��Zqe@d�d���Zrd�d��Zs�dd�d��Zte@d�d���Zud�d��Zve@�dd�d���Zwd�d��Zxd�d��Zyd�d��Zz�dd�d��Z{d�d��Z|e@d�d���Z}d�d��Z~d�d��Z�dd�dÄZ��dd�dńZ�d�dDŽZ�d�dɄZ�d�d˄Z�e@�dd�d΄�Z�e@�dd�dЄ�Z�e@d�d҄�Z�e@d�dԄ�Z��dd�dׄZ�d�dلZ�d�dۄZ�d�d݄Z��d	d�d߄Z��d
d�d�Z�d�d�Z�d�d�Z�d�d�Z�e=d�d��Z�d�d�Z�d�d�Z��dd�d�Z�d�d�Z�d�d�Z��dd�d��Z�dS(
rFaQMain class for representing local repositories.

    All local repositories are instances of this class.

    Constructed on its own, instances of this class are not usable as
    repository objects. To obtain a usable repository object, call
    ``hg.repository()``, ``localrepo.instance()``, or
    ``localrepo.makelocalrepository()``. The latter is the lowest-level.
    ``instance()`` adds support for creating new repositories.
    ``hg.repository()`` adds more extension integration, including calling
    ``reposetup()``. Generally speaking, ``hg.repository()`` should be
    used.
    >r��dirstatesbisect.state�cache/r:NcCs�||_||_||_||_|j|_||_|j|_||_t	|_
|j
j|_||_||_
|	|_|
|_||_||_d|_|j�dd�s�|j�dd�r�|�|jj�|j_g|_t�|j�|jj|_|jj|_|jj|_|j�dd�s�|j�dd��r$t�|jd��r|�|jjj�|jj_n|�|jj�|j_d|_ t!�"�|_#d|_$i|_%i|_&d|_'|_(|_)i|_*i|_+g|_,t-�-�|_.i|_/i|_0t1�2|�|_3d|_4t5j6|jv�r�d|_4t7�|_8i|_9t:�;|�dS)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.
        Nrj�all-warnings�check-lockssvfsFrY)<rr�r�wvfsr�r<r6r^r*r�
nodeconstants�nullidrLr�r0rrr�
filternamer"�_getvfsward�audit�_phasedefaultsrZsetupZspathr~r_rfr5r��_getsvfsward�_dirstatevalidatewarnedr
ZBranchMapCache�
_branchcaches�_revbranchcache�_filterpats�_datafilters�	_transref�_lockref�	_wlockrefr}�filteredrevcache�
_postdsstatusr!rC�_sparsesignaturecacheZ_sparsematchercacher)Zextrafilter�_extrafilteridZfilecopiesmoder�r_rPr��_sidedata_computers�sidedatamodZset_sidedata_spec_for_repo)rHrr�rrr�r*rr�r0rrrrrNrNrOrY'sfD
�


�
	
zlocalrepository.__init__cs t����d���fdd�	}|S)zbuild a ward for self.vfsNcs��|d�}��}|dus2t�|d�r2t�|d�s6dS|dvrBdS��|j�rd�t|j�dd����d�r�d}|jj|�dd	d
�d}t�fdd
�|D��r�|�|j	�dur�|jjd�ddd
�nD|�|j
�du�r�jD]}��|�r�dSq�|jjd�ddd
�|S)N��modes	_wlockref�_lockref�N�rsrbrr�s2accessing cache with vfs instead of cachevfs: "%s"�s	cache-vfs)�
stacklevelr#)sjournal.sundo.s
strip-backup/r�c3s|]}��|�VqdSrA)ro)r	rw�r^rNrO�	<genexpr>�rez@localrepository._getvfsward.<locals>.checkvfs.<locals>.<genexpr>�write with no lock: "%s"r�swrite with no wlock: "%s")r5r�ror^�lenr��	develwarn�any�_currentlockr�r��_wlockfreeprefix)r^r�r�rIrxZvfs_path_prefixesrw��origfunc�rrefrHr�rO�checkvfs�sD�
�
�
�

�z-localrepository._getvfsward.<locals>.checkvfs)N��weakref�ref)rHr�r�rNr�rOr��s
-zlocalrepository._getvfswardcst�|��d��fdd�	}|S)zbuild a ward for self.svfsNcs��||d�}��}|dus&t�|d�s*dS|dvr6dS|�|j�rX|t|j�dd�}|�|j�dur||jjd|dd�|S)Nr�r�r�rr��)r�)	r5r�ror�r�r�r�r�r�)r^r�r�rI�r�r�rNrO�	checksvfs�s�z/localrepository._getsvfsward.<locals>.checksvfs)Nr�)rHr�r�rNr�rOr��s
zlocalrepository._getsvfswardcCs|��dSrA)�_writecachesrkrNrNrOr�szlocalrepository.closecCs|jr|j��dSrA)r��writerkrNrNrOr�szlocalrepository._writecachescCs\|j�dd�r>t|�}t�tj|dd��}|�dt�|��|j�dd�rX|�t	j
�|S)NrZsbundle2-advertisesclient)Zrolesbundle2=snarrow)r�r"rPrZ
encodecapsZgetrepocapsr[�urlreq�quoter7Z	NARROWCAP)rHr�ZcapsblobrNrNrOr�s�z%localrepository._restrictcapabilitiescCstj|j|jd�S)N)�callback�r$Zpathauditorr<�_checknestedrkrNrNrO�auditor szlocalrepository.auditorcCstj|j|jddd�S)NFT)r�Zrealfs�cachedr�rkrNrNrO�nofsauditor&s�zlocalrepository.nofsauditorcCs�|�|j�sdS|t|j�dd�}t�|�}|d}t�|�}|r�d�|�}||jvr�||krfdS|�|�}|�	|t|�dd��SqB|�
�qBdS)z/Determine if path is a legal nested repository.FrNr}T)ror<r�r5�pconvertZ	splitpathr_�substate�subZchecknested�pop)rHr^ZsubpathZnormsubpath�ctx�partsrwr�rNrNrOr�.s





zlocalrepository._checknestedcCst|�SrA)r�rkrNrNrOr�Tszlocalrepository.peercCs|S)zaReturn unfiltered version of the repository

        Intended to be overwritten by filtered repo.rNrkrNrNrOrBWszlocalrepository.unfilteredcCs<|jdur d|vr |d|j}t�|��j�}||||�S)aReturn 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�%)r�r)ZnewtyperBrM)rHr~Zvisibilityexceptionsr8rNrNrOr�]szlocalrepository.filtered)�	bookmarksrX)sbookmarks.currentrX)r�rerhcCs|��t�|�SrA)�_refreshchangelogrZbmstorerkrNrNrO�
_bookmarksos7zlocalrepository._bookmarkscCs dt|�vr|��dur|`dS)z7make sure the in memory changelog match the on-disk one�	changelogN)r��currenttransactionr�rkrNrNrOr��sz!localrepository._refreshchangelogcCs|jjSrA)r�ZactiverkrNrNrO�_activebookmark�szlocalrepository._activebookmark�
phaserootsricCst�||j�SrA)r%Z
phasecacher�rkrNrNrO�_phasecache�szlocalrepository._phasecachesobsstorecCst�|j|�SrA)r#r*r�rkrNrNrO�obsstore�szlocalrepository.obsstorecCs,|j��|jjt�|j�t�|j	d�d�S)N�	changelog)Zconcurrencychecker)
rZprefetch_parentsr0r�r4Zmayhavependingr<�
revlogcheckerZget_checkerr�)rIrNrNrOr��s


�zlocalrepository.changelogcCs|j�||j�SrA)r0�manifestlogr�rkrNrNrOr��szlocalrepository.manifestlogr�cCs|��SrA)�
_makedirstaterkrNrNrOr�szlocalrepository.dirstatec
sP�fdd�}tj}tj}|�jv}|�jv}tj�j�j�j�j|�j	||d�S)z3Extension point for wrapping the dirstate per-repo.cs
t���SrA)r/ZmatcherrNrkrNrOr�rez/localrepository._makedirstate.<locals>.<lambda>)�use_tracked_hint)
r�ru�DIRSTATE_TRACKED_HINT_V1r*rr6r�r<�_dirstatevalidater�)rHZ
sparsematchfnZv2_req�thZuse_dirstate_v2r�rNrkrOr��s

�zlocalrepository._makedirstatecCsVz|j�|�|WStjyP|jsFd|_|j�td�t|��|j	YS0dS)NTs-warning: ignoring unknown working parent %s!
)
r��revr�LookupErrorr�r�rsrr	r��rH�noderNrNrOr��s��z!localrepository._dirstatevalidatecCs
t�|�S)zdmatcher patterns for this repository's narrowspec

        A tuple of (includes, excludes).
        )r"�loadrkrNrNrO�
narrowpats�szlocalrepository.narrowpatscCs0tj|jvrt��S|j\}}tj|j||d�S�N)�include�exclude)	r�rqr*�matchmod�alwaysr�r"rr<�rHr�r�rNrNrOr��s
z!localrepository._storenarrowmatchcCs:tj|jvrt��St�|�|j\}}tj|j	||d�Sr�)
r�rqr*r�r�r"Zcheckworkingcopynarrowspecr�rr<r�rNrNrO�_narrowmatch�s


zlocalrepository._narrowmatchFcCsP|rJ|r<|j��s<t�|���}t�|j|g�}t�||�St�||j�S|jS)amatcher 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�filesZunionmatcherZintersectmatchers)rHrZincludeexactZemZnmrNrNrO�narrowmatchs	zlocalrepository.narrowmatchcCst�|||�|jdd�dS)NT��clearfilecache)r"Zsave�
invalidate)rHZnewincludesZnewexcludesrNrNrO�
setnarrowpatsszlocalrepository.setnarrowpatscCs(dt|jjftt|jjf|jt|jfiS)N�null)rr�r�rkrNrNrO�_quick_access_changeid_nulls�z+localrepository._quick_access_changeid_nullc	Cs�|j��}|��j}|j��D]z}||jkr.q|j�|�}|durDq||f}|||<|||<|�	|�D]0}|t
krtqf|�|�}||f}|||<|||<qfq|j��}||jkr�|||d<|S)N�.)
r�r�rBr�r�parentsr��index�get_revZ
parentrevsrr��p1)	rHZquick�clr�r�Zpairrvr
Zp1noderNrNrO�_quick_access_changeid_wc$s,





z)localrepository._quick_access_changeid_wccCsdt|�vr|jd=dS)Nr�)r�rCrkrNrNrO�!_quick_access_changeid_invalidateCsz1localrepository._quick_access_changeid_invalidatecCs|jtjvr|jS|jS)z�an helper dictionnary for __getitem__ calls

        This contains a list of symbol we can recognise right away without
        further processing.
        )r�r)Z
filter_has_wcr�r�rkrNrNrO�_quick_access_changeidHsz&localrepository._quick_access_changeidc	sh|durt���St|tj�r"|St|t�rN�fdd�tj|�t����D�S�j	�
|�}|dur||\}}tj�||dd�S|dkr��j�
�}�j�|�}t��||�S�z8t|t�rʈj�|�}|}�n
|dkr�j��}���j�|�}n�t|��jjk�r�z|}�j�|�}Wnttj�y4t|�}�YnVt�y�����rz|���j��v�rztd�}t�|t|���t|�}�Yn0nHt|�d�jjk�r�t|�}�j�|�}nt� d	|t�!t"|��f��t��||�WStj#tjf�yt�$td
�t�!|���YnNt%tf�yDt�&td�t�!|���Yn tj'�ybt���YS0dS)Ncs g|]}|�jjvr�|�qSrN)r��filteredrevs)r	�irkrNrO�
<listcomp>]s�z/localrepository.__getitem__.<locals>.<listcomp>F)Zmaybe_filtered�tipr�s*working directory has unknown parent '%s'!res$unsupported changeid '%s' of type %ssfiltered revision '%s'�unknown revision '%s')(rZ
workingctxr3Zbasectx�slicer'Zxrange�indicesr�r�rp�	changectxr��tipr��intr�rr�rBr�ZnodelenrZFilteredLookupErrorrr�r�r�rr�r	rrzr�rJZFilteredIndexErrorZFilteredRepoLookupError�
IndexError�RepoLookupErrorZWdirUnsupported)rH�changeidZquick_accessr�r�rxrNrkrO�__getitem__Sst


�


��
����zlocalrepository.__getitem__cCs*z||WdStjy$YdS0dS)z!True if the given changeid existsTFN)rr)rHrrNrNrO�__contains__�s
zlocalrepository.__contains__cCsdSr�rNrkrNrNrO�__nonzero__�szlocalrepository.__nonzero__cCs|��}t|j�SrA)rBr�r�)rHrKrNrNrO�__len__�szlocalrepository.__len__cCs
t|j�SrA)�iterr�rkrNrNrO�__iter__�szlocalrepository.__iter__cGs tj|g|�R�}t�|�|�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-Zspectreer,Zmakematcher)rH�exprr�ZtreerNrNrO�revs�s
zlocalrepository.revscgs&|j|g|�R�D]}||VqdS)aVFind 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
)rHrr�rvrNrNrOrP�s	zlocalrepository.setcCs||dgkrt�tg�S|dgkrD|j�d�}|durDt�|dg�S|rdtj|j|t�|�|d�}ntjd||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,Zbasesetrr�rpZmatchanyr�Zlookupfn)rHZspecs�userrZ
quick_datarrNrNrO�anyrevs�s

�zlocalrepository.anyrevscCs
d|jS)Nsfile:r;rkrNrNrOr��szlocalrepository.urlcKstj|j|||fi|��S)z�Call 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.
        )rr�)rHr~�throwr�rNrNrOr�szlocalrepository.hookcCs*Gdd�dt�}|�}|��\|_|_|S)zMReturns a tagscache object that contains various tags related
        caches.c@seZdZdd�ZdS)z-localrepository._tagscache.<locals>.tagscachecSsd|_|_d|_|_dSrA)r2�tagtypes�
nodetagscache�tagslistrkrNrNrOrYsz6localrepository._tagscache.<locals>.tagscache.__init__N)rRrSrTrYrNrNrNrO�	tagscache�sr)r��	_findtagsr2r)rHr�cacherNrNrO�
_tagscache�szlocalrepository._tagscachec
Cspi}|jjr|��\}}n|jj}|jj}t�|�D]6\}}z||�|||<Wq4tj	t
fyhYq40q4|S)zreturn a mapping of tag to node)r�r�rrr2r�r'�	iteritemsrr�r)rH�tr2�ttr��k�vrNrNrOr2szlocalrepository.tagscCs�t�|j|�}dd�|D�}t�|j|||�i}t�|�D]$\}\}}||jkr<||t�|�<q<|j	�
�|d<dd�t�|�D�}||fS)auDo 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.cSsi|]
}|d�qS)sglobalrN)r	�tagrNrNrO�
<dictcomp>1rez-localrepository._findtags.<locals>.<dictcomp>r�cSsi|]\}}t�|�|�qSrN)r�tolocal)r	r~rQrNrNrOr>s�)�tagsmodZfindglobaltagsr�Z
readlocaltagsr'rr�rr r�r)rHZalltagsrr2r~r�ZhistrNrNrOr s
�zlocalrepository._findtagscCs|jj�|�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
        )rrrp)rHZtagnamerNrNrO�tagtypeDs	zlocalrepository.tagtypecCsZ|jjsRg}t�|���D] \}}|�|j�|�||f�qdd�t|�D�|j_|jjS)z)return a list of tags ordered by revisioncSsg|]\}}}||f�qSrNrN)r	rvrr
rNrNrOr�Urez,localrepository.tagslist.<locals>.<listcomp>)	rrr'rr2rqr�r�r4)rH�lrr
rNrNrOrOszlocalrepository.tagslistcCsf|jjsVi}t�|jj�D]\}}|�|g��|�qt�|�D]}|��q@||j_|jj�	|g�S)z&return the tags associated with a node)
rrr'rr2�
setdefaultrqZ
itervalues�sortrp)rHr�rrr
r2rNrNrO�nodetagsYs
zlocalrepository.nodetagscCs|j�|�S)z;return the list of bookmarks pointing to the specified node)r�rCr�rNrNrO�
nodebookmarksdszlocalrepository.nodebookmarkscCs
|j|S)zkreturns a dictionary {branch: [branchheads]} with branchheads
        ordered by increasing revision number)r�rkrNrNrOr
hszlocalrepository.branchmapcCs|jst�|���|_|jSrA)r�r
�revbranchcacherBrkrNrNrOr(mszlocalrepository.revbranchcachecCs|���||�dSrA)r(Zsetdata)rHr�ZchangelogrevisionrNrNrO�register_changesetssz"localrepository.register_changesetcCs@z|���|�WSty:|s6t�td�|��nYn0dS)z�return 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).

        sunknown branch '%s'N)r
�	branchtiprDrrr)rH�branchZ
ignoremissingrNrNrOr*vszlocalrepository.branchtipcCs.t�||���}|dur*t�td�|��|S)Nr�)r.�	revsymbolr�rrr)rHr�r�rNrNrOr��szlocalrepository.lookupcCs"|���|�r|St�||���SrA)r
�	hasbranchr.r,r+r�rNrNrO�lookupbranch�szlocalrepository.lookupbranchc	CsJ|j}|jj}|j}g}|D](}||�}|dup6||v}|�|�q|SrA)r�r�r�r�rq)	rHr�r�r�r�r�r
rvZresprNrNrOr��szlocalrepository.knowncCs|SrArNrkrNrNrOr��szlocalrepository.localcCs|jjdddd�S)N�phasesspublishT)Z	untrusted)r�r"rkrNrNrO�
publishing�szlocalrepository.publishingcCs(|��sdS|��sdS|�d�jjS)NFT�visible)r�r0r�r�r�rkrNrNrO�cancopy�s
zlocalrepository.cancopycCs|j|jkrdSdS)z2the type of shared repository (None if not shared)rN)r�r^rkrNrNrOr6�szlocalrepository.sharedcGs|jj|j|g|�R�SrA)r6Zreljoinr<)rHr�ZinsidefrNrNrO�wjoin�szlocalrepository.wjoincCs*|dur|j}|d�||�|��dSrA)r��
setparentsr�)rHr��p2rNrNrOr4�szlocalrepository.setparentscCstj|||||d�S)zcchangeid must be a changeset revision, if specified.
        fileid can be a file revision or node.)r)r�filectx)rHr^rZfileidrrNrNrOr6�s
�zlocalrepository.filectxcCs
|j��SrA)r�getcwdrkrNrNrOr7�szlocalrepository.getcwdcCs|j�||�SrA)r�pathto)rHr��cwdrNrNrOr8�szlocalrepository.pathtocCs�||jvr�g}|j�|�D]�\}}|dkr,qt�|jd|g�}d}|}t�|j�D].\}}	|�	|�rR|	}|t
|�d���}q�qR|s�dd�}d|_t�
|�ds�|}
|
fdd�}d|
j|_|�|||f�q||j|<|j|S)	N�!rec[st�||�SrA)r:�filter)�s�cr�rNrNrOr�rez-localrepository._loadfilter.<locals>.<lambda>Z
commandfilterrec[s
|||�SrArN)r<r=�oldfnr�rNrNrOr�rezcompat-)r�r�Zconfigitemsr�rr<r'rr�ror��lstriprRZ
getargspecrq)rHr;r#�pat�cmd�mfr��paramsr~Zfilterfnr>rNrNrO�_loadfilter�s.


zlocalrepository._loadfiltercCsT|D]J\}}}||�r|j�d||p.t�|j�f�||||j||d�}qPq|S)Nsfiltering %s through %s
)r�rI�filename)r��debugr'ZsysbytesrR)rHZ
filterpatsrE�datarBr�rArNrNrO�_filter�s��zlocalrepository._filtercCs
|�d�S)Nsencode�rDrkrNrNrO�_encodefilterpats�sz!localrepository._encodefilterpatscCs
|�d�S)NsdecoderIrkrNrNrO�_decodefilterpats�sz!localrepository._decodefilterpatscCs||j|<dSrA)r�)rHr~r;rNrNrO�
adddatafilter�szlocalrepository.adddatafiltercCs6|j�|�r|j�|�}n|j�|�}|�|j||�SrA)r��islink�readlinkr�rHrJ�rHrErGrNrNrO�wread�szlocalrepository.wreadcKst|�|j||�}d|vr(|j�||�nD|jj||fd|i|��d|vr\|j�|dd�n|j�|dd�t|�S)z�write ``data`` into ``filename`` in the working directory

        This returns length of written (maybe decoded) data.
        �l�backgroundclose�xFT)rHrKr��symlinkr�Zsetflagsr�)rHrErG�flagsrRr�rNrNrO�wwrite	s���zlocalrepository.wwritecCs|�|j||�SrA)rHrKrOrNrNrO�
wwritedata	szlocalrepository.wwritedatacCs(|jr|��}nd}|r$|��r$|SdS)z4return the current transaction or None if non existsN)r�Zrunning)rH�trrNrNrOr�	s
z"localrepository.currenttransactionc
sP�j�dd�s�j�dd�r6���j�dur6t�d�������durR�j�d�S�j�	d�rttj
td�td�d	��d
t��t
�
�f}tt�|����}d|}�jdd
�|d�����dd����D�}|r�|}n�jj}�j�jd�}t����dd���j�dd�}	�dk�r8|	�r8�j�����fdd������fdd�}
��fdd�}tj|�j|ddt|��jj|
|t�d��t ���j!d<t"��j!d <g�j!d!<i�j!d"<|�j#d#<��j#d$<�j!�j#d%<��$d&�jj%���fd'd(�}��$d)|���&d*��'����fd+d,�}
��(d-|
���&d.�j)�t����_*t+�,�����S)/Nrjr�r�stransaction requires locking)r~�journalsabandoned transaction founds(run 'hg recover' to clean up transactionrs%.40f#%fsTXN:s
pretxnopenT)rZtxnname�txnidcSsg|]\}}||t|�f�qSrN��undoname�r	r6�xrNrNrOr�9	rez/localrepository.transaction.<locals>.<listcomp>)rXrcSsdSrArN)r^rNrNrOrb	rez-localrepository.transaction.<locals>.<lambda>rZshook-track-tags�stripcs���}t�|j|��}|j��}t�|j||�}t�|j|||�}|r�d|jd<|jdddd��}t�||�Wd�n1s�0YdS)N�1s	tag_movedschanges/tags.changes�wT)Z
atomictemp)	r!�	fnoderevsr�r��headrevsZdifftags�hookargsr6Z	writediff)�tr2rIZ	oldfnodesZnewheadsZ	newfnodes�changesZchangesfile)�oldheads�reporefrNrO�	tracktagsj	s

�z.localrepository.transaction.<locals>.tracktagsc	sp�|���}d}|jj|�}|rf|jj|�d}|�dd�}|�dd�rPd}nd}t�||�||�t�|jd�r�t�j	d	�
��D]D\}\}}	�j��}
|
�
t�|||	��|jdd
dit�|
���q�t�|jd��rP|��j}�j	d
D]^\}\}}	|D]L}
�j��}
t|�|
��}|
�
t�|||	��|jdd
dit�|
����qq�|jdd
dit��j���dS)zwill run pre-closing hooks)rZssingle-head-per-branchrsaccount-closed-headsFspublic-changes-onlys	immutabler1�pretxnclose-bookmarkr�rT�pretxnclose-phaser/�pretxncloseN)rj)rk)rl)r�r"Zconfigsuboptionsrpr.Zenforcesingleheadr�hashookr4rfr@rdr�ryr�preparehookargsr'r�rBr�rr�r%)rerIZ
singleheadoptZ
singleheadZ
singleheadsubZ
accountclosedr�r~r�r�r�r�r
r�r�)�descrhrXrirNrO�validate}	sb�
��
���

�����
�z-localrepository.transaction.<locals>.validatecsZ��}|durdS|r$|j�d�n2t��d�t��d�|j�dd�|jdd�dS)N�journal.narrowspec�journal.narrowspec.dirstate�journal.dirstateTr�)rr�r"�
restorebackup�restorewcbackupr�)rX�successrI)rhrHrNrO�	releasefn�	sz.localrepository.transaction.<locals>.releasefn�undo)Z	validatorrw�checkambigfilesr~�origrepolens
obsmarkersr/r�stxnidstxnnameschangess
flush-fncachecs*|j����fdd�}��}|�|�dS)z@To be run if transaction is successful, will schedule a hook runc	s ��}t�|jd�rpt�jd���}|D]D\}\}}�j��}|�t	�
|||��|jdddit�|���q*t�|jd��r|�
�j}t�jddd�d	�}|D]\\}	\}}|	D]J}
�j��}t|�|
��}|�t�
|||��|jdddit�|���q�q�|jd
ddit�����dS)N�txnclose-bookmarkr�rF�txnclose-phaser/cSs|ddS)NrrN)rvrNrNrOr	
rezUlocalrepository.transaction.<locals>.txnclosehook.<locals>.hookfunc.<locals>.<lambda>)r��txnclose)r{)r|)r})rrmr�r4rfr@rdr�ryrrnr'r�rBr�rr�r%)�unused_successrIZ	bmchangesr~r�r�r�r�Zphasemvr
r�r�)rdrhrXrNrO�hookfunc�	sJ
���
�
���
���zClocalrepository.transaction.<locals>.txnclosehook.<locals>.hookfuncN)rd�
_afterlock)rerrI)rhrX)rdrO�txnclosehook�	s#z1localrepository.transaction.<locals>.txnclosehooks
txnclose-hooks-warm-cachecs&��}|jdddit�|j���dS)z#To be run if transaction is aborted�txnabortrFN)r�)rr'r�rd)rerI�rhrNrO�txnaborthook%
s��
�z1localrepository.transaction.<locals>.txnaborthooks
txnabort-hooksrefresh-filecachestats)-r�r"r�r�rrzr�Znestr~r�r�r�random�timerr9Zsha1�digestr�
_writejournal�
_journalfilesrsr6r�r�r�rcr3�
aftertransr0r+rZr�rfrPrdZaddfinalizer�Zaddpostclose�_buildcacheupdaterZaddabort�_refreshfilecachestatsr�r.Zregistersummarycallback)rHro�reportZidbaseZharZ�renamesZrp�vfsmapZshouldtracktagsrprwr�r�rN)rorgrhrHrXrirOr3"	s~�
�

"�
@�




/zlocalrepository.transactionc	CsH|jdf|jdf|jdf|jdf|jdf|jdft�|�df|jdffS)	NrYrqrrrs�journal.branch�journal.desc�journal.bookmarks�journal.phaseroots)r~r6r�bookmarksvfsrkrNrNrOr�5
s�zlocalrepository._journalfilescCsdd�|��D�S)NcSsg|]\}}|t|�f�qSrNr[r]rNrNrOr�B
rez-localrepository.undofiles.<locals>.<listcomp>)r�rkrNrNrO�	undofilesA
szlocalrepository.undofilescCs�|j�dd�t�|d�t�|d�|j�dt�|j����|j�ddt	|�|f�t
�|�}|�d|�d��|j
�d	|j
�d
��dS)Nrsrrrqr�r�s%d
%s
r�r�r�r�)rZ
savebackupr"Zsavewcbackupr6r�rZ	fromlocalr+r�rr�r�r~)rHror�rNrNrOr�D
s�

�zlocalrepository._writejournalcCs�|����|j�d�rf|j�td��|j|jd�}tj|j|d|jj	t
d�|��Wd�dS|j�	td��Wd�dSWd�n1s�0YdS)NrYs%rolling back interrupted transaction
)rerX�ryTs%no interrupted transaction available
F)rr~r�r��statusrr6r3�rollbackrsrZr�)rHr�rNrNrO�recoverS
s"
��zlocalrepository.recoverc
Cs�d}}}zv|��}|��}|j�d�rRt�|d�}|�|||�Wt|||�S|j�t	d��Wt|||�dSWt|||�nt|||�0dS)Nrxsrollbacks"no rollback information available
r)
�wlockrr~r�r�	_rollback�releaser�rsr)rH�dryrun�forcer�r�dsguardrNrNrOr�h
s��zlocalrepository.rollbackcst|j}zz|j�d���}t|d�|dd}}}t|�dkrH|d}|d}	|rn|jrntd�|	||f}
ntd�|	|f}
Wnty�td�}
d}Yn0|s�|d	|d
kr�|dkr�t	j
td�td
�d��|�|
�|r�dS|j�
�}|��|j|jd�}tj|j|d|jtd�t�|�}
|
�d��rB|
jdddd�|j�d��rb|jjdddd�|��|jjj�t�fdd�|D��}|�rh|��t�|d�t� |d�|j�dd�z"|j�d�}|j�!t"�#|��Wn,t�y|�td�|j�$��Yn0t%dd �|d�
�D��}t|�dk�rJ|�td!�|�n|�td"�|�t&j'�(|�|�)�dS)#Ns	undo.descrrr�res8repository tip rolled back to revision %d (undo %s: %s)
s4repository 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 datasuse -f to forcer)rXrerxr�sundo.bookmarksr�T)Z
checkambigsundo.phaserootsr�c3s|]}�|�VqdSrArN�r	�p��has_noderNrOr��
rez,localrepository._rollback.<locals>.<genexpr>sundo.narrowspecsundo.narrowspec.dirstates
undo.dirstatesundo.branchs>named branch could not be reset: current branch is still '%s'
cSsg|]}|���qSrN)r�r�rNrNrOr��
rez-localrepository._rollback.<locals>.<listcomp>s3working directory now based on revisions %d and %d
s+working directory now based on revision %d
)*r�r6r�r�rr��verboserr�rr�r�rr��
destroyingr~r3r�rsrZrr�r��renamer�r�r�r�r�r�r"rtruZ	setbranchrr r+r5�
mergestatemodr�clean�	destroyed)rHr�r�r�r�r�ZoldlenroZdetailZoldtiprxr�r�r�Z
parentgoner+rNr�rOr�w
s�
����
��

�
�
���
���
�zlocalrepository._rollbackcst�|���fdd�}|S)z�called 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.
        cs��}|�|�dSrA)�updatecaches)rXrIr�rNrO�updater�
sz3localrepository._buildcacheupdater.<locals>.updaterr�)rHZnewtransactionr�rNr�rOr��
s
z"localrepository._buildcacheupdatercCs�|dur|j�d�dkrdS|��}|rVd}|j�|d�tj}|dkrNtj}tj}n|durdtj}tj	|vr�|dus�|j
dt|�kr�|j�d�|�
d	���|�
d
���|j�|�tj|vr�|jj|d�tj|vr�|jj|d�tj|v�r |��}|jD]}|�|��q|��tj|v�rH|d��D]}|���q8tj|v�rjt�|j||j� ��tj!|v�r~|�"�tj#|v�r�|�
d	��"�tj$|v�r�t%j&�'�D]}	|�
|	�}
|
���|
��q�dS)
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.
        Nssourcer_za`full` argument for `repo.updatecaches` is deprecated
(use `caches=repository.CACHE_ALL` instead)s5.9s
post-clonerzsupdating the branch cache
r�s
served.hidden)r3r�)(rdrprBr�Z
deprecwarnr8Z
CACHES_ALLZCACHES_POST_CLONEZCACHES_DEFAULTZCACHE_BRANCHMAP_SERVEDrfr�rFr�r
r�Z
write_delayedZCACHE_CHANGELOG_CACHEr�Z
update_cachesZCACHE_MANIFESTLOG_CACHEr�ZCACHE_REV_BRANCHr(Z
branchinfor�ZCACHE_FULL_MANIFESTr�ZmanifestZCACHE_FILE_NODE_TAGSr!rbr
ZCACHE_TAGS_DEFAULTr2ZCACHE_TAGS_SERVEDZCACHE_BRANCHMAP_ALLr)Zfiltertable�keys)rHrXZfullZcachesrKrxZrbcrvr�Zfiltr�rNrNrOr��
sR�




zlocalrepository.updatecachescCs4dt|�vr|jd=|j��|��|j��dS)Nr)r�rCr��clear�invalidatevolatilesetsr�rkrNrNrO�invalidatecaches7s

z localrepository.invalidatecachescCs |j��t�|�|��dSrA)r�r�r#Zclearobscachesr�rkrNrNrOr�As

z&localrepository.invalidatevolatilesetsc	CsNt|d�rJ|jjD](}zt|j|�Wqty8Yq0qt|��d�dS)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).rN)r�rr}r
�AttributeErrorrB)rHrrNrNrO�invalidatedirstateFs	
z"localrepository.invalidatedirstatec	Cs�|��}t|j���D]V}|dkr$q|dkr>|��r>|jjr>q|rJ|j|=zt||�WqtyjYq0q|�	�|��s�|j
�	�dS)a9Invalidates both store and non-store parts other than dirstate

        If a transaction is running, invalidation of store is omitted,
        because discarding in-memory changes might cause inconsistency
        (e.g. incomplete fncache causes unintentional failure, but
        redundant one doesn't).
        r�r�N)rB�listr}r�r�r�Z_delayedr
r�r�r0)rHr�rBrrNrNrOr�Ws(���zlocalrepository.invalidatecCs|��|��dS)zyFully invalidates both store and non-store parts, causing the
        subsequent operation to reread any outside changes.N)r�r�rkrNrNrO�
invalidateall{szlocalrepository.invalidateallcCs>|j��D].\}}t�|�}|dks
||jvr0q
|��q
dS)z>Reload stats of cached files so that they are flagged as validrN)r}r@r'r�rC�refresh)rHrXrZcerNrNrOr��s

z&localrepository._refreshfilecachestatscCsXd}d}|r(|j�dd�}|j�dd�}|j�dd�}	tj|j||||||||	d�	}
|
S)Nr�uistimeoutstimeout.warnssignal-safe-lock)rw�	acquirefnro�
signalsafe)r�r\r"�lockmodZtrylock)rHr6�lockname�waitrwr�ro�timeoutZwarntimeoutr�r#rNrNrO�_lock�s$	�zlocalrepository._lockcCsB|j|jfD](}|o|�}|r|jr|j�|�q>q|d�dS)z�add a callback to be run when the repository is fully unlocked

        The callback will be executed when the outermost lock is released
        (with wlock being higher level than 'lock').TN)r�r��heldZpostreleaserq)rHr�r�r#rNrNrOr��s

zlocalrepository._afterlockTcCsT|�|j�}|dur |��|S|j|jd|d|jtd�|jd�}t�	|�|_|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.Nslocks
repository %s)r6r�r�rwr�ro)
r�r�rr�r~r�rrr�r�)rHr�r#rNrNrOr�s�zlocalrepository.lockc	s��jr���nd}|dur,|jr,|��|S|rh�j�dd�sL�j�dd�rh���j�durh�j�d��fdd�}���j	d||�j
td	��j�}t
�|��_|S)
a8Lock 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.Nrjr�r�s"wlock" acquired after "lock"cs4�j��r�j��n�j�d��jd��dS)Nr�)rZpendingparentchanger�r�r}r�rNrkrNrO�unlock�s
z%localrepository.wlock.<locals>.unlockswlocksworking directory of %s)r�r�rr�r"r�r�r�r�r6r�rrr�r�)rHr�r#r�rNrkrOr��s,���zlocalrepository.wlockcCs(|durdS|�}|dus |js$dS|S)z3Returns the lock if it's held, or None if it's not.N)r�)rHZlockrefr#rNrNrOr��szlocalrepository._currentlockcCs|�|j�S)z4Returns the wlock if it's held, or None if it's not.)r�r�rkrNrNrO�currentwlock�szlocalrepository.currentwlockc	Cs�|��s|��r�t|j|j|j�}|��D]�}|j�|�}|dks.||vs.||j	vrZq.||j
vrr||td��|j�
|�s�|���|�r�|d}|D]}|�|�r�q�q�||td��q.||jvr.||td��q.dS)z2check for commit arguments that aren't committabler�sfile not found!r}sno match under directory!sfile not tracked!N)ZisexactrwrP�modifiedZaddedZremovedr�r�	normalizer��deletedrr�rr�Zhasdirro)	rH�wctxrr��failZmatchedr��drBrNrNrO�checkcommitpatternss 


z#localrepository.checkcommitpatternsrec
s>|duri}dd�}|s t��}|s*||_�������������d}	t|	���dk}
|sx|
rx|��sxt�t	d����j
||d�}|r�|j�|j
�tj�j|	|||d�\}}
}|sȈ�|	|||�t��|||||�}tj���}t�|�|���r<�j�dd	��s<�j�d
�|��Wd�Wd�dS|
�rZ|���rZt�t	d���|�rn|�||�|_||jk}��|j�}|�r�t �!��}t"|
�D]R}|	�#|�}�j�
t	d�|t�$|���|�%|j||�}||d
|f||<�q�t�&�|��j'��\}}t(|�|�j)k�r&t(|��p(d��zr�j*dd��d���+d��@��,|d��t-�.�||g��|�/��|��Wd�n1�s�0YWn<|�rֈj�0t	d�|��j�0t	d�|��Yn0Wd�n1�s�0YWd�n1�s0Y����fdd�}��1|��S)z�Add 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.
        NcSst�d||f��dS)Ns%s: %s)rZ
InputError)r�rxrNrNrOr�-sz$localrepository.commit.<locals>.failrsBcannot partially commit a merge (do not specify files or patterns))rr�)r�r�sallowemptycommits(nothing to commit, clearing merge state
s&cannot commit merge with missing filesscommitting subrepository %s
rres	precommitT)r�parent1�parent2r�s!note: commit message saved in %s
s6note: use 'hg commit --logfile %s --edit' to reuse it
cs&�j���r"�jdt����d�dS)Nr�)r�r�r�)r�Zhasnoderr�r~�Zhookp1Zhookp2r�rHrNrO�
commithook�s�z*localrepository.commit.<locals>.commithook)2r�r�Zbadr�rr�r�rr�rr�r��extendr�r1Z	precommitr�r�rZworkingcommitctxr�rr�r ZcheckunresolvedZisemptyr"rF�resetr�Z_text�savecommitmessager.Zgetuipathfnr4r�Z
subrelpathrZ
writestaterrr�rr3�	commitctxrryZ
markcommittedr�r�)rH�textr�daterr�ZeditorZextrar�r��merger�ZsubsZ
commitsubsZnewstateZcctx�msZeditedZmsg_pathZuipathfnr<r��srr�r5r�rNr�rOrs������
�


��$�
,
����H
zlocalrepository.commitcCstj||||d�S)N)r�origctx)rr�)rHr�rr�rNrNrOr��szlocalrepository.commitctxcCsdt|�vr|j��dS)aInform the repository that nodes are about to be destroyed.
        Intended for use by strip and rollback, so there's a common
        place for anything that has to be done before destroying history.

        This is mostly useful for saving state that is in memory and waiting
        to be flushed when the current lock is released. Because a call to
        destroyed is imminent, the repo will be invalidated causing those
        changes to stay in memory (waiting for the next unlock), or vanish
        completely.
        r�N)r�r�r�rkrNrNrOr��szlocalrepository.destroyingcCs*|j�|�|j��|��|��dS)z�Inform 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�Z
filterunknownr�r�r�rkrNrNrOr��s
zlocalrepository.destroyedr�cCs||�||||||�S)z3a convenience method that calls node1.status(node2))r�)rHZnode1Znode2rZignoredr��unknownZlistsubreposrNrNrOr��s�zlocalrepository.statuscCs|j�|�dS)a�Add a callback to run within the wlock, at the point at which status
        fixups happen.

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

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

        This list is emptied out after each status run -- extensions should
        make sure it adds to this list each time dirstate.status is called.
        Extensions should also make sure they don't call this for statuses
        that don't involve the dirstate.
        N)r�rq)rHZpsrNrNrO�addpostdsstatus�szlocalrepository.addpostdsstatuscCs|jS)zAUsed by workingctx to get the list of post-dirstate-status hooks.�r�rkrNrNrO�postdsstatus�szlocalrepository.postdsstatuscCs|jdd�=dS)z7Used by workingctx to clear post-dirstate-status hooks.Nr�rkrNrNrO�clearpostdsstatus�sz!localrepository.clearpostdsstatuscsJ|dur,|j�t����}�fdd�|D�S|j�|�}t||jjdd�S)Ncsg|]}��|��qSrN)r�)r	r��r�rNrOr�
rez)localrepository.heads.<locals>.<listcomp>T)r��reverse)r��reversedrcr�r4r�)rH�startrcr�rNr�rOr�
szlocalrepository.headscsv|dur|d��}|��}|�|�s*gStt|j||d���}|durrt|j�|g|�d���fdd�|D�}|S)aVreturn 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)�closedrecsg|]}|�vr|�qSrNrN)r	�h�ZfbheadsrNrOr�
rez/localrepository.branchheads.<locals>.<listcomp>)	r+r
r-r�r��branchheadsrPr�Znodesbetween)rHr+r�r�r�ZbheadsrNr�rOr�
s
zlocalrepository.branchheadscCst|s|j��g}g}|D]V}|}|j�|�}|d|jksH|d|jkrd|�|||d|df�q|d}q q|S)Nrr)r�rr�r�rq)rHr�r�r
rr�rNrNrOr�!
szlocalrepository.branchesc
Cs~g}|D]p\}}|gd}}}d}||krn||jkrn|j�|�d}	||kr`|�|�|d}|	}|d7}q$|�|�q|S)Nrrre)r�r�r�rq)
rHr�rv�topZbottomr
r#r�r�r�rNrNrOr�/
s

zlocalrepository.betweencCsdS)z�Extensions can override this function if additional checks have
        to be performed before pushing, or call it if they override push
        command.
        NrN)rHZpushoprNrNrO�	checkpushB
szlocalrepository.checkpushcCst��S)z�Return util.hooks consists of a pushop with repo, remote, outgoing
        methods, which are called before pushing changesets.
        )r5ZhooksrkrNrNrO�prepushoutgoinghooksH
sz$localrepository.prepushoutgoinghooksc	
szb���}i}|dur"|�|j�t�|�}�|d<�|d<�|d<�|d<�jdddi|��WnXtjy�}z>�j�	t
d�|�|jr��j�	t
d	�|j�WYd}~d
Sd}~00�j�d��f�t
��������������fdd
�}��|��S)Nr�r�r�r��
prepushkeyrTspushkey-abort: %s
s(%s)
Fspushing key for "%s:%s"
cs�jd�����d�dS)Nr�)r�r�r�r�r�)rr��r�r�r�r�r�rHrNrO�runhookc
s�z(localrepository.pushkey.<locals>.runhook)r�)r�ryrdr'r�rrZ	HookAbortr�Z	write_errrrrFr&�pushr�)	rHr�r�r�r�rXrdr�r�rNr�rOr&O
s*


zlocalrepository.pushkeycCs@|jdd|d�|j�d|�t�||�}|jd||d�|S)NsprelistkeysT)rr�slisting keys for "%s"
slistkeys)r��values)rr�rFr&r�)rHr�r�rNrNrOr�p
s
zlocalrepository.listkeyscCs$d||t�|�t�|�t�|�fS)z+used to test argument passing over the wirer�r�r�rNrNrOr�w
s�zlocalrepository.debugwireargscCsL|�dd�}z|�|�W|��n
|��0|�|jt|j�dd��S)Nslast-message.txtswbr)r6r�r�r8r~r�r<)rHr��fprNrNrOr��
s
z!localrepository.savecommitmessagecCs&tj|jvrdS|j�t�|��dSrA)r8r/rr�r[r'r�)rH�categoryrNrNrO�register_wanted_sidedata�
sz(localrepository.register_wanted_sidedatac	Cs�|tjvr td�}t�||��t�|�}||j�|g�v}|rZ|sZtd�}t�||��|rx|sxtd�}t�||��|j�	|i�|||f|j||<dS)Nsunexpected revlog kind '%s'.s<cannot register a sidedata computer twice for category '%s'.sKcannot replace a sidedata computer that isn't registered for category '%s'.)
rnZ	ALL_KINDSrrrzr'r�r�rpr$)	rH�kindr�r�ZcomputerrU�replacerxZalready_registeredrNrNrO�register_sidedata_computer�
s"

��z*localrepository.register_sidedata_computer)N)N)NF)FN)F)F)N)NNN)N)F)N)FF)NFN)F)T)T)reNNNFNN)FN)r�NNFFFF)N)NNF)NNN)F)�rRrSrTrUr��BOOKMARKS_IN_STORE_REQUIREMENTr.r_r�rurUrTrk�INTERNAL_PHASE_REQUIREMENTrrr�r]r-r r!rRrmrSr[rGr�rYr�r�r�r�r��propertyr�r�r�r�rBr�rxr�r�r�rdr�r�rgr�rur�rWrr�r�r"ZFILENAMEr�r�r�r�r�r�r�r�r�r�r�rrr�__bool__r	rr
rPrr�rr�rr2rr"rr&r'r
r(r)r*r�r.r�r�r0r2r6r3r4r6r7r8rDrHrJrKrLrPrVrWr�r3r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r&r�r�r�r�r�rNrNrNrOrF�s�� �
3

&
�
4















O

	
$


	







\Q
$

)	�

!�


!
�rFcsdd�|D���fdd�}|S)NcSsg|]}t|��qSrN)r5)r	rrNrNrOr��
rezaftertrans.<locals>.<listcomp>csb�D]X\}}}|�|�z|�||�WqtyZ}z|jtjkrF�WYd}~qd}~00qdSrA)Z	tryunlinkr�rr�r�)r6�src�destr��ZrenamefilesrNrO�a�
s
zaftertrans.<locals>.arN)r�r�rNr�rOr��
sr�cCs(tj�|�\}}tj�||�ddd��S)NrYrxr)�osr^rpr_r�)r�r�r~rNrNrOr\�
sr\cCs*t�|�}|rt|||d�t|||d�S)N��
createopts)r)r<Zurllocalpath�createrepositoryr9)r�r^Zcreaterr�Z	localpathrNrNrO�instance�
s
r�cCsdSr�rNr�rNrNrO�islocal�
sr�cCs(t|pi�}d|vr$|�dd�|d<|S)z�Populate the default creation options for a repository.

    A dictionary of explicitly requested creation options can be passed
    in. Missing keys will be populated.
    �backendrbsnew-repo-backend)�dictr#�r�r�rNrNrO�defaultcreateopts�
srcCsdt�}|js|St||d�}t||�D]}|tjvr&|�|�q&|jD]}|tjvrF|�|�qF|S)z�clone 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�)rPr*r�newreporequirementsr��WORKING_DIR_REQUIREMENTSr[)r�r�ZsrcrepoZtarget_requirementsrvrNrNrO�clone_requirements�
s


rcCs~d|vrt�d��|ddkr4t�td�|d��tjh}|�dd�r�|�tj�|�dd�r�|�tj	�|�dd�r�|�tj
�|�dd	�}|D],}|tj
vr�tj
|}|��r�|��r�q�q�tjtd
�d�dd
�|D��td�d��|dk�r|�d�n|dk�r|�d|�t�|��rL|�tj�|�dd��rL|�tj�|�dd��rf|�tj�|�dd��r�|�tj�|�tj�|�dd��r�|�tj�|�dd�}|dk�r�|�tj�|�dd�}|dk�r�|�tj�|�tj�|�dd��r|�tj�|�d��r(|�tj�|�d��r>|�d�|�dd��rX|�tj�|�dd ��rr|�tj �|�dd!��r�|�tj!�d"|v�r&t"|d"j#�}tj!|v�r�|}nJt"�}	|D].}
|
tj$v�rԐq�|
|v�r�q�|	�|
��q�||	8}||O}|�d#��r|�tj%�n|�tj&�|�dd$��rz|�'dd%�}td&�}td'�}
|d(k�rn|j(|||
d�n|�tj)�|S))z�Determine the set of requirements for a new local repository.

    Extensions can wrap this function to specify custom requirements for
    new repositories.
    rsFbackend key not present in createopts; was defaultcreateopts() called?r`sCunable to determine repository requirements for storage backend: %srXsusestores
usefncaches	dotencodesrevlog-compressionsIcompression engines %s defined by format.revlog-compression not available�, css|]}d|VqdS)s"%s"NrN)r	r�rNrNrOr�rez&newreporequirements.<locals>.<genexpr>s;run "hg debuginstall" to list available compression enginesrrEsrevlog-compression-zstdszlibrDrcsuse-dirstate-v2s"exp-use-copies-side-data-changesetrZrWsexp-use-changelog-v2s*enable-unstable-format-and-corrupt-my-datarasinternal-phase�narrowfilesr?sbookmarks-in-storesuse-persistent-nodemap�use-share-safe�
sharedrepo�sharedrelativesuse-dirstate-tracked-hints!use-dirstate-tracked-hint.versionz)ignoring unknown tracked key version: %d
z<see `hg help config.format.use-dirstate-tracked-hint-versionr)*rrzr�rr�r]r"r[rSrTrUZ
configlistr5rIrJrKr_r.Zgdinitconfigrkrmrur.r_r[r#r0r-r�rprqr�rrr!rPr*rr�r r\rsr�)r�r�r*rIZ
compenginerNZchangelogv2Zrevlogv2Zsource_requirementsZto_dropZreq�versionrxrrNrNrOr�
s�����

����







rcCs�t�}tj|vr�tj|vr4|�td��|�tj�tj|vsHtj|vrVt	�
td���tj|vr�|�dd�r~td�}|�|�|�tj�|S)z�Checks 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 itsvignoring 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 disabledrXr	srignoring enabled 'format.use-share-safe' config because it is incompatible with disabled 'format.usestore' config
)
rPr�rSr�rsrr[r r�rr�r!rA)r�r*ZdroppedrxrNrNrO�checkrequirementscompats4

������
�
r
cshd���fdd�|��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.
    >rrsshallowfilestore�shareditemsr
r?rcsi|]\}}|�vr||�qSrNrN)r	rr�r�rNrOr�rez)filterknowncreateopts.<locals>.<dictcomp>)r@rrNrrO�filterknowncreateopts�s
rc
CsJ|dur$|durd}t�|��i}nlt||d�}t||�}t|t�sNt�d��|rvtjtd�d�t	|��td�d��t
||d�}|t||�8}tj
|d	d	d
�}t�
|�d��}|��r�t�td�|��d
|v�rL|d
j}|�d��rLztj�||j�}t�|�}WnBttf�yJ}	z$tjtd�t�|	�d��WYd}	~	n
d}	~	00|���s^|��|jd	d�d
|v�r~|�d�|�d�tj |v}
|
�r�d
|v�r�|�d�|�!dd�t"�#|�\}}t"�$||�|�rd
|v�rtj
|�d�d	d�}
t"�$|
|�d
|v�r|�%d|�|�d��rFd�t	|d��d}|�%d|�dS)a7Create 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 dictsBunable to create repository because of unknown creation option: %srs#is a required extension not loaded?rTr�r�srepository %s already existsr
rscannot calculate relative path)Z
notindexedr
rrris9�� dummy changelog to prevent using the old repo layoutrr�rr�sshared)&rrzrrr3rr�rr_r4rr
r�r6r�r�r�rpr�r^�relpathr�r5r�r�rr;r��makedirsZmakedir�mkdirr�rSrqr.ZfilterrequirementsZ
writerequiresr�)r�r^r�r*rxZunknownoptsrr�r�r�Z	has_storeZwcreqZstorereqrr6rNrNrOr��sx


����	

�






�
r�cCs*|��Gdd�dt�}t�|d|�dS)z9Poison a repository instance so it can no longer be used.c@seZdZdd�Zdd�ZdS)z,poisonrepository.<locals>.poisonedrepositorycSs"|dkrt�||�St�d��dS)Nr�s/repo instances should not be used after unshare)r��__getattribute__rrz)rH�itemrNrNrOrNs
�z=poisonrepository.<locals>.poisonedrepository.__getattribute__cSsdSrArNrkrNrNrOr�Vsz2poisonrepository.<locals>.poisonedrepository.closeN)rRrSrTrr�rNrNrNrO�poisonedrepositoryMsrrMN)r�r�r�)rIrrNrNrO�poisonrepositoryCsr)N)N)NN)N)NN)�Z
__future__rr�r�r�r�r�r�r�Zi18nrr�rrrrr	r'r
rr$rr
rrrrrrrrrrrrrrrrr�rr�rr�r r!r"r#r$r%r&r(r)r*r�r+r,r-r.r/r0rVr1r2r!r3r4r5r6r�r7Z
interfacesr8Z
interfaceutilZutilsr9r:r;r<Zrevlogutilsr=r�r>rnr?r�r�Zurlerrr�rPrZZ	filecacher@rWrdrgrurxrZ
propertycacher�r�r�r�r��unionr�ZimplementerZipeercommandexecutorr�r�Z
ipeercommandsr�r�Zipeerlegacycommandsr�rHr�r�r9r%r&r'r(r)r*r,r^rzZilocalrepositoryfilestorager{r�r�Zilocalrepositorymainr2rFr�r\r�r�rrrr
rr�rrNrNrNrO�<module>	s��/


-

%
:
*'%



�
J

+
~

Youez - 2016 - github.com/yon3zu
LinuXploit