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 :  /lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/__pycache__/ui.cpython-39.pyc
a

�+�b�@�@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZddlmZmZddlmZmZmZmZmZmZmZmZmZmZmZm Z ddl!m"Z"m#Z#m$Z$m%Z%m&Z&e j'Z'd	�(d
d�e)ej*e+d��D��Z,d
Z-ddddd�Z.dd�Z/dd�Z0Gdd�de1�Z2dd�Z3e1�Z4gZ5Gdd�de1�Z6da7dd�Z8dd �Z9d!d"�Z:d#d$�Z;dS)%�)�absolute_importN�)�_)�hex)�getattr�open)�color�config�configitems�encoding�error�	formatter�loggingutil�progress�pycompat�rcutil�scmutil�util)�dateutil�procutil�resourceutil�
stringutil�urlutil�ccs|]}|��s|VqdS�N)�isalnum��.0�c�r�2/usr/lib64/python3.9/site-packages/mercurial/ui.py�	<genexpr>7sr!�s�
[ui]
# The rollback command is dangerous. As a rule, don't use it.
rollback = False
# Make `hg status` report copy information
statuscopies = yes
# Prefer curses UIs when available. Revert to plain-text with `text`.
interface = curses
# Make compatible commands emit cwd-relative paths by default.
relative-paths = yes

[commands]
# Grep working directory by default.
grep.all-files = True
# Refuse to perform an `hg update` that would cause a file content merge
update.check = noconflict
# Show conflicts information in `hg status`
status.verbose = True
# Make `hg resolve` with no action (like `-m`) fail instead of re-merging.
resolve.explicit-re-merge = True

[diff]
git = 1
showfunc = 1
word-diff = 1
s�# example user config (see 'hg help config' for more info)
[ui]
# name and email, e.g.
# username = Jane Doe <jdoe@example.com>
username =

# We recommend enabling tweakdefaults to get slight improvements to
# the UI over time. Make sure to set HGPLAIN in the environment when
# writing scripts!
# tweakdefaults = True

# uncomment to disable color in command output
# (see 'hg help color' for details)
# color = never

# uncomment to disable command output pagination
# (see 'hg help pager' for details)
# paginate = never

[extensions]
# uncomment the lines below to enable some popular extensions
# (see 'hg help extensions' for more info)
#
# histedit =
# rebase =
# uncommit =
s�# example repository config (see 'hg help config' for more info)
[paths]
default = %s

# path aliases to other clones of this repo in URLs or filesystem paths
# (see 'hg help config.paths' for more info)
#
# default:pushurl = ssh://jdoe@example.net/hg/jdoes-fork
# my-fork         = ssh://jdoe@example.net/hg/jdoes-fork
# my-clone        = /home/jdoe/jdoes-clone

[ui]
# name and email (local to this repository, optional), e.g.
# username = Jane Doe <jdoe@example.com>
s�# example repository config (see 'hg help config' for more info)
[paths]
# path aliases to other clones of this repo in URLs or filesystem paths
# (see 'hg help config.paths' for more info)
#
# default         = http://example.com/hg/example-repo
# default:pushurl = ssh://jdoe@example.net/hg/jdoes-fork
# my-fork         = ssh://jdoe@example.net/hg/jdoes-fork
# my-clone        = /home/jdoe/jdoes-clone

[ui]
# name and email (local to this repository, optional), e.g.
# username = Jane Doe <jdoe@example.com>
s�# example system-wide hg config (see 'hg help config' for more info)

[ui]
# uncomment to disable color in command output
# (see 'hg help color' for details)
# color = never

# uncomment to disable command output pagination
# (see 'hg help pager' for details)
# paginate = never

[extensions]
# uncomment the lines below to enable some popular extensions
# (see 'hg help extensions' for more info)
#
# blackbox =
# churn =
)susersclonedslocalsglobalcCst�tj|�Sr)r�rapplyZstrurl)Z
maybebytesrrr �_maybestrurl�sr$cCst�tj|�Sr)rr#Zbytesurl)Zmaybestrrrr �_maybebytesurl�sr%c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�httppasswordmgrdbproxyz)Delays loading urllib2 until it's needed.cCs
d|_dSr)�_mgr��selfrrr �__init__�szhttppasswordmgrdbproxy.__init__cCs|jdurt��|_|jSr)r'�urlreqZhttppasswordmgrwithdefaultrealmr(rrr �_get_mgr�s

zhttppasswordmgrdbproxy._get_mgrcCs$|���t|�t|�t|�t|��Sr)r,�add_passwordr$)r)�realmZuris�user�passwdrrr r-�s�z#httppasswordmgrdbproxy.add_passwordcCs |��}t|�t|�t|���Sr)r,r%�find_user_passwordr$)r)r.ZuriZmgrrrr r1�s�z)httppasswordmgrdbproxy.find_user_passwordN)�__name__�
__module__�__qualname__�__doc__r*r,r-r1rrrr r&�s
r&cGs
tj�dSr)rZSignalInterrupt)�argsrrr �
_catchterm�sr7c@sJeZdZd�dd�Zdd�Zedd��Zdd	�Zd
d�Zdd
�Z	e
jdd��Ze
jdd��Z
dd�Zdd�Zd�dd�Zd�dd�Zd�dd�Zd�dd�Zd d!�Zd�d"d#�Zd$d%�Zd&d'�Zd�d(d)�Zd*d+�Zd�d,d-�Zedfd.d/�Zedfd0d1�Zd2d3�Zedfd4d5�Zedfd6d7�Z edfd8d9�Z!eddfd:d;�Z"edfd<d=�Z#edfd>d?�Z$edfd@dA�Z%edfdBdC�Z&dDdE�Z'd�dFdG�Z(d�dHdI�Z)d�dJdK�Z*d�dLdM�Z+dNdO�Z,dPdQ�Z-d�dRdS�Z.d�dTdU�Z/dVdW�Z0d�dXdY�Z1e2j3dZd[��Z4d\d]�Z5e6d^d_��Z7e7j8d`d_��Z7e6dadb��Z9e9j8dcdb��Z9e6ddde��Z:e:j8dfde��Z:e6dgdh��Z;e;j8didh��Z;e
jd�djdk��Z<d�dldm�Z=dndo�Z>dpdq�Z?drds�Z@dtdu�ZAdvdw�ZBdxdy�ZCdzd{�ZDd|d}�ZEd~d�ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKe
jd�d���ZLd�d��ZMd�d��ZNd�d�d��ZOe6d�d���ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d�d��ZVd�d�d��ZWd�d��ZXeYd�d���ZZd�d�d��Z[d�d�d��Z\d�d��Z]d�d��Z^d�d��Z_d�d��Z`d�d��Zae]Zbe`Zce^ZdeBZed�d�d��Zfd�d�d��Zgd�d��Zhd�d�d��Zid�d��Zje2j3d�d„�Zkd�dĄZld�d�dƄZmd�dȄZnd�dʄZod�d̄Zpd�d΄Zqd�d�dфZrd�d�dԄZsd�dքZte
jd�d�d؄�Zud�dڄZvdS)��uiNcCsNg|_g|_d|_d|_|_|_|_d|_tj	|_
t��|_t��|_
t��|_t�|_t�|_d|_i|_d|_d|_d|_i|_i|_d|_d|_|�r�|j|_|j|_|j|_|j|_|j|_|j |_ |j!|_!|j"�#�|_"|j$|_$|j%|_%|j&|_&|j
�#�|_
|j�#�|_|j�#�|_|j�#�|_|j�#�|_|j'|_'|j|_|j|_|j|_|j|_|j�#�|_|j�#�|_|�(�|j)|_)|j*|_*nht+j,|_t+j-|_t+j.|_d|_|j/|_|j0|_ d|_!i|_"d|_$d|_%d|_&t1j'|_'t2�|_)t3�4t5�|_*|�6dd�}d|v�r|j'|_7n.i|_7|D]"}||j'v�r&|j'||j7|<�q&dS)z�Create a fresh new ui object if no src given

        Use uimod.ui.load() to create a ui which knows global and user configs.
        In most cases, you should use ui.copy() to create a copy of an existing
        ui object.
        NFT�experimentalsexportableenviron�*)8�_buffers�
_bufferstates�_bufferapplylabels�quiet�verbose�	debugflag�
tracebackflag�_reportuntrustedr
Z	coreitems�_knownconfigr	�_ocfg�_tcfg�_ucfg�set�_trustusers�_trustgroupsZ	callhooks�
_path_to_rootZinsecureconnections�logblockedtimes�
_colormodeZ_terminfoparamsZ_styles�_uninterruptible�
showtimestamp�_fout�_ferr�_fin�_fmsg�_fmsgout�_fmsgerr�_finoutredirected�_loggers�copy�pageractive�
_disablepager�_tweaked�environ�	fixconfig�httppasswordmgrdb�
_blockedtimesr�stdout�stderr�stdin�fout�ferrrr&�collections�defaultdict�int�
configlist�_exportableenviron)r)�src�allowed�krrr r*�s�





zui.__init__cCs"|j��|j��|j��dSr)rDZ
new_sourcerErFr(rrr �_new_source3s

zui._new_sourcec	Cs�|�}t��D]�\}}|dkr.|j|dd�q|dkrF|j|dd�q|dkr�|��t�}|D]:\}}}}|j�||||�|j�||||�|�|�q`|D]}|j	|d�q�qt
�d|��q|��|��|S)z,Create a ui and load global and user configsspathT)�trustsresourcesitems��sectionsunknown rctype: %s)
rZrccomponents�
readconfig�read_resource_configrlrGrErF�addr\rZProgrammingError�_maybetweakdefaults)	�cls�u�t�f�sectionsro�name�value�sourcerrr �load8s&zui.loadcCs||�dd�sdS|js |�d�r$dSd|_t��}|�dt�|D]4}|�|�D]$\}}|�||�sP|�|||d�qPqBdS)N�uis
tweakdefaultsTs<tweakdefaults>)	�
configboolrZ�plainr	�parse�tweakrc�items�	hasconfig�	setconfig)r)Ztmpcfgroryrzrrr rsSszui._maybetweakdefaultscCs
|�|�Sr)�	__class__r(rrr rWgszui.copycCs|jr|j��t�|_dS)z;Clear internal state that shouldn't persist across commandsN)�_progbar�
resetstater&r]r(rrr r�js
z
ui.resetstateccs^t��}z,dVW|j|dt��|d7<n$|j|dt��|d7<0dS)Ns_blocked��)r�timerr^)r)�key�	starttimerrr �timeblockedsectionps
�
�zui.timeblockedsectionc	#s���dd�}|r$��dd�r$���}�js.|s8dVdS�fdd�}t�|��0zd�_dVWd�_nd�_0Wd�n1s�0YdS)	a/Mark an operation as unsafe.

        Most operations on a repository are safe to interrupt, but a
        few are risky (for example repair.strip). This context manager
        lets you advise Mercurial that something risky is happening so
        that control-C etc can be blocked if desired.
        r9snointerruptsnointerrupt-interactiveonlyNcs ��td����td��dS)Nsshutting down cleanly
s4press ^C again to terminate immediately (dangerous)
T)�warnrrr(rr r��s
�z ui.uninterruptible.<locals>.warnTF)r~�interactiverMr�uninterruptible)r)Zenabledr�rr(r r�{s	�
zui.uninterruptiblecCst�||||�Sr)r
)r)�topic�optsrrr r
�szui.formattercCs�t�|�}t�|�rdS|j|j}}d|vs6d|vr:dSt�|j�}t�|j�}||vsn||vsn|t��krrdS|j	r�|�
td�|||f�dS)NTr:s6not trusting file %s from untrusted user %s, group %s
F)r�fstatZisownerrHrI�username�st_uidZ	groupname�st_gidrBr�r)r)�fprw�stZtusersZtgroupsr/�grouprrr �_trusted�s&

���zui._trustedFcCsTzt�|d|d�}Wnty6|s0YdS�Yn0|�d||||||�dS)Nrrsresource:%s.%s)r�
open_resource�IOError�_readconfig)r)ry�rootrmrx�remapr�rrr rq�s�zui.read_resource_configcCsFzt|d�}Wnty,|s&YdS�Yn0|�||||||�dS)N�rb)rr�r�)r)�filenamer�rmrxr�r�rrr rp�sz
ui.readconfigc
Cs�|��t��}|p |p |�||�}z|j||||d�WnFtjy~}	z,|rP�|�td�|	j|	jf�WYd}	~	n
d}	~	00Wd�n1s�0Y|�	|||�dS)N)rxr�signored %s: %s
)
r	r��readr�ConfigErrorr�r�location�message�_applyconfig)
r)r�r�r�rmrxr��cfg�trusted�instrrr r��s�8zui._readconfigrcCs@t��}|��D]\\}}}|�||||�q|�|d|�dS)a�Add configitems from a non-file source.  Unlike with ``setconfig()``,
        they can be overridden by subsequent config file reads.  The items are
        in the same format as ``configoverride()``, namely a dict of the
        following structures: {(section, name) : value}

        Typically this is used by extensions that inject themselves into the
        config file load procedure by monkeypatching ``localrepo.loadhgrc()``.
        TN)r	r�rGr�)r)r
r{r�r�roryrzrrr �applyconfig�s	zui.applyconfigcCsZ|��r�dD]}||dvr|d|=q|�d�D]\}}|d|=q2|�d�D]\}}|d|=qP|�d�D]\}}|d|=qn|�d�r�|�d�D]\}}|d|=q�|�d�r�|�d�D]\}}|d|=q�|�d�r�|�d�D]\}}|d|=q�|�r|j�|�|j�|j�|j�|�|j�|j�|du�rJtj�d	�}|j	|d
�dS)N)
�debugsfallbackencoding�quietsslashslogtemplate�message-outputsstatuscopiessstyle�	traceback�verboser}sdefaultsscommandsscommand-templatessaliassrevsetaliass
templatealias�~)r�)
rr�rE�updaterDrF�os�path�
expanduserr\)r)r�r�r�rk�vrrr r��s6



zui._applyconfigcCs|dvr�|pt��}|j|j|jfD]�}|�d�D]�\}}|}|�d|�pLd}|||f}||jvrl||j|<d|vrvq2|s|q2d|vr�|dur�d}|�t	d�|||f�|�
dd�}||kr2|�d||�q2q$|d	v�r�t|�\|_
|_|�d
d�|_|j�p|�d
d�|_|j�o |�d
d
�|_|j�r@|j�r@d|_|_|j�pR|�d
d�|_|�d
d�|_|�d
d�|_|�d
d�|_|dv�r�|j�|�dd��|j�|�dd��|dv�r|j�rt�}	|�dd��r�|	�d�|	�rt�|j|	�}
|� d|
�dS)N)N�pathsr�snone�:s%%Znones((deprecated '%%' in path %s=%s from %s)
�%)Nr}r}r�r�r�Fsreport_untrustedstimestamp-outputr�slogblockedtimes)N�trustedr�suserssgroups)N�develr}r�sdebug.extensionss	extension)!r�getcwdrErFrDr��configsourcerJr�r�replaceZalter�_selectmsgdestsrSrTr~r@r?r>rBrNrArKrHr�rgrIrGrrrZfileobjectloggerrP�	setlogger)r)r�ror�n�pZold_p�sZroot_key�tracked�loggerrrr r\ s^


��
�

zui.fixconfigcCs(|j�||�|j�||�|j�||�fSr)rD�backuprErF)r)ro�itemrrr �backupconfigXs�zui.backupconfigcCs4|j�|d�|j�|d�|j�|d�dS)Nrr�)rDZrestorerErF)r)�datarrr �
restoreconfig_szui.restoreconfigcCs>|j|j|jfD]}|�||||�q|j|d�|��dS)Nrn)rDrErFrGr\rs)r)roryrzr{r�rrr r�dszui.setconfigcCs|r
|jp|jSr)rFrE)r)�	untrustedrrr �_datajszui._datacCs|�|��||�Sr)r�r{�r)roryr�rrr r�mszui.configsourcecCs"|j||||d�}|turdS|S)z+return the plain string version of a config)�defaultr�N)�_config�_unset�r)roryr�r�rzrrr r	ps�z	ui.configcs�|}}|j�|i��|�}||fg}|durV|�|j�t|j�rN|��}qt|j}nd}	|	||f;}	|�|	dd�|tur�|dur�|}n4|jtj	ur�d}d}	|	||f;}	|�|	dd�n|}nH|du�r|jtj	u�r||k�rd}	|	||t
�|�f;}	|�|	dd�g}
|�|��|D]2\}}��||d�}
|
du�r|
�
|||
f��q|
�rp�fdd�}t|
|d	�d}|j�r�|�s�|j�r�|D]@\}}|j�||�}|du�r�||k�r�|�d
|||f��q�|S)Ns+accessing unregistered config item: '%s.%s'r�swarn-config-unknowns7config item requires an explicit default value: '%s.%s'swarn-config-defaultsPspecifying a mismatched default value for a registered config item: '%s.%s' '%s'cs��|d|d�S)Nrr)�level)�x�r	rr r��szui._config.<locals>.level)r��3ignoring untrusted configuration option %s.%s = %s
)rC�get�extend�alias�callabler��	develwarnr�r
�dynamicdefaultr�bytestrr��append�maxr@rBrF�debug)r)roryr�r�rz�itemdefaultr�Z
alternates�msgZ
candidatesr�r��	candidater��uvaluerr�r r�ysb


�
���

��z
ui._configcCs.|j�|i��|�}|dur(t||f��|jS)z�return the default value for a config option

        The default is returned "raw", for example if it is a callable, the
        callable was not called.
        N)rCr��KeyErrorr�)r)roryr�rrr �config_default�szui.config_defaultcCs�|j||||d�}|�|�}i}d|}|�|�D]&\}	}
|	�|�r2|
||	t|�d�<q2|jr�|s�|jr�|��D]D\}	}
|j�|d||	f�}|durr||
krr|�	d|||	|f�qr||fS)a�Get a config option and all sub-options.

        Some config options have sub-options that are declared with the
        format "key:opt = value". This method is used to return the main
        option and all its declared sub-options.

        Returns a 2-tuple of ``(option, sub-options)``, where `sub-options``
        is a dict of defined sub-options where keys and values are strings.
        �r�s%s:Ns%s:%ss6ignoring untrusted configuration option %s:%s.%s = %s
)
r	r�r��
startswith�lenr@rBrFr�r�)r)roryr�r��mainr��sub�prefixrkr�r�rrr �configsuboptions�s"



