https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/extensions.cpython-310.pyc
o

�]Lbkz�@s�ddlmZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZm
Z
mZddlmZmZmZmZmZddlmZiZiZiZgZhd�ZdVd	d
�Zdd�Zd
d�Zdd�ZdWdd�Zdd�Z dd�Z!dZ"dd�Z#dd�Z$dVdd�Z%dd�Z&d d!�Z'dVd"d#�Z(d$d%�Z)d&d'�Z*d(d)�Z+d*d+�Z,d,d-�Z-dWd.d/�Z.d0d1�Z/Gd2d3�d3e0�Z1d4d5�Z2dVd6d7�Z3d8d9�Z4d:d;�Z5d<d=�Z6d>d?�Z7d@dA�Z8dBdC�Z9dDdE�Z:dFdG�Z;dHdI�Z<dXdKdL�Z=dYdNdO�Z>dPdQ�Z?dRdS�Z@dTdU�ZAdS)Z�)�absolute_importN�)�_�gettext)�getattr�open�setattr)�cmdutil�configitems�error�pycompat�util)�
stringutil>	�color�hgcia�shelve�hbisect�inotify�interhg�progress�	bookmarks�
parentrevspecc#sH��r
�fdd�}ndd�}tD]}t|}|r!||�r!||fVqdS)Ncs6dD]}��d||�}|dur|�d�sdSqdS)N)s%s�hgext.%s�
extensions�!T)�config�
startswith)�name�format�conf��ui��6/usr/lib/python3/dist-packages/mercurial/extensions.py�enabled9s��zextensions.<locals>.enabledcSsdS)NTr")rr"r"r#�<lambda>@szextensions.<locals>.<lambda>)�_order�_extensions)r!r$r�moduler"r r#�
extensions6s�
��r)cCsld}zt|}Wn%ty-t�t�D]\}}|�d|�s&|�d|�r*|}nqYnw|s4t|��|S)z'return module with given extension nameN�.�/)r'�KeyErrorr�	iteritems�endswith)r�mod�k�vr"r"r#�findGs���r2c
Cs�|�dd�}t�t�|��}t�|�}t�|�}tj�|�r8tj�	|�\}}t
�||g�\}}}t
�||||�Szt
�
||�WStyR}z|jsM||_�d}~ww)Nr*�_)�replacer
�normpath�
expandpathr�fsdecode�os�path�isdir�split�imp�find_module�load_module�load_source�IOError�filename)r9�module_name�d�f�fd�fpath�desc�excr"r"r#�loadpathVs$

���rIcCs8tt�|��}|�d�}|dd�D]}t||�}q|S)z#import and return the <name> moduler*rN)�
__import__r�sysstrr;r)rr/�
components�compr"r"r#�_importhms

rNc
Cs�|rt|d|�}|Sz	td|�}W|Styc}zC|r(||d|d|�ztd|�}Wn tyP}z|rB||d||�t|�}WYd}~nd}~wwWYd}~|SWYd}~|Sd}~ww)Nrshgext3rd.%s)rIrN�ImportError)rr9�
reportfuncr/�errr"r"r#�
_importextvs.
�
���
�
���rRcCs>|�dd|t�|�|�|jr|�dd�r|��dSdSdS)N�	extensions*    - could not import %s (%s): trying %s
sdevelsdebug.extensions)�logr�forcebytestr�	debugflag�
configbool�	traceback)r!rQ�failed�nextr"r"r#�_reportimporterror�s��r[cCs�t|tttf�r|D]}t||�q
dSt|t�r5|��D]\}}t||�td|t�|�f|�qdSt|t	d��rGt
jd||fdd��dS)Ns%s.%s�sunicode %r found in %ssuse b'' to make it byte string��hint)�
isinstance�list�set�tuple�_rejectunicode�dict�itemsrrU�typer�ProgrammingError)r�xs�xr0r1r"r"r#rc�s�

�
��rc)snoreposoptionalrepos	inferrepocsRt�|�D]!\}}|d��fdd�tD�}|sqtjdd�|�d|d��dS)	z4Check if extension commands have required attributesrcsg|]
}t��|�s|�qSr")r
�safehasattr)�.0�a�rDr"r#�
<listcomp>�sz%_validatecmdtable.<locals>.<listcomp>smissing attributes: %ss, s'use @command decorator to register '%s'r]N)rr-�
_cmdfuncattrsrrg�join)r!�cmdtable�c�e�missingr"rmr#�_validatecmdtable�s��rucCsXdD]}t|t||i��qdD]}t||d�}|r t||j�qt|t|di��dS)z=Sanity check for loadable tables provided by extension module)�cmdtable�
colortable�configtable)�filesetpredicate�
internalmerge�revsetpredicate�templatefilter�templatefunc�templatekeywordNrq)rcr�_tableru)r!r/�t�or"r"r#�_validatetables�s�r�cCs�|�d�s
|�d�r|dd�}n|}|tvrdS|tvr!t|S|�dd|�dt|<t�d|��}t||tt|��}Wd�n1sFwY|�dd||�|dur`|||j	7<t
|dd�}|r�tjd	d
�}t�t�
|�d	�}	d|	vr�|	dp�d|	dp�df}	d|vs�|	|kr�td
�}
|�|
||t��f�dS|�dd|�t||�|t|<t�|�|�dd|�t�d|��}t�|g�D]}|dd�q�Wd�n1s�wY|�dd|�|S)Nshgext.shgext/�rSs  - loading extension: %s
zload extension %ss  > %s extension loaded in %s
�minimumhgversion�)�nrrs^(third party extension %s requires version %s or newer of Mercurial (current: %s); disabling)
s&    - validating extension tables: %s
s(    - invoking registered callbacks: %s
zcallbacks extension %sT��loadeds     > callbacks completed in %s
)r�_builtinr'rTr
�timedcmrR�bindr[�elapsedr�versiontuplerrUr�warn�versionr�r&�append�_aftercallbacks�get)r!rr9�loadingtime�	shortname�statsr/�minver�curver�extmin�msg�fnr"r"r#�load�sR��

���r�c
C�ztt|dd�}|r;z||�WdSty:}z|jdd�t�|�}|�td�||f�WYd}~dSd}~wwdS)N�uisetupT��force�&*** failed to set up extension %s: %s
F�rr'�	ExceptionrXrrUr�r)rr!r��instr�r"r"r#�_runuisetup��
�
��r�c
Cr�)N�extsetupTr�r�Fr�)rr!r�r�r�r"r"r#�_runextsetupr�r�cs�t�t�}|�d�}�dur�fdd�|D�}dd�|D�}tt�}|�dd|r*dnd�|�dd	t|��t�d
���}|�	dd�d}|D]�\}}|rh|d
d�dkrh|t
vr_|�dd|�|dd�t
|<qFz	t||||�WqFty�}	zxt
�|	�}
|r�td�}||||
f;}n
td�}|||
f;}|��}|�	d|�d}
|�|
�t
�|�dd��r�d}t|	tj�r�|	jr�|	j}|dur�td�}tj||d��|�d|�t|	tj�r�|	jr�|�td�|	j�|��WYd}	~	qFd}	~	wwWd�n	1�swY|�ddtt�||�dtdfg}|�dd�t|||�t�}|�dd�t�d��S}t|d�D]D}|�dd|�t�d|��}t||��s[|�dd |�|�|�Wd�n	1�sfwY|�dd!||�|||j7<�q9Wd�n	1�s�wY|�dd"|�|�dd#�t�d$��Z}t|d�D]K}||v�r��q�|�dd%|�t�d&|��}t ||��s�|�dd'|�|�|�Wd�n	1�s�wY|�dd(||�|||j7<�q�Wd�n	1�s�wY|�dd)|�|D]}|�dd*|�dt!|<�q|�dd+�t�d,��)}t"D]}|t!v�r2�q)t"|D]}|�dd-|�|d.d/��q6�q)Wd�n	1�sSwY|�dd0|�t"�#�dd1l$m%}m&}m'}m(}m)}m*}m+}m,}|�dd2�d3|d4fd5|d6fd7|d8fd9|d:fd;|d8fd<|d=fd>|d?fd@|dAfg}t�dB��}t|||�Wd�n	1�s�wY|�ddC|�t-|�D]}|�ddD|t�.||���q�|�ddE�dS)FNrcs g|]\}}|�vr||f�qSr"r"�rkr0r1��	whitelistr"r#rn� zloadall.<locals>.<listcomp>cSs g|]\}}d|vr||f�qS)�:r"r�r"r"r#rnr�rSsloading %sextensions
sadditional �s- processing %d entries
zload all extensions�*rrrs$  - skipping disabled extension: %s
s+failed to import extension "%s" from %s: %ss#failed to import extension "%s": %ssrequiredsnosSloading of this extension was required, see `hg help config.extensions` for detailsr]s*** %s
s	*** (%s)
s&> loaded %d extensions, total time %s
rxsloadconfigtables!- loading configtable attributes
s- executing uisetup hooks
zall uisetups  - running uisetup for %s
z
uisetup %ss&    - the %s extension uisetup failed
s  > uisetup for %s took %s
s> all uisetup took %s
s- executing extsetup hooks
zall extsetups  - running extsetup for %s
zextsetup %ss'    - the %s extension extsetup failed
s  > extsetup for %s took %s
s> all extsetup took %s
s$    - disabling broken %s extension
s%- executing remaining aftercallbacks
�aftercallbackss.  - extension %s not loaded, notify callbacks
Fr�s+> remaining aftercallbacks completed in %s
)�color�commands�	filemerge�fileset�revset�templatefilters�
templatefuncs�
templatekws)- loading extension registration objects
rvsloadcmdtablerwsloadcolortablerys
loadpredicaterzsloadinternalmerger{r|s
loadfilterr}sloadfunctionr~sloadkeywordzload registration objectss0> extension registration object loading took %s
s*> extension %s take a total of %s to load
sextension loading complete
)/�collections�defaultdict�intr
�lenr&rTr
r��configsuboptions�_disabledextensionsr�r�rrUr�copy�update�	parseboolr�r_r�Hintr^�Abortr�rX�
_loadextrarar��addr�r�r'r��clearr\r�r�r�r�r�r�r�r��sorted�	timecount)r!r�r��result�newindexr��default_sub_optionsrr9r�r��	error_msg�options�ext_optionsr^�earlyextraloaders�broken�alluisetupstats�allextetupstatsr�r�r�r�r�r�r�r�r�r��extraloadersr"r�r#�loadalls4


��
�
�����.
���
����

�
����
����(�
���r�c	CsZt|d�D]$}t|}|sq|D]\}}}t||d�}|dur)t||�|||�qqdS�N)r&r'r)	r!r�r�rr(�objname�	loadermod�
loadername�extraobjr"r"r#r��s���r�cCs8|tvrt|du}||d�dSt�|g��|�dS)a�Run the specified function after a named extension is loaded.

    If the named extension is already loaded, the callback will be called
    immediately.

    If the named extension never loads, the callback will be called after
    all extensions have been loaded.

    The callback receives the named argument ``loaded``, which is a boolean
    indicating whether the dependent extension actually loaded.
    Nr�)r'r��
setdefaultr�)�	extension�callbackr�r"r"r#�afterloaded�s
r�cCs�t|�D]9\}}t|dd�}|sqz||�Wqty=}z|jdd�|�td�|t�|�f�WYd}~qd}~wwdS)aMRun extension hooks on the given ui to populate additional members,
    extend the class dynamically, etc.

    This will be called after the configuration is loaded, and/or extensions
    are loaded. In general, it's once per ui instance, but in command-server
    and hgweb, this may be called more than once with the same ui.
    �
uipopulateNTr�s.*** failed to populate ui by extension %s: %s
)r)rr�rXr�rrrU)r!rr/�hookr�r"r"r#�
populateui�s �����r�cst��sJ���fdd�}|S)z�Partial function application

    Returns a new function that is the partial application of args and kwargs
    to func.  For example,

        f(1, 2, bar=3) === bind(f, 1)(2, bar=3)cs��|i|��Sr�r")rl�kw��args�funcr"r#�closureszbind.<locals>.closure)�callable)r�r�r�r"r�r#r�sr�cCs\z|j|_Wn	tyYnwt|d�|_t|d�|_|j�t|di��||_||_dS)z.Copy and add some useful attributes to wrapper�
__module__�__doc__�__dict__N)	�__name__�AttributeErrorrr�r�r�r��	_origfunc�_unboundwrapper)�wrap�origfn�unboundwrapperr"r"r#�_updatewrappers�
r�c
Cs�t|�sJ�t�||�\}}t�|�D]\}}||ur|}	nq|d}
t�t�|�t�|
��}t	||
|�|durA|j
|7_
t|�}||d<|durU|d|7<t|�||	<|S)a.Wrap the command named `command' in table

    Replace command in the command table with wrapper. The wrapped command will
    be inserted into the command table specified by the table argument.

    The wrapper will be called like

      wrapper(orig, *args, **kwargs)

    where orig is the original (wrapped) function, and *args, **kwargs
    are the arguments passed to it.

    Optionally append to the command synopsis and docstring, used for help.
    For example, if your extension wraps the ``bookmarks`` command to add the
    flags ``--remote`` and ``--all`` you might call this function like so:

      synopsis = ' [-a] [--remote]'
      docstring = """

      The ``remotenames`` extension adds the ``--remote`` and ``--all`` (``-a``)
      flags to the bookmarks command. Either flag will show the remote bookmarks
      known to the repository; ``--remote`` will also suppress the output of the
      local bookmarks.
      """

      extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks,
                             synopsis, docstring)
    rNr�)
