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__/exthelper.cpython-39.opt-1.pyc
a

�+�bU/�@sHddlmZddlmZmZmZmZmZddlm	Z	Gdd�de
�ZdS)�)�absolute_import�)�commands�error�
extensions�pycompat�	registrar)�tracingc@sreZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
ddd�Zdd�ZdS)�	exthelperaM	Helper for modular extension setup

    A single helper should be instantiated for each module of an
    extension, where a command or function needs to be wrapped, or a
    command, extension hook, fileset, revset or template needs to be
    registered.  Helper methods are then used as decorators for
    these various purposes.  If an extension spans multiple modules,
    all helper instances should be merged in the main module.

    All decorators return the original function and may be chained.

    Aside from the helper functions with examples below, several
    registrar method aliases are available for adding commands,
    configitems, filesets, revsets, and templates.  Simply decorate
    the appropriate methods, and assign the corresponding exthelper
    variable to a module level variable of the extension.  The
    extension loading mechanism will handle the rest.

    example::

        # ext.py
        eh = exthelper.exthelper()

        # As needed (failure to do this will mean your registration will not
        # happen):
        cmdtable = eh.cmdtable
        configtable = eh.configtable
        filesetpredicate = eh.filesetpredicate
        revsetpredicate = eh.revsetpredicate
        templatekeyword = eh.templatekeyword

        # As needed (failure to do this will mean your eh.wrap*-decorated
        # functions will not wrap, and/or your eh.*setup-decorated functions
        # will not execute):
        uisetup = eh.finaluisetup
        extsetup = eh.finalextsetup
        reposetup = eh.finalreposetup
        uipopulate = eh.finaluipopulate

        @eh.command(b'mynewcommand',
            [(b'r', b'rev', [], _(b'operate on these revisions'))],
            _(b'-r REV...'),
            helpcategory=command.CATEGORY_XXX)
        def newcommand(ui, repo, *revs, **opts):
            # implementation goes here

        eh.configitem(b'experimental', b'foo',
            default=False,
        )

        @eh.filesetpredicate(b'lfs()')
        def filesetbabar(mctx, x):
            return mctx.predicate(...)

        @eh.revsetpredicate(b'hidden')
        def revsetbabar(repo, subset, x):
            args = revset.getargs(x, 0, 0, b'babar accept no argument')
            return [r for r in subset if b'babar' in repo[r].description()]

        @eh.templatekeyword(b'babar')
        def kwbabar(ctx):
            return b'babar'
    cCstg|_g|_g|_g|_g|_g|_g|_i|_t�	|j�|_	i|_
t�|j
�|_t��|_t�
�|_
t��|_dS�N)�_uipopulatecallables�_uicallables�
_extcallables�_repocallables�_commandwrappers�_extcommandwrappers�_functionwrappers�cmdtabler�command�configtableZ
configitem�filesetpredicate�revsetpredicate�templatekeyword)�self�r�9/usr/lib64/python3.9/site-packages/mercurial/exthelper.py�__init__Zs

zexthelper.__init__cCs�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j	�|j	�|j
�|j
�|j�|j�|j�
|j�t�|j�D].\}}||jvr�|j|�
|�q�||j|<q�dSr)r
�extendrrrrZ_mergerrrrrr�updaterZ	iteritemsr)r�other�section�itemsrrr�mergejs
zexthelper.mergec
	Cs�|jD]6\}}}t�tj||�}|r|D]}|d�|�q(q|jD]\}}}t�|||�qD|jD]<}	t	�
dt|	���|	|�Wd�qd1s�0YqddS)aDMethod to be used as the extension uisetup

        The following operations belong here:

        - Changes to ui.__class__ . The ui object that will be used to run the
          command has not yet been created. Changes made here will affect ui
          objects created after this, and in particular the ui that will be
          passed to runcommand
        - Command wraps (extensions.wrapcommand)
        - Changes that need to be visible to other extensions: because
          initialization occurs in phases (all extensions run uisetup, then all
          run extsetup), a change made here will be visible to other extensions
          during extsetup
        - Monkeypatch or wrap function (extensions.wrapfunction) of dispatch
          module members
        - Setup of pre-* and post-* hooks
        - pushkey setup
        rzfinaluisetup: %sN)rr�wrapcommandr�table�appendr�wrapfunctionr
r	�log�repr)
r�uir�wrapper�opts�entry�optZcont�funcname�crrr�finaluisetup|s
zexthelper.finaluisetupcCs|jD]}||�qdS)z�Method to be used as the extension uipopulate

        This is called once per ui instance to:

        - Set up additional ui members
        - Update configuration by ``ui.setconfig()``
        - Extend the class dynamically
        N)r)rr)r/rrr�finaluipopulate�s	
