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

�+�bEn�@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZddlmZmZmZmZddlmZmZddlm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z4m5Z5m6Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>mZm?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZNmOZOmPZPmQZQmRZSmTZTmUZVmWZWmXZXddlYmZZZdd	l[m\Z\m]Z]m^Z^m_Z_m`Z`maZadd
lbmcZdmeZemfZfmgZge4jhZhiZiei�jeLjkjl�e?�kei�Zkekdged�d
d�dd��Zmekdg�dd��Znekdgd�dd��Zoekdddded�fddded�fdd ded!�fd"d#ded$�fged%���d�d'd(��Zp�d�d)d*�Zq�d�d+d,�Zr�d�d-d.�Zsd/d0�Zt�d�d1d2�Zuekd3d4d5ded6�fd"d7ged8�fd"d9ded:�fged�d
d;��d�d<d=��Zvekd>ged?�d
d;�d@dA��ZwekdBdCgdD�dEdF��ZxekdGgd"�dHdI��ZyekdJd"dKdedL�fgdM�dNdO��ZzdPdQ�Z{dRdS�Z|ekdTgd�dUdV��Z}ekdWdXdYdedZ�fd[d\ded]�fd"d^ded_�fd`dadedb�fgedc�d
d��d�ddde��Z~ekdfe#jedg���d�dhdi��Z�ekdjdkdldedm�fgedn�d
d
do��d�dpdq��Z�ekdre#je#j�eds�d
d��d�dtdu��Z�ekdvd"dwdedx�fd"dyd
edz�fd"d{ded|�fd"d}d&ed~�fd"d5d&ed�fged���d�d���Z�ekd�d"d�ded��fd"d�ded��fd"d�gd�fd�d�d�ge#j�e#j�ed����d�d�d���Z�d�Z�ekd�dd�d"ed��fgd
d��d�d�d���Z�ekd�e#j�gd
d�d�d���Z�ekd�d�d�d"ed��edD�fd"d�d&ed��fd`d�ded��fd�d�ged��ed��fged���d�d���Z�ekd�d"d�d"ed��ed�fd"d�d"ed��ed�fd"d�d&ed��fge#j��d�d���Z�ekd�ge#j��d�d���Z�ekd�ged��d
d;��d�d�d���Z�ekd�d�d�ged��ed��fd�d�ged��ed��fdXd�d�edÃedăfgedŃd
d;��d�d�dDŽ�Z�ekd�gdɃd�d˄�Z�ekd�e#je#j�eds���d�d�d΄�Z�ekd�e#jeds�d
d��d�d�dф�Z�ekd�g�d�dԄ�Z�ekd�ge#j�d"d
d;�d�dׄ�Z�ekd�gedكd
d;�d�dۄ�Z�ekd�ged݃�d�d߄�Z�ekd�d�d�ded�fd�d�ded�fd`d�ded�fd�d�ded�fged���d�d��Z�ekd�d"d�d&ed�fd4d�ged�ed�fgd"��d�d�d���Z�ekd�ge#j�d"�d�d���Z�ekd�ged���d�d���Z�ekd�d"d�d&e�d�fd"�dd&e�d�fd"�dd&e�d�fd"�dd&e�d�fg��d�d��Z�ek�d	d"�d
de�d�fd"�dd&e�d
�fd�d�ge�d�fd"�dd&e�d�fd"�dd&e�d�fd"�dge�d�fge#j�e#j�e�d���d�d�d��Z�ek�dd�d�d"e�d�edD�fge�d���d�d��Z�ek�dd�d�d"e�d�edD�fge�d���d�d��Z�ek�d�d �d!de�d"�fd�d#de�d$�fd4�d%de�d&�fd��d'de�d(�fge�d)���d*�d+��Z�ek�d,e#j��d-d
�d.��d/�d0��Z�ek�d1ged?�d
d;��d2�d3��Z�ek�d4d�d�d"e�d5�edD�fd"�d6de�d7�fge#j�e#j�e�d8�d
�d.��d9�d:��Z�ek�d;ge�d<�d
d;��d=�d>��Z�ek�d?ge�d@���d�dA�dB��Z�ek�dCd�d�d"e�dD�edD�fd"�dEde�dF�fge�d���dG�dH��Z�ek�dId"�dJd&e�dK�fgd"��dL�dM��Z�ek�dNd�d�d"e�d�edD�fge�dO���dP�dQ��Z�ek�dRgd"��dS�dT��Z�ek�dUe#j�dV�dWd&e�dX�fgeds�d
d��d�dY�dZ��Z�ek�d[e#j�d �d\de�d]�e�d^�fge�d_�d
d��d�d`�da��Z�ek�dbd"�dcde�dd�fd"�ded
e�df�fd`�dgde�dh�fd�d�ged��ed��fd"�did&e�dj�fd"�dkd&e�dl�fg�dm��dn�do��Z�ek�dpd"�dqd&e�dr�fd"�dsd"e�dt�fd"�dud"e�dv�fgd"��dw�dx��Z�ek�dyge�dz���d�d{�d|��Z�ek�d}e#jedg���d�d~�d��Z�ek�d�g�d�d
d��d�d��d���Z�ek�d��d�ge#j�e�d����d��d���Z�ek�d�d�d�d"e�d��edD�fge�d����d�d��d���Z�ek�d�d
d��d��d���Z�ek�d�d"�d�d&e�d��fge�d����d��d���Z�ek�d�g��d��d���Z�ek�d�d�d�ge�d��edD�f�d��d�ge�d��e�d��fge�d��d
d��d��d���Z�ek�d�d��d�d"e�d��e�d��fge�d��d
d;��d�d��d���Z�ek�d�d��d�d"e�d��e�d��fge�d��d
d;��d�d��d���Z�ek�d�g��d��d���Z�ek�d�d�dcge�d��ed��fd"�d�d&e�d��fd"�d�d
e�d��fd"�d�de�d��fd"�d�de�d��fd"�d�de�d��fg��d�d��d���Z�ek�d�e#j�e�d��d
�d.��d��d���Z�ek�d�gedD���dÐdĄ�Z�ek�d�g�dƢe#j�e�dǃd
d;��dȐdɄ�Z��dʐd˄Z�ek�d�d"�d�d&e�d΃fd"�d�d"e�dЃfd"�d�d&e�d҃fd"�d�d&e�dԃfge#j�ed��d
d��d�dՐdք�Z�dS(��)�absolute_importN�)�_)�bin�hex�nullrev�short)�getattr�open)5�bundle2�
bundlerepo�changegroup�cmdutil�color�context�copies�	dagparser�
dirstateutils�encoding�error�exchange�
extensions�	filemerge�filesetlang�	formatter�hg�httppeer�	localrepo�lock�
logcmdutil�
mergestate�metadata�obsolete�obsutil�pathutil�phases�policy�pvec�pycompat�	registrar�repair�repoview�requirements�revlog�revset�
revsetlang�scmutil�setdiscovery�simplemerge�sshpeer�sslutil�streamclone�strip�tags�	templater�
treediscovery�upgrade�url�util�vfs�wireprotoframing�wireprotoserver)�
repository)�cborutil�compression�dateutil�procutil�
stringutil�urlutil)�deltas�nodemap�rewrite�sidedatas
debugancestors[INDEX] REV1 REV2T)�optionalrepoc	Gs�t|�dkr8|\}}}t�tjt��dd�|�}|j}nBt|�dkrl|sVt�t	d���|\}}|j
}|j}nt�t	d���|�||�||��}|�d|�
|�t|�f�dS)	z<find the ancestor revision of two revisions in a given index�F��audit��5there is no Mercurial repository here (.hg not found)s&either two or three arguments requireds%d:%s
N)�lenr-�vfsmodr=r�getcwd�lookupr�Abortr�	changelog�ancestor�write�revr)	�ui�repo�args�index�rev1�rev2�rrT�a�rb�=/usr/lib64/python3.9/site-packages/mercurial/debugcommands.py�
debugancestorxs
�rdsdebugantivirusrunningcCs^|j�dd�� }|�t�d��Wd�n1s40Yt�d�t�|j�d��dS)z?attempt to trigger an antivirus scanner to see if one is activezeicar-test-file.com�wbsUST#=}P$fV?P+K%yP+C|uG$>GBDK|qyDK~v2MM*<JQY}+dK~6+LQba95PE<)&Nm5l)EmTEQR4qnHOhq9iNGnJxNrO)	Zcachevfsr
rXr<Z	b85decode�time�sleep�unlink�join)rZr[�frbrbrc�debugantivirusrunning�s��"	
rksdebugapplystreamclonebundlesFILEcCs(t�||�}t�|||�}|�|�dS)z apply a stream clone bundle fileN)r�openpathr�
readbundle�apply)rZr[�fnamerj�genrbrbrc�debugapplystreamclonebundle�srq�
debugbuilddag�msmergeable-files!add single file mergeable changes�osoverwritten-files"add single file all revs overwrite�nsnew-filesadd new file at each rev�s
from-existings$continue from a non-empty repositorys[OPTION]... [TEXT]Fc"sd|dur |�td��|j��}|j}t|�dkrD|sDt�td���d}t�	|�D]\}	}
|	dkrR|d7}qR|r�d}dd	�t
�d||�D�}|�d
�g}
|j
td�td�|d
�}|���|����h|����<|�d���d}d}g�d}|�|�t�	|�D�]�\}	}
|	dk�r\|�dt
�|
��|
\}}g}i�d}|�r"d�||d}t|�dk�r�||d}|�|�}�fdd	�|||fD�\}}}t�|||�}dd	�t�|�dD�}|�d
�n"|dk�r�|����d�}n|}|||d|7<d�|�}|���|��<|�rBd�|���d|��<|�r�d|�|���d|��<t|�dk�r�|�s�||d}|D],���d��r�|���|�����<�q��fdd�}t|�dk�s�|ddk�r�ddg}n2t|�dk�r
�|ddg}n�fdd	�|D�}tj||d||||dfdd |id!�}|�|�} ��| �|}n\|	d"k�r�|
\}}!|�d#|!�|
�d$t|j� |��|!f�n|	d%k�r�|�d&|
�|
}|�|��q|
�r�|j!�"d'd
�|
��Wd�n1�s�0YWd�n1�s0YWd�n1�s60YWd�n1�sV0YdS)(abuilds a repo with a given DAG from scratch in the current empty repo

    The description of the DAG is read from stdin if not given on the
    command line.

    Elements:

     - "+n" is a linear run of n nodes based on the current default parent
     - "." is a single node based on the current default parent
     - "$" resets the default parent to null (implied at the start);
           otherwise the default parent is always the last node created
     - "<p" sets the default parent to the backref p
     - "*p" is a fork at parent p, which is a backref
     - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
     - "/p2" is a merge of the preceding node and p2
     - ":tag" defines a local tag for the preceding node
     - "@branch" sets the named branch for subsequent nodes
     - "#...\n" is a comment up to the end of the line

    Whitespace between the above elements is ignored.

    A backref is either

     - a number n, which references the node curr-n, where curr is the current
       node, or
     - the name of a local tag you placed earlier using ":tag", or
     - empty to denote the default parent.

    All string valued-elements are either strictly alphanumeric, or must
    be enclosed in double quotes ("..."), with "\" as escape character.
    Nsreading DAG from stdin
rsrepository is not emptyrurrOcSsg|]}d|�qS)s%drb)�.0�irbrbrc�
<listcomp>�sz!debugbuilddag.<locals>.<listcomp>rvsbuildings	revisions)Zunit�totalsbuilddag����defaultsnode %s
smfcsg|]}|����qSrb)�data)rw�x��fnrbrcryscSsg|]}|���qSrb�r6�rw�lrbrbrcrys��
s r%isofsr%i
snf%isnfcs |�vrt�|||�|�SdS�N)rZ
memfilectx)r[�cx�path)�filecontentrbrc�fctxfn:s
�zdebugbuilddag.<locals>.fctxfncsg|]}�|�qSrbrb�rw�p)�nodeidsrbrcryFrv�r%irr�branch)�date�userZextra�lstag %s
�%s %s
�as
branch %s
s	localtags)#�statusr�fin�readrVrQrrUrZparsedagr(�xrange�appendZmakeprogress�wlockr�transaction�update�note�bytestrrWr2Z
Merge3TextZrender_minimizedr}�splitri�
startswithrZmemctxZ	commitctxr�noder=rX)"rZr[�textZmergeable_fileZoverwritten_fileZnew_fileZ
from_existing�clrz�typer}ZlinesperrevZinitialmergedlinesr7ZprogressZatZatbranch�idZps�files�p2�p1�pa�base�local�otherZm3�mlZ
mergedtextr�Zparsr��nodeid�namerb)r�r�r�rc�
debugbuilddag�s�B

�
�.



��






�



 
r�c	s�d|�|rn��d�����fdd�}���|d����|d�t�ji�D]}|d}||�qVnZt�tj�r�t�	t
d���������D].}|\}	}
}}}
}}}��d	�t
|	�f�q�dS)
N� s3%sformat: id, p1, p2, cset, delta base, len(delta)
c
sl��d�|f����D]L}|\}}}}}}}}	��d�t|�t|�t|�t|�t|�t|�f�qdS)Ns
%s%s
s%s%s %s %s %s %s %d
)rX�	deltaiterrrQ)
Znamed�	deltadatar�r�r��cs�	deltabase�delta�flagsrJ�rp�
indent_stringrZrbrc�
showchunksis���z%_debugchangegroup.<locals>.showchunks�	changelog�manifestsfilenamesuse debugbundle2 for this file�%s%s
)�writenoi18nZchangelogheaderZmanifestheader�iterZ
filelogheader�
isinstancer�
unbundle20rrUrr�rXr)rZrp�all�indent�optsr�Z	chunkdataror�r�r�r�r�r�r�r�rJrbr�rc�_debugchangegroupas*��r�c

Ks�t�|�}|��}d|}zt�|�\}}WnHtjyt}z.d}	|	||jt|�f;}	|�	|	�WYd}~nvd}~00d}	|	||t|�f;}	|�	|	�|�
d|�}
t|�D].}t�
d|�}|
��|
�|�t�|
|�q�|
��dS)�/display version and markers contained in 'data'r�s%%sunsupported version: %s (%d bytes)
Ns%sversion: %d (%d bytes)
�
debugobsolete)r(�byteskwargsr�r"Z_readmarkersrZUnknownVersion�versionrQrXr�sortedr#Zmarker�	startitem�plainr�
showmarker�end)
rZ�partr�r�r}r�r��markers�exc�msg�fmZ	rawmarker�mrbrbrc�_debugobsmarkers�s&
 

r�cCsVd|}t�|�}tjD]8}||D]*}|�|�|�dt|�tj|f�q$qdS)r�r�r�N)r%ZbinarydecodeZ	allphasesrXrZ
phasenames)rZr}r�r�ZheadsbyphaseZphase�headrbrbrc�_debugphaseheads�s