��zui.configsuboptionscCsv|�||||�}|durdStj�|�r0d|vrr|�|||�}d|vrrtj�|�d�d�}tj�|tj�|��}|S)zMget a path config item, expanded relative to repo root or config
        fileNs://r�r)	r	r�r��isabsr��dirname�rsplit�joinr�)r)roryr�r�r�ri�baserrr �
configpath�sz
ui.configpathcCsr|j||||d�}|dur|S|tur6|tur2dS|St|t�rD|St�|�}|durnt�td�|||f��|S)a\parse a configuration element as a boolean

        >>> u = ui(); s = b'foo'
        >>> u.setconfig(s, b'true', b'yes')
        >>> u.configbool(s, b'true')
        True
        >>> u.setconfig(s, b'false', b'no')
        >>> u.configbool(s, b'false')
        False
        >>> u.configbool(s, b'unknown')
        False
        >>> u.configbool(s, b'unknown', True)
        True
        >>> u.setconfig(s, b'invalid', b'somevalue')
        >>> u.configbool(s, b'invalid')
        Traceback (most recent call last):
            ...
        ConfigError: foo.invalid is not a boolean ('somevalue')
        r�NFs%s.%s is not a boolean ('%s'))	r�r��
isinstance�boolrZ	parseboolrr�r)r)roryr�r�r��brrr r~�s

�z
ui.configboolc
Csr|�||||�}|dur|Sz
||�WSttjfyl|durNt�|j�}t�td�||||f��Yn0dS)aparse a configuration element with a conversion function

        >>> u = ui(); s = b'foo'
        >>> u.setconfig(s, b'float1', b'42')
        >>> u.configwith(float, s, b'float1')
        42.0
        >>> u.setconfig(s, b'float2', b'-4.25')
        >>> u.configwith(float, s, b'float2')
        -4.25
        >>> u.configwith(float, s, b'unknown', 7)
        7.0
        >>> u.setconfig(s, b'invalid', b'somevalue')
        >>> u.configwith(float, s, b'invalid')
        Traceback (most recent call last):
            ...
        ConfigError: foo.invalid is not a valid float ('somevalue')
        >>> u.configwith(float, s, b'invalid', desc=b'womble')
        Traceback (most recent call last):
            ...
        ConfigError: foo.invalid is not a valid womble ('somevalue')
        Ns%s.%s is not a valid %s ('%s'))	r	�
ValueErrorr�
ParseErrorr�sysbytesr2r�r)r)Zconvertroryr�Zdescr�r�rrr �
configwiths
�z
ui.configwithcCs|�t|||d|�S)aparse a configuration element as an integer

        >>> u = ui(); s = b'foo'
        >>> u.setconfig(s, b'int1', b'42')
        >>> u.configint(s, b'int1')
        42
        >>> u.setconfig(s, b'int2', b'-42')
        >>> u.configint(s, b'int2')
        -42
        >>> u.configint(s, b'unknown', 7)
        7
        >>> u.setconfig(s, b'invalid', b'somevalue')
        >>> u.configint(s, b'invalid')
        Traceback (most recent call last):
            ...
        ConfigError: foo.invalid is not a valid integer ('somevalue')
        sinteger)r�rf�r)roryr�r�rrr �	configint6s�zui.configintc	Cst|�||||�}|tur(|tur$d}|}t|t�s6|Szt�|�WStjynt�t	d�|||f��Yn0dS)a�parse a configuration element as a quantity in bytes

        Units can be specified as b (bytes), k or kb (kilobytes), m or
        mb (megabytes), g or gb (gigabytes).

        >>> u = ui(); s = b'foo'
        >>> u.setconfig(s, b'val1', b'42')
        >>> u.configbytes(s, b'val1')
        42
        >>> u.setconfig(s, b'val2', b'42.5 kb')
        >>> u.configbytes(s, b'val2')
        43520
        >>> u.configbytes(s, b'unknown', b'7 MB')
        7340032
        >>> u.setconfig(s, b'invalid', b'somevalue')
        >>> u.configbytes(s, b'invalid')
        Traceback (most recent call last):
            ...
        ConfigError: foo.invalid is not a byte quantity ('somevalue')
        rs#%s.%s is not a byte quantity ('%s')N)
r�r�r��bytesr�	sizetointrr�r�rr�rrr �configbytesMs
��zui.configbytescCs:|�tj|||d|�}t|t�r*t�|�S|dur6gS|S)a�parse a configuration element as a list of comma/space separated
        strings

        >>> u = ui(); s = b'foo'
        >>> u.setconfig(s, b'list1', b'this,is "a small" ,test')
        >>> u.configlist(s, b'list1')
        ['this', 'is', 'a small', 'test']
        >>> u.setconfig(s, b'list2', b'this, is "a small" , test ')
        >>> u.configlist(s, b'list2')
        ['this', 'is', 'a small', 'test']
        slistN)r�rZ	parselistr�r�)r)roryr�r�r�rrr rgrs
�

z
ui.configlistcCs6|�||||�r&|�tj|||d|�S|tur2dS|S)z�parse a configuration element as a tuple of ints

        >>> u = ui(); s = b'foo'
        >>> u.setconfig(s, b'date', b'0 0')
        >>> u.configdate(s, b'date')
        (0, 0)
        sdateN)r	r�rZ	parsedater�r�rrr �
configdate�s�z
ui.configdatecCs>|j�|i��|�}d}|dur:t|j�r4|��}n|j}|S)z,returns the default value of the config itemN)rCr�r�r�)r)roryr�r�rrr �
configdefault�s

zui.configdefaultcCs|�|��||�Sr)r�Zhasitemr�rrr r��szui.hasconfigcCs||�|�vS)z&tell whether section exists in config.)r�)r)ror�rrr �has_section�szui.has_sectioncCsr|�|��|�}|r"dd�|D�}|jrn|sn|jrn|j�|�D].\}}|j�||�|kr>|�d|||f�q>|S)NcSsg|]}d|dvr|�qS)r�rr)r�irrr �
<listcomp>�rz"ui.configitems.<locals>.<listcomp>r�)r�r�r@rBrFrEr�r�)r)ror�Z	ignoresubr�rkr�rrr r
�s��zui.configitemsccs�|�|�}|s"|D]
}|VqdS|��}t|d�}t|d�}|dusN|dur�|durh|Vt|d�}q>|dur�|Vt|d�}q>|dd�|dd�kr�|Vt|d�}t|d�}q>|dd�|dd�kr�|Vt|d�}q>|Vt|d�}q>dS)Nrr�)�_walk_config�_walk_known�next)r)r�Z	all_knownZdefined�dZknownZcurrent_definedZ
current_knownrrr �
walkconfig�s0



z
ui.walkconfigccstt|j���D]`\}}t|���D]J\}}|jr2q"t|j�rF|��}n|jtjurXd}n|j}||j|fVq"qdS)Ns	<DYNAMIC>)	�sortedrCr�Zgenericr�r�r
r�ry)r)ror�rkrr�rrr r�s

zui._walk_knownccs>|�|�}|��D]&}|�||�D]\}}|||fVq"qdSr)r�rxr
)r)r�r�roryrzrrr r�s
zui._walk_configcCsfdtjvrdtjvrdStj�dd����d�}dtj�dd��d�vrR|�d�|rb|rb||vSdS)	auis plain mode active?

        Plain mode means that all configuration variables which affect
        the behavior and output of Mercurial should be
        ignored. Additionally, the output should be stable,
        reproducible and suitable for use in scripts or applications.

        The only way to trigger plain mode is by setting either the
        `HGPLAIN' or `HGPLAINEXCEPT' environment variables.

        The return value can either be
        - False if HGPLAIN is not set, or feature is in HGPLAINEXCEPT
        - False if feature is disabled by default and not included in HGPLAIN
        - True otherwise
        sHGPLAINs
HGPLAINEXCEPTFr�,s+strictflagssstrictflagsT)rr[r��strip�splitr�)r)�feature�
exceptionsrrr r�s����
zui.plaincCstj�d�}|dur4|�dd�}|dur4tj�|�}|durHtj�d�}|durX|rX|S|dur~|�dd�r~|jt	d�dd�}|dur�|�
�s�z0d	t��t�
t���f}|�t	d
�|�Wnty�Yn0|s�tjt	d�t	d�d
��d|v�rt�t	d�t�|���|S)a�Return default username to be used in commits.

        Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL
        and stop searching if one of these is set.
        If not found and acceptempty is True, returns None.
        If not found and ui.askusername is True, ask the user, else use
        ($LOGNAME or $USER or $LNAME or $USERNAME) + "@full.hostname".
        If no username could be found, raise an Abort error.
        �HGUSERNr}susernamesEMAILsaskusernamesenter a commit username:�r�s%s@%ss&no username found, using '%s' instead
sno username supplieds+use 'hg config --edit' to set your username)�hint�
susername %r contains a newline
)rr[r�r	r�r��
expandvarsr~�promptrr�rZgetuser�
strtolocal�socketZgetfqdnr�r�r�Abortrr�)r)Zacceptemptyr/rrr r�s<
��
�zui.usernamecCs|jst�|�}|S)z>Return a short representation of a user name or email address.)r?r�	shortuser)r)r/rrr r0s
zui.shortusercCsxd}|�|d�z|�|�}|r(|jWSWntjy>Yn0|rtz|�|�}|r\|jWSWntjyrYn0|S)z:Return repository location relative to cwd or from [paths]s?ui.expandpath is deprecated, use `get_*` functions from urlutil�6.0)�
deprecwarn�getpathZrawlocrZ	RepoError)r)�locr�r�r�rrr �
expandpath6s 