zexthelper.finaluipopulatec	Cs�i}|jD]r\}}}}||vrNzt�|�}WntyBYq
Yn0|j||<t�||||�}|r
|D]}	|d�|	�qhq
|jD]<}
t�	dt
|
���|
|�Wd�q�1s�0Yq�dS)z�Method to be used as the extension extsetup

        The following operations belong here:

        - Changes depending on the status of other extensions. (if
          extensions.find(b'mq'))
        - Add a global option to all commands
        rzfinalextsetup: %sN)rr�find�KeyErrorrr#r%rr	r'r()rr)Z	knownexts�extrr*r+�er,r-r/rrr�
finalextsetup�s	


zexthelper.finalextsetupc	CsJ|jD]>}t�dt|���|||�Wd�q1s:0YqdS)z�Method to be used as the extension reposetup

        The following operations belong here:

        - All hooks but pre-* and post-*
        - Modify configuration variables
        - Changes to repo.__class__, repo.dirstate.__class__
        zfinalreposetup: %sN)rr	r'r()rr)Zrepor/rrr�finalreposetup�s	
zexthelper.finalreposetupcCs|j�|�|S)a%Decorated function will be executed during uisetup

        example::

            # Required, otherwise your uisetup function(s) will not execute.
            uisetup = eh.finaluisetup

            @eh.uisetup
            def setupbabar(ui):
                print('this is uisetup!')
        )r
r%�r�callrrr�uisetup�szexthelper.uisetupcCs|j�|�|S)a5Decorated function will be executed during uipopulate

        example::

            # Required, otherwise your uipopulate function(s) will not execute.
            uipopulate = eh.finaluipopulate

            @eh.uipopulate
            def setupfoo(ui):
                print('this is uipopulate!')
        )rr%r8rrr�
uipopulate�szexthelper.uipopulatecCs|j�|�|S)a/Decorated function will be executed during extsetup

        example::

            # Required, otherwise your extsetup function(s) will not execute.
            extsetup = eh.finalextsetup

            @eh.extsetup
            def setupcelestine(ui):
                print('this is extsetup!')
        )rr%r8rrr�extsetup�szexthelper.extsetupcCs|j�|�|S)a8Decorated function will be executed during reposetup

        example::

            # Required, otherwise your reposetup function(s) will not execute.
            reposetup = eh.finalreposetup

            @eh.reposetup
            def setupzephir(ui, repo):
                print('this is reposetup!')
        )rr%r8rrr�	reposetup�szexthelper.reposetupNcs\�durg�n8�D]2}t|t�s*t�d��t|�dvrd}t�|��q����fdd�}|S)aVDecorated function is a command wrapper

        The name of the command must be given as the decorator argument.
        The wrapping is installed during `uisetup`.

        If the second option `extension` argument is provided, the wrapping
        will be applied in the extension commandtable. This argument must be a
        string that will be searched using `extension.find` if not found and
        Abort error is raised. If the wrapping applies to an extension, it is
        installed during `extsetup`.

        example::

            # Required if `extension` is not provided
            uisetup = eh.finaluisetup
            # Required if `extension` is provided
            extsetup = eh.finalextsetup

            @eh.wrapcommand(b'summary')
            def wrapsummary(orig, ui, repo, *args, **kwargs):
                ui.note(b'Barry!')
                return orig(ui, repo, *args, **kwargs)

        The `opts` argument allows specifying a list of tuples for additional
        arguments for the command.  See ``mercurial.fancyopts.fancyopts()`` for
        the format of the tuple.

        Nsopts must be list of tuples)��s)each opt tuple must contain 4 or 5 valuescs4�dur�j��|�f�n�j���|�f�|Sr)rr%r�r*�r�	extensionr+rrr�dec3s
�z"exthelper.wrapcommand.<locals>.dec)�
isinstance�tuplerZProgrammingError�len)rrrBr+r-�msgrCrrArr#s

	zexthelper.wrapcommandcs���fdd�}|S)aLDecorated function is a function wrapper

        This function takes two arguments, the container and the name of the
        function to wrap. The wrapping is performed during `uisetup`.
        (there is no extension support)

        example::

            # Required, otherwise the function will not be wrapped
            uisetup = eh.finaluisetup

            @eh.wrapfunction(discovery, b'checkheads')
            def wrapcheckheads(orig, *args, **kwargs):
                ui.note(b'His head smashed in and his heart cut out')
                return orig(*args, **kwargs)
        cs�j���|f�|Sr)rr%r@��	containerr.rrrrCPsz#exthelper.wrapfunction.<locals>.decr)rrIr.rCrrHrr&>szexthelper.wrapfunction)NN)�__name__�
__module__�__qualname__�__doc__rr"r0r1r6r7r:r;r<r=r#r&rrrrr
s@

2r
N)Z
__future__r�rrrrrZhgdemandimportr	�objectr
rrrr�<module>s

Youez - 2016 - github.com/yon3zu
LinuXploit