r�csBt�ttjtjf�r4dd��fdd�t��D��St�	t
���S)Ns{%s}�, c3s|]}d|�|fVqdS)s%s: %sNrb)rw�k��thingrbrc�	<genexpr>�rvz_quasirepr.<locals>.<genexpr>)r��dictr<Zsortdict�collections�OrderedDictrir�r(r��reprr�rbr�rc�
_quasirepr�s
�r�c	Kst|tj�st�td���|�dt|j��|�	dg�}|�
�D]�}|rV|j|vrVqBd}|�||jt|j�|jf�|jdkr�|j�	dd�}t
�||d�}|js�t||f|d	d
�|��|jdkr�|js�t||fdd	i|��|jd
krB|jsBt||d	d�qBdS)zlists the contents of a bundle2snot a bundle2 filesStream params: %s
Z	part_types%s -- %s (mandatory: %r)
schangegroupsversions01sUN�)r�r�s
obsmarkersr�sphase-heads)r�N)r�rr�rrUrrXr��params�getZ	iterpartsr�Z	mandatoryr
Zgetunbundler�quietr�r�r�)	rZrpr�r�Z	parttypesr�r�r�Zcgrbrbrc�
_debugbundle2�s(


r�sdebugbundler��allsshow all detailss	part-typesshow only the named part typesspecs"print the bundlespec of the bundle)�norepocKs�t�||���}|r<t�||�}|�d|�Wd�dSt�|||�}t|tj�rzt	||fd|i|��Wd�St
||fd|i|��Wd�n1s�0YdS)zlists the contents of a bundle�%s
Nr�)rrlrZ
getbundlespecrXrmr�rr�r�r�)rZ�
bundlepathr��specr�rjrprbrbrc�debugbundle�s$r�sdebugcapabilitiessPATHc
Ks�t�|�}t�|||�}z�|��}|�d�t|�D]}|�d|�q4t�	|�}|r�|�d�tt�
|��D].\}}|�d|�|D]}	|�d|	�q�qnW|��n
|��0dS)z'lists the capabilities of a remote peersMain capabilities:
�  %s
sBundle2 capabilities:
s    %s
N)r(r�r�peerZcapabilitiesr�r�rXrZbundle2caps�	iteritems�close)
rZr�r�r�Zcaps�cZb2caps�key�values�vrbrbrc�debugcapabilities�s



r�sdebugchangedfiles)rvscomputeFs6compute information instead of reading it from storagesREVcKst�||d�}d}|dr&t�|�}n.|j�|���}|�tj�}|durTt�	|�}|du�r
t
|j�D]�}||jvr|d}	n4||j
vr�d}	n$||jvr�d}	n||jvr�d}	nd}	d}
d}||jvr�d	}
|j|}n||jvr�d
}
|j|}|	|
||f}d}
|�|
|�qhdS)z,list the stored files changes for a revisionNZcompute�added�removedsmergedssalvagedstouchedrv�p1�p2s%-8s %2s: %s, %s;
)r�	revsingler!Zcompute_all_files_changesrVrJrYr�ZSD_FILESZdecode_files_sidedatar�Ztouched�added�removedZmergedZsalvagedZcopied_from_p1Zcopied_from_p2rX)rZr[rYr��ctxr��sdZfiles_blockrj�actionZcopy_parentZcopy_sourcer}�templaterbrbrc�debugchangedfiles�s<








rsdebugcheckstatec	Csz|j��\}}||��}||��}d}|j�||�D]&}|�|d|dd��|d7}q8|rvtd�}t�|��dS)z0validate the correctness of the current dirstaterrNs8.hg/dirstate inconsistent with current parent's manifest)�dirstate�parents�manifestZverify�warnrrrU)	rZr[Zparent1Zparent2Zm1Zm2�errors�errZerrstrrbrbrc�debugcheckstate,s
rs
debugcolorsstylesshow all configured styless
hg debugcolorcKs4|�dt�|j��|�d�r(t|�St|�SdS)z&show available color, effects or stylescolor mode: %s
ZstyleN)r�rE�pprintZ
_colormoder��_debugdisplaystyle�_debugdisplaycolor�rZr[r�rbrbrc�
debugcolor;s
rcCs�|��}|j��t�|���D]}||j|<q |jr�|�d�D]B\}}|�d�rf|dd�|j|<q@|�d�r@|dd�|j|<q@|�	t
d��t|j��dd�d	�}|D]\}}|j	d
||d�q�dS)Nscolorscolor.�s	terminfo.�	savailable colors:
cSsd|dv|d|dfS)N�_rrrb)rxrbrbrc�<lambda>Vrvz$_debugdisplaycolor.<locals>.<lambda>�r�r���label)
�copy�_styles�clearrZ_activeeffects�keysZ_terminfoparams�configitemsr�rXrr��items)rZZeffectr�r�rZ	colornamerrbrbrcr
Is


r
c	s���td���jsdStdd��jD��}t�j���D]p\}}�jd||d�|r���d���dtd|t|�����d	��fd
d�|��D�����d�q:dS)Nsavailable style:
css|]}t|�VqdSr��rQ�rw�srbrbrcr�_rvz%_debugdisplaystyle.<locals>.<genexpr>�%srs: r�rr�c3s|]}��||�VqdSr�r�rw�e�rZrbrcr�frvr�)	rXrr�maxr�rrQrir�)rZ�widthrZeffectsrbr rcr	[s
"r	sdebugcreatestreamclonebundlecCsTt�|�r|�td��t�|�\}}t�|||�|�td�d�	t
|���dS)z�create a stream clone bundle file

    Stream bundles are special bundles that are essentially archives of
    revlog files. They are commonly used for cloning very quickly.
    s=(warning: stream clone bundle will contain secret revisions)
sbundle requirements: %s
r�N)r%Z	hassecretrrr5Zgeneratebundlev1r
ZwritechunksrXrir�)rZr[ror,rprbrbrc�debugcreatestreamclonebundlejs	
��r#sdebugdag�tstagssuse tags as labels�b�branchessannotate with branch namessdotssuse dots for runs�ssspacessseparate elements by spacessPTION]... [FILE [REV]...]c	s�|�d�}|�d�}|rPt�tjt��dd�|��dd��D����fdd�}nv|r�|j�|�d	��|�d
���r�i�|����D] \}}	��	��
|	�g��|�q�����fdd�}nt�
td���tj|�|d
d
||dd�D]}
|�|
�|�d�q�dS)aformat the changelog or an index DAG as a concise textual description

    If you pass a revlog index, the revlog's DAG is emitted. If you list
    revision numbers, they get labeled in the output as rN.

    Otherwise, the changelog DAG of the current repo is emitted.
    �spaces�dotsFrMcSsh|]}t|��qSrb)�int�rwr`rbrbrc�	<setcomp>�rvzdebugdag.<locals>.<setcomp>c3sJ�D]@}d|tdd���|�D��ffV|�vrd|d|ffVqdS)Nrucss|]}|dkr|VqdS�r{Nrbr�rbrbrcr��rv�+debugdag.<locals>.events.<locals>.<genexpr>r�r�)�list�
parentrevs)r`)�revs�rlogrbrc�events�s"zdebugdag.<locals>.eventsr7�branchesc3s�d}�D]�}�r>����|��dd}||kr>d|fV|}d|tdd���|�D��ffV�r��|�}|r|D]}d||ffVqvqdS)	Nr|�r�r�rucss|]}|dkr|VqdSr-rbr�rbrbrcr��rvr.r�)r�r�r/r0r�)�br`ZnewbZlsr�)r4r��labelsr7rbrcr3�s
"
sneed repo for changelog dagT�F)Z	addspacesZ
wraplabelsZwrapannotationsZ
wrapnonlinearZusedotsZmaxlinewidthr�N)r�r-rRr=rrSrVr7r�
setdefaultrYr�rrUrrZdagtextlinesrX)rZr[�file_r1r�r(r)r3r��n�linerb)r4r�r7r1r2r7rc�debugdag�s6



�
	