z
ui.expandpathcCs
t�|�Sr)r�pathsr(rrr rKszui.pathscOs*d}|�|d�|jj|g|�Ri|��S)zwsee paths.getpath for details

        This method exist as `getpath` need a ui for potential warning message.
        s<ui.getpath is deprecated, use `get_*` functions from urlutilr)rrr)r)r6�kwargsr�rrr rOsz
ui.getpathcCs|jSr)rOr(rrr rbXszui.foutcCs||_t|�\|_|_dSr)rOr�rSrT�r)rwrrr rb\scCs|jSr)rPr(rrr rcaszui.ferrcCs||_t|�\|_|_dSr)rPr�rSrTrrrr rcescCs|jSr�rQr(rrr �finjszui.fincCs
||_dSrr rrrr r!nscCs|jS)zUStream dedicated for status/error messages; may be None if
        fout/ferr are used)rRr(rrr �fmsgrszui.fmsgcCs||_t|�\|_|_dSr)rRr�rSrTrrrr r"xsccs2|j|||d�zdVW|��n
|��0dS)N)r�subproc�labeled)�
pushbuffer�	popbuffer�r)rr#r$rrr �silent}sz	ui.silentcCs(|j�g�|j�|||f�||_dS)aeinstall a buffer to capture standard output of the ui object

        If error is True, the error output will be captured too.

        If subproc is True, output from subprocesses (typically hooks) will be
        captured too.

        If labeled is True, any labels associated with buffered
        output will be handled. By default, this has no effect
        on the output returned, but extensions and GUI tools may
        handle this argument and returned styled output. If output
        is being buffered so it can be captured and parsed or
        processed, labeled should not be set to True.
        N)r;r�r<r=r'rrr r%�sz
ui.pushbuffercCs8|j��|jr"|jdd|_nd|_d�|j���S)z2pop the last buffer and return the buffered output���r�Nr)r<�popr=r�r;r(rrr r&�s

zui.popbuffercCs:||jurt|j�S||jur6t|jo2|jdd�SdS)Nr)rF)rOr�r;rPr<)r)�destrrr �_isbuffered�s



zui._isbufferedcCs|jr|jsdS|jduS)zcheck if write skips the labelTN)r;r=rLr(rrr �canwritewithoutlabels�szui.canwritewithoutlabelscCs
|jdkS)z.check if write calls with labels are batchable�win32)rLr(rrr �canbatchlabeledwrites�szui.canbatchlabeledwritescsL�j}�jrX|�dd���rD�jrD�jd���fdd�|D��n�jd�|�dS|�dd�sl���d�|�}t��}z�zT�j	d	kr�t
j�|j|fi|��n,�j	dur�|�dd����
|��}|�|�Wn0t�y}zt�|��WYd}~n
d}~00W�jd
t��|d7<n �jd
t��|d7<0dS)a:write args to output

        By default, this method simply writes to the buffer or stdout.
        Color mode can be set on the UI class to have the output decorated
        with color modifier before being written to stdout.

        The color used is controlled by an optional keyword argument, "label".
        This should be a string containing label names separated by space.
        Label names take the form of "topic.type". For example, ui.debug()
        issues a label of "ui.debug".

        Progress reports via stderr are normally cleared before writing as
        stdout and stderr go to the same terminal. This can be skipped with
        the optional keyword argument "keepprogressbar". The progress bar
        will continue to occupy a partial line on stderr in that case.
        This functionality is intended when Mercurial acts as data source
        in a pipe.

        When labeling output for a specific command, a label of
        "cmdname.type" is recommended. For example, status issues
        a label of "status.modified" for modified files.
        �labelrr)c3s|]}��|��VqdSr�r0�r�a�r0r)rr r!�rzui.write.<locals>.<genexpr>N�keepprogressbarFr.�
stdio_blockedr�)rOr;r�r=r��
_progclearr�rr�rLr�
win32print�writer0r�r�
StdioErrorr^)r)r6r�r+r�r��errrr4r r9�s6
"


"

�
�zui.writecOs|j|jg|�Ri|��dSr)�_writerP)r)r6r�rrr �	write_err�szui.write_errcsp��|�rT|�dd���rB�jrB�jd���fdd�|D��ql�jd�|�n�j|g|�Ri|��dS)Nr0rr)c3s|]}��|��VqdSrr1r2r4rr r!�rzui._write.<locals>.<genexpr>)r,r�r=r;r��_writenobuf�r)r+r6r�rr4r r<�s

"z	ui._writecOs�|�dd�s|��d�|�}t��}�zZz�||jurNt|jdd�sN|j��t|dd�rn|j	|fi|��nP|j
dkr�tj||j	|fi|��n,|j
dur�|�dd�}|�
||�}|�	|�||jur�t|dd�s�|��Wn�t�y`}zh||ju�rB|jtjtjtjfv�rBWYd}~W|jdt��|d	7<dSt�|��WYd}~n
d}~00W|jdt��|d	7<n |jdt��|d	7<0dS)
Nr5Fr�closed�
structuredr.r0r6r�)r�r7r�rr�rPrrO�flushr9rLrr8r0r��errno�EPIPE�EIO�EBADFr^rr:)r)r+r6r�r�r�r0r;rrr r>�sJ




�

��"

�
�zui._writenobufcOs`|jo|�d�dv}|r6dt�tj�����f|}t|j|g|�Ri|��|r\|�	�dS)N�type>�status�error�warning�noter�s[%s] )
rNr�rr��datetimeZnowZ	isoformat�
_writemsgwithr<rB)r)r+r6r�Z	timestamprrr �	_writemsg&s���zui._writemsgcOst|j|g|�Ri|��dSr)rMr>r?rrr �_writemsgnobuf7szui._writemsgnobufcCsXt��}�z(z�z|j��WnDty`}z,|jtjtjtjfvrLt	�
|��WYd}~n
d}~00Wz|j��WnDty�}z,|jtjtjtjfvr�t	�
|��WYd}~n
d}~00nXz|j��WnFt�y}z,|jtjtjtjfvr�t	�
|��WYd}~n
d}~000W|jdt��|d7<n |jdt��|d7<0dS)Nr6r�)
rr�rOrBr�rCrDrErFrr:rPr^)r)r�r;rrr rB:s0""�$

�
�zui.flushcCs|�dd�rdSt�|�S)Nr}�nonttyF)r~r�isatty)r)Zfhrrr �_isattyNsz
ui._isattycCsD|jr|j|jfSt�|j|j�\}}||f|j|jfk|_||fS)aDuplicate ui streams and redirect original if they are stdio

        Returns (fin, fout) which point to the original ui fds, but may be
        copy of them. The returned streams can be considered "owned" in that
        print(), exec(), etc. never reach to them.
        )rUrQrOrZprotectstdio�r)r!rbrrr �
protectfinoutSs
zui.protectfinoutcCs6||f|j|jfkrdSt�|j|j||�d|_dS)z7Restore ui streams from possibly duplicated (fin, fout)NF)rQrOrZrestorestdiorUrSrrr �
restorefinoutbszui.restorefinoutc
cs:|��\}}z||fVW|�||�n|�||�0dS)z.Run code block with protected standard streamsN)rTrUrSrrr �protectedfinoutkszui.protectedfinoutcCs
d|_dS)NT)rYr(rrr �disablepagertszui.disablepagercCsd|js|jrdS|�d�s|||�dd�vsx|�dd�rx|�dd|d�rxtj�d	�d
ksx|��rx|�	�sx|j
sxdtjvr|dS|�
ddtj�}|s�dSi}t����D]\}}|tjvr�|||<q�|�dt�|��|��|��}t�td
�r�t�tjt�|�||��rXd|_|�dd|d�|�dddd�|j}||�
dd|�k�r`t�|�n|� �dS)aStart a pager for subsequent command output.

        Commands which produce a long stream of output should call
        this function to activate the user's preferred pagination
        mechanism (which may be no pager). Calling this function
        precludes any future use of interactive functionality, such as
        prompting the user or activating curses.

        Args:
          command: The full, non-aliased name of the command. That is, "log"
                   not "history, "summary" not "summ", etc.
        Nsinternal-always-spagersignorer}spaginatesattend-T�TERM�dumbs