r�r	�findcmdrr-�	functools�partialr
�checksignaturer�r�r`rb)
�table�command�wrapper�synopsis�	docstring�aliases�entry�aliasrs�keyr�r��newentryr"r"r#�wrapcommand's(��r�cs~t�|�}t��sJ�|jD]"}||jvr0|j|j�t��s!J���fdd�}||j|_nq|tur=td||f��dS)z[Wraps a filecache property.

    These can't be wrapped using the normal wrapfunction.
    cs��g|�Ri|��Sr�r")r��kwargs�r�r�r"r#r�g�zwrapfilecache.<locals>.wrapztype '%s' has no property '%s'N)rrKr��__mro__r�r��objectr�)�cls�propnamer��currclsr�r"rr#�
wrapfilecache[s


�
�rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�wrappedfunctionz3context manager for temporarily wrapping a functioncCs"t|�sJ�||_||_||_dSr�)r��
_container�	_funcname�_wrapper)�self�	container�funcnamer�r"r"r#�__init__ts
zwrappedfunction.__init__cC�t|j|j|j�dSr�)�wrapfunctionr
rr)r
r"r"r#�	__enter__zrzwrappedfunction.__enter__cCrr�)�unwrapfunctionr
rr)r
�exctype�excvaluerXr"r"r#�__exit__}rzwrappedfunction.__exit__N)r�r��__qualname__r�rrrr"r"r"r#r	qs
r	cCs`t|�sJ�t||�}t|�sJ�t�|�rt�||�}nt||�}t|||�t|||�|S)a�Wrap the function named funcname in container

    Replace the funcname member in the given container with the specified
    wrapper. The container is typically a module, class, or instance.

    The wrapper will be called like

      wrapper(orig, *args, **kwargs)

    where orig is the original (wrapped) function, and *args, **kwargs
    are the arguments passed to it.

    Wrapping methods of the repository object is not recommended since
    it conflicts with extensions that extend the repository by
    subclassing. All extensions that need to extend methods of
    localrepository should use this subclassing trick: namely,
    reposetup() should look like

      def reposetup(ui, repo):
          class myrepo(repo.__class__):
              def whatever(self, *args, **kwargs):
                  [...extension stuff...]
                  super(myrepo, self).whatever(*args, **kwargs)
                  [...extension stuff...]

          repo.__class__ = myrepo

    In general, combining wrapfunction() with subclassing does not
    work. Since you cannot control what other extensions are loaded by
    your end users, you should play nicely with others by using the
    subclass trick.
    )	r�r�inspect�ismoduler�r�r�r�r)rrr�r�r�r"r"r#r�s!