r=�	debugdatas-c|-m|FILE REVcKs�t�|�}|�d�s(|�d�s(|�d�rL|dur@t�dtd���d|}}n|durdt�dtd���t�|d||�}z|�|�	|�
|���Wn$ty�t�td�|��Yn0dS)z)dump the contents of a data file revisionr�r��dirNr>�invalid arguments�invalid revision identifier %s)
r(r�r�r�CommandErrorrr�openstoragerXZrawdatarT�KeyErrorrU)rZr[r:rYr�r`rbrbrc�	debugdata�s
rEs	debugdate�esextendedstry extended date formatss[-e] DATE [RANGE])r�rKcKsl|drt�|tj�}n
t�|�}|�d|�|�dt�|��|rht�|�}|�d||d��dS)zparse and display a dateZextendedsinternal: %d %d
s
standard: %s
s
match: %s
rN)rC�	parsedateZextendeddateformatsr�ZdatestrZ	matchdate)rZr��ranger��dr�rbrbrc�	debugdate�s	

rJ�debugdeltachains
-c|-m|FILEc sLt�|�}t�|d||���j��j}�j}�j�t�dd�}���fdd�}|�	d|�}|�
d�|rr|�
d�|�
d�i}	�D�]�}
||
�\}}}
}}|d	}|	�|t|	�d
�}||�}||
�}|||}||}z|d}Wnt
y�d}Yn0|d	k�rt|�t|�}n|}|d	k�r<t|�t|�}n|}|��|jd
d|
|t|�||
||||||||
|t|�||
|||||||d�|�r4d	}d	}d	}t��|�D]L}|d
7}||d�||d�}|||d	�}||7}||k�r�|}�q�|�rt|�t|�}nd
}|jdd||||||||d�
|�
d�q�|��dS)adump information about delta chains in a revlog

    Output can be templatized. Available template keywords are:

    :``rev``:       revision number
    :``chainid``:   delta chain identifier (numbered by unique base)
    :``chainlen``:  delta chain length to this revision
    :``prevrev``:   previous revision in delta chain
    :``deltatype``: role of delta / how it was computed
    :``compsize``:  compressed size of revision
    :``uncompsize``: uncompressed size of revision
    :``chainsize``: total size of compressed revisions in chain
    :``chainratio``: total chain size divided by uncompressed revision size
                    (new delta chains typically start at ratio 2.00)
    :``lindist``:   linear distance from base revision in delta chain to end
                    of this revision
    :``extradist``: total size of revisions not part of this delta chain from
                    base of delta chain to end of this revision; a measurement
                    of how much extra data we need to read/seek across to read
                    the delta chain for this revision
    :``extraratio``: extradist divided by chainsize; another representation of
                    how much unrelated data is needed to load this delta chain

    If the repository is configured to use the sparse read, additional keywords
    are available:

    :``readsize``:     total size of data read from the disk for a revision
                       (sum of the sizes of all the blocks)
    :``largestblock``: size of the largest block of data read from the disk
    :``readdensity``:  density of useful bytes in the data read from the disk
    :``srchunks``:  in how many data hunks the whole revision would be read

    The sparse read can be enabled with experimental.sparse-read = True
    rKZ_withsparsereadFcs��|}|d}|d}d}�rz|d|dkr6d}q�|d|dkrLd}q�|d|dkrbd	}q�|d|krtd
}q�d}n|d|kr�d
}nd	}��|�d}|D]}�|}||d7}q�|||||fS)NrrOrrLr5r�r
r�sprevsbase�other)Z_deltachain)rYr�compsize�
uncompsize�	chainsize�	deltatype�chainZiterrev�Zgeneraldeltar]r`rbrc�revinfos,z debugdeltachain.<locals>.revinfoss    rev  chain# chainlen     prev   delta       size    rawsize  chainsize     ratio   lindist extradist extraratios)   readsize largestblk rddensity srchunksr�rr���r{slrev chainid chainlen prevrev deltatype compsize uncompsize chainsize chainratio lindist extradist extraratios7%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f)rY�chainid�chainlen�prevrevrPrMrNrO�
chainratioZlindist�	extradist�
extraratios*readsize largestblock readdensity srchunkss %10d %10d %9.5f %8d)�readsize�largestblock�readdensity�srchunksN)r(r�r�
openrevlogr]�start�lengthZ
_generaldeltar	rr�r9rQ�
IndexError�floatr�rX�	deltautilZ
slicechunkr�) rZr[r:r�r`raZwithsparsereadrSr��
chainbasesrY�compZuncomprPrQrO�	chainbaserUZ	basestartZrevstartZ
lineardistrYrWrXrZr[r\r^Z	revschunkZblkendZblksizer]rbrRrc�debugdeltachain�s�)
�





�
�
rhsdebugdirstate|debugstatesnodatess+do not display the saved mtime (DEPRECATED)sdatessdisplay the saved mtimesdatesortssort by saved mtimesdockets*display the docket (metadata file) insteads9display dirstate-v2 tree nodes that would not exist in v1s[OPTION]...c	Ks|�d�r�|jjs t�td���|jjj}tj	j
�|j�\}}}}}}	}
|�
td�|j�|�
td�|j�|�
td�|�|�
td�|�|�
td�|�|�
td�|�|�
td	�|�|�
td
�t�|
��dS|d}|�d
�du�rd}|�d�}|�rdd�}
nd}
t|jjj|dd��}|j|
d�|D]�}|\}}}}}|dk�rld}n(|�rxd}nt�dt�|��}t�|�}|d@�r�d}nd|d@tj@}|�
d|||||f��qJ|j��D]$}|�
td�|j�|�|f��q�dS)z)show the contents of the current dirstate�dockets"dirstate v1 does not have a docketssize of dirstate data: %d
sdata file uuid: %s
sstart offset of root nodes: %d
snumber of root nodes: %d
snodes with entries: %d
snodes with copies: %d
snumber of unused bytes: %d
signore pattern hash: %s
NZdates�nodatesT�datesortcSs|\}}}}}||fSr�rb)�entry�filename�_state�_mode�_size�mtimerbrbrc�keyfunc�szdebugstate.<locals>.keyfuncr�)r�rr{sunset               sset                 z%Y-%m-%d %H:%M:%S i slnks%3oi�s%c %s %10d %s%s
scopy: %s -> %s
)r�rZ_use_dirstate_v2rrUr�_maprirZv2Z
TREE_METADATA�unpackZ
tree_metadatarX�	data_sizeZuuid�binasciiZhexlifyr/Z
debug_iter�sortrf�strftime�	localtimer�
strtolocalr<�umaskrZcopied)rZr[r�riZstart_offsetZ
root_nodesZnodes_with_entryZnodes_with_copyZunused_bytesZ_unusedZignore_patternrjrkrr�entriesrlrm�state�mode�sizerqZtimestrrjrbrbrc�
debugstate�s^

	��





r��debugdiscovery�oldsuse old-style discovery�nonheadss/use old-style discovery with non-heads included�revs&restrict discovery to this set of revs)rv�seeds12323s)specify the random seed use for discovery)rvs
local-as-revsrvs+treat local has having these revisions only)rvsremote-as-revsrvs4use local as remote, with only these these revisionss[--rev REV] [OTHER]r|c$	sNt�������}�d}�d}t�t�d��|stt�d��|�\}}t�	��|�}��
td�t�|��nNdgf}t
�|d|g��t����fdd	�}	|	tjd
<��	�}|j�d
�|_|�rt
�|d|g��t����fdd�}
|
tjd
<��d
��i���d��r*|f����fdd�	}n|f���fdd�	}tj�||dd�\}}
�d}��d��}|j�r�tj��fdd��}ntj}|��Jt�d��}|||�\}}Wd�n1�s�0YWd�n1�s�0Yt|�}t|�}t����}||@}||@}||@|@}��d�}��d|�}��d|�}��d|�}��d|�}��d|�}��d||�}��d|�} ��d|�}!||@}"||@}#|j �d<t!|��d<t!|��d <t!|��d!<t!|��d"<t!|��d#<t!|��d$<t!|�t!|��d%<t!|��d&<t!|�t!|��d'<t!|��d(<t!|��d)<t!|��d*<t!|��d+<t!|��d,<t!|��d-<t!| ��d.<t!|!��d/<t!|"��d0<t!|#��d1<|�"�|j#fit�$����|�%d2��|�%d3��|�%d4�|�%d5��|�%d6��|�%d7��|�%d8��|�%d9��|�%d:��|�%d;��|�%d<��|�%d=��|�%d>��|�%d?��|�%d@��|�%dA��|�%dB��|�%dC��|�%dD��|�%dE��|�%dF��|�%dG��|�%dH��|�%dI��|�%dJ���j&�rB|�%dKdL�'t(dMdN�|D����|�)�dS)Oa�runs the changeset discovery protocol in isolation

    The local peer can be "replaced" by a subset of the local repository by
    using the `--local-as-revs` flag. Int he same way, usual `remote` peer can
    be "replaced" by a subset of the local repository using the
    `--local-as-revs` flag. This is useful to efficiently debug pathological
    discovery situation.

    The following developer oriented config are relevant for people playing with this command:

    * devel.discovery.exchange-heads=True

      If False, the discovery will not start with
      remote head fetching and local head querying.

    * devel.discovery.grow-sample=True

      If False, the sample size used in set discovery will not be increased
      through the process

    * devel.discovery.grow-sample.dynamic=True

      When discovery.grow-sample.dynamic is True, the default, the sample size is
      adapted to the shape of the undecided set (it is set to the max of:
      <target-size>, len(roots(undecided)), len(heads(undecided)

    * devel.discovery.grow-sample.rate=1.05

      the rate at which the sample grow

    * devel.discovery.randomize=True

      If andom sampling during discovery are deterministic. It is meant for
      integration tests.

    * devel.discovery.sample-size=200

      Control the initial size of the discovery sample

    * devel.discovery.sample-size.initial=100

      Control the initial size of the discovery for initial change
    s
local_as_revssremote_as_revsr�r�scomparing with %s
Nsnot (::(%s))cs�Sr�rb�r~)�remote_filtered_revsrbrc�remote_func]sz#debugdiscovery.<locals>.remote_funcsdebug-discovery-remote-filtercs�Sr�rbr�)�local_filtered_revsrbrc�
local_funcksz"debugdiscovery.<locals>.local_funcsdebug-discovery-local-filterr�cs�t�|d�st�|���}tj�|d�d�\}}}t|�}��d�s���	dd�
tdd�|D�����jj
���d	|�}�fd
d�|D�}||fS)Nr&T)�forcerNr�sunpruned common: %s
r�css|]}t|�VqdSr��r�rwr;rbrbrcr�rvz/debugdiscovery.<locals>.doit.<locals>.<genexpr>sheads(::%ln)csh|]}�|��qSrbrbr+�Zclnoderbrcr,�rvz/debugdiscovery.<locals>.doit.<locals>.<setcomp>)r<�safehasattrrZlocallegacypeerr�r9Zfindcommonincoming�setr�r�rir�rVr�r1)�
pushedrevs�remoteheads�remote�commonZ_in�hds)r}r�r[rZr�rc�doitts �
��zdebugdiscovery.<locals>.doitcsHd}|r&t��|�}�fdd�|D�}tj��||�d�\}}}||fS)Ncsg|]}�|���qSrb�r�r+�r[rbrcry�rvz0debugdiscovery.<locals>.doit.<locals>.<listcomp>)ZancestorsofrN)r�revranger1Zfindcommonheads)r�r�r��nodesr1r��anyr�)r}r[rZrbrcr��s
�)r1r�c3s���dV����d<dS)N�output)Z
pushbufferZ	popbufferrb)r}rZrbrc�may_capture_output�sz*debugdiscovery.<locals>.may_capture_outputzdebug-discoverysall()s::%lnsroots(::%ld)s	not ::%lds
heads(%ld)s
roots(%ld)snot (::%ln or %ln::)selapsedsnb-common-headssnb-common-heads-localsnb-common-heads-remotesnb-common-heads-bothsnb-common-rootss
nb-head-localsnb-head-local-missingsnb-head-remotesnb-head-remote-unknownsnb-revssnb-revs-commonsnb-revs-missingsnb-missing-headssnb-missing-rootss
nb-ini_undsnb-ini_und-headssnb-ini_und-rootssnb-ini_und-commonsnb-ini_und-missings#elapsed time:  %(elapsed)f seconds
s-round-trips:           %(total-roundtrips)9d
sheads summary:
s,  total common heads:  %(nb-common-heads)9d
s2    also local heads:  %(nb-common-heads-local)9d
s3    also remote heads: %(nb-common-heads-remote)9d
s1    both:              %(nb-common-heads-both)9d
s*  local heads:         %(nb-head-local)9d
s2    common:            %(nb-common-heads-local)9d
s2    missing:           %(nb-head-local-missing)9d
s+  remote heads:        %(nb-head-remote)9d
s3    common:            %(nb-common-heads-remote)9d
s3    unknown:           %(nb-head-remote-unknown)9d
s$local changesets:      %(nb-revs)9d
s+  common:              %(nb-revs-common)9d
s,    heads:             %(nb-common-heads)9d
s,    roots:             %(nb-common-roots)9d
s,  missing:             %(nb-revs-missing)9d
s-    heads:             %(nb-missing-heads)9d
s-    roots:             %(nb-missing-roots)9d
s'  first undecided set: %(nb-ini_und)9d
s-    heads:             %(nb-ini_und-heads)9d
s-    roots:             %(nb-ini_und-roots)9d
s.    common:            %(nb-ini_und-common)9d
s/    missing:           %(nb-ini_und-missing)9d
scommon heads: %s
r�css|]}t|�VqdSr�r�r�rbrbrcr��rvz!debugdiscovery.<locals>.<genexpr>)*r(r��
unfiltered�randomZseedr*rF�get_unique_pull_pathrr�r�rZhidepasswordrr��	frozensetr+ZfiltertableZ_repoZfilteredr��
addbranchrevsrZ
strict_format�
contextlib�contextmanagerr<�nullcontextmanagerZtimedcmr��headsr1�elapsedrQr�r}�	strkwargsr��verboserir�r�)$rZr[Z	remoteurlr��unfiZ
local_revsZremote_revsr4r�r�r�r�Z
remoterevsZ	_checkoutZ	localrevsr�r��tr�r�Zheads_commonZheads_remoteZheads_localZheads_common_localZheads_common_remoteZheads_common_bothr�Zroots_common�missingZ
heads_missingZ
roots_missingZinitial_undecidedZheads_initial_undecidedZroots_initial_undecidedZcommon_initial_undecidedZmissing_initial_undecidedrb)r}r�r�r�r[rZrc�debugdiscovery�s�I
�
�

�


N
�
�

��r�is
debugdownloadr�spathcKsjt�|||�}|}|r"t|dt�}z4|�t�}|rH|�|�|�t�}q.W|rf|��n|rd|��0dS)z4download a resource using Mercurial logic and configreN)�urlmodr
�
_chunksizer�rXr�)rZr[r;�outputr��fh�destr}rbrbrc�
debugdownload�s	


�r��debugextensionsc

Ks�t�|�}t�|�}t��}|�d|�}t|t�d�d�D�]v\}}t�	|�}d}	t�
|d�rlt�|j�}	nt
tdd�r~tj}	|r�g}
nt
|dd	���}
t
|d
d�}|��|js�|jr�|�dd|�nR|�dd
|�|s�||
vr�|�d�n,|
�s|�td��n|
d}|�d|�|�|j�o(|	dtd�|	�p8d	�|j�r^|�td�ddg|�|j|d�|�|j�ox|
dtd�|j|
dd��|�|j�o�|dtd�|�p�d	�q:|��dS)z(show information about active extensionsr�rrN�__file__�oxidizedFZ
testedwithrvZbuglink�namer�rr�s
 (untested!)
r{s (%s!)
ssources  location: %s
s  bundled: %s
�no�yes)Zbundleds
testedwiths  tested with: %s
sver�r�sbuglinks  bug reporting: %s
)r(r�rr<r�rr��operator�
itemgetterZismoduleinternalr��fsencoder�r	�sys�
sysexecutabler�r�r�r�rXr�r�	condwriter}�
formatlistr�)
rZr[r�Zexts�hgverr�ZextnameZextmodZ
isinternalZ	extsourceZ
exttestedwithZ
extbuglinkZlasttestedversionrbrbrc�debugextensionss^



�
�
�r�sdebugfileset�rs#apply the filespec on this revisions	all-filess3test files from all revisions and working directorysshow-matchers(print internal representation of matcher�ps
show-stages$print parsed tree at the given stagesNAMEs+[-r REV] [--all-files] [OPTION]... FILESPECcKsDddlm}|jt�|�}t�||�d�d�}dtjfdt	j
fdt	jfg}dd	�|D�}t�}|j
rx|d
sx|�d�|d
dgkr�|�|�n6|d
D]}	|	|vr�t�td�|	��q�|�|d
�t	�|�}
|D]L\}	}||
�}
|	|vr�|d
�s|	dk�r|�d
|	�|�t	�|
�d�q�t�}|d�rb|D](}
||
}|�|���|�|j��q8|d�sz|��du�r�|d}|�|jjt�|�t|j�ddd��|�|j�n|�|���|�|j�|�|��|�}|d�s|ddu�r|j
�r|� dt!�"|�d�t#|�D]"}||��s.�q|�d|��qdS)z'parse and apply a fileset specificationr)�filesetr�N�parsed�analyzed�	optimizedcSsh|]\}}|�qSrbrb�rwr;rjrbrbrcr,�rvzdebugfileset.<locals>.<setcomp>�
show_stager��invalid stage name: %s�* %s:
r�s	all_filesT)Zsubrepos�unknown�ignoredsshow_matcher�* matcher:
r�)$�r�Zsymbolsr(r�rr�r��identityr�analyze�optimizer�r��addr�rrUr�parserX�prettyformatr��substaterYr�walkr0Zmatchallr/ZmatchfilesetrSr�rE�
prettyreprr�)rZr[�exprr�r�r��stages�
stagenames�
showalwaysr;�treerjr�r`r�Zwctxr�rbrbrc�debugfilesetUsf"
�


�� 
r�sdebug-repair-issue6528s	to-reports1build a report of affected revisions to this filesfrom-reports+repair revisions listed in this report filesparanoids3check that both detection methods do the same thingcKsrt�|dddg�|�d�}|�d�}|�d�}|�d�}tj|jvrXd}t�t|���tj	||||||d�dS)afind affected revisions and repair them. See issue6528 for more details.

    The `--to-report` and `--from-report` flags allow you to cache and reuse the
    computation of affected revisions for a given repository across clones.
    The report format is line-based (with empty lines ignored):

    ```
    <ascii-hex of the affected revision>,... <unencoded filelog index filename>
    ```

    There can be multiple broken revisions per filelog, they are separated by
    a comma with no spaces. The only space is between the revision(s) and the
    filename.

    Note that this does *not* mean that this repairs future affected revisions,
    that needs a separate fix at the exchange level that was introduced in
    Mercurial 5.9.1.

    There is a `--paranoid` flag to test that the fast implementation is correct
    by checking it against the slow implementation. Since this matter is quite
    urgent and testing every edge-case is probably quite costly, we use this
    method to test on large repositories as a fuzzing method of sorts.
    �	to_report�from_report�dry_run�paranoids9can only repair revlogv1 repositories, v2 is not affected)r�r�r�r�N)
rZcheck_incompatible_argumentsr�r,ZREVLOGV1_REQUIREMENTrrUrrIZrepair_issue6528)rZr[r�r�r�r�r�r�rbrbrc�debug_repair_issue6528�s$2
�



�r��debugformatcs�t�|�}tdd�tjD���ttd�����fdd�}|�d|�}|��rVdd�}ntj}|�	d�|�	d	�td��|�	d
�|j
r�|�	d�|�	d�tjD]�}|��|�|�}|�
|�}||kr�d
}	d}
n||jkr�d}	d}
nd}	d}
|jd||j�|j|	d�|jdd||�|
d�|j|k�r6d}nd}|j|j
dd||�|d�|j|j
dd||j�dd�|�	d�q�|��dS)z�display format information about the current repository

    Use --verbose to get extra information about current config value and
    Mercurial default.css|]}t|j�VqdSr�)rQr�)rw�fvrbrbrcr�rvzdebugformat.<locals>.<genexpr>sformat-variantcsdd�t|�S)Ns%s:r�rr��Zmaxvariantlengthrbrc�makeformatname