--debuggersstarting pager for command %s
sSIGPIPE�	formatted�interactiveFscolors	pagermode)!rYrXr�rgr~rr[r��	formattedrr;rZsysargvr	rZ
fallbackpagerZdefaultpagerenvr�r�rZpprintrBr�safehasattr�signal�SIGPIPEr7�	_runpagerr�rLrZsetuprW)r)�commandZpagercmdZpagerenvryrzZwasformatted�cmrrr �pagerwsT

�
���	�
��
�

�zui.pagerc
s\�dkrdSt�fdd�dD��}tjrT|sTt���}|sP|�td���dS|�z8tjt�	��|dtj
tjtjtj
t�t�|��d��WnVty�}z>|jtjkr�|s�|�td���WYd	}~dS�WYd	}~n
d	}~00t�tj����t�tj
����t��j��tj���|�tj
��rBt��j��tj
���|j���fd
d��}dS)
z�Actually start the pager and set up file descriptors.

        This is separate in part so that extensions (like chg) can
        override how a pager is invoked.
        scatFc3s|]}|�vVqdSrrr)rarr r!�rzui._runpager.<locals>.<genexpr>s|&;<>()$`\"' 	
*?[#~=%s+missing pager command '%s', skipping pager
r))�shell�bufsizeZ	close_fdsrar_r`�envNcsVt�td�rt�tjtj�t��tj�	��t��tj
�	���j����
�dS)NsSIGINT)rr]r^�SIGINT�SIG_IGNr��dup2rr_�filenor`ra�close�waitr)rc�stderrfd�stdoutfdrr �	killpager�s
zui._runpager.<locals>.killpagerT)�anyrZ	iswindowsrZfindexer�r�
subprocess�PopenZtonativestrZclosefds�PIPEr_r`ZtonativeenvZshellenviron�OSErrorrC�ENOENTr��duprjrirarR�atexit)r)rarfrdZfullcmd�eror)rarcrmrnr r`�sJ


��


�	zui._runpagercCstSr)�_reqexithandlersr(rrr �
_exithandlersszui._exithandlerscOs|j�|||f�|S)zzregister a function to run after dispatching a request

        Handlers do not stay registered across request boundaries.)rzr�)r)�funcr6rrrr rw	sz	ui.atexitc	Cs"tddg�}ddgddgd�}||��vr6td|��t||�}||krVtd|��|��sntj�d�dkrrdSd}|�dd	�}||vr�|}|}|�dd
|�}||vr�|}|dur�||kr�|dur�|�t	d�|f�n|�t	d
�||f�|du�r||k�r|�t	d�|||f�|S)aAwhat interface to use for interactive console features?

        The interface is controlled by the value of `ui.interface` but also by
        the value of feature-specific configuration. For example:

        ui.interface.histedit = text
        ui.interface.chunkselector = curses

        Here the features are "histedit" and "chunkselector".

        The configuration above means that the default interfaces for commands
        is curses, the interface for histedit is text and the interface for
        selecting chunk is crecord (the best curses interface available).

        Consider the following example:
        ui.interface = curses
        ui.interface.histedit = text

        Then histedit will use the text interface and chunkselector will use
        the default curses interface (crecord at the moment).
        stextscurses)s
chunkselectorshisteditsUnknown feature requested %ss1Feature %s does not handle all default interfacesrXrYr}s	interfacesinterface.%sNs#invalid value for ui.interface: %s
s.invalid value for ui.interface: %s (using %s)
s1invalid value for ui.interface.%s: %s (using %s)
)
�	frozenset�keysr�rrr[r�r	r�r)	r)rZalldefaultsZfeatureinterfacesZavailableinterfacesZdefaultinterfacerZchoseninterfacerwrrr �	interfacesP��������zui.interfacecCs$|�dd�}|dur |�|j�S|S)a-is interactive input allowed?

        An interactive session is a session where input can be reasonably read
        from `sys.stdin'. If this function returns false, any attempt to read
        from stdin should fail with an error, unless a sensible default has been
        specified.

        Interactiveness is triggered by the value of the `ui.interactive'
        configuration variable or - if it is unset - when `sys.stdin' points
        to a terminal device.

        This function refers to input only; for output, see `ui.formatted()'.
        r}r[N)r~rRrQ�r)rrrr r�^szui.interactivecCs<dtjvr.zttjd�WSty,Yn0t�|�dS)z$how wide is the terminal in columns?sCOLUMNSr)rr[rfr�rZtermsizer(rrr �	termwidthts
zui.termwidthcCs0|��rdS|�dd�}|dur,|�|j�S|S)a*should formatted output be used?

        It is often desirable to format the output to suite the output medium.
        Examples of this are truncating long lines or colorizing messages.
        However, this is not often not desirable when piping output into other
        utilities, e.g. `grep'.

        Formatted output is triggered by the value of the `ui.formatted'
        configuration variable or - if it is unset - when `sys.stdout' points
        to a terminal device. Please note that `ui.formatted' should be
        considered an implementation detail; it is not intended for use outside
        Mercurial or its extensions.

        This function refers to output only; for input, see `ui.interactive()'.
        This function always returns false when in plain mode, see `ui.plain()'.
        Fr}rZN)rr~rRrOrrrr r\}szui.formatted� cCsf|�|j�o.|�|j�o.t�|j�o.t�|j�}|r^zddl}|jWnty\d}Yn0|j	dksl|s�|sti}|j
|j|fddi|��|��d}n|�
|d�d}|�d���|�r|��t�|�}t�t�|��}tjd	k�rB|�d
��rB|dd�}n<|j�t�|��|j��|j��}|�s6t�|�tj�}Wd�n1�sX0Y|S)NrFr.rG�promptr�s	ui.prompt�stdios
�
r))rRrQrOrZisstdinZisstdout�readline�read_history_file�	ExceptionrLrOrSrBr0r�rZstrfromlocalrrZrawinputZ	oslinesep�endswithr9r��EOFError�rstrip)r)r�
promptoptsZusereadliner��linerrr �	_readline�sP
�
�
�

���


,zui._readline�ycCs|j||d�S)zhPrompt user with msg, read response.
        If ui is not interactive, the default is returned.
        r)�_prompt)r)r�r�rrr r�sz	ui.promptcKs�|d}|��sH|j|j|dfddi|��|j|j|p:dddd�|Sz@|j||d	�}|s`|}|�d