rcCsVt||�}|��}|dur|d}|�|�t|||�t|�D]}t|||�q |S)a/undo wrapfunction

    If wrappers is None, undo the last wrap. Otherwise removes the wrapper
    from the chain of wrappers.

    Return the removed wrapper.
    Raise IndexError if wrapper is None and nothing to unwrap; ValueError if
    wrapper is not None but is not found in the wrapper chain.
    Nr)�getwrapperchain�pop�remover�reversedr)rrr��chainr��wr"r"r#r�s


rcCsDg}t||�}|r t|�sJ�|�t|d|��t|dd�}|s	|S)z�get a chain of wrappers of a function

    Return a list of functions: [newest wrapper, ..., oldest wrapper, origfunc]

    The wrapper functions are the ones passed to wrapfunction, whose first
    argument is origfunc.
    r�r�N)rr�r�)rrr�r�r"r"r#r�s
�rcCs�ddl}t�|d�r*tj�t�t�|j	���}zt�
|�}Wn
ty)iYSwiSi}|D]9}|�d�rG|�
dd�d}tj�||�}n|}tj�||d�}tj�|�sXq0||vsd|tvsd|dkreq0|||<q0t�t�D]
\}}|ry|||<qo|S)	zAfind paths of disabled extensions. returns a dict of {name: path}rN�__file__s.pyr*rs__init__.pys__init__)�hgextr
rjr8r9�dirname�abspathr�fsencoder!�listdir�OSErrorr.�rsplitrp�existsr&r-r�)r"�extpath�files�extsrsrr9r"r"r#�_disabledpaths�s8��

�r-cCs�g}|��}|dd�dks|��s%|��}|sn|dd�dks|��r|dd�}|dks3|dkra|dd�}|r`|���|�rQ|�|�d}|rP|�|�n|sUdS|�|�|��}|s;ndSd�|�S)	z�return the top-level python documentation for the given file

    Loosely inspired by pydoc.source_synopsis(), but rewritten to
    handle triple quotes and to return the whole text instead of just
    the synopsisNr�#�s"""s'''rr�)�readline�strip�rstripr.r;r�rp)�filer��line�startr"r"r#�
_moduledoc�s0�

��
r6cCs`zt|d��}t|�}Wd�n1swYWn
ty%YdSw|r,t|�Std�S)zBretrieve help synopsis of a disabled extension (without importing)�rbN�(no help text available))rr6r@rr)r9�src�docr"r"r#�
_disabledhelp s
���r;c	Cs�zddlm}dd�t�|j�D�WSttfyYnwt�}|s%iSi}t�|�D]\}}t|�}|rB|dkrB|�	�d||<q,|S)zCfind disabled extensions from hgext. returns a dict of {name: desc}r)�	__index__cSs"i|]
\}}|tvr|t|��qSr")r&r)rkrrGr"r"r#�
<dictcomp>3s
�zdisabled.<locals>.<dictcomp>s	__index__)
r"r<rr-�docsrOr�r-r;�
splitlines)r<�pathsr,rr9r:r"r"r#�disabled.s$
���rAcCst�}||vr
t||�SdS)z<Obtain the full help text for a disabled extension, or None.N)r-r;)rr@r"r"r#�
disabled_helpHs�rBccs��t�|g�}|r?|��}t|tj�s|�t�|��q|jD]}t|tj	�s(qt|j
tj�s0q|j
jdkr7q|Vq|s	dSdS)z7Scan @command() decorators in the tree starting at noder�N)
r��deque�popleftr_�ast�FunctionDef�extend�iter_child_nodes�decorator_list�Callr��Name�id)�node�todorCr"r"r#�_walkcommandOs �
�rOcCs�t|d��}t�|��|�}Wd�n1swYi}t|�D]-}|js)q#|jd}t|tj�r;t�	|j
�}ntjrHt|tj�rH|j
}nq#dgdf||<q#|S)zuConstruct a dummy command table without loading the extension module

    This may raise IOError or SyntaxError.
    r7Nrr�)
rrE�parse�readrOr�r_�Strr�sysbytes�s�ispy3�Bytes)r9r9�rootrqrMrlrr"r"r#�_disabledcmdtableas�
rXc
	Cs�zt|�}WnttfyYdSwzt�|||�\}}Wntjtjfy,YdSw|D]}|�|�r:|}nq/|d}t	|�}	|||	fS)Nr)
rXr@�SyntaxErrorr	r�r�AmbiguousCommand�UnknownCommandrr;)
r!�cmdrr9�strictrqr�r�rrr:r"r"r#�_finddisabledcmdws$��
�
r^FcCs~t�}|s
t�|��d}|�|d�}|rt|||||d�}|s6t�|�D]\}}t|||||d�}|r5nq$|r:|St�|��)zXfind cmd from disabled extensions without importing.
    returns (cmdname, extname, doc)N)r])r-rr[rr^rr-)r!r\r]r@�extr9rr"r"r#�disabledcmd�s 
�
r`TcCs\i}t�D]&\}}t|j�ptd�}|dusJ�|r!|�d�d}|��d��||<q|S)z+return a dict of {name: desc} of extensionsr8Nr*���r)r)rr�rr;r?r1)r�r,�enamer_r:r"r"r#r$�sr$cCsdd�t�t�D�S)z4return short names of extensions that failed to loadcSsg|]
\}}|dur|�qSr�r")rkrr/r"r"r#rn�sznotloaded.<locals>.<listcomp>)rr-r'r"r"r"r#�	notloaded�s�rccCs�t�|d�rt|j�rz|��}Wntyd}Yn
wt�|d�r'|j}nd}t|ttf�r<d�	dd�|D��}|St
�|�}|S)z8return version information from given module as a strings
getversionsunknowns__version__r�r*css�|]}t�|�VqdSr�)r�bytestr)rkr�r"r"r#�	<genexpr>�s�z moduleversion.<locals>.<genexpr>)r
rjr��
getversionr��__version__r_r`rbrprrU)r(r�r"r"r#�
moduleversion�s�
�rhcCst|dd�}|dkS)N�
testedwithsships-with-hg-core)r)r(�
exttestedwithr"r"r#�ismoduleinternal�srkr�)NN)F)T)B�
__future__rrEr�r�r<rr8�i18nrrrrrrr\r	r
rr
�utilsrr'r�r�r&r�r)r2rIrNrRr[rcrorur�r�r�r�r�r�r�r�r�r�r�rrr	rrrr-r6r;rArBrOrXr^r`r$rcrhrkr"r"r"r#�<module>sn


	
3

=

4
2&!




https://t.me/RX1948 - 2025