sz#debugformat.<locals>.makeformatnamer�cSs t�|d�r|S|rdSdSdS)Ns
startswithr�r�)r<r���valuerbrbrc�formatvalues
z debugformat.<locals>.formatvaluer�s repos config defaultr�s!formatvariant.name.mismatchconfigs!formatvariant.repo.mismatchconfigs"formatvariant.name.mismatchdefaults"formatvariant.repo.mismatchdefaultsformatvariant.name.uptodatesformatvariant.repo.uptodater�rsrepos %3ssformatvariant.config.specialsformatvariant.config.defaultsconfigs %6sr|s %7ssformatvariant.defaultN)r(r�r!r:ZallformatvariantrQrZisplainr�r�r�r�ZfromrepoZ
fromconfig�defaultrXr�r�r�)rZr[r�r�r�r�r�Z	repovalueZconfigvalueZ	namelabelZ	repolabelZconfiglabelrbr�rc�debugformats^

	







��r�sdebugfsinfos[PATH]�.cCs|�d|�|�dt�|�p d�|�dt�|�r:dp<d�|�dt�|�pTd�|�dt�|�rndppd�|�d	t�|�r�dp�d�d}zFtjd
|d��$}t�	|j
�r�dp�d}Wd�n1s�0YWnty�Yn0|�d
|�dS)z2show information detected about current filesystems	path: %s
smounted on: %s
s	(unknown)s	exec: %s
r�r�sfstype: %s
ssymlink: %s
s
hardlink: %s
s.debugfsinfo)�prefix�dirNscase-sensitive: %s
)r�r<ZgetfsmountpointZ	checkexecZ	getfstypeZ	checklinkZ
checknlinkr(Z
namedtempfileZfscasesensitiver��OSError)rZr�Z
casesensitiverjrbrbrc�debugfsinfoHs&���6r�sdebuggetbundle�Hsheadsid of head nodesID�Cscommonsid of common node�type�bzip2sbundle compression type to usesTYPEsREPO FILE [-H|-C ID]...cKs�t�|�}t�|||�}|�d�s,t�d��i}|rFdd�|D�|d<|r\dd�|D�|d<d|d	<|jdi|��}|�dd��	�}	d
dddd�}
|
�|	�}	|	t
jvr�t�td���t
�
||||	�dS)z�retrieves a bundle from a repo

    Every ID must be a full-length hex node id string. Saves the bundle to the
    given file.
    s	getbundles.getbundle() not supported by target repositorycSsg|]}t|��qSrb�rrrbrbrcry|rvz"debuggetbundle.<locals>.<listcomp>r�cSsg|]}t|��qSrbr�rrbrbrcry~rvr�NZ
bundlecaps�debugr�r�sHG10UNsHG10BZsHG10GZsHG20)snoner�sgzipsbundle2s)unknown bundle type specified with --type)r�)r(r�rr��capablerrUZ	getbundler��lowerrZbundletypesrZwritebundle)rZ�repopathr�r�r�r�r[r\ZbundleZ
bundletypeZbtypesrbrbrc�debuggetbundle`s*


�

r�sdebugignores[FILE]cOs0|jj}|s$|�dt�|���ntj|d|d�}tj|dd�}|��D]�}t	�
|�}d}	d}
|dkr�||�r�|}	|j�|�}
n,t�
|�D] }||�r�|}	|j�|�}
q�q�|	�r|	|kr�|�td�||��n|�td�||�|	f�|
\}}
}|�td	�||
|f�qL|�td
�||��qLdS)adisplay the combined ignore pattern and information about ignored files

    With no argument display the combined ignore pattern.

    Given space separated file names, shows if the given file is ignored and
    if so, show the ignore rule (file and line number) that matched it.
    r�N)�patsT)Zlegacyrelativevaluer�s%s is ignored
s1%s is ignored because of containing directory %s
s#(ignore rule in %s, line %d: '%s')
s%s is not ignored
)r�_ignorerXr(Zbytereprr0�matchZgetuipathfnr�r<�normpathZ_ignorefileandliner$Zfinddirsr)rZr[r�r��ignorer�ZuipathfnrjZnfr�Z
ignoredatar�Z
ignorefile�linenor<rbrbrc�debugignore�sF	
�
��
��r�
debugindexcKst�|�}t�|d||�}|jr&t}nt}d}|D]}t||�|���}qNq2|�	d|�}|�
dd�|�d�|�f�|D]�}	|�|	�}
|�|
�}|�
�|�dd|	�|�dd	|�|	��|�d
d||
��|�dd||d��|�d
d||d��|�
d�q||��dS)z'dump index data for a storage primitiver��   rev linkrev %s %s p2
�nodeidr�r�s%6d slinkrevs%7d �nodes%s rr�rrr�N)r(r�rrC�	debugflagrrrQr�rr��ljustrr�rX�linkrevr�)rZr[r:r��store�shortfn�idlenrxr�rYr�rrbrbrc�
debugindex�s4
��

r�
debugindexdotcKs�t�|�}t�|d||�}|�d�|D]^}|�|�}|�|�}|�d|�|d�|f�|d|j	kr(|�d|�|d�|f�q(|�d�dS)z(dump an index DAG as a graphviz dot filersdigraph G {
s
	%d -> %d
rrs}
N)
r(r�rrCr�r�rrXrY�nullid)rZr[r:r�r`rxr��pprbrbrc�
debugindexdot�s



rsdebugindexstatscCsb|j�|jd�|jj}t�|d�s2t�td���t	|�
����D]\}}|�d||f�qBdS)z)show stats related to the changelog indexrsstatss+debugindexstats only works with native codes%s: %d
N)
rVZshortestrr]r<r�rrUrr�ZstatsrrX)rZr[r]r�r�rbrbrc�debugindexstats�sr�debuginstallc"
Kst�|�}d}|�d|�}|��|�ddtj�d}zt�t�tj��Wn6t	y�}zt
�|�}|d7}WYd}~n
d}~00|�|dd|�d}t
�td	�r�tj�t�tj��}nttd
d�r�tj}|�dtd
�tjp�td��|�dtd�t�t����|�dtd�dtjdd��|�dtd�|�p<td��zddlm}|jWnt�ynd}Yn0t t!j"�}t!j#�r�|�$d�|�dtd�|j%t&|�dddd��d|v�r�|�'td ��d|v�r�|�'td!��|�'td"|du�r�d#nd$��t
�(�}	|�d%td&�|	�)d'�d�|�d(td)�d'�*|	�)d'�dd���d}
t
�tj+t,d	��rvtj�t�t��}
nttd
d��r�tj}
|�d*td+�t-j-�|�d,td-�|
�p�td��t-j-d.v}|}t-j-d/v�p�|}|�p�|}
|
�r�d}zd|�r(dd0l.m/}m0}m1}m2}t3|�t3|�t3|�t3|�f|�rNdd1lm4}m5}t3|�t3|�fWn8t6�y�}zt
�|�}|d7}WYd}~n
d}~00|�|d2d3|�t
j7j8�9�}|�d4td5�|j%t&d6d7�|D��d8dd9d��|�d:td;�|j%t&d<d7�|D��d8dd9d��t:j7�;t:j<�}|�d=td>�|j%d?d@�|D�d8dd9d��d#}t
j=�rJdA}|�'tdB�|�|j>t?t
j=�dC�t@�A�}|�dDdE|�p�dF�|�|dFtdG��|�rBt@�BdH�\}}|�rd}zt@j@�C|�Wn4t6�y}zt
�|�}d}WYd}~n
d}~00|�|dId3|�nd}|�|dJtdK�|�|�|dLtdM�dN�|�sP|d7}|�|dFtdO��|�D�}t
�E|�}tF�G|�d}|�dPtdQ�|�tF�H|�}|�|�o�|dRkdStdT�|�o�|dRk�o�|�|�|�o�|dRkdUtdV�|�o�|�|�s|dRk�r|d7}d}d}z|�I�}Wn6tJjK�y\}z|jL}|d7}WYd}~n
d}~00|�|dWtdX�|�|�|dYtdZ�|�tM�M�D].\}} t| d[d�}!|!du�r�||!||�7}�q�|�|dFtd\��|�s�|j>|d]�|�|d^td_�|�|�N�|S)`z;test Mercurial installation

    Returns 0 on success.
    rrsencodingschecking encoding (%s)...
Nrs
encodingerrors. %s
 (check that your locale is properly set)
r�r�Fs	pythonexes checking Python executable (%s)
sunknownspythonimplementations$checking Python implementation (%s)
s	pythonverschecking Python version (%s)
s%d.%d.%drLs	pythonlibschecking Python lib (%s)...
)�rustextssnispythonsecuritys&checking Python security support (%s)
sprotocolr�,)r��fmt�sepstls1.2sT  TLS 1.2 not supported by Python install; network connections lack modern security
sV  SNI not supported by Python install; may have connectivity issues with some servers
schecking Rust extensions (%s)
�missings	installedshgvers checking Mercurial version (%s)
�+s
hgverextras%checking Mercurial custom build (%s)
shgmodulepolicyschecking module policy (%s)
s	hgmoduless#checking installed modules (%s)...
)srust+csrust+c-allow)�csallow)�base85�bdiff�mpatch�osutil)rWrsextensionserrors %s
scompenginess-checking registered compression engines (%s)
css|]}|��VqdSr�r�rrbrbrcr��rvzdebuginstall.<locals>.<genexpr>s
compenginer�scompenginesavails,checking available compression engines (%s)
css|]}|��r|��VqdSr�)Z	availabler�rrbrbrcr��rvscompenginesservers>checking available compression engines for wire protocol (%s)
cSsg|]}|��r|���qSrb)Zwireprotosupportr�rrbrbrcry�rvz debuginstall.<locals>.<listcomp>s	availables"checking "re2" regexp engine (%s)
)�re2stemplatedirsschecking templates (%s)...
rvs no template directories found
smap-cmdline.defaultsdefaulttemplateerrorsdefaulttemplateschecking default template (%s)
sdefaulttemplatenotfounds template '%s' not found
r|s5 (templates seem to have been installed incorrectly)
seditorschecking commit editor... (%s)
svis
vinotfoundsf No commit editor set and can't find %s in PATH
 (specify a commit editor in your configuration file)
seditornotfoundsV Can't find editor '%s' in PATH
 (specify a commit editor in your configuration file)
susernameschecking username (%s)
s
usernameerrorsJchecking username...
 %s
 (specify a username in your configuration file)
�debuginstallsno problems detected
)�problemssproblemss1%d problems detected, please check your install!
)Or(r�rr�rXr�codecsrT�sysstr�LookupErrorrE�forcebytestrr�r<r��osr��dirnamer�r�r	r�r�rZsysbytes�platformZpython_implementation�version_infor�r�__doc__�ImportErrorr�r4ZsupportedprotocolsZhassnir�r�r�r�r�r�ri�modules�__name__r&�cextrrr r!r�rWr�	Exception�compenginesZ_enginesr�rBZsupportedwireenginesZ
SERVERROLEZ_re2r}�boolr8ZtemplatedirZtry_open_templateZfrommapfileZ	geteditorZ
expandpathrDZ
shellsplitZfindexe�usernamerrU�messagerr�)"rZr�r$r�r�instZ	pythonlibrZsecurityr�Z	hgmodulesZrustandcr1Znopurerrr r!rWrr3Zwirecompenginesr"r�r��fpZeditorZ	editorbinZcmdpathr5rr��modZhandlerrbrbrcr#
s�

�����



�
��
�����
����


��
��
����

���

��
�
�
���

�r#s
debugknowns
REPO ID...cOsbt�|�}t�|||�}|�d�s,t�d��|�dd�|D��}|�dd�	dd�|D���dS)	z�test whether node ids are known to a repo

    Every ID must be a full-length hex node id string. Returns a list of 0s
    and 1s indicating unknown/known.
    sknowns*known() not supported by target repositorycSsg|]}t|��qSrbr�rrbrbrcryArvzdebugknown.<locals>.<listcomp>r�rvcSsg|]}|rdpd�qS)�1�0rb�rwrjrbrbrcryBrvN)
r(r�rr�r�rrUZknownrXri)rZr�Zidsr�r[r�rbrbrc�
debugknown6s


r=sdebuglabelcompletesLABEL...cGst||g|�R�dS)zEbackwards compatibility with old bash completion scripts (DEPRECATED)N)�debugnamecomplete)rZr[r\rbrbrc�debuglabelcompleteEsr?s
debuglocks�Lsforce-free-locksfree the store lock (DANGEROUS)�Wsforce-free-wlocks'free the working state lock (DANGEROUS)sset-locks set the store lock until stopped�Ss	set-wlocks(set the working state lock until stoppedcsN|�d�r|j�d�|�d�r,|j�d�|�d�s@|�d�rDdSg}z�|�d�r�z|�|�d��Wn"tjy�t�t	d���Yn0|�d	�r�z|�|�
d��Wn"tjy�t�t	d
���Yn0t|�r��t	d��Wt
|�dSWt
|�n
t
|�0t���d}��fdd
�}|||jd|j
�7}|||jd|j�7}|S)a�show or modify state of locks

    By default, this command will show which locks are held. This
    includes the user and process holding the lock, the amount of time
    the lock has been held, and the machine name where the process is
    running if it's not local.

    Locks protect the integrity of Mercurial's data, so should be
    treated with care. System crashes or other interruptions may cause
    locks to not be properly released, though Mercurial will usually
    detect and remove such stale locks automatically.

    However, detecting stale locks may not always be possible (for
    instance, on a shared filesystem). Removing locks may also be
    blocked by filesystem permissions.

    Setting a lock will prevent other commands from changing the data.
    The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs.
    The set locks are removed when the command exits.

    Returns 0 if no locks are held.

    Zforce_free_lockslockZforce_free_wlockswlockrZ	set_wlockFswlock is already heldZset_lockslock is already helds&ready to release the lock (y)? $$ &Yesc
sz|d�}Wntjy$d}Yn0|r4|��n�z�|�|�}�|tj}t�|j�}|�	|�}d|vr�|�
d�\}}	|t��kr�d|p�d|	f}nd|p�d|	|f}��
d|d||f�WdSty�}
z|
jtjkr�WYd}
~
n
d}
~
00��
d|d�d	S)
NF�:suser %s, process %ssNonesuser %s, process %s, host %ss%-6s %s (%ds)
rs
%-6s free
r)r�LockHeld�release�lstat�stat�ST_MTIMEr<r5�st_uidZreadlockr��socketZgethostnamer�r��errno�ENOENT)r=r��methodr��stZager�Zlocker�host�pidr�ZnowrZrbrc�report�s6



�zdebuglocks.<locals>.report)r�ZsvfsZ	tryunlinkr=r�r�rrDrUrrrQZpromptchoicerErf)rZr[r��locksZheldrRrbrQrc�
debuglocksKs<-



�"rTsdebugmanifestfulltextcachesclearsclear the cachesadds)add the given manifest nodes to the cachesNODErbcs��fdd�}|�d�rR����$|�}|jdd�Wd�dS1sH0Y|�r������j}|�d�}|D]X}z||�|�}	Wn8tjy�}
ztjt	|
�dd	��WYd}
~
n
d}
~
00|	�
�qvWd�dS1�s�0Y|�}t|��s|�t
d
��n�|�t
d�t|�f�d}|D]D}|�|�}
t|
�}||d
7}|�t
d�t|�t�|�f��q2|j�d�j}|�t
d�t�|�t�|�f�dS)z@show, clear or amend the contents of the manifest fulltext cachecs>�j�d�}z|jWSty8td�}t�|��Yn0dS)NrvsOCurrent revlog implementation doesn't appear to have a manifest fulltext cache
)�manifestlog�
getstorageZ_fulltextcache�AttributeErrorrrrU)r`r�r�rbrc�getcache�s�z,debugmanifestfulltextcache.<locals>.getcacherT)Zclear_persisted_dataNrvsCheck your manifest node id��hintscache empty
sFcache contains %d manifest entries, in order of most to least recent:
r�sid: %s, size %s
smanifestfulltextcaches%total cache data size %s, on-disk %s
)r�r�rrUrVrTrr'rU�bytesr�rQrXr�peekrr<Z	bytecount�_openerrG�st_size)rZr[r�r�rX�cacher�r
r;rr�	totalsizer�r}rZondiskrbr�rc�debugmanifestfulltextcache�sV

 