d�r�|j|j|pzdddd�|WSty�t���Yn0dS)Nr�r�rGr�rrs
promptecho)rG)rr�r})r�rNrSr�r~r�r�ResponseExpected)r)r�r�r��rrrr r��s$��z
ui._promptcsNt�d|�}|�d�}dd�|�d��d�D�}dd��|�fd	d�|D�fS)
a4Extract prompt message and list of choices from specified prompt.

        This returns tuple "(message, choices)", and "choices" is the
        list of tuple "(response character, text without &)".

        >>> ui.extractchoices(b"awake? $$ &Yes $$ &No")
        ('awake? ', [('y', 'Yes'), ('n', 'No')])
        >>> ui.extractchoices(b"line\nbreak? $$ &Yes $$ &No")
        ('line\nbreak? ', [('y', 'Yes'), ('n', 'No')])
        >>> ui.extractchoices(b"want lots of $$money$$?$$Ye&s$$N&o")
        ('want lots of $$money$$?', [('s', 'Yes'), ('o', 'No')])
        s(?s)(.+?)\$\$([^$]*&[^ $].*)rcSsg|]}|�d��qS)r�)r
)rr�rrr rrz%ui.extractchoices.<locals>.<listcomp>r�s$$cSs0|�d�}||d|d���|�ddd�fS)N�&rr�r)�index�lowerr�)r�Zampidxrrr �choicetuples
z&ui.extractchoices.<locals>.choicetuplecsg|]}�|��qSrr�rr��r�rr rr)�re�matchr�r)r�mr��choicesrr�r �extractchoices�s

zui.extractchoicesrcCsb|�|�\}}dd�|D�}|j||||d�}|��|vrJ|�|���S|�|jtd��qdS)aePrompt user with a message, read response, and ensure it matches
        one of the provided choices. The prompt is formatted as follows:

           "would you like fries with that (Yn)? $$ &Yes $$ &No"

        The index of the choice is returned. Responses are case
        insensitive. If ui is not interactive, the default is
        returned.
        cSsg|]\}}|�qSrr)rr�rvrrr rrz#ui.promptchoice.<locals>.<listcomp>)r�r�sunrecognized response