�
"
���
���rb�debugmergestatecOs|jr\t�|�}|��}|��}|s*|s*n2|s:|�d�n"|�||�rR|�d�n
|�d�t�|�}|dsvd|d<tj�	|�}|�
d|�}|��|�d�}|�
��rd|jd	fd
|jdffD]T\}	}
}|��|j|	d�|jt|
�d
�|jr�t|j�|kr�|j|j|d�q�|��|�d�}|�
��r~|D�]B}
|��|j|
d�|j|
}|j|d	d�|d	tjtjfv�r�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�|j|dd�n6|d	tjtjfv�r*|j|dd�|j|dd �|�d!�}t|�|
����D]*\}}|��|j|d"�|j|d#��qF|���q8|��|�d!�}tt�|����D]Z\}
}|
|v�r��q�t�|�D]6\}}|��|j|
d$�|j|d"�|j|d#��qq�|��|��d%S)&zpprint merge state

    Use --verbose to print out information about whether v1 or v2 merge state
    was chosen.sno version 2 merge state
s!v1 and v2 states match: using v2
s$v1 and v2 states mismatch: using v1
�templates�{if(commits, "", "no merge state found
")}{commits % "{name}{if(label, " ({label})")}: {node}
"}{files % "file: {path} (state \"{state}\")
{if(local_path, "  local path: {local_path} (hash {local_key}, flags \"{local_flags}\")
  ancestor path: {ancestor_path} (node {ancestor_node})
  other path: {other_path} (node {other_node})
")}{if(rename_side, "  rename side: {rename_side}
  renamed path: {renamed_path}
")}{extras % "  extra: {key} = {value}
"}"}{extras % "extra: {file} ({key} = {value})
"}rcscommitsslocalrrLrr�r�rsfiles)r�)r})Z	local_keyrO)Z
local_pathrL)Z
ancestor_pathr�)Z
ancestor_noder5)�
other_pathr
)Z
other_node�)Zlocal_flags)Zrenamed_path)Zrename_sidesextrasrr�)�fileN)r��
mergestatemodr Z_readrecordsv1Z_readrecordsv2r�Z
_v1v2matchr(r�r�rr��nestedZactiver�r�r}rZ_labelsrQr�rnZMERGE_RECORD_UNRESOLVEDZMERGE_RECORD_RESOLVEDZMERGE_RECORD_UNRESOLVED_PATHZMERGE_RECORD_RESOLVED_PATHr��extrasrr�Z	allextras)rZr[r\r��msZ	v1recordsZ	v2recordsr�Z
fm_commitsr�r�Zlabel_indexZfm_filesrjr}Z	fm_extrasr�r�rIrbrbrc�debugmergestate	s�


�



�



��


rlsdebugnamecompletesNAME...cs�t�}t�|j�D] \}}|dkr|�|�|��q|�dd�|����D��t�}|s`dg}|D]�|��fdd�|D��qd|�d�	t
|���|�d�dS)z:complete "names" - tags, open branch names, bookmark namesr&css|]\}}}}|s|VqdSr�rb)rw�tagr�Ztip�closedrbrbrcr�~	s
�z$debugnamecomplete.<locals>.<genexpr>rvc3s|]}|���r|VqdSr�)r�r��rarbrcr��	rvr�N)r�r(r��namesr�Z	listnamesZ	branchmapZiterbranchesrXrir�)rZr[r\rpr��nsZcompletionsrbrorcr>t	s

�r>sdebugnodemapsdump-news1write a (new) persistent binary nodemap on stdouts	dump-disksdump on-disk data on stdoutschecks-check that the data on disk data are correct.smetadatas-display the on disk meta data for the nodemapc	Ksz|drJ|��}|j}t�|jd�r0|j��}nt�|j�}|�|��n,|dr�|��}|j}t�	|�}|dur�|\}}|�|dd��n�|dr�|��}|j}t�	|�}|dur�|\}}t�
||j|�Sn�|d�rv|��}|j}t�	|�}|du�rv|\}}|�d|j�|�d|j�|�d	t
|j��|�d
|j�|�d|j�|jd|j}|�d
|�dS)z!write and inspect on disk nodemapZdump_new�nodemap_data_allZ	dump_diskN�checkr!suid: %s
stip-rev: %d
s
tip-node: %s
sdata-length: %d
sdata-unused: %d
�Y@sdata-unused: %2.3f%%
)r�rVr<r�r]rrrHZpersistent_datarXZpersisted_dataZ
check_data�uidZtip_revrZtip_nodeZdata_lengthZdata_unused)	rZr[r�r�r�r}Znm_datariZunused_percrbrbrc�debugnodemap�	sD




rvr��flagssmarkers flagsrecord-parentss+record parent information for the precursorsdisplay markers relevant to REV�	exclusives0restrict display to markers only relevant to REV�indexsdisplay index of the marker�deletes#delete markers specified by indicess[OBSOLETED [REPLACEMENT ...]]c
sTt�|�}�fdd��|�d�r�g}|�d�D]D}z|�t|��Wq.typtjtd�|td�d��Yq.0q.��	�r�t�
td�������0t�
�j|�}|�td�|�Wd	�n1s�0Yd	S|d	u�rL|d
r�t�d��i}t�|d�p
|���|d<t�fd
d�|D��}	���}
�z
��d�}z�z�|�d�}|�r^t�|�}nd	}�|�}
d	}|d�r�|
���v�r�t�
d�����|
��}tdd�|D��}�jj||
|	|d||||d�|��Wn>t�y}z$t�
td�t�|���WYd	}~n
d	}~00W|��n
|��0W|
��n
|
��0�n|d
�r�t��|d
�}�fdd�|D�}t t!j"�||dd��}|j#dd�d�n
t!�"��}|}dd�}|�d
��r�|�d��r�t!�"��}t$|���fd d�}|�%d|�}t&|�D]D\}}||��s�q|�'�|�d��r0|nd	}t(j)|||d!��q|�*�d	S)"zccreate arbitrary obsolete marker

    With no arguments, displays the list of obsolescence markers.csFz$t|�}t|��jjkr t��|WSty@t�d��Yn0dS)Ns>changeset references must be full hexadecimal node identifiers)rrQZ
nodeconstantsZnodelen�	TypeErrorr�
InputError)rr;r�rbrc�parsenodeid�	s�z"debugobsolete.<locals>.parsenodeidrzsinvalid index value: %rsuse integers for indicesrYs6cannot delete obsmarkers in the middle of transaction.s deleted %i obsolescence markers
Nr�s+cannot select revision when creating markersuserc3s|]}�|�VqdSr�rb)rwZsucc)r}rbrcr�
rvz debugobsolete.<locals>.<genexpr>r�sdatesrecord_parentss2cannot used --record-parents on unknown changesetscss|]}|��VqdSr�r�r�rbrbrcr�)
rvrw)rr�r!rZsbad obsmarker input: %scsg|]}�|���qSrbr�r+r�rbrcry@
rvz!debugobsolete.<locals>.<listcomp>rx)r�Z	exclusivecSs|jSr�)�_datar�rbrbrcrF
rvzdebugobsolete.<locals>.<lambda>rcSsdS)NTrb�r�rbrbrcrK
rvrycs|�vSr�rbr)�	markersetrbrcrO
rv)r])+r(r�r�r�r*�
ValueErrorrr|rZcurrenttransactionrUrr*ZdeleteobsmarkersZobsstorerXrZ	fromlocalr5�tupler�rCrGr�rZcreater�rEr(rErr�r/r#Z
getmarkersrwr�r�	enumerater�rr�r�)rZr[Z	precursorZ
successorsr��indicesr�r;r!Zsuccsr��trr�Zprecrr�r1r�r�Z
markerstoiterZ
isrelevantr�rxr�Zindrb)r�r}r[rc�
debugobsolete�	s�


��
0
�


��
�

��


r�s
debugp1copiessrevision to debugs[-r REV]cKsLt�|�}tj||�d�dd�}|����D]\}}|�d||f�q,dS)z$dump copy information compared to p1r�N�r��	%s -> %s
)r(r�r0r�r�Zp1copiesrrX�rZr[r�r��dst�srcrbrbrc�
debugp1copiesb
s
r�s
debugp2copiescKsLt�|�}tj||�d�dd�}|����D]\}}|�d||f�q,dS)z$dump copy information compared to p2r�Nr�r�)r(r�r0r�r�Zp2copiesrrXr�rbrbrcr�p
s
sdebugpathcomplete�fsfullscomplete an entire pathsnormalsshow only normal filesr�sshow only added filesr�sshow only removed filessFILESPEC...cs���fdd�}d}�dr"|d7}�dr2|d7}�drB|d	7}����|sTd
g}t�t�}}|D]*}|||ptd�\}	}
|�|	�|�|
�qf|�|�|�d���fd
d�t|�D���|�d�dS)a)complete part or all of a tracked path

    This command supports shells that offer path name completion. It
    currently completes only files already known to the dirstate.

    Completion extends only to the next path segment unless
    --full is specified, in which case entire paths are used.cs8�j}tj�tj�t��|��}�jtj	}|�jkrH|�
|�sHggfStj�|�r\|d7}|t|�d�}tj	dk}|r�|�
tj	d�}t|�}�d}t�t�}}	|	j|j}
}t�|�D]p\}}
|�
|�r�|
j|vr�|r�|�
dtj	�}|�r�||�q�|�tj	|�}|dk�r&|
|d|��q�||�q�||	fS)N�/Zfullr)rr)r�rrirrS�rootr(�ossepr��isdirrQ�replacer�r�r�r}�find)r��
acceptablerr�ZrootdirZfixpathsZspeclenZ	fullpathsr��dirsZadddirZaddfilerjrNr)r�r[rbrc�complete�
s6


z#debugpathcomplete.<locals>.completervZnormalsnmr�r�r�r�r�snmarr�c3s|]}��|��VqdSr�)�pathtor�)�cwdr[rbrcr��
rvz$debugpathcomplete.<locals>.<genexpr>N)rSr�r�rXrir�)rZr[Zspecsr�r�r�r�r�r�rjrIrb)r�r�r[rc�debugpathcomplete~
s&

$r�sdebugpathcopiess#hg debugpathcopies REV1 REV2 [FILE])Z	inferrepocOs\t�||�}t�||�}t�|||�}tt�|||����D]\}	}
|�d|
|	f�q<dS)z!show copies between two revisionsr�N)r0r�rr�rZ
pathcopiesrrX)rZr[r^r_r�r�Zctx1Zctx2r�r�r�rbrbrc�debugpathcopies�
s
r�s	debugpeerc	Cs�ddi}|�|���t�|i|�}zz|��du}|��}|�td�|���|�td�|rdtd�ntd��|�td�|r�td�ntd��W|��n
|��0Wd�n1s�0YdS)	z+establish a connection to a peer repository)sdevelsdebug.peer-requestTNsurl: %s
s
local: %s
r�r�s
pushable: %s
)	�configoverriderr�r��canpushrXrr;r�)rZr��	overridesr�r�r�rbrbrc�	debugpeer�
s�"�r�sdebugpickmergetools check for files in this revision�changedeletes!emulate merging change and deletes[PATTERN]...cOslt�|�}i}|dr:|d|d<|�dt�|d��|�|d���tj�d�}|durr|�dt�|��|�dd	�}|r�|�d
t�|��t	�
||�d��}t	�|||�}|d}	|�|�D]~}
||
}|j
s�|jd
d�nt���4t�|||
|��d|��v|	�\}}
Wd�n1�s*0Y|�d|
|f�q�Wd�n1�s^0YdS)afexamine which merge tool is chosen for specified file

    As described in :hg:`help merge-tools`, Mercurial examines
    configurations below in this order to decide which merge tool is
    chosen for specified file.

    1. ``--tool`` option
    2. ``HGMERGE`` environment variable
    3. configurations in ``merge-patterns`` section
    4. configuration of ``ui.merge``
    5. configurations in ``merge-tools`` section
    6. ``hgmerge`` tool (for historical reason only)
    7. default tool for fallback (``:merge`` or ``:prompt``)

    This command writes out examination result in the style below::

        FILE = MERGETOOL

    By default, all files known in the first parent context of the
    working directory are examined. Use file patterns and/or -I/-X
    options to limit target files. -r/--rev is also useful to examine
    files in another context without actual updating to it.

    With --debug, this command shows warning messages while matching
    against ``merge-patterns`` and so on, too. It is recommended to
    use this option with explicit file patterns and/or -I/-X options,
    because this option increases amount of output per file according
    to configurations in hgrc.

    With -v/--verbose, this command shows configurations below at
    first (only if specified).

    - ``--tool`` option
    - ``HGMERGE`` environment variable
    - configuration of ``ui.merge``

    If merge tool is chosen before matching against
    ``merge-patterns``, this command can't show any helpful
    information, even with --debug. In such case, information above is
    useful to know why a merge tool is chosen.
    stool)�uis
forcemergeswith --tool %r
sdebugmergepatternssHGMERGENswith HGMERGE=%r
r�smergeswith ui.merge=%r
r�r�T)rr�s%s = %s
)r(r��
notenoi18nr�r�r�environr�Zconfigr0r�rr�r
�silentr<r�rZ	_picktoolZisbinaryr�rX)rZr[r�r�r�ZhgmergeZuimerger�r�Zchangedeleter��fctxZtoolZtoolpathrbrbrc�debugpickmergetool�
s@5
���
�(r�sdebugpushkeysREPO NAMESPACE [KEY OLD NEW]c
	Os�t�|i|�}z�|r�|\}}}|���*}	|	�d||||d����}
Wd�n1sV0Y|�t�|
�d�|
W|��St	t�
|�|���D]&\}}|�dt
�|�t
�|�f�q�W|��n
|��0dS)z�access the pushkey key/value protocol

    With two args, list the keys in the given namespace.

    With five args, set a key to new if it currently is set to old.
    Reports success or failure.
    spushkey)s	namespaceskeyr�snewNr�s%s	%s
)rr��commandexecutor�callcommand�resultr�r(r�r�r�r�ZlistkeysrXrE�	escapestr)
rZr��	namespaceZkeyinfor��targetr��old�newrr`r�r�rbrbrc�debugpushkeyBs0


��&
���r�s	debugpvecsA Bc	Cs�t�||�}t�||�}t�|�}t�|�}||kr:d}n(||krHd}n||krVd}n||Brbd}|�td�|�|�td�|�|�td�|j|jf�|�td�t|j|j�t�|j	|j	�|�
|�|f�dS)	N�=�>�<�|sa: %s
sb: %s
sdepth(a): %d depth(b): %d
s.delta: %d hdist: %d distance: %d relation: %s
)r0r�r'ZctxpvecrXrZ_depth�absZ_hammingZ_vecZdistance)	rZr[rar6�ca�cbr�Zpb�relrbrbrc�	debugpvecgs0

���r�s&debugrebuilddirstate|debugrebuildstatesrevision to rebuild tosminimalsEonly rebuild files that are inconsistent with the working copy parentcs�t�||�}|���||j�d}|�d�rlt|�����}t��}||}||}	�fdd�|	D�}
||
B}��|�	�|��|�Wd�n1s�0YdS)a�rebuild the dirstate as it would look like for the given revision

    If no revision is specified the first current parent will be used.

    The dirstate will be set to the files of the given revision.
    The actual working directory content or existing dirstate
    information such as adds or removes is not considered.

    ``minimal`` will only rebuild the dirstate status for files that claim to be
    tracked but are not in the parent manifest, or that exist in the parent
    manifest but are not in the dirstate. It will not change adds, removes, or
    modified files that are in the working copy parent.

    One use of this command is to make the next :hg:`status` invocation
    check the actual file content.
    NZminimalcsh|]}��|�js|�qSrb)Z	get_entryr�r<�rrbrcr,�rvz'debugrebuilddirstate.<locals>.<setcomp>)
r0r�r�rr�r�rrZrebuildr�)rZr[rYr�r�ZchangedfilesZ
manifestfilesZ
dirstatefilesZmanifestonlyZdsonlyZ
dsnotaddedrbr�rc�debugrebuilddirstate�s!

r�sdebugrebuildfncaches	only-datas*only look for wrong .d files (much faster)cKs"t�|�}t�|||�d��dS)zrebuild the fncache files	only_dataN)r(r�r*Zrebuildfncacher�rrbrbrc�debugrebuildfncache�s
r�sdebugrenames[-r REV] [FILE]...c
	Os�t�|�}t�||�d��}t�|||�}|�|�D]d}||}|���|�	��}|�
|�}	|r�|�td�|	|dt
|d�f�q4|�td�|	�q4dS)zdump rename informationr�s%s renamed from %s:%s
rrs%s not renamed
N)r(r�r0r�r�rr�ZfilelogZrenamedZfilenoder�rXrr)
rZr[r�r�r�r�r�r��or�rbrbrc�debugrename�s

&r�sdebugrequires|debugrequirementscCs"t|j�D]}|�d|�q
dS)z#print the current repo requirementsr�N)r�r,rX)rZr[r`rbrbrc�debugrequirements�sr��debugrevlog�d�dumpsdump index datacEsL
t�|�}t�|d||�}|�d��r8t|�}|�d�d}t�}t�|�D]�}|�	|�}	|	dkrf|}	|�
|�}
|�|�}|�|�\}}
|�
|�}||}|t|�|��8}|�|�z||�|�}Wnty�d}Yn0|�d|||
|�|�|�|�|�|	�|�|
�|�|�|�|
�|||t|�|f�qLdS|j}|j}g}d}|tj@�rb|�d�|tj@�r|d	}|�d
�|�s�dg}d}d}d}d}d}d}t�dd
��}d}d}d}d}d}d} g}!g}"g}#gd�}$gd�}%gd�}&t�dd
��}'gd�}(i})i}*dd�}+t|�}t�|�D�]�}|�|�\}}
|�	|�},|dk�rZ|+|�
|�|$�|
tk�rl|d7}|�|�}-|,tk�r�|!�d�|"�|�|��|#�|-�|-dk�r�|d7}|d7}n0|d7}|dd7<|+|-|%�|+|-|'d��n&|!�|!|,d�|"|,}.|�|�}/|"�|.�|#�|/|.|-�|-dk�rP|d7}|d7}n�|�|��r�|+|-|&�|d7}|�|�}0||0d7<|+|-|'|0�n�|+|-|(�|,|dk�r�|d7}|,|k�r�|d7}n|,|
k�r| d7} n:|,|k�r�|d7}n&|,|
k�r|d7}n|,tk�r|d7}t�|d��r:|� ||�d}1n|j!� ||�d}1|1�rdt"|1dd��}2nd}2|2|)v�r�d|)|2<d|*|2<|)|2d7<|*|2|-7<�q"|$|%|&|(fD]}-|-ddu�r�d|-d<�q�||||}3||| }4|$d}5|$d|<|%d}6|dk�r d|%d<n|%d|<|&d}7i}8|dk�rV|&d|<|'D].}0|'|0d|8|0<|'|0d||0<�qZ|(d}9|3dk�r�|(d|3<|6|7|9}:t#|!�|};t$|!�}<t$|#�}=d}>|:�r�|5|:}>d�d��fdd�}?dB�fdd�	}@dd�}A|�%d|�|�%d d!�&|��|�d"�|@|:�}B|?|:�}C|�%d#|C|�|�%d$|B|A||��|�%d%|B|A|||��|�%d#|C|�|�%d&|B|A||��|�%d'|B|A|||��|�%d(|B|A|||��|�%d)|B|A|||��t'|�D]&}0|�d*|0|B|A||0|���q|�%d+|B|A|3|��|�%d,|C|:�|�%d)|B|A|6|7|:��t'|�D]&}0|�d*|0|B|A|8|0|:���q�|�%d+|B|A|9|:��d-d.�}D|�d"�|�%d/|C|�t'|)�D],}2|�|D|2��|�|B|A|)|2|���q�|�%d0|C|:�t'|)�D],}2|�|D|2��|�|B|A|*|2|:���qB|�d"�|?t$|;|<|=|>��}B|�%d1|B|;�|�%d2|B|<�|�%d3|B|=�|�%d4|B|>�|dk�r�|�d"�|�%d5t(|$��|�%d6t(|%��|�%d7t(|&��t'|'�D]0}0|0dk�	r8�	q&|�%d8|0ft(|'|0���	q&|�%d9t(|(��|3dk�
rH|�d"�|@|3�}B|@|3d:�}C|�%d;|B|A||3��|dk�	r�|�%d<|C|A||��|�%d=|C|A| |��|�%d>|C|A|4|��|�
rH|�%d?|B|A||3��|�%d@|B|A||3��|�%dA|B|A||3��dS)Cz'show data and statistics about a revlogr�r�se# rev p1rev p2rev start   end deltastart base   p1   p2 rawsize totalsize compression heads chainlen
rr{s:%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d %11d %5d %8d
FsinlineTsgeneraldeltas(none)cSsdS)Nrrbrbrbrbrcr6rvzdebugrevlog.<locals>.<lambda>�NrrcSsgd�S)Nr�rbrbrbrbrcrMrvcSsH|ddus||dkr ||d<||dkr4||d<|d|7<dS)NrrrOrb)rr�rbrbrc�addsizeRs
zdebugrevlog.<locals>.addsizers_getsegmentforrevs�emptyNrOs%%%dd
s%%%dd %s(%%5.2f%%%%)
cs�tt|��Sr��rQ�str)r!)�basedfmtstrrbrc�dfmtstr�szdebugrevlog.<locals>.dfmtstrcs�tt|��d|fS)Nr�r�)r!Zpadding)�basepcfmtstrrbrc�pcfmtstr�szdebugrevlog.<locals>.pcfmtstrcSs$|r|dt|�|fS|dfSdS)N�drt)rc)r�rzrbrbrc�pcfmt�szdebugrevlog.<locals>.pcfmtsformat : %d
sflags  : %s
r�r�srevisions     : s    merges    : s    normal    : s    empty     : s                   text  : s                   delta : s    snapshot  : s      lvl-%-3d :       s    deltas    : srevision size : cSs@|dkrd|S|t�tj�vr0dt|�|fSdt|�SdS)Nr�s
    %s     : s    0x%s (%s)  : s    0x%s      : )r(r��string�
ascii_lettersr)�	chunktyperbrbrc�fmtchunktype�s
z!debugrevlog.<locals>.fmtchunktypeschunks        : schunks size   : savg chain length  : smax chain length  : smax chain reach   : scompression ratio : s4uncompressed data size (min/max/avg) : %d / %d / %d
s4full revision size (min/max/avg)     : %d / %d / %d
s4inter-snapshot size (min/max/avg)    : %d / %d / %d
s5    level-%-3d (min/max/avg)          : %d / %d / %d
s4delta size (min/max/avg)             : %d / %d / %d
r�sdeltas against prev  : s    where prev = p1  : s    where prev = p2  : s    other            : sdeltas against p1    : sdeltas against p2    : sdeltas against other : )r))r(r�rr_r�rQrXr�r�ZdeltaparentrgrVr0�rawsizer�r��ZeroDivisionErrorr`Z_format_versionZ
_format_flagsr-ZFLAG_INLINE_DATAr�ZFLAG_GENERALDELTAr��defaultdictrraZ
issnapshotZ
snapshotdepthr<r�Z_getsegmentforrevs�_revlogr\�sumr!r�rir�r�)ErZr[r:r�r`Znumrevs�tsr�rYZdbaseZcbaseZclenr�r�ZrsrB�formatr�r�ZgdeltaZ	nummergesZnumemptyZnumemptytextZ
numemptydeltaZnumfullZnumsemiZnumsnapdepthZnumprevZnump1Znump2ZnumotherZ	nump1prevZ	nump2prevZchainlengthsreZ
chainspansZdatasizeZfullsizeZsemisizeZ
snapsizedepthZ	deltasizeZchunktypecountsZchunktypesizesr�r�rZbaseaddrZrevaddr�depthZsegmentr�Z	numdeltasZnumoprevZtotalrawsizeZ	fulltotalZ	semitotalZ	snaptotalZ
deltatotalraZavgchainlenZmaxchainlenZmaxchainspanZ	compratior�r�r�rZfmt2r�rb)r�r�rc�debugrevlog�s<
�





���

































�����������



������
����


�
������r��debugrevlogindex�formats
revlog formatsFORMATs[-f FORMAT] -c|-m|FILEcKsnt�|�}t�|d||�}|�dd�}|dvr@t�td�|��|jrLt	}nt
}d}|D]}t||�|���}qtqX|dkr�|j
r�|�dd�|�d	�|�f�q�|�d
d�|�d	�|�f�n8|dkr�|j
r�|�dd�|��n|�d
d�|��|D�]h}|�|�}	|dk�r�z|�|	�}
Wn t�yF|j|jg}
Yn0|j
�r�|�d||�|�|�|�|�|�||	�||
d�||
d�f�n2|�d||�|�||	�||
d�||
d�f�q�|dkr�|�|�}|j
�r.|�d||�|�|�|�|�|�|�|�|�|�|d|d||	�f	�q�|�d||�|�|�|�|�|�|d|d||	�f�q�dS)z#dump the contents of a revlog indexr�r�r)rrsunknown format %drs*   rev    offset  length linkrev %s %s p2
rr�rrs?   rev flag   offset   length     size   link     p1     p2 %s
s-   rev flag     size   link     p1     p2 %s
s% 6d % 9d % 7d % 7d %s %s %s
s% 6d % 7d %s %s %s
s+% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d %s
s!% 6d %04x % 8d % 6d % 6d % 6d %s
N)r(r�rr_r�rrUrr
rrrQr�r�r�r�rjustrr2rrXr`rarr0r�r�)rZr[r:r�r`r�rrrxr�rZprrbrbrc�debugrevlogindexF
s�	
��������




���


���

������r�sdebugrevspec�optimizes/print parsed tree after optimizing (DEPRECATED)s	show-revss(print list of result revisions (default)sshow-sets+print internal representation of result setsno-optimizeds"evaluate tree without optimizationsverify-optimizedsverify optimized resultsREVSPECcs�t�|�}��d��ddd�fd��fdd�fdtjfdtjfd	tjfg}|d
r^|dd�}|d
r||d
r|t�t	d���dd�|D�}t
�}t
�}�jr�|ds�|�d�|�
ddg�|dr�|�d	�|dr�|dr�t�t	d���|ddgk�r|�
|�n:|dD]"}||v�rt�t	d�|���q|�
|d�i}	d}
tj|t�|�d�}|D]p\}}||�|	|<}||v�s�||v�rb||
k�rb|d�s�|dk�r���d|���t�|�d�|}
�qb|d
�r<t�|	d�|�}
t�|	d	�|�}|d�s"|ddu�rJ�j�rJ��dt�|
�d���dt�|�d�t|
�}
t|�}|
|k�rhdS�jddd��jd d!d�t�d|
|�}|��D]�\}}}}}|d"v�r�|
||�D]}�jd#|d$d��q�|d%v�r|||�D]}�jd&|d'd��q�|d(k�r�|
||�D]}��d)|��q�q�d*St�|�}||�}|d�sn|ddu�r��j�r���d+t�|�d�|d,�s�dS|D]}��d-|��q�dS).a�parse and apply a revision specification

    Use -p/--show-stage option to print the parsed tree at the given stages.
    Use -p all to print tree at every stage.

    Use --no-show-revs option with -s or -p to print only the set
    representation or the parsed tree respectively.

    Use --verify-optimized to compare the optimized result with the unoptimized
    one. Returns 1 if the optimized result differs.
    srevsetaliasr�cSs|Sr�rb�r�rbrbrcr�
rvzdebugrevspec.<locals>.<lambda>sexpandedcst�|��j�Sr�)r/�
expandaliasesrr���aliasesrZrbrcr�
rvsconcatenatedr�r�sno_optimizedNr{sverify_optimizeds1cannot use --verify-optimized with --no-optimizedcSsh|]\}}|�qSrbrbr�rbrbrcr,�
rvzdebugrevspec.<locals>.<setcomp>r�r�s'cannot use --optimize with --show-stager�r��rTr�r�sshow_sets* analyzed set:
s* optimized set:
rs
--- analyzed
sdiff.file_ars+++ optimized
sdiff.file_b)�deleter�s-%d
sdiff.deleted)�insertr�s+%d
s
diff.insertedZequals %d
rs* set:
s	show_revss%d
)r(r�rr/Z
foldconcatr�r�rrUrr�r�r�r�r�r.ZlookupfnrXr�Zmakematcherr�rEr�r/�difflibZSequenceMatcherZget_opcodes)rZr[r�r�r�r�r�Zshowchangedr;ZtreebystageZprintedtreer�rjZarevsZbrevsZsmrmZaloZahiZbloZbhir��funcr1rbr�rc�debugrevspec�
s�-


��
�



 ��




 
r��
debugserve�sshstdios*run an SSH server bound to process handles�logiofds$file descriptor to log server I/O to�	logiofilesfile to log server I/O toc
Ks�t�|�}|ds t�td���d}|drB|drBt�td���|dr�zt�t|d�dd�}Wq�ty�}z0|j	t	j
kr��t�t|d�d	d�}WYd}~q�d}~00n|dr�t|dd
d�}tj
|||d�}|��dS)z�run a server with advanced settings

    This command is similar to :hg:`serve`. It exists partially as a
    workaround to the fact that ``hg serve --stdio`` must have specific
    arguments for security reasons.
    r�s&only --sshstdio is currently supportedNr�r�s)cannot use both --logiofd and --logiofile�abr�wbsab)�logfh)r(r�rrUrr)�fdopenr*r�rKZESPIPEr