N)r�r�r�r�rNrSr)r)rr�r�r�Zrespsr�rrr �promptchoiceszui.promptchoicecCs�|��s|Sz�|j|j|p td�ddd�|�d��`|�dd�rn|j��}|sTt�|�	d�Wd�WSt
��Wd�WSWd�n1s�0YWnty�t�
��Yn0dS)	Ns
password: r�T)rG�passwordr�r}rPr)r�rNrTrr�r~rQr�r�r�rZget_passwordrr�)r)rr��lrrr �getpasss$
�
:z
ui.getpasscOs(|js$|j|jg|�Rddi|��dS)zqwrite status message to output (if ui.quiet is False)

        This adds an output label of "ui.status".
        rGrHN)r>rNrS�r)r�r�rrr �status3sz	ui.statuscOs"|j|jg|�Rddi|��dS)zewrite warning message to output (stderr)

        This adds an output label of "ui.warning".
        rGrJN�rNrTr�rrr r�;szui.warncOs"|j|jg|�Rddi|��dS)zawrite error message to output (stderr)

        This adds an output label of "ui.error".
        rGrINr�r�rrr rBszui.errorcOs(|jr$|j|jg|�Rddi|��dS)zfwrite note to output (if ui.verbose is True)

        This adds an output label of "ui.note".
        rGrKN)r?rNrSr�rrr �noteIszui.notecOs<|jr8|j|jg|�Rddi|��|�ddd�|��dS)zrwrite debug message to output (if ui.debugflag is True)

        This adds an output label of "ui.debug".
        rGr�s%srN)r@rNrS�logr�r�rrr r�Qszui.debugc	Cs�|dur|�d�ddd�}|durF|�d�dur<|�d�|�|�|}|dkrXd}	n|rfd	|}	n|d}	d}
|�d
d�r�|}
tjd|d
d|	|
d�\}}�z,t�|d�� }
|
�t	�
|��Wd�n1s�0Yd|i}d|v�r
|�dt|d�i�dD](}||v�r|�d||i��q8�q|�rL|�d|i�|�r`|�d|i�|��}|j
d||f|tjtd�dd�t|d��}
t	�|
���}Wd�n1�s�0YWt�|�nt�|�0|S)NsAaction is None but will soon be a required parameter to ui.edit()�editors.txt)�prefix�suffixr�s>extra.suffix is not None but will soon be ignored by ui.edit()sdiffs.diffs
.%s.hg.txtr9s
editortmpinhgshg-r��-)r��suffix�dir�wbrstransplant_sources
HGREVISION)sintermediate-sourcessources
rebase_sources
HGEDITFORMs
HG_PENDINGs%s "%s"sedit failed)r[�onerr�	errprefix�
blockedtagr�)r�r�r�r~rZmkstempr��fdopenr9rZtonativeeolr�	geteditor�systemrZ
CanceledErrorrrZ
fromnativeeolr��unlink)r)�textr/ZextraZeditform�pendingZrepopath�actionZextra_defaultsr�Zrdir�fdryrwr[r0�editorrvrrr �edit`sj
���

�
.
�


�0zui.editcCs�|dur$|�dt�dd�}d|}|j}tdd�|jD��rB|}|�|��"|j||||d�}	Wd�n1st0Y|	r�|r�dt�|�dt�	|	�f}
|r�d	||
f}
||
��|	S)
z�execute shell command with appropriate output stream. command
        output will be redirected if fout is not stdout.

        if command fails and onerr is None, return status, else raise onerr
        object as exception.
        Ni����sunknown_system_css|]}|dVqdS)rNrr�rrr r!�rzui.system.<locals>.<genexpr>�r[�cwd�outs%s %srs%s: %s)
�	translate�
_keepalnumrOrpr<r��
_runsystemrZ
shellsplitZexplainexit)r)�cmdr[r�r�r�r�Z	cmdsuffixr��rc�errmsgrrr r��s"0�z	ui.systemcCstj||||d�S)z[actually execute the given shell command (can be overridden by
        extensions like chg)r�)rr�)r)r�r[r�r�rrr r��sz
ui._runsystemc
Cs�|js
|r�|durt��}t|ddd�}|dur�t�|d�}t�|d�}t�|d|d�}|�dt�	d�
|dd���t�	d�
|��t�	d�
|���n0t�|d|d|d�}|�t�	d�
|���|jp�|S)	z�print exception traceback if traceback printing enabled or forced.
        only to call in exception handler. returns true if traceback
        printed.Nr�causer�rs#Traceback (most recent call last):
�r))rA�sys�exc_infor�	traceback�	format_tb�format_exception_onlyr=rrr��format_exception)r)�exc�forcer�Zcausetb�exctbZexconly�outputrrr r��s"
�zui.tracebackcCs:tjdkrd}ntjrd}nd}tj�d�p8|�dd|�S)zreturn editor to usesplan9�EsvimsvisHGEDITORr}r�)rZsysplatformZisdarwinrr[r�r	)r)r�rrr r��s
�zui.geteditorcCs.|js"|js"|�dd�s"t�|�s&dSt|�S)z,setup the progbar singleton to the ui object�progresssdisableN)r>r@r~rZshouldprint�
getprogbarr(rrr r�s��
��zui._progbarcCs*t�s
dS|jdur&|jjr&|j��dS)z:clear progress bar output if any. use it before any outputN)�haveprogbarr�Zprinted�clearr(rrr r7
sz
ui._progclearcsJt�jdd�r�fdd�}n�jdur0�jj}ndd�}t��||||�S)z0Create a progress helper for the specified topicrAFc	s�jjdd|||||d�dS)Nr�)rGr��posr��unit�total)rTr9�r�r�r�r�r�r(rr �	updatebars�z"ui.makeprogress.<locals>.updatebarNcSsdSrrr�rrr r�+s)rrTr�rr)r)r�r�r�r�rr(r �makeprogresss

zui.makeprogresscCs|j�|�S)z=Returns a logger of the given name; or None if not registered)rVr�)r)ryrrr �	getlogger0szui.getloggercCs||j|<dS)z�Install logger which can be identified later by the given name

        More than one loggers can be registered. Use extension or module
        name to uniquely identify the logger instance.
        N)rV)r)ryr�rrr r�4szui.setloggerc	s||js
dS�fdd�t�|j�D�}|s,dS||}t�|�}|j}i|_z$|D]}|�|�||�qPW||_n||_0dS)a2hook for logging facility extensions

        event should be a readily-identifiable subsystem, which will
        allow filtering.

        msgfmt should be a newline-terminated format string to log, and
        *msgargs are %-formatted into it.

        **opts currently has no defined meanings.
        Ncsg|]}|���r|�qSr)r�)rr���eventrr rIszui.log.<locals>.<listcomp>)rVrZ
itervaluesZbyteskwargsr�)	r)r�ZmsgfmtZmsgargsr�Z
activeloggersr�Zregisteredloggersr�rr�r r�<s

�
zui.logcCs|jdurt�|||�S|S)aVstyle msg based on supplied label

        If some color mode is enabled, this will add the necessary control
        characters to apply such color. In addition, 'debug' color mode adds
        markup showing which label affects a piece of text.

        ui.write(s, 'label') is equivalent to
        ui.write(ui.label(s, 'label')).
        N)rLrZ
colorlabel)r)r�r0rrr r0Ys

zui.labelrc	
Cs�|�dd�s$|dus |�d|�s$dSd|}|d7}|jrpt�|||j|j�|�dd|d�t�|��f�nnt	�
�}t	�|d	�}||dd
�\}}}t�
|�t�
|�}}|�d||||f�|�dd||||�~~dS)z�issue a developer warning message

        Use 'stacklevel' to report the offender some layers further up in the
        stack.
        r��all-warningsNsdevel-warn: rs	develwarns	%s at:
%srr��s%s at: %s:%d (%s)
)r~rArZdebugstacktracerPrOr�r�Zgetstackframes�inspectZcurrentframeZgetouterframesrr�r=)	r)r��
stacklevelr	ZcurframeZcalframe�fname�linenor"rrr r�gs.���zui.develwarnr�cCs<|�dd�s|�dd�sdS|d|7}|j||dd�dS)z�issue a deprecation warning

        - msg: message explaining what is deprecated and how to upgrade,
        - version: last version where the API will be supported,
        r�r�sdeprec-warnNsF
(compatibility will be dropped after Mercurial-%s, update your code.))r�r	)r~r�)r)r��versionr�rrr r�s
�
��z
ui.deprecwarncCs|jS)zWThe environment variables that are safe to export, e.g. through
        hgweb.
        )rhr(rrr �exportableenviron�szui.exportableenvironc	
cs�i}zt|��D]0\\}}}|�||�|||f<|�||||�qdVW|��D]\}}|�|�qPd|vr�|jdd�n2|��D]\}}|�|�q�d|vr�|jdd�0dS)z�Context manager for temporary config overrides
        `overrides` must be a dict of the following structure:
        {(section, name) : value}N)r}r�r}rn)r�r�r�r�r\)	r)Z	overridesr{Zbackupsroryrz�__r�rrr �configoverride�s�zui.configoverridecCsP|�dd�}|durHzt�|�WStjyFt�td�|��Yn0t��S)z�Provide an estimate for the available system memory in Bytes.

        This can be overriden via ui.available-memory. It returns None, if
        no estimate can be computed.
        r}savailable-memoryNs+ui.available-memory value is invalid ('%s'))r	rr�rr�r�rZ_estimatememory)r)rzrrr �estimatememory�s
�
zui.estimatememory)N)NFNN)NFNN)NFNN)rN)NN)r)F)F)F)FF)FF)N)F)N)FFF)FFF)N)r�N)r�)r)NN)NNNNN)NNNNN)NF)rN)rN)r�)r)wr2r3r4r*rl�classmethodr|rsrWr��
contextlib�contextmanagerr�r�r
r�rqrpr�r�r�r\r�r�r�r�r�r�r	r�r�r�r�r~r�r�r�rgr�r�r�rr
rrrrr�rrrZ
propertycacherr�propertyrb�setterrcr!r"r(r%r&r,r-r/r9r=r<r>rNrOrBrRrTrUrVrWrcr`rzrwr~r�r�r\r�rr��staticmethodr�r�r�r�r�rr�r�Zstatusnoi18nZ
notenoi18nZ
warnnoi18nZwritenoi18nr�r�r�r�r�r�r7r�r�r�r�r0r�rr�r�r�rrrr r8�s
_



"�
�

�

+
8

	=
&�
%%




!
)

	









:*	
I
E
N	
7




�
O�
#



 
r8cCstdurt�|�atSr)�_progresssingletonrZprogbar)r8rrr r��s
r�cCstduSr)r�rrrr r��sr�cCsl|�dd�}|dkr2|jr&|j|jfS|j|jfS|dkrF|j|jfS|dkrZ|j|jfSt�d|��dS)Nr}r�schannelr�sstderrs)invalid ui.message-output destination: %s)r	r"rcrbrr)r8ryrrr r��sr�cOsLd|vr2t|dd�s2|�dd�d|�d�|d<||g|�Ri|��dS)z�Write ui message with the given ui._write*() function

    The specified message type is translated to 'ui.<type>' label if the dest
    isn't a structured channel, so that the message will be colorized.
    rGrAFr0rs ui.%sN)rr�r*)r9r+r6r�rrr rM�srM)<Z
__future__rrdr�rLrCr�r�r�r^rrqr�r�Zi18nrZnoderrrrr�rr	r
rrr
rrrrrZutilsrrrrrr+r��mapZbytechr�ranger�r�Zsamplehgrcsr$r%�objectr&r7r�ryr8r�r�r�r�rMrrrr �<module>sn8
��N	

Youez - 2016 - github.com/yon3zu
LinuXploit