r?Z	sshserverZ
serve_forever)rZr[r�r�rrrbrbrc�
debugserve>s"
.r�sdebugsetparentssREV1 [REV2]cCsZt�||���}t�||d���}|���|�||�Wd�n1sL0YdS)a�manually set the parents of the current working directory (DANGEROUS)

    This command is not what you are looking for and should not be used. Using
    this command will most certainly results in slight corruption of the file
    level histories withing your repository. DO NOT USE THIS COMMAND.

    The command update the p1 and p2 field in the dirstate, and not touching
    anything else. This useful for writing repository conversion tools, but
    should be used with extreme care. For example, neither the working
    directory nor the dirstate is updated, so file status may be incorrect
    after running this command. Only used if you are one of the few people that
    deeply unstand both conversion tools and file level histories. If you are
    reading this help, you are not one of this people (most of them sailed west
    from Mithlond anyway.

    So one last time DO NOT USE THIS COMMAND.

    Returns 0 on success.
    snullN)r0r�r�r�Z
setparents)rZr[r^r_Znode1Znode2rbrbrc�debugsetparentsps
r�s
debugsidedatac	Ks(t�|�}|�d�s(|�d�s(|�d�rL|dur@t�dtd���d|}}n|durdt�dtd���t�|d||�}t|d|�}z|�	|�
|��}Wn$ty�t�td�|��Yn0|�r$t
|���}|��|�d	t|��|D]8\}}|�d
|t|�f�|jr�|�dt�|��q�dS)zcdump the side data for a cl/manifest/file revision

    Use --verbose to dump the sidedata content.r�r�r?Nr>r@r�rAs%d sidedata entries
s entry-%04o size %d
r�)r(r�r�rrBrrrCr	rJrTrDrUr/rrwr�rQr�rEr)	rZr[r:rYr�r`rJr�r�rbrbrc�
debugsidedata�s*
r��debugssls[SOURCE]cKsvtjst�td���|s.|s*t�td���d}t�d|||�\}}t�|�}ddd�}|j|vr�z|j	t
|jpv||j�f}Wq�ty�t�td���Yq�0nt�td	���d
dl
m}tjt��tjtjdd
�}	z�|	�|�|	�d�}
|�td�|j	�|j|
dd�}|�sN|�td��|�|
��s>|�td��n|�td��n|�td��W|	��n
|	��0dS)atest a secure connection to a server

    This builds the certificate chain for the server on Windows, installing the
    missing intermediates and trusted root via Windows Update if necessary.  It
    does nothing on other platforms.

    If SOURCE is omitted, the 'default' path will be used.  If a URL is given,
    that server is used. See :hg:`help urls` for more information.

    If the update succeeds, retry the original operation.  Otherwise, the cause
    of the SSL error is likely another issue.
    s6certificate chain building is only possible on Windowss>there is no Mercurial repository here, and no server specifiedr|r�i��)shttpsssshsmalformed port number in URLs,only https and ssh connections are supportedr)�win32N)Zssl_versionZ	cert_reqsZca_certsTs&checking the certificate chain for %s
F)Zbuilds-certificate chain is incomplete, updating... sfailed.
sdone.
s$full certificate chain is available
)r(Z	iswindowsrrUrrFr�r;�schemerOr*�portr�r�r��sslZwrap_socketrJZPROTOCOL_TLSZ	CERT_NONEZconnectZgetpeercertr�Zcheckcertificatechainr�)rZr[�sourcer�r4r;ZdefaultportZaddrr�rZcertr�rbrbrc�debugssl�sT����


�

r��debugbackupbundle)rv�recoverrvs7brings the specified changeset back into the repositorys%hg debugbackupbundle [--recover HASH]cs�tttjjt��j�d�d���}|jdd�dd�t	�
���d�d<d	�d
<t�������fdd�}��
d
�}|r�t��|�r�|�td�|�d	Sn.|r�td�}|j|dd�n|�td��d	S|D�]�}tj�|t���}	tjd�||	��
d�d�\}	}
zt���|	��Wn`tj�yv}zDtd�|	}td�t|j�}|j||d�WYd	}~q�WYd	}~n
d	}~00t���|
��
d��\}
}|
�r��fdd�|
D�}
|���^z&t �!|��|
�d�d
�\�}}Wn&tj�yYWd	�q�Yn0Wd	�n1�s0Y�z�|�s6W|�q�|�r.��"�����#d���}t��|��r�|�td�|�t�$||	�}t%�&|||	�}t'|t(j)��r�t(j*�||dd|	d�n|�+�dd|	�Wd	�Wd	�W|��q�Wd	�n1�s0YWd	�n1�s"0Yn�t�,t-�.d t-�/tj�0|	����}|�d!|�1d"��|j2�r�|�d#d�1d$�|	f�nd%�d&<t�3|��d'�}|�||�|�4�W|�q�|�0q�d	S)(a�lists the changesets available in backup bundles

    Without any arguments, this command prints a list of the changesets in each
    backup bundle.

    --recover takes a changeset hash and unbundles the first bundle that
    contains that hash, which puts that changeset back in your repository.

    --verbose will print the entire commit message and the bundle path for that
    backup.
    sstrip-backups/*.hgcSstj�|�Sr�)r)r��getmtimer�rbrbrcrrvz#debugbackupbundle.<locals>.<lambda>T)r��reverservsbundleNsforcecs���d�r|��d}|D]`}�dur2|�kr2q|�fdd�|j�|�D�}��d�rdt|�dkrdq|d7}|�||�qdS)Nsnewest_firstrcsg|]}|�jkrd�qS)T)rr�r�rbrcrysz6debugbackupbundle.<locals>.display.<locals>.<listcomp>s	no_mergesrOr)r�r�rVrrQ�show)r��chlist�	displayer�countr;r)�limitr�r[rbrc�displays


�z"debugbackupbundle.<locals>.displayr�s%s already exists in the repo
sgRecover changesets using: hg debugbackupbundle --recover <changeset hash>

Available backup changesets:sstatus.removedrsno backup changesets found
r�r�)Zdefault_branchess"
warning: unable to open bundle %ss
(missing parent rev %s)
rYr�csg|]}��|��qSrbr�)rwrY)r�rbrcryKrvz%debugbackupbundle.<locals>.<listcomp>sunbundlesUnbundling %s
sbundle:)r�r;z%a %H:%M, %Y-%m-%ds
%s
�2r��
s8{label('status.modified', node|short)} {desc|firstline}
rdF)5r/�filterr)r��isfile�globr=rirwr(r�rZgetlimitr�r0Zisrevsymbolrrr��relpathrrSrFr�rr�rr'rr�r�r�rZgetremotechangesrr�rlrrmr�rr�Zapplybundlernrzrfrxryr�rr�Zchangesetdisplayerr�)rZr[r�r�ZbackupsrZrecovernoder��backupr�r4�exrZr1ZcheckoutrZ	cleanupfnr�rjrpZ
backupdaterrb)rr�r�r[rc�debugbackupbundle�s���


�
�
"�
�6&���H�����
r
sdebugsubsrevision to checks[-r REV] [REV]cCs\t�||d�}t|j���D]:\}}|�d|�|�d|d�|�d|d�qdS)Nspath %s
s
 source   %s
rs
 revision %s
r)r0r�r�r�rr�)rZr[rYr�r�r�rbrbrc�debugsub�s
rs
debugshellcCs"ddl}||d�}|j|d�dS)z�run an interactive Python interpreter

    The local namespace is provided with a reference to the ui and
    the repo instance (if available).
    rN)rZr[)r�)�codeZinteract)rZr[rZimported_objectsrbrbrc�
debugshell�s
�rsdebugsuccessorssetssclosests#return closest successors sets onlys[REV]cOs�i}t}t}t�||�D]�}||}|�d||��tj||��|d|d�D]X}	|	r�|�d�|�||	d��|	dd�D]}
|�d�|�||
��q�|�d	�qPqdS)
a}show set of successors for revision

    A successors set of changeset A is a consistent group of revisions that
    succeed A. It contains non-obsolete changesets only unless closests
    successors set is set.

    In most cases a changeset A has a single successors set containing a single
    successor (changeset A replaced by A').

    A changeset that is made obsolete with no successors are called "pruned".
    Such changesets have no successors sets at all.

    A changeset that has been "split" will have a successors set containing
    more than one successor.

    A changeset that has been rewritten in multiple different ways is called
    "divergent". Such changesets have multiple successor sets (each of which
    may also be split, i.e. have multiple successors).

    Results are displayed as follows::

        <rev1>
            <successors-1A>
        <rev2>
            <successors-2A>
            <successors-2B1> <successors-2B2> <successors-2B3>

    Here rev2 has two possible (i.e. divergent) successors sets. The first
    holds one element, whereas the second holds three (i.e. the changeset has
    been split).
    r��closest)rr`s    rrNr�r�)r\rrr�rXr#Zsuccessorssetsr�)rZr[r1r�r`Zctx2strZnode2strrYr�Zsuccssetr�rbrbrc�debugsuccessorssets�s &�


rsdebugtagscachecCs�t�|���}|�d�}|D]h}||��}|j|dd�}|rZt|�}|�|�sl|d7}n|durhd}nd}|�d|t|�|f�qdS)	z/display the contents of .hg/cache/hgtagsfnodes1s.hgtagsF)Zcomputemissings (unknown node)Nrsinvalids	%d %s %s
)	�tagsmodZhgtagsfnodescacher�rgr�ZgetfnoderZhasnoderX)rZr[r`Zflogr`r�ZtagsnodeZtagsnodedisplayrbrbrc�debugtagscache�s


rs
debugtemplatesapply template on changesets�Dsdefinesdefine template keywords	KEY=VALUEs&[-r REV]... [-D KEY=VALUE]... TEMPLATEc	Ks�d}|dr2|dur"t�td���t�||d�}i}|dD]`}z6dd�|�dd�D�\}}|rj|d	krnt�|||<Wq>ty�t�td
�|��Yq>0q>|jr�|�	d�}	t
�|�}
|�t
�
|
�d�t
�|
|	�}||
kr�|�d
t
�
|�d�|du�rpt�||�}tj|||d�}
|j�r^|
��\}}|�dd�t|���|�dd�t|���|�|
�|��n�t�|||�}|j�r�|j��\}}|�dd�t|���|�dd�t|���|D]"}|j||fit�|����q�|��dS)z�parse and apply a template

    If -r/--rev is given, the template is processed as a log template and
    applied to the given changesets. Otherwise, it is processed as a generic
    template.

    Use --verbose to print the parsed tree.
    NrYrPZdefinecss|]}|��VqdSr�r�rrbrbrcr�rvz debugtemplate.<locals>.<genexpr>r�rr�s malformed keyword definition: %ss
templatealiasr�s* expanded:
)Z	resourcess* keywords: %s
r�s* functions: %s
)rZ	RepoErrorrrr�r�r�rUr�rr8r�r�r�r�r�rZtemplateresourcesZ
maketemplaterZsymbolsuseddefaultr�rir�rXZ
renderdefaultr�r�r(r�r�)rZr[Ztmplr�r1ZpropsrIr�r�r�r�ZnewtreeZtresr��kwdsZfuncsrr`rbrbrc�
debugtemplate�sR�

�
 rsdebuguigetpassspromptsprompt textsTEXTs	[-p TEXT]cCs(|�|�}|durd}|�d|�dS)zshow prompt to type passwordNs<default response>�
response: %s
)Zgetpassr��rZ�promptr`rbrbrc�debuguigetpass+s

rs
debuguipromptcCs|�|�}|�d|�dS)zshow plain promptrN)rr�rrbrbrc�
debuguiprompt;s

rsdebugupdatecachesc	Osb|���F|���|jtjd�Wd�n1s60YWd�n1sT0YdS)z'warm all known caches in the repository)ZcachesN)r�rZupdatecachesr@Z
CACHES_ALL)rZr[r�r�rbrbrc�debugupdatecachesIsrsdebugupgradereposextra optimization to performsrunsperforms an upgradesbackups&keep the old repository content aroundr�s select the changelog for upgrader�sselect the manifest for upgradesfilelogssselect all filelogs for upgradecKs tj||f|t|�|d�|��S)a0upgrade a repository to use different features

    If no arguments are specified, the repository is evaluated for upgrade
    and a list of problems and potential optimizations is printed.

    With ``--run``, a repository upgrade is performed. Behavior of the upgrade
    can be influenced via additional arguments. More details will be provided
    by the command output when run without ``--run``.

    During the upgrade, the repository will be locked and no writes will be
    allowed.

    At the end of the upgrade, the repository may not be readable while new
    repository data is swapped in. This window will be as long as it takes to
    rename some directories inside the ``.hg`` directory. On most machines, this
    should complete almost instantaneously and the chances of a consumer being
    unable to access the repository should be low.

    By default, all revlogs will be upgraded. You can restrict this using flags
    such as `--manifest`:

      * `--manifest`: only optimize the manifest
      * `--no-manifest`: optimize all revlog but the manifest
      * `--changelog`: optimize the changelog only
      * `--no-changelog --no-manifest`: optimize filelogs only
      * `--filelogs`: optimize the filelogs only
      * `--no-changelog --no-manifest --no-filelogs`: skip all revlog optimizations
    )�runr�r)r:Zupgraderepor�)rZr[rr�rr�rbrbrc�debugupgraderepoPs.�
��rs	debugwalks[OPTION]... [FILE]...c
s�t�|�}t��d||�}|jr6|�dt�|�d�t�d�	|��}|sPdSdd�}|�
dd�rvtjdkrvd	d�}d
tdd�|D��t�fd
d�|D��f}|D]<}|||��
|��|�|�r�dp�df}	|�d|	���q�dS)z&show how files match on given patternsNr�r�cSs|Sr�rbrrbrbrcr�rvzdebugwalk.<locals>.<lambda>r�sslashr�cSs
t�|�Sr�)r<rrrbrbrcr�rvsf  %%-%ds  %%-%ds  %%scSsg|]}t|��qSrbr�rwr�rbrbrcry�rvzdebugwalk.<locals>.<listcomp>csg|]}t��|���qSrb)rQr�r r�rbrcry�rvsexactrvr�)r(r�r0rr�r�rEr�r/r�Z
configboolr�r!r��exactrX�rstrip)
rZr[r�r�r�rrjrr�r<rbr�rc�	debugwalk�s*
��r#sdebugwhyunstablec	Csjt�|t�||��D]P}d}|�d�rBd�dd�|dD��d}|�d|d||d|d	f�qd
S)z$explain instabilities of a changesetrvsdivergentnodesr�css"|]}d|��|��fVqdS)s%s (%s)N)rZphasestr)rwr�rbrbrcr��s�z#debugwhyunstable.<locals>.<genexpr>s%s: %s%s %s
sinstabilitysreasonr	N)r#Zwhyunstabler0r�r�rirX)rZr[rYrlZdnodesrbrbrc�debugwhyunstable�s

�����r$s
debugwireargs))rv�threervr%)rv�fourrvr&)rv�fivervr'sREPO [OPTIONS]... [ONE [TWO]]cOs�t�|�}t�|||�}z�tjD]}||d=q i}t�|�D]\}}|r>|||<q>t�|�}|j|i|��}	|j|i|��}
|�	d|	�|	|
kr�|�
d|
�W|��n
|��0dS)Nrr�)r(r�rr�r�
remoteoptsr�r��
debugwireargsrXrr�)rZr�Zvalsr�r[�optr\r�r�Zres1Zres2rbrbrcr)�s 



r)ccs�d}g}d}|D]�}|��}|s"q|�d�r.q|�d�sT|rF||fV|}g}d}q|sft�td���t|�t|���}||kr�|r�|d|��7<q|�|�|}q|r�||fVdS)Nr�#r�sindented line outside of blockr{)r"r�rrUrrQ�lstripr�)r�ZactiveactionZ
blocklinesZ
lastindentr<r�rbrbrc�_parsewirelangblocks�s2



r-sdebugwireproto�localsshs!start an SSH server for this repo�peers(construct a specific version of the peer�noreadstderrs%do not read from stderr of the remotesnologhandshakes,do not log I/O related to the peer handshakec*sR	t�|�}|dr$|s$t�td���|drN|ddvrNtjtd�td�d��|rh|drht�td���|��r~|�td	��tt|j	��}d
}d
}d
}d
}d
}	|d�r�t
��d|jdd
g}
t
jt�t
j|
�t
jt
jt
jdd�}|j}|j}|j}|j�s|ddk�rHtj||jddd�}tj||jddd�}tj||jddd�}d}|d}|ddk�r�|�td��tj||||||d
|d�}
nH|ddk�r�|�td��d
}
n&|�td��tj|||||||d�}
�n|�r�t�|�}|jdk�rt�td���|��\}}dd i}|j�r8|�|d!dd"d#�d$��|j �rLd|d%d&<|ddk�rbd"|d'<t!j"||fi|��}	|ddk�r�|�td��d
}
n2|d�r�t�td(�|d��nt#j|||	d)�}
nt�td*���d
}|D�]4\}}|d+v�rH|�s
t�td,���d-�$d.d/�|D��}t%�&|�}|�|�|d0k�	r|�'��q�|d1k�rr|�sft�td2���|�'��q�|�(d3��r2|
�s�t�td4���|�)d5d6�d6}i}
|D]l}|�*��)d5d6�}t+|�d6k�r�|d}d-}n|\}}|�(d7��rt%�,|d8d
��}n
t%�&|�}||
|<�q�|d
u�r4|�-||
f��q�|�.td9�|�d:|
v�r�t/|
d:d;��d}|
d:=|
j0||fit�1|
���\}}|�.td<�t%�2|��|�.td=�t%�2|��Wd
�n1�s�0YnX|
�3�� }|�4||
��5�}Wd
�n1�s0Y|�.td>�t%j6|dd?d@���q�|dAk�r\|d
u�rTt�tdB���g}�q�|dCk�r�|�.tdD�t+|��t7|
�8|��D]&\}}|�.tdE�|t%�2|�f��q�d
}�q�|�(dF��r�|	�s�t�tdG���|�)d5d?�} t+| �dHk�rt�tdI���| d6d
�\�}!i}"d
}#g}$|D]�}|�*�}t9�:dJ|�}%|%�rlt�;|%�<d6��}t�;|%�<d?��}||"|<�q"|�(dK��r�t/|�)d5d6�dL��}|�=�}#Wd
�n1�s�0Yn@|�(dM��r�t>�?|t+dM�d
��}&|$�-|&�nt�tdN�|���q"||!}|$�rd-�$dOd/�|$D��}#t!j@�At�;|�|#|"�}'�fdPdQ�|'_Bz|	�/|'�}|�=�}#WnJtjCjD�y�}z,tE|dRdSdQ���WYd
}~�q�WYd
}~n
d
}~00|jF�GdT�}(|(dUk�	r|�tdV�t%j6tH�I|#�dd?d@���q�|dWk�r�|
�J��q�|dXk�r4|�r|�st�tdY���|�J�|�=�|�=�n�|dZk�r\|�sRt�td[���|�K�n�|d\k�r�|�szt�td]���|�K�n�|�(d^��r�tL|�)d5d6�d6�})|�s�t�td_���|�=|)�nR|�(d`��	rtL|�)d5d6�d6�})|�s�t�tda���|�=|)�nt�tdb�|���q�|d
u�	r2t�tdc���|
�	r@|
�J�|�	rN|�M�d
S)da�send wire protocol commands to a server

    This command can be used to issue wire protocol commands to remote
    peers and to debug the raw data being exchanged.

    ``--localssh`` will start an SSH server against the current repository
    and connect to that. By default, the connection will perform a handshake
    and establish an appropriate peer instance.

    ``--peer`` can be used to bypass the handshake protocol and construct a
    peer instance using the specified class type. Valid values are ``raw``,
    ``ssh1``. ``raw`` instances only allow sending raw data payloads and
    don't support higher-level command actions.

    ``--noreadstderr`` can be used to disable automatic reading from stderr
    of the peer (for SSH connections only). Disabling automatic reading of
    stderr is useful for making output more deterministic.

    Commands are issued via a mini language which is specified via stdin.
    The language consists of individual actions to perform. An action is
    defined by a block. A block is defined as a line with no leading
    space followed by 0 or more lines with leading space. Blocks are
    effectively a high-level command with additional metadata.

    Lines beginning with ``#`` are ignored.

    The following sections denote available actions.

    raw
    ---

    Send raw data to the server.

    The block payload contains the raw data to send as one atomic send
    operation. The data may not actually be delivered in a single system
    call: it depends on the abilities of the transport being used.

    Each line in the block is de-indented and concatenated. Then, that
    value is evaluated as a Python b'' literal. This allows the use of
    backslash escaping, etc.

    raw+
    ----

    Behaves like ``raw`` except flushes output afterwards.

    command <X>
    -----------

    Send a request to run a named command, whose name follows the ``command``
    string.

    Arguments to the command are defined as lines in this block. The format of
    each line is ``<key> <value>``. e.g.::

       command listkeys
           namespace bookmarks

    If the value begins with ``eval:``, it will be interpreted as a Python
    literal expression. Otherwise values are interpreted as Python b'' literals.
    This allows sending complex types and encoding special byte sequences via
    backslash escaping.

    The following arguments have special meaning:

    ``PUSHFILE``
        When defined, the *push* mechanism of the peer will be used instead
        of the static request-response mechanism and the content of the
        file specified in the value of this argument will be sent as the
        command payload.

        This can be used to submit a local bundle file to the remote.

    batchbegin
    ----------

    Instruct the peer to begin a batched send.

    All ``command`` blocks are queued for execution until the next
    ``batchsubmit`` block.

    batchsubmit
    -----------

    Submit previously queued ``command`` blocks as a batch request.

    This action MUST be paired with a ``batchbegin`` action.

    httprequest <method> <path>
    ---------------------------

    (HTTP peer only)

    Send an HTTP request to the peer.

    The HTTP request line follows the ``httprequest`` action. e.g. ``GET /foo``.

    Arguments of the form ``<key>: <value>`` are interpreted as HTTP request
    headers to add to the request. e.g. ``Accept: foo``.

    The following arguments are special:

    ``BODYFILE``
        The content of the file defined as the value to this argument will be
        transferred verbatim as the HTTP request body.

    ``frame <type> <flags> <payload>``
        Send a unified protocol frame as part of the request body.

        All frames will be collected and sent as the body to the HTTP
        request.

    close
    -----

    Close the connection to the server.

    flush
    -----

    Flush data written to the server.

    readavailable
    -------------

    Close the write end of the connection and read all available data from
    the server.

    If the connection to the server encompasses multiple pipes, we poll both
    pipes and read available data.

    readline
    --------

    Read a line of output from the server. If there are multiple output
    pipes, reads only the main pipe.

    ereadline
    ---------

    Like ``readline``, but read from the stderr pipe, if available.

    read <X>
    --------

    ``read()`` N bytes from the server's main output pipe.

    eread <X>
    ---------

    ``read()`` N bytes from the server's stderr pipe, if available.

    Specifying Unified Frame-Based Protocol Frames
    ----------------------------------------------

    It is possible to emit a *Unified Frame-Based Protocol* by using special
    syntax.

    A frame is composed as a type, flags, and payload. These can be parsed
    from a string of the form:

       <request-id> <stream-id> <stream-flags> <type> <flags> <payload>

    ``request-id`` and ``stream-id`` are integers defining the request and
    stream identifiers.

    ``type`` can be an integer value for the frame type or the string name
    of the type. The strings are defined in ``wireprotoframing.py``. e.g.
    ``command-name``.

    ``stream-flags`` and ``flags`` are a ``|`` delimited list of flag
    components. Each component (and there can be just one) can be an integer
    or a flag name for stream flags or frame flags, respectively. Values are
    resolved to integers and then bitwise OR'd together.

    ``payload`` represents the raw frame payload. If it begins with
    ``cbor:``, the following string is evaluated as Python code and the
    resulting object is fed into a CBOR encoder. Otherwise it is interpreted
    as a Python byte string literal.
    r.s --localssh requires a repositoryr/)�raw�ssh1sinvalid value for --peers!valid values are "raw" and "ssh1"rYs/cannot specify --localssh with an explicit paths (waiting for commands on stdin)
Ns-Rr�s
--sshstdior)�stdin�stdout�stderr�bufsizer1�iT)�logdatartrFsssh://localserverr0r2s.creating ssh peer for wire protocol version 1
)�autoreadstderrsusing raw connection to peer
s)creating ssh peer from handshake results
shttps*only http:// paths are currently supportedZ	useragentsMercurial debugwireprotor'F)r8�logdataapis)Z	loggingfhZloggingname�loggingoptsr;r:Z
sendaccepts'--peer %s not supported with HTTP peers)�openers$unsupported connection configuration)r1�raw+s!cannot call raw/raw+ on this peerrvcss|]}|��VqdSr�)r,r�rbrbrcr�arvz!debugwireproto.<locals>.<genexpr>r=sflushscannot call flush on this peerscommands6cannot send commands unless peer instance is availabler�rseval:r5ssending %s command
sPUSHFILE�rbsresult: %s
sremote output: %s
rrO)Zbprefixr�s
batchbeginsnested batchbegin not allowedsbatchsubmits#sending batch with %d sub-commands
sresponse #%d: %s
shttprequest s+cannot use httprequest without an HTTP peerrLsDinvalid httprequest: expected format is "httprequest <method> <path>s^([a-zA-Z0-9_-]+): (.*)$s	BODYFILE srbsframe s#unknown argument to httprequest: %scss|]}t|�VqdSr�)r\r<rbrbrcr��rvcs
t���Sr�)r(r&rb�rMrbrcr�rvz debugwireproto.<locals>.<lambda>r�cSsdSr�rbrbrbrbrcr�rvzContent-Typezapplication/mercurial-cbors	cbor> %s
scloses
readavailables(readavailable not available on this peersreadlines#readline not available on this peers	ereadlines$ereadline not available on this peersread sread not available on this peerseread s eread not available on this peersunknown action: %ssunclosed "batchbegin" request)Nr(r�rrUr�interactiverXr/r-r�rDZhgcmdr��
subprocess�PopenZrapplyZtonativestr�PIPEr3r4r5r�r<Zmakeloggingfileobjectr3Z	sshv1peerZmakepeerrFr;r��authinfor�r
r�r<rrirEZunescapestr�flushr�r�r,rQZevalpythonliteralr�r�r
Z	_callpushr�r�r�r�r�rr�Z_submitbatch�rerZstrurl�groupr�r>ZmakeframefromhumanstringZurlreq�requestZ
get_methodZurlerrZurlerrorr	�headersr�rAZ	decodeallr��readliner*�kill)*rZr[r�r�Zblocks�procr3r4r5r<r\r;r9r��urDZ
openerargsZbatchedcommandsr��linesr}�commandr<�fieldsr�r�r��resr�rrx�chunkrHZhttppathrI�bodyZframesr��frameZreqZctrrbr?rc�debugwireproto�sL
�
��
�
�
�
�
�


����
�




��


��
�&
0��


������*�
�
$
���

�





rU)NFFFF)Nr)r)r)N)NN)N)N)N)N)r|)N)r�)NN)N)N)rb)N)N)N)N)N)N)N)N)rv)rv)FNT)N)�Z
__future__rrvr%r�r�r�rKr	r�r)r+r�rFrJr�rGr�rAr�rfZi18nrr�rrrrr(r	r
r�rrr
rrrrrrrrrrrrrrrrrZlockmodrr rhr!r"r#r$r%r&r'r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7rr8r9r:r;r�r<r=rRr>r?Z
interfacesr@ZutilsrArBrCrDrErFZrevlogutilsrGrdrHrIrJrE�tabler�rOZ_tablerdrkrqr�r�r�r�r�r�r�r�rrrr
r	r#r=ZdebugrevlogoptsrErJZ
formatteroptsrhr�r(r�r�r�r�r�Z
dryrunoptsr�r�r�r�rrrrr#r=r?rTrbZtemplateoptsrlr>rvZcommitopts2r�r�r�Zwalkoptsr�r�Z
mergetooloptsr�r�r�r�r�r�r�r�r�r�r�r�r�r�Zlogoptsr
rrrrrrrrrr#r$r)r-rUrbrbrbrc�<module>s��7 	




������#)
��

��
'

�
	

��<�

�1�����
?�
����c��
>������ 
A������
0
G��� 

1
�$�


-

����
]��
�=
l
�����'�������	�	��
<�	����K$����!�����`��l������!d��
�$H��	�
��3
��	8����
���"���*�����

Youez - 2016 - github.com/yon3zu
LinuXploit