
    	^cU                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZddlmZ ddlmZmZmZmZ ddlmZmZ ddl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,m-Z-m.Z.m/Z/m0Z0m1Z2m3Z3m4Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<mZm=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZMmNZNmOZOmPZPmQZRmSZSmTZUmVZVmWZW ddlXmYZY ddlZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z` dd	lBmaZbmcZdmeZfmgZgmhZhmiZi e2jj        Zji Zkekl                    eKjm        jn                    e=jm        ek          Zm emd
g  ed          d          d             Zo emdg           d             Zp emdg d          d             Zq emdddd ed          fddd ed          fddd ed          fddd ed           fg ed!                    	 	 	 	 	 dd#            Zrdd$Zsdd%Ztdd&Zud' Zvdd(Zw emd)d*d+d ed,          fdd-g  ed.          fdd/d ed0          fg ed          d1          dd2            Zx emd3g  ed4          d1          d5             Zy emd6d7gd8          d9             Zz emd:g d          d;             Z{ emd<dd=d ed>          fgd?          d@             Z|dA Z}dB Z~ emdCg d          dD             Z emdEdFdGd edH          fdIdJd edK          fddLd edM          fdNdOd edP          fg edQ          d          ddR            Z emdSe!j         edT                    ddU            Z emdVdWdXd edY          fg edZ          dd[          dd\            Z emd]e!j        e!j        z    ed^          d          dd_            Z emd`e!j        e!j        z    edT          d          dda            Z emdbddcd edd          fdded edf          fddgd edh          fddid" edj          fdd+d" edk          fg edl                    dm             Z emdng  ed                    do             Z emdpddqd edr          fddsd edt          fddug dvfdwdxdyge!j        z   e!j        z    edz                    dd|            Zd}Z emd~ddd ed          fgd          dd            Z emde!j        g d          d             Z emdddud ed           ed8          fddd" ed          fdNdd ed          fddg  ed           ed          fg ed                    d             Z emdddd ed           ed          fddd ed           ed          fddd" ed          fge!j        z             d             Z emdg e!j        z             d             Z emdg  ed          d1          dd            Z emdddg  ed           ed          fddg  ed           ed          fdFdd ed           ed          fg ed          d1          dd            Z emdg d          d             Z emde!j        e!j        z    ed^                    dd            Z emde!j         ed^          d          dd            Z emdg           d             Z emdg e!j        z   dd1          d             Z emdg  ed          d1          d             Z emdg  ed                    d             Z emdddd ed          fddd edĦ          fdNdd edƦ          fddd edɦ          fg edl                    dʄ             Z emdddd" edͦ          fd*dg  edϦ           edЦ          fgd          dd҄            Z emdg e!j        z   d          dԄ             Z emdg  ed֦                    dׄ             Z emdddd" edڦ          fddd" edܦ          fddd" edަ          fddd" ed          fg          d             Z emdddd  ed          fddd" ed          fddug  ed          fddd" ed          fddd" ed          fddg  ed          fge!j        z   e!j        z    ed                    dd            Z emdddud ed           ed8          fg ed                    d             Z emdddud ed           ed8          fg ed                    d             Z emdddd ed          fddd ed          fd*dd ed          fddd ed          fg ed                     d             Z emde!j        dd          d             Z emdg  ed4          d1          d             Z emdddud ed	           ed8          fdd
d ed          fge!j        z   e!j        z    ed          d          d             Z emdg  ed          d1          d             Z emdg  ed                    dd            Z emdddud ed           ed8          fddd ed          fg ed                    d             Z emdddd" ed          fgd          d             Z emdddud ed           ed8          fg ed                    d             Z emd g d          d!             Z emd"e!j        d#d$d" ed%          fgz    ed^          d          dd&            Z emd'e!j        dd(d  ed)           ed*          fgz    ed+          d          dd,            Z emd-dd.d ed/          fdd0d ed1          fdNd2d ed3          fddg  ed           ed          fdd4d" ed5          fdd6d" ed7          fgd8          d9             Z emd:dd;d" ed<          fdd=d ed>          fdd?d ed@          fgd          dA             Z emdBg  edC                    ddD            Z emdEe!j         edT                    ddF            Z emdGg dHd          ddI            Z emdJdKge!j        z    edL                    dM             Z emdNddud edO           ed8          fg edP                    ddQ            Z emdRd          dS             Z emdTddUd" edV          fg edW                    dX             Z emdYg           dZ             Z emd[ddug  ed\           ed8          fd]d^g  ed_           ed`          fg eda          d          db             Z emdcdddd ede           edf          fg edg          d1          ddh            Z emdidddd ede           edf          fg edg          d1          ddj            Z emdkg           dl             Z emdmdd.g  edn           ed          fddod" edp          fddqd edr          fddsd edt          fddud edv          fddwd edx          fg          ddy            Z emdze!j         ed{          d          d|             Z emd}g  ed8                    d~             Z emdg de!j        z    ed          d1          d             ZŐd Z emdddd" ed          fddd ed          fddd" ed          fddd" ed          fge!j        z    ed          d          dd            ZdS (      N   )_)binhexnullrevshort)getattropen)6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revlogutils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)	constantsdebugdeltasnodemaprewritesidedatas   debugancestors   [INDEX] REV1 REV2T)optionalrepoc                 V   t          |          dk    rH|\  }}}t          j        t          j        t	          j                    d          |          }|j        }nkt          |          dk    r7|s!t          j        t          d                    |\  }}|j
        }|j        }n!t          j        t          d                    |                     ||           ||                    }|                     d|                    |          t          |          fz             dS )	z<find the ancestor revision of two revisions in a given index   Faudit   5   there 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rrX   as	            9/usr/lib/python3/dist-packages/mercurial/debugcommands.pydebugancestorrg   z   s    4yyA~~ tTM&*X_%6%6eDDDeLL	Ta 	+JKK   
dNk!EFFGGG	

66$<<..AHHZ15588SVV,,-----    s   debugantivirusrunningc                 :   |j                             dd          5 }|                    t          j        d                     ddd           n# 1 swxY w Y   t          j        d           t          j        |j                             d                     dS )z?attempt to trigger an antivirus scanner to see if one is activezeicar-test-file.com   wbsU   ST#=}P$fV?P+K%yP+C|uG$>GBDK|qyDK~v2MM*<JQY}+dK~6+LQba95PE<)&Nm5l)EmTEQR4qnHOhq9iNGnJxNrS   )	cachevfsr
   r\   r=   	b85decodetimesleepunlinkjoin)r^   r_   fs      rf   debugantivirusrunningrr      s     
		15	9	9 
Q	N1 	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 	JqMMMK""#899:::::s   (AAAs   debugapplystreamclonebundles   FILEc                     t          j        | |          }t          j        | ||          }|                    |           dS )z apply a stream clone bundle fileN)r   openpathr   
readbundleapply)r^   r_   fnamerq   gens        rf   debugapplystreamclonebundlery      s<     	BA

b!U
+
+CIIdOOOOOrh      debugbuilddag   ms   mergeable-files!   add single file mergeable changes   os   overwritten-files"   add single file all revs overwrite   ns   new-files   add new file at each revrh   s   from-existings$   continue from a non-empty repositorys   [OPTION]... [TEXT]Fc                 
  "#$ |;|                      t          d                     | j                                        }|j        }t          |          dk    r#|s!t          j        t          d                    d}t          j	        |          D ]\  }	}
|	dk    r|dz  }|r4d}d t          d||z            D             }|                    d	           g }|                     t          d
          t          d          |          }|5  |                                5  |                                5  |                    d          5  d}d}g $d}|                    |           t          j	        |          D ]b\  }	}
|	dk    r|                     dt%          j        |
          z             |
\  }}g }i "d}|r&d#||d                  }t          |          dk    r||d                  }|                    |          }#fd|||fD             \  }}}t+          j        |||          }d t+          j        |          d         D             }|                    d	           n6|dk    r.|#                                                             d          }n|}|||z  xx         d|z  z  cc<   d                    |          }|                    #           |"#<   |rd#|                    #           d|z  "#<   |rd|z  #|                    #           d|z  "#<   t          |          dk    r\|s||d                  }|D ]I##                    d          r2|                    #           |#                                         "#<   J"fd}t          |          dk    s|d         dk     rddg}n2t          |          dk    r$|d                  dg}n$fd|D             }t9          j        ||d|z  |||dfdd|i          }|                    |          } $                    |            |}n|	d k    r]|
\  }}!|                     d!|!z             |                    d"t?          |j                             |                    |!fz             n |	d#k    r|                     d$|
z             |
}|                    |           d|r.|j!        "                    d%d	                    |                     ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   ddd           dS # 1 swxY w Y   dS )&a  builds 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.
    Ns   reading DAG from stdin
r   s   repository is not emptyr}   r   rS   c                     g | ]}d |z  S )s   %d ).0is     rf   
<listcomp>z!debugbuilddag.<locals>.<listcomp>   s    OOOAeaiOOOrh   rh   s   buildings	   revisions)unittotals   builddag   defaults   node %s
s   mfc                 D    g | ]}|                                          S r   )data)r   xfns     rf   r   z!debugbuilddag.<locals>.<listcomp>  s2     . . .-.AbEJJLL. . .rh   c                 6    g | ]}|                                 S r   r7   r   ls     rf   r   z!debugbuilddag.<locals>.<listcomp>  s0        ! GGII  rh      
s    r%is   ofs   r%i
s   nf%is   nfc                 J    |v rt          j        | |||                   S d S N)r   
memfilectx)r_   cxpathfilecontents      rf   fctxfnzdebugbuilddag.<locals>.fctxfn:  s8    {**&1 "dK,=      4rh   c                      g | ]
}|         S r   r   )r   pnodeidss     rf   r   z!debugbuilddag.<locals>.<listcomp>F  s    3331GAJ333rh      r%irz      branch)dateuserextra   ls   tag %s
   %s %s
   as
   branch %s
s	   localtags)#statusr   finreadrZ   rU   r   rY   r   parsedagrangeappendmakeprogresswlockr   transactionupdatenoter(   bytestrr[   r3   
Merge3Textrender_minimizedr   splitrp   
startswithr   memctx	commitctxr   noder>   r\   )%r^   r_   textmergeable_fileoverwritten_filenew_filefrom_existingclr   typer   linesperrevinitialmergedlinesr8   progressatatbranchidpsfilesp2p1pabaselocalotherm3ml
mergedtextr   parsr   nodeidnamer   r   r   s%                                     @@@rf   debugbuilddagr      sC   D |
		!/00111v{{}}	B
2ww{{={k!677888 E(..  
d4<<QJE 'OOq%+:M1N1NOOO!!#&&&D	+Q|__E   H 
 \9 \94::<< \9 \9 \9 \9d.>.>{.K.K \9 \9#,T22 S	  S	 JD$t||(8(>(>>@@@B ! 1BbeB2ww{{!"Q%[[[__. . . .35r2,. . .*eU )3D%GG %0%A"%E%Ea%H   		#aV[[]]0077/rK'(((GbL8(((!&BJLL$$$&0KO# 4BLL$$$&.mKO 
@ 2BLL$$$&.mKO2ww{{! -!%beB"$ @ @B!}}U33 @ %R 0 0 024R&++--B          r77a<<2a5199 $<DDWW\\#BqEND1DD3333333D^RKa)$h/	 	 	 ++v&&&Dt+---J#dn.A.A".E.E*F*F)MMNNNN$.000OOB 	9HNN<$888y\9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9 \9s   U)&U;T:OT#	T:#T''T:*T'+T:.U:T>>UT>UU)U	U)U	U))U-0U-c           	      ^    d|z  |r                      dz              fd}                                  |d                                             |d           t          j        i           D ]}|d         } ||           d S t          t          j                  r!t          j	        t          d                                                                                     D ]4}|\  }	}
}}}}}}                     dt          |	          fz             5d S )	N    s3   %sformat: id, p1, p2, cset, delta base, len(delta)
c                 Z                        d| fz             
                                D ]z}|\  }}}}}}}}	                     dt          |          t          |          t          |          t          |          t          |          t          |          fz             {d S )Ns   
%s%s
s   %s%s %s %s %s %s %d
)r\   	deltaiterr   rU   )named	deltadatar   r   r   cs	deltabasedeltaflagsrM   rx   indent_stringr^   s             rf   
showchunksz%_debugchangegroup.<locals>.showchunksi  s    HH[M5#99::: ]]__  	FOCb"b)UE8,%D		BBBIE

	    rh   	   changelog   manifests   filenames   use debugbundle2 for this file   %s%s
)writenoi18nchangelogheadermanifestheaderiterfilelogheader
isinstancer   
unbundle20r   rY   r   r   r\   r   )r^   rx   allindentoptsr   	chunkdatarw   r   r   r   r   r   r   r   r   rM   r   s   ``               @rf   _debugchangegroupr   a  s   6MM
 $=
C	
 	
 	

	 	 	 	 	 	 	" 	
<   
;c/44 	 	Ik*EJu	 	 c7-.. 	D+a ABBCCC 	= 	=IBK?D"b"ixHHY-T!;;<<<<	= 	=rh   c                    t          j        |          }|                                }d|z  }	 t          j        |          \  }}d}|||t          |          fz  }|                     |           |                     d|          }	t          |          D ]U}
t          j
        d|
          }|	                                 |	                    |           t          j        |	|           V|	                                 dS # t           j        $ r<}d}|||j        t          |          fz  }|                     |           Y d}~dS d}~ww xY w)/display version and markers contained in 'data'r   s   %sversion: %d (%d bytes)
   debugobsoleteNs%   %sunsupported version: %s (%d bytes)
)r(   byteskwargsr   r"   _readmarkersrU   r\   r   sortedr#   marker	startitemplainr   
showmarkerendr   UnknownVersionversion)r^   partr   r   r   r   r   markersmsgfm	rawmarkermexcs                rf   _debugobsmarkersr    sL   %%D99;;D6MM#066 ,}gs4yy00
\\*D11 	& 	&ItY//ALLNNNHH]###r1%%%%
    7}ck3t9944
s   D E1E		Ec                    d|z  }t          j        |          }t           j        D ]Y}||         D ]N}|                     |           |                     dt	          |          t           j        |         fz             OZdS )r   r   r   N)r%   binarydecode	allphasesr\   r   
phasenames)r^   r   r   r   headsbyphasephaseheads          rf   _debugphaseheadsr	    s    6MM&t,,L! I I ' 	I 	IDHH]###HHZ3t99f.?.F"GGHHHH	II Irh   c                      t           t          t          j        t          j        f          r1dd                     fdt                     D                       z  S t          j	        t                               S )Ns   {%s}   , c              3   2   K   | ]}d ||         fz  V  dS )s   %s: %sNr   )r   kthings     rf   	<genexpr>z_quasirepr.<locals>.<genexpr>  s0      HHQyAuQx=0HHHHHHrh   )r   dictr=   sortdictcollectionsOrderedDictrp   r   r(   r   repr)r  s   `rf   
_quasireprr    sq    %${/FGHH 
JJHHHH&--HHHHH
 	
 DKK(((rh   c                    t          |t          j                  s!t          j        t          d                    |                     dt          |j                  z             |	                    dg           }|
                                D ]}|r
|j        |vrd}|                     ||j        t          |j                  |j        fz             |j        dk    rI|j        	                    dd          }t          j        ||d          }| j        st!          | |f|d	d
| |j        dk    r| j        st#          | |fdd	i| |j        dk    r| j        st%          | |d	           dS )zlists the contents of a bundle2s   not a bundle2 files   Stream params: %s
	part_types   %s -- %s (mandatory: %r)
s   changegroups   versions   01s   UN   )r   r   s
   obsmarkersr   s   phase-heads)r   N)r   r   r   r   rY   r   r\   r  paramsget	iterpartsr   	mandatoryr   getunbundlerquietr   r  r	  )	r^   rx   r   r   	parttypesr   r   r   cgs	            rf   _debugbundle2r!    s   c7-.. 4k!122333HH$z#*'='==???b))I 5 5 	)33+
#Jt{$;$;T^LLNNN9&&kooj%88G)'4??B8 E!"bDc!DDtDDD9%%8 = T<<!<t<<<9&&8 5 T!44445 5rh   s   debugbundler      alls   show all detailss	   part-types   show only the named part types   specs"   print the bundlespec of the bundle)norepoc                    t          j        | |          5 }|r;t          j        | |          }|                     d|z             	 ddd           dS t          j        | ||          }t          |t          j                  rt          | |fd|i|cddd           S t          | |fd|i| ddd           dS # 1 swxY w Y   dS )zlists the contents of a bundle   %s
Nr   )r   rt   r   getbundlespecr\   ru   r   r   r   r!  r   )r^   
bundlepathr   specr   rq   rx   s          rf   debugbundler)    s^    
R	$	$ 	4 	)"a00DHHWt^$$$		4 	4 	4 	4 	4 	4 	4 	4 !"a44c7-.. 	; S::c:T::	4 	4 	4 	4 	4 	4 	4 	4 	"c33s3d333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s   1B=?B= B==CCs   debugcapabilitiess   PATHc                 j   t          j        |          }t          j        | ||          }	 |                                }|                     d           t          |          D ]}|                     d|z             t          j	        |          }|rq|                     d           t          |
                                          D ]:\  }}|                     d|z             |D ]}	|                     d|	z             ;|                                 dS # |                                 w xY w)z'lists the capabilities of a remote peers   Main capabilities:
     %s
s   Bundle2 capabilities:
s       %s
N)r(   r   r   peercapabilitiesr   r   r\   r   bundle2capsitemsclose)
r^   r   r   r,  capscb2capskeyvaluesvs
             rf   debugcapabilitiesr7    s4    %%D72tT""D  ""
./// 	$ 	$AHHY]####$T** 	.NN5666%fllnn55 . .VS))) . .AHH[1_----. 	



s   CD D2s   debugchangedfiles)rh   s   computeFs6   compute information instead of reading it from storages   REVc                 v   t          j        ||d          }d}|d         rt          j        |          }na|j                            |                                          }|                    t
          j                  }|t          j	        |          }|t          |j                  D ]}||j        v rd}	n&||j        v rd}	n||j        v rd}	n||j        v rd}	nd}	d}
d}||j        v rd	}
|j        |         }n||j        v rd
}
|j        |         }|	|
||f}d}|                     ||z             dS dS )z,list the stored files changes for a revisionNcompute   added   removeds   mergeds   salvageds   touchedrh      p1   p2s   %-8s %2s: %s, %s;
)r   	revsingler!   compute_all_files_changesrZ   rM   r]   r  SD_FILESdecode_files_sidedatar   touchedaddedremovedmergedsalvagedcopied_from_p1copied_from_p2r\   )r^   r_   r]   r   ctxr   sdfiles_blockrq   actioncopy_parentcopy_sourcer   templates                 rf   debugchangedfilesrP    s    
tS$
/
/CEI 72377^$$SWWYY//ffX.//"2266E&& 	& 	&AEK!em###el"""en$$$#KKE(((##215e***##215KK8D-HHHX_%%%%1 	& 	&rh   s   debugcheckstatec                    |j                                         \  }}||                                         }||                                         }d}|j                             ||          D ]-}|                     |d         |dd         z             |dz  }.|r#t          d          }t          j        |          dS )z0validate the correctness of the current dirstater   r   Ns8   .hg/dirstate inconsistent with current parent's manifest)dirstateparentsmanifestverifywarnr   r   rY   )	r^   r_   parent1parent2m1m2errorserrerrstrs	            rf   debugcheckstater^  ,  s     },,..GW	g			!	!B	g			!	!BF}##B++  
AQRR !!!! "NOOk&!!!" "rh   s
   debugcolors   styles   show all configured styless   hg debugcolorc                     |                      dt          j        | j                  z             |                    d          rt          |           S t          |           S )z&show available color, effects or styles   color mode: %s
style)r   rF   pprint
_colormoder  _debugdisplaystyle_debugdisplaycolorr^   r_   r   s      rf   
debugcolorrf  ;  sY     NN&):2=)I)IIJJJxx &!"%%%!"%%%rh   c                    |                                  } | j                                         t          j        |                                           D ]}|| j        |<   | j        rj|                     d          D ]T\  }}|                    d          r|dd          | j        |<   -|                    d          r|dd          | j        |<   U| 	                    t          d                     t          | j                                        d           }|D ]\  }}| 	                    d	|z  |
            d S )Ns   colors   color.   s	   terminfo.	   s   available colors:
c                 4    d| d         v | d         | d         fS )N   _r   r   r   )r   s    rf   <lambda>z$_debugdisplaycolor.<locals>.<lambda>V  s    dadlAaD!A$5O rh   r4  r%  label)copy_stylesclearr   _activeeffectskeys_terminfoparamsconfigitemsr   r\   r   r   r/  )r^   effectr  r6  r/  	colornamero  s          rf   rd  rd  I  sN   	BJ&r**//11 $ $#
6	 &NN8,, 	& 	&DAq||I&& & !!""
1l++ & !!""
1HHQ%&&'''2:##%%+O+OPPPE! 3 3	5
9$E22223 3rh   c                 v                          t          d                      j        sd S t          d  j        D                       }t	           j                                                  D ]\  }}                      d|z  |           |r                      d                                 dt          d|t          |          z
            z                                   d                     fd	|                                D                                                        d
           d S )Ns   available style:
c              3   4   K   | ]}t          |          V  d S r   rU   r   ss     rf   r  z%_debugdisplaystyle.<locals>.<genexpr>_  s(      ++1A++++++rh      %srn  s   : r   r   r  c              3   D   K   | ]}                     ||          V  d S r   rn  )r   er^   s     rf   r  z%_debugdisplaystyle.<locals>.<genexpr>f  s/      HH1AHHHHHHrh   r   )	r\   r   rq  maxr   r/  rU   rp   r   )r^   widthro  effectss   `   rf   rc  rc  [  s(   HHQ$%%&&&: ++
+++++E !1!1!3!344  w
e,,, 	JHHUOOOHHTSECJJ$6778999HHUZZHHHHHHHHHIII
 rh   s   debugcreatestreamclonebundlec                 V   t          j        |          r"|                     t          d                     t	          j        |          \  }}t          j        | ||           |                     t          d          d	                    t          |                    z             dS )zcreate 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)
s   bundle requirements: %s
r  N)r%   	hassecretrV  r   r6   generatebundlev1r   writechunksr\   rp   r   )r^   r_   rw   r,   rx   s        rf   debugcreatestreamclonebundler  j  s      

  	
 	
 	
 $4T::L#BU+++HHQ+,,uzz&:N:N/O/OOPPPPPrh   s   debugdag   ts   tagss   use tags as labels   b   branchess   annotate with branch namess   dotss   use dots for runs   ss   spacess   separate elements by spacess   [OPTION]... [FILE [REV]...]c           	      6   |                     d          }|                     d          }|rMt          j        t          j        t	          j                    d          |          d D             fd}n|r|j        |                     d          |                     d          rji |                                                                D ]A\  }}		                    
                    |	          g                               |           Bfd	}n!t          j        t          d
                    t          j         |            |dd||d          D ],}
|                     |
           |                     d           -dS )a  format 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dotsFrQ   c                 ,    h | ]}t          |          S r   )int)r   rd   s     rf   	<setcomp>zdebugdag.<locals>.<setcomp>  s    %%%1A%%%rh   c            	   3      K   D ]C} d| t          d                     |           D                       ffV  | v rd| d| z  ffV  Dd S )Nr}   c              3   &   K   | ]}|d k    |V  dS r   Nr   r   r   s     rf   r  z+debugdag.<locals>.events.<locals>.<genexpr>  s&      $N$N1a2ggQgggg$N$Nrh   r   r   )list
parentrevs)rd   revsrlogs    rf   eventszdebugdag.<locals>.events  s|       0 0Q$N$N0B0B$N$N$N N NOOOOO99FQJ////0 0rh   r8   branchesc            	   3   R  K   d} D ]}rB                                         |                    d         d         }|| k    rd|fV  |} d|t          d                     |          D                       ffV  r$                    |          }|r|D ]
}d||ffV  d S )Nr      r   r   r}   c              3   &   K   | ]}|d k    |V  dS r  r   r  s     rf   r  z+debugdag.<locals>.events.<locals>.<genexpr>  s&      $L$L1AGGQGGGG$L$Lrh   r   )r   r   r  r  r  )	brd   newblsr   r  r   labelsr8   s	        rf   r  zdebugdag.<locals>.events  s      A / / !772771::..q1)<Dqyy"Dj((( Q$L$La0@0@$L$L$L L LMMMMM /AB /!# / /A"&A,..../ /rh   s   need repo for changelog dagTF   )	addspaces
wraplabelswrapannotationswrapnonlinearusedotsmaxlinewidthr   N)r  r-   rV   r>   r   rW   rZ   r8   r/  
setdefaultr]   r   r   rY   r   r   dagtextlinesr\   )r^   r_   file_r  r   r  r  r  r   nliner  r   r  r  r8   s      `       @@@@@rf   debugdagr    s   & XXhF88FD #=}VZ(9(9GGGOO%%%%%	0 	0 	0 	0 	0 	0 	0 
 =^xx88J'' 	;F		))++ ; ;1!!"&&))R0077::::	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/  k!:;;<<<&   
 
 	

 
rh   	   debugdatas   -c|-m|FILE REVc                 P   t          j        |          }|                    d          s*|                    d          s|                    d          r)|"t          j        dt          d                    d|}}n$|"t          j        dt          d                    t          j        |d||          }	 |                     |	                    |
                    |                               dS # t          $ r% t          j        t          d          |z            w xY w)z)dump the contents of a data file revisionr   r      dirNr     invalid arguments   invalid revision identifier %s)r(   r   r  r   CommandErrorr   r   openstorager\   rawdatarX   KeyErrorrY   )r^   r_   r  r]   r   rd   s         rf   	debugdatar    s%    %%Dxx H+!6!6 H$((6:J:J H?$\15I3J3JKKK5s	 q1E/F/FGGGD,t<<AF
188C==))***** F F Fk!=>>DEEEFs   9;C6 6/D%s	   debugdate   es   extendeds   try extended date formatss   [-e] DATE [RANGE])r#  rN   c                    |d         r t          j        |t           j                  }nt          j        |          }|                     d|z             |                     dt          j        |          z             |r=t          j        |          }|                     d ||d                   z             dS dS )zparse and display a dateextendeds   internal: %d %d
s   standard: %s
s
   match: %s
r   N)rD   	parsedateextendeddateformatsr   datestr	matchdate)r^   r   r   r   dr   s         rf   	debugdater    s     J %tX%ABBt$$NN'!+,,,NN$x'7':'::;;; 1u%%
~!A$/000001 1rh      debugdeltachains
   -c|-m|FILEc                   "#$% t          j        |          }t          j        |d||          $$j        #$j        }$j        }$j        "t          $dd          }t          #          %"#$%fd}| 
                    d|          }|                    d           |r|                    d           |                    d           i }	$D ]}
 ||
          \  }}}}}}}|d         }|	                    |t          |	          d	z             } ||          } ||
          }||z   |z
  }||z
  }	 |d
         }n# t          $ r d}Y nw xY w|dk    r t          |          t          |          z  }n|}|dk    r t          |          t          |          z  }n|}|                                 |                    dd|
|||t          |          ||||||||||
|t          |          |||||||||           |rd}d}d}t#          j        $|          D ]K}|d	z  } ||d                    ||d                   z   }| ||d                   z
  } || z  }|| k     r| }L|r t          |          t          |          z  }!nd	}!|                    dd|||!||||!|
  
         |                    d           |                                 dS )a	  dump information about delta chains in a revlog

    Output can be templatized. Available template keywords are:

    :``rev``:       revision number
    :``p1``:        parent 1 revision number (for reference)
    :``p2``:        parent 2 revision number (for reference)
    :``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
                    - base:  a full snapshot
                    - snap:  an intermediate snapshot
                    - p1:    a delta against the first parent
                    - p2:    a delta against the second parent
                    - skip1: a delta against the same base as p1
                              (when p1 has empty delta
                    - skip2: a delta against the same base as p2
                              (when p2 has empty delta
                    - prev:  a delta against the previous revision
                    - other: a delta against an arbitrary revision
    :``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
    r  _withsparsereadFc                    |          }|t           j                 }|t           j                 }d}|t           j                 }|t           j                 }|t           j                 }|}|t          k    rn|k     rh|         }	|	t           j                 dk    rJ|	t           j                 }
|
|k    s|
t          k    s|
k    rn |
}|         }	|	t           j                 dk    J|}|t          k    rn|k     rh|         }|t           j                 dk    rJ|t           j                 }
|
|k    s|
t          k    s|
k    rn |
}|         }|t           j                 dk    JrT||k    rd}nV||k    rd}nM|| k    rd}nD||k    rd}n;||k    rd}n2                    |           rd}n|| dz
  k    rd	}nd
}n|| k    rd}nd	}                    |           d         }|D ]}|         }||t           j                 z  } |||||||fS )Nr   r<  r=  s   bases   skip1s   skip2s   snapr   s   prev   other)	revlog_constantsENTRY_DATA_COMPRESSED_LENGTHENTRY_DATA_UNCOMPRESSED_LENGTHENTRY_DELTA_BASEENTRY_PARENT_1ENTRY_PARENT_2r   
issnapshot_deltachain)r]   r  compsize
uncompsize	chainsizer   r   r   p1_basee1new_basep2_basee2	deltatypechainiterrevgeneraldeltara   rd   
total_revss                   rf   revinfoz debugdeltachain.<locals>.revinfo-  sl   #J%BC'FG
	!23././ ==R*__rB%BCqHH.?@''7**:--"7^ %BCqHH ==R*__rB%BCqHH.?@''7**:--"7^ %BCqHH  	$rzz!		!		#		$		$		c"" %#		q#		$		s{{#		#	c""1% 	J 	JGgA+HIIII2xYyHHrh   s       rev      p1      p2  chain# chainlen     prev   delta       size    rawsize  chainsize     ratio   lindist extradist extraratios)      readsize largestblk rddensity srchunksr   r   r   r   sr   rev p1 p2 chainid chainlen prevrev deltatype compsize uncompsize chainsize chainratio lindist extradist extraratios?   %7d %7d %7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f)r]   chainidchainlenprevrevr  r  r  r  
chainratiolindist	extradist
extraratios*   readsize largestblock readdensity srchunkss    %10d %10d %9.5f %8d)readsizelargestblockreaddensitysrchunksN)r(   r   r   
openrevlogra   startlength_generaldeltar	   rU   r   r   r  
IndexErrorfloatr   r\   	deltautil
slicechunkr   )&r^   r_   r  r   r  r  withsparsereadr  r   
chainbasesr]   r   r   compuncompr  r  r  	chainbaser  	basestartrevstart
lineardistr  r  r  r  r  r  r  	revschunkblkendblksizer  r  ra   rd   r  s&                                     @@@@rf   debugdeltachainr    s   j %%D4!3UDAAAGEGEXF?LQ 1599N UJGI GI GI GI GI GI GI GIR 
($	/	/BHH	  
  ?
=>>>HHUOOOJ X X<CGCLL9Bfi	!H	''	3z??Q3FGGE)$$	5::_y0
*		BiGG 	 	 	GGG	 Q;;y))E&MM9JJ"J>>y))E),<,<<JJ"J

 OJJZZ!!= 	 	
 	
 	
@  	HLH&1!U;; + +	Ay}--y}0E0EE 551#6#66G#'))#*L  #I..x@HH='!)'!     	FFHHHHHs   7E  EEs   debug-delta-findc           	      L   t          j        |          }|d}|}n|}|}t          |          }t          j        |d||          }t          j        || j        | j                   } |j	        |          }	 |j
        |          \  }
} |j	        |
          } |j	        |          } |j        |          g}t          |d                   }d} |j        |          }t          j        |	||||||          } |j                    }|                    |||           dS )a  display the computation to get to a valid delta for storing REV

    This command will replay the process used to find the "best" delta to store
    a revision and display information about all the steps used to get to that
    result.

    The revision use the revision number of the target storage (not changelog
    revision number).

    note: the process is initiated from a full text of the revision to store.
    Nr  )write_debugdebug_searchr   )
target_rev)r(   r   r  r   r  r  deltacomputerr\   r  r   r  revisionrU   r   r.   revisioninfo_datafpfinddeltainfo)r^   r_   arg_1arg_2r   r  r]   r-   r  r   p1rp2rr   r   btexttextlen
cachedeltar   r  fhs                       rf   debugdeltafindr    sT   $ %%D}
c((C&8%FFF+H\  M 6;sD v %%HC	S		B	S		BV_S!!"E%(mmGJFLE&

 G 
		B<<<<<rh   s   debugdirstate|debugstates   nodatess+   do not display the saved mtime (DEPRECATED)s   datess   display the saved mtimes   datesorts   sort by saved mtimes   dockets*   display the docket (metadata file) insteads9   display dirstate-v2 tree nodes that would not exist in v1s   [OPTION]...c           	         |                     d          r|j        j        s!t          j        t          d                    |j        j        j        }t          j	        j
                            |j                  \  }}}}}}	}
|                     t          d          |j        z             |                     t          d          |j        z             |                     t          d          |z             |                     t          d          |z             |                     t          d          |z             |                     t          d          |z             |                     t          d	          |z             |                     t          d
          t!          j        |
          z             dS |d          }|                     d          d}|                     d          }|rd }nd}t%          |j        j                            |d                             }|                    |           |D ]}|\  }}}}}|dk    rd}n@|rd}n;t+          j        dt+          j        |                    }t1          j        |          }|dz  rd}nd|dz  t4          j         z  z  }|                     d|||||fz             |j                                        D ]A}|                     t          d          |j                            |          |fz             BdS )z)show the contents of the current dirstatedockets"   dirstate v1 does not have a dockets   size of dirstate data: %d
s   data file uuid: %s
s   start offset of root nodes: %d
s   number of root nodes: %d
s   nodes with entries: %d
s   nodes with copies: %d
s   number of unused bytes: %d
s   ignore pattern hash: %s
NdatesnodatesTdatesortc                     | \  }}}}}||fS r   r   )entryfilename_state_mode_sizemtimes         rf   keyfunczdebugstate.<locals>.keyfuncY  s    491HfeUE8$$rh   r   )r   rm  r   s   unset               s   set                 z%Y-%m-%d %H:%M:%S i    s   lnks   %3oi  s   %c %s %10d %s%s
s   copy: %s -> %s
)r  rR  _use_dirstate_v2r   rY   r   _mapr  r   v2TREE_METADATAunpacktree_metadatar\   	data_sizeuuidbinasciihexlifyr  
debug_itersortrm   strftime	localtimer   
strtolocalr=   umaskr   copied)r^   r_   r   r  start_offset
root_nodesnodes_with_entrynodes_with_copyunused_bytes_unusedignore_patternr  r  r  entriesr  r  statemodesizer  timestrrq   s                          rf   
debugstater;    sT   : xx }- 	H+a EFFGGG#* *11&2FGG	
 	122V5EEFFF
*++fk9:::
677,FGGG
011J>???
.//2BBCCC
-..@AAA
233lBCCC
*++h.>~.N.NN	
 	
 	
 	w-Gxx	&xx
##H 	% 	% 	% 	%
 4=%00T%[0AABBGLLWL P P-2*%tUB;;-GG 	3-GGm$8$.:O:OPPG)'22G'> 	9DDTE\TZK78D
%dGX(NNOOOO]!!## H H
&''4=+?+?+B+BA*FFGGGGH Hrh   s   debugdirstateignorepatternshashc                     |j         j        rO|j         j        j        }d}|j        | d         }|                     t          j        |          dz              dS dS )z^show the hash of ignore patterns stored in dirstate if v2,
    or nothing for dirstate-v2
       Nr   )rR  r  r  r  r#  r\   r&  r'  )r^   r_   r   r  hash_len
hash_bytess         rf   debugdirstateignorepatternshashr@  s  sh     }% 7#*)8)**5

!*--566666	7 7rh      debugdiscovery   olds   use old-style discovery   nonheadss/   use old-style discovery with non-heads included   revs&   restrict discovery to this set of revs)rh      seeds   12323s)   specify the random seed use for discovery)rh   s   local-as-revsrh   s+   treat local has having these revisions only)rh   s   remote-as-revsrh   s.   use local as remote, with only these revisionss   [--rev REV] [OTHER]r   c           	         #$%& t          j                                                  }d         }d         &t          j        t          d                              &sht          j        d |          \  }}t          j	        |          } 
                    t          d          t          j        |          z             nsdg f}t          j        |d&z  g          %t          %          %%fd}|t           j        d	<   	                                }|j                            d	          |_        |rQt          j        |d|z  g          $t          $          $$fd
}	|	t           j        d<                       d          i #                    d          r|f#& fd	}
n	|f# fd	}
t          j        ||d          \  }}d         }                     d          }|j        rt0          j        # fd            }nt4          j        } |            5  t5          j        d          5 } |
||          \  }}ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   t;          |          dk    rj        |v rt?                      }t?          |          }t?          |          }t?                                                     }||z  }||z  }||z  |z  }!                    d          }!                    d|          }!                    d|          }!                    d|          }!                    d|          }!                    d|          }t;          |          t;          |          z   t;          |          k    sJ !                    d||          }!                    d|          }!                    d|          } ||z  }!||z  }"|j"        #d<   t;          |          #d<   t;          |          #d<   t;          |          #d<   t;          |          #d<   t;          |          #d <   t;          |          #d!<   t;          |          t;          |          z
  #d"<   t;          |          #d#<   t;          |          t;          |          z
  #d$<   t;          |          #d%<   t;          |          #d&<   t;          |          #d'<   t;          |          #d(<   t;          |          #d)<   t;          |          #d*<   t;          |          #d+<   t;          |           #d,<   t;          |!          #d-<   t;          |"          #d.<   |#                                  |j$        dVi t          j%        #           |&                    d/#z             |&                    d0#z             d1#v r|&                    d2#z             d3#v r|&                    d4#z             d5#v r|&                    d6#z             |&                    d7#z             d8#v r|&                    d9#z             d:#v r|&                    d;#z             |&                    d<           |&                    d=#z             |&                    d>#z             |&                    d?#z             |&                    d@#z             |&                    dA#z             |&                    dB#z             |&                    dC#z             |&                    dD#z             |&                    dE#z             |&                    dF#z             |&                    dG#z             |&                    dH#z             |&                    dI#z             |&                    dJ#z             |&                    dK#z             |&                    dL#z             |&                    dM#z             |&                    dN#z             |&                    dO#z             |&                    dP#z             |&                    dQ#z             |&                    dR#z              j'        rB|&                    dSdT(                    tS          dU |D                                 z             |*                                 dS )Wa  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. In the same way, the usual `remote` peer
    can be "replaced" by a subset of the local repository using the
    `--remote-as-revs` flag. This is useful to efficiently debug pathological
    discovery situations.

    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_revss   remote_as_revsrE  rA  s   comparing with %s
Ns   not (::(%s))c                     S r   r   )r   remote_filtered_revss    rf   remote_funcz#debugdiscovery.<locals>.remote_func  s	    ''rh      debug-discovery-remote-filterc                     S r   r   )r   local_filtered_revss    rf   
local_funcz"debugdiscovery.<locals>.local_func  s	    &&rh   s   debug-discovery-local-filterrB  c           	      .   t          j        |d          sIt          j        |                                          }
r!|j                            d          }||_        t          j        |d          \  }}}t          |          }	
                    d          sr                    dd                    t          d |D                                 z             j        j                            d	|          }fd
|D             }||fS )Nr  rJ  T)forcerR   rC  s   unpruned common: %s
r   c              3   4   K   | ]}t          |          V  d S r   r   r   r  s     rf   r  z/debugdiscovery.<locals>.doit.<locals>.<genexpr>	  s(      &@&@AuQxx&@&@&@&@&@&@rh   s   heads(::%ln)c                 &    h | ]} |          S r   r   )r   rd   clnodes     rf   r  z/debugdiscovery.<locals>.doit.<locals>.<setcomp>  s!    444&&))444rh   )r=   safehasattrr   locallegacypeerr   _repofilteredr:   findcommonincomingsetr  r   rp   r   rZ   r   r  )
pushedrevsremoteheadsremoterd   common_inhdsrT  r   r   remote_revsr_   r^   s          @rf   doitzdebugdiscovery.<locals>.doit  s%   #FK88 %"26<<>>BB %--.NOOA#$FL,?fD     FC [[F88K(( 5,ii&@&@&@&@&@ @ @AAB  
 ,?F;;4444V4443;rh   c                     d }| r#t          j        	|           }	fd|D             }t          j        
	||d          \  }}}||fS )Nc                 D    g | ]}|                                          S r   r   r   rd   r_   s     rf   r   z0debugdiscovery.<locals>.doit.<locals>.<listcomp>  s%    666Aa666rh   F)ancestorsofrR   abortwhenunrelated)r   revranger2   findcommonheads)r[  r\  r]  nodesr  r^  anyr`  r   r_   r^   s           rf   rb  zdebugdiscovery.<locals>.doit  sw    E 7!*4<<6666666+;!#(     FC 3;rh   )r  rD  c               3   j   K                                     d V                                   d<   d S )N   output)
pushbuffer	popbuffer)r   r^   s   rf   may_capture_outputz*debugdiscovery.<locals>.may_capture_output(  s2      MMOOOEEE llnnDOOOrh   zdebug-discoveryr   s   all()s   ::%lns   roots(::%ld)s	   not ::%lds
   heads(%ld)s
   roots(%ld)s   not (::%ln or %ln::)s   elapseds   nb-common-headss   nb-common-heads-locals   nb-common-heads-remotes   nb-common-heads-boths   nb-common-rootss   nb-head-locals   nb-head-local-missings   nb-head-remotes   nb-head-remote-unknowns   nb-revss   nb-revs-commons   nb-revs-missings   nb-missing-headss   nb-missing-rootss
   nb-ini_unds   nb-ini_und-headss   nb-ini_und-rootss   nb-ini_und-commons   nb-ini_und-missings#   elapsed time:  %(elapsed)f seconds
s-   round-trips:           %(total-roundtrips)9d
s   total-round-trips-headss5     round-trips-heads:    %(total-round-trips-heads)9d
s   total-round-trips-branchess;     round-trips-branches:    %(total-round-trips-branches)9d
s   total-round-trips-betweens9     round-trips-between:    %(total-round-trips-between)9d
s*   queries:               %(total-queries)9d
s   total-queries-branchess3     queries-branches:    %(total-queries-branches)9d
s   total-queries-betweens2     queries-between:     %(total-queries-between)9d
s   heads 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
s   common heads: %s
r   c              3   4   K   | ]}t          |          V  d S r   rQ  rR  s     rf   r  z!debugdiscovery.<locals>.<genexpr>  s(      >>AuQxx>>>>>>rh   r   )+r(   r   
unfilteredrandomseedr  rG   get_unique_pull_pathr   r,  r   r   hidepasswordr   ri  	frozensetr+   filtertablerW  rX  r  addbranchrevsr   strict_format
contextlibcontextmanagerr=   nullcontextmanagertimedcmrU   nullidrZ  headsr  elapsedr   r   	strkwargsr   verboserp   r   r   )'r^   r_   	remoteurlr   unfi
local_revsr  r]  rI  rM  rb  
remoterevs	_checkout	localrevsr   rq  tr^  r`  heads_commonheads_remoteheads_localheads_common_localheads_common_remoteheads_common_bothr   roots_commonmissingheads_missingroots_missinginitial_undecidedheads_initial_undecidedroots_initial_undecidedcommon_initial_undecidedmissing_initial_undecidedr   rL  rH  ra  s'   `` `                               @@@@rf   debugdiscoveryr    s
   R %%D??D &'J()K KDM""### O%:tR
 
	8 tY//
		!*++g.B9.M.MMNNNN":)2?[01 
  
  ))=>>	( 	( 	( 	( 	( BM=>|,,-MNN 
>(1?Z/0
 
 ((;<<	' 	' 	' 	' 	' AK<=}}<==Dxx '17 	 	 	 	 	 	 	 	 	 	 	0 28 	 	 	 	 	 	 	 	 ,T68$OOOJ	VI	'	.	.B	 	5		"	- 	- 	- 	- 	- 
#	"	- 	- "4				 6 6\+,, 	6$y*55KFC	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	66 6 6 6 6 6 6 6 6 6 6 6 6 6 6
 6{{aDK611v;;Ls88Ldjjll##K &3&5$|3kA
))H

CYYx((F99_f55Liif--GIImW55MIImW55Mv;;W%S1111		!46H  #ii7HII"ii7HII069 1G ;yD"<00D	%();%<%<D	!"&)*=&>&>D	"#$'(9$:$:D	 !"<00D	 --D	%(%5%5<N8O8O%OD	!"!,//D	&),&7&7#; ; 'D	"# 3xxD!&kkD	"7||D	 #M 2 2D	 #M 2 2D	/00D #$; < <D	 #$; < <D	!$%=!>!>D	"%&?"@"@D	LLNNNBG''h &&'''HH4t;<<<HH>EFFF!T))
EL	
 	
 	
 %,,
K	
 	
 	
 $t++
IDP	
 	
 	
 HH;dBCCC D((
H4OPPP4''
G$NOOOHH !!!HH=DEEEHHCdJKKKHHDtKLLLHHBTIJJJHH;dBCCCHHCdJKKKHHCdJKKKHH<tCDDDHHDtKLLLHHDtKLLLHH5<===HH<tCDDDHH=DEEEHH=DEEEHH=DEEEHH>EFFFHH>EFFFHH84?@@@HH>EFFFHH>EFFFHH?$FGGGHH@4GHHH	z 

!ii>>>>>>>??@	
 	
 	
 FFHHHHHs6   2I:I#I:#I'	'I:*I'	+I::I>I>i   s   debugdownloadrn  s   pathc                 j   t          j        | ||          }| }|rt          |dt                    }	 |                    t                    }|r1|                    |           |                    t                    }|1|r|                                 dS dS # |r|                                 w w xY w)z4download a resource using Mercurial logic and configrj   N)urlmodr
   
_chunksizer   r\   r0  )r^   r_   r<   outputr   r  destr   s           rf   debugdownloadr    s     
Rf	%	%BD /FE:..wwz"" 	'JJt77:&&D  	'  	JJLLLLL	 	6 	JJLLLL	s   AB B2   debugextensionsc           
         t          j        |          }t          j        |           }t          j                    }|                     d|          }t          |t          j        d                    D ]?\  }}t          j	        |          }d}	t          j
        |d          rt          j        |j                  }	n"t          t          dd          rt           j        }	|rg }
n#t          |dd	                                          }
t          |d
d          }|                                 | j        s| j        r|                    dd|           nx|                    dd|           |s||
v r|                    d           nE|
s#|                    t-          d                     n |
d         }|                    d|z             |                    | j        o|	dt-          d          |	pd	           | j        r-|                    t-          d          ddg|         z             |                    |           |                    | j        o|
dt-          d          |                    |
d                     |                    | j        o|dt-          d          |pd	           A|                                 dS )z(show information about active extensionsr  r   rm  N__file__oxidizedF
testedwithrh   buglink   namer%  r~  r   s    (untested!)
r   s    (%s!)
s   sources     location: %s
s     bundled: %s
   no   yes)bundleds
   testedwiths     tested with: %s
s   verr   s   buglinks     bug reporting: %s
)r(   r   r   r=   r   r   r   operator
itemgetterismoduleinternalrU  fsencoder  r	   syssysexecutabler   r   r  r  r\   r   r   	condwriter   
formatlistr   )r^   r_   r   extshgverr   extnameextmod
isinternal	extsourceexttestedwith
extbuglinklasttestedversions                rf   debugextensionsr    s    %%D $$DLNNE	($	/	/B!$H,?,B,BCCC 3
 3
088
	FJ// 	/ )&/::IIS*e,, 	/ .I 	GMM#FL#>>DDFFMVY55

8 
	:rz 
	:HHWgw////HHWeW--- :Um33" :,--....$1"$5!'88999
J$9!""		
 	
 	
 : 	JHHQ)**eV_Z-HHIII

###
J(=$%%MM-fM55		
 	
 	
 	J%:&''#		
 	
 	
 	
 FFHHHHHrh   s   debugfileset   rs#   apply the filespec on this revisions	   all-filess3   test files from all revisions and working directorys   show-matchers(   print internal representation of matcher   ps
   show-stages$   print parsed tree at the given stages   NAMEs+   [-r REV] [--all-files] [OPTION]... FILESPECc                    ddl m} |j         t          j        |          }t          j        ||                    d          d          }dt          j        fdt          j
        fdt          j        fg}d |D             }t                      }| j        r|d	         s|                    d           |d	         d
gk    r|                    |           nN|d	         D ]*}	|	|vr$t!          j        t%          d          |	z            +|                    |d	                    t          j        |          }
|D ]b\  }	} ||
          }
|	|v rN|d	         s|	dk    r|                     d|	z             |                     t          j        |
          d           ct                      }|d         rN|D ]K}||         }|                    |                                           |                    |j                   L|d         s|                                x|d         }|                    |j                            t7          j        |          t;          |j                  dd                     |                    |j                   nA|                    |                                           |                    |j                   |                    |                                |          }|d         s|d         0| j        r)|                      dtC          j"        |          d           tG          |          D ]&} ||          s|                     d|z             'dS )z'parse and apply a fileset specificationr   )filesetrD  N   parsed   analyzed	   optimizedc                     h | ]\  }}|S r   r   r   r  rq   s      rf   r  zdebugfileset.<locals>.<setcomp>%      '''1!'''rh   
   show_stager"     invalid stage name: %s   * %s:
r   s	   all_filesT)subreposunknownignoreds   show_matcher   * matcher:
r%  )$ r  symbolsr(   r   r   r>  r  identityr   analyzeoptimizerZ  r  addr   r   rY   r   parser\   prettyformatr   substater]   rR  walkr1   matchallr  matchfilesetrW   r   rF   
prettyreprr   )r^   r_   exprr   r  rI  stages
stagenames
showalwaysr  treerq   r   rd   r2  wctxr   s                    rf   debugfilesetr    s   D OO%%D

tTXXf%5%5t
<
<C 
H%&	k)*	{+,F
 (''''JJ	z "$}- "y!!!Mvh&&*%%%%m$ 	D 	DA
""k!$=">">"BCCC #$}-...T""D < <1qww
??M" )a9nna(((HH[-d33U;;;EEEL % 	% 	%AQALL###LL$$$$L #SWWYY.DzM &&dm,,	   	
 	
 	
 	T]####SYY[[!!!S\"""--AO Io!6!>2:!>

(=a(@(@%HHHE]]  qtt 	
1 rh   s   debug-repair-issue6528s	   to-reports1   build a report of affected revisions to this files   from-reports+   repair revisions listed in this report files   paranoids3   check that both detection methods do the same thingc                 ~   t          j        |dddg           |                    d          }|                    d          }|                    d          }|                    d          }t          j        |j        vr#d}t          j        t          |                    t          j	        | |||||           dS )a  find 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paranoids9   can only repair revlogv1 repositories, v2 is not affected)r  r  r  r  N)
r   check_incompatible_argumentsr  r,   REVLOGV1_REQUIREMENTr   rY   r   rL   repair_issue6528)r^   r_   r   r  r  r  r  r   s           rf   debug_repair_issue6528r  Y  s    d (kM95   hhy!!G%%I((=))Kxx
##H (0AAAJk!C&&!!!
     rh      debugformatc           	         t          j        |          }t          d t          j        D                       t          t          d                    fd}|                     d|          }|                                rd }nt           j        }|	                    d           |	                    dt          d          z
  z             |	                    d           | j
        r|	                    d           |	                    d	           t          j        D ](}|                                 |                    |          }|                    |          }||k    rd
}	d}
n||j        k    rd}	d}
nd}	d}
|                    d ||j                  |j        |	           |                    dd ||          |
           |j        |k    rd}nd}|                    | j
        dd ||          |           |                    | j
        dd ||j                  d           |	                    d	           *|                                 dS )zdisplay format information about the current repository

    Use --verbose to get extra information about current config value and
    Mercurial default.c              3   >   K   | ]}t          |j                  V  d S r   )rU   r   )r   fvs     rf   r  zdebugformat.<locals>.<genexpr>  s*      KKB3rw<<KKKKKKrh   s   format-variantc                 4    ddt          |           z
  z  z   S )Ns   %s:r   r{  )r   maxvariantlengths    rf   makeformatnamez#debugformat.<locals>.makeformatname  s    !1CII!=>??rh   r  c                 <    t          j        | d          r| S | rdS dS )Ns
   startswithr  r  )r=   rU  values    rf   formatvaluez debugformat.<locals>.formatvalue  s.    }55  vurh   r   s    repos    config defaultr   s!   formatvariant.name.mismatchconfigs!   formatvariant.repo.mismatchconfigs"   formatvariant.name.mismatchdefaults"   formatvariant.repo.mismatchdefaults   formatvariant.name.uptodates   formatvariant.repo.uptodater  rn  s   repos    %3ss   formatvariant.config.specials   formatvariant.config.defaults   configs    %6sr   s    %7ss   formatvariant.defaultN)r(   r   r  r;   allformatvariantrU   r   isplainr  r   r  r   fromrepo
fromconfigdefaultr\   r   r  r   )r^   r_   r   r  r   r  r  	repovalueconfigvalue	namelabel	repolabelconfiglabelr  s               @rf   debugformatr    s    %%DKK'2JKKKKK30113CDD@ @ @ @ @ 
nd	+	+B	zz|| (	 	 	 	 'HHHHT%,=(>(>>?@@@HHX	z %
#$$$HHUOOO& # #
KK%%	mmD))##<I<II"*$$=I=II6I6I
..1127)LLL
';;y#9#9KKK:$$9KK9K
JK$$ 	 	
 	
 	
 	JK
##* 	 	
 	
 	
 	FFHHHHHrh   s   debugfsinfos   [PATH]   .c                    |                      d|z             |                      dt          j        |          pdz             |                      dt          j        |          rdpdz             |                      dt          j        |          pdz             |                      dt          j        |          rdpdz             |                      d	t          j        |          rdpdz             d}	 t          j        d
|          5 }t          j	        |j
                  rdpd}ddd           n# 1 swxY w Y   n# t          $ r Y nw xY w|                      d|z             dS )z2show information detected about current filesystems	   path: %s
s   mounted on: %s
s	   (unknown)s	   exec: %s
r  r  s   fstype: %s
s   symlink: %s
s   hardlink: %s
s   .debugfsinfo)prefixdirNs   case-sensitive: %s
)r   r=   getfsmountpoint	checkexec	getfstype	checklink
checknlinkr(   namedtempfilefscasesensitiver   OSError)r^   r   casesensitiverq   s       rf   debugfsinfor    s    NN=4'(((NNt3D99I\J   NN=DN4$8$8$CV$LuMNNNNN?dnT&:&:&JlKLLLNNDN400;VDuE   NNT_T22=vFG   !M#?EEE 	M 088CVLuM	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M   NN*]:;;;;;s6   >E
 D>2E
 >EE
 EE
 

EEs   debuggetbundle   Hs   heads   id of head nodes   ID   Cs   commons   id of common node   type   bzip2s   bundle compression type to uses   TYPEs   REPO FILE [-H|-C ID]...c                 ,   t          j        |          }t          j        | ||          }|                    d          st          j        d          i }|rd |D             |d<   |rd |D             |d<   d|d<    |j        di |}|                    d
d          	                                }	ddddd}
|
                    |	          }	|	t          j        vr!t          j        t          d                    t          j        | |||	           dS )zretrieves 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 repositoryc                 ,    g | ]}t          |          S r   r   r|  s     rf   r   z"debuggetbundle.<locals>.<listcomp>  s    111Q#a&&111rh   r^  c                 ,    g | ]}t          |          S r   r  r|  s     rf   r   z"debuggetbundle.<locals>.<listcomp>!  s    ...AQ...rh   r  N
bundlecaps   debugr  r  s   HG10UNs   HG10BZs   HG10GZs   HG20)s   noner  s   gzips   bundle2s)   unknown bundle type specified with --type)r  )r(   r   r   r,  capabler   rY   	getbundler  lowerr   bundletypesr   writebundle)r^   repopathr'  r  r^  r   r_   r`   bundle
bundletypebtypess              rf   debuggetbundler$    s?   , %%D72tX&&D<<%% MkKLLLD 211&111X /.....WDT^----F'8,,2244J	 F J''J,,,k!HIIJJJFJ
;;;;;rh   s   debugignores   [FILE]c                    |j         j        }|s,|                     dt          j        |          z             dS t          j        |d         |          }t          j        |d          }|                                D ]N}t          j
        |          }d}	d}
|dk    rh ||          r|}	|j                             |          }
n@t          j        |          D ]+} ||          r|}	|j                             |          }
 n,|	r|	|k    r/|                     t          d           ||          z             n0|                     t          d           ||          |	fz             |
\  }}}|                     t          d	          |||fz              |                     t          d
           ||          z             PdS )a  display 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)legacyrelativevaluer  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
)rR  _ignorer\   r(   bytereprr1   matchgetuipathfnr   r=   normpath_ignorefileandliner$   finddirsr   )r^   r_   r   r   ignorer   uipathfnrq   nfr  
ignoredatar   
ignorefilelinenor  s                  rf   debugignorer5  3  s    ]"F %B
8,V44455555M$t*5111&tFFF 	B 	BAq!!BGJTzz6":: " G!%!A!A"!E!EJJ%.r22 " "!6!99 "&'G)-)I)I!)L)LJ!E"  Bb==HHQ122XXa[[@AAAAHH9  $8A;;0	1   ,6(
FD=>>!6401   
 122XXa[[@AAAA?	B 	Brh   s   debug-revlog-index|debugindexc                     t          j        |          }t          j        |d||          }|                     d|          }t          |d|          }t          j        | |||| j                  S )zdump index data for a revlogs
   debugindexs   _revlog)r   r-   	full_node)	r(   r   r   r  r   r	   revlog_debugdebug_index	debugflag)r^   r_   r  r   storer   r-   s          rf   
debugindexr<  e  sy     %%DmUDAAE	mT	*	*BUJ..F#
,   rh      debugindexdotc                    t          j        |          }t          j        |d||          }|                     d           |D ]}|                    |          }|                    |          }|                     d|                    |d                   |fz             |d         |j	        k    r3|                     d|                    |d                   |fz             |                     d           dS )z(dump an index DAG as a graphviz dot filer=  s   digraph G {
s
   	%d -> %d
r   r   s   }
N)
r(   r   r   r  r   r   rS  r\   r]   r  )r^   r_   r  r   rd   r   r   pps           rf   debugindexdotr@  |  s     %%DD"2E4@@ANN#$$$ : :vvayyYYt__
AEE"Q%LL!#44555a5DKHH_bea'88999HHVrh   s   debugindexstatsc                 p   |j                             |j        d           |j         j        }t	          j        |d          s!t          j        t          d                    t          |
                                                                          D ]\  }}|                     d||fz              dS )z)show stats related to the changelog indexr   s   statss+   debugindexstats only works with native codes   %s: %d
N)rZ   shortestr  ra   r=   rU  r   rY   r   r   statsr/  r\   )r^   r_   ra   r  r6  s        rf   debugindexstatsrD    s     	NDK+++N EE8,, Mk!JKKLLLu{{}}**,,-- ' '1
1v%&&&&' 'rh      debuginstallc           
         t          j        |          }d}|                     d|          }|                                 |                    ddt
          j                   d}	 t          j        t          j        t
          j                             n0# t          $ r#}t          j        |          }|dz  }Y d}~nd}~ww xY w|                    |dd|           d}t          j        t          d	          r<t          j                            t          j        t          j                            }n"t)          t*          d
d          rt           j        }|                    dt/          d          t           j        pt/          d                     |                    dt/          d          t          j        t3          j                                         |                    dt/          d          dt*          j        dd         z             |                    dt/          d          |pt/          d                     	 ddlm} |j         n# t>          $ r d}Y nw xY wtA          tB          j"                  }tB          j#        r|$                    d           |                    dt/          d          |%                    tM          |          ddd                     d|vr"|'                    t/          d                      d|vr"|'                    t/          d!                     |'                    t/          d"|d#nd$z                       t          j(                    }	|                    d%t/          d&          |	)                    d'          d                    |                    d(t/          d)          d'*                    |	)                    d'          dd                              d}
t          j        t*          j+        tX                   d	          r7t          j                            t          j        t&                              }
n"t)          t*          d
d          rt           j        }
|                    d*t/          d+          tZ          j-                   |                    d,t/          d-          |
pt/          d                     tZ          j-        d.v }|}tZ          j-        d/v p|}|p|}|rd}	 |rFdd0l.m/}m0}m1}m2} tg          |          tg          |          tg          |          tg          |          f |r&dd1lm4}m5} tg          |          tg          |          f n0# tl          $ r#}t          j        |          }|dz  }Y d}~nd}~ww xY w|                    |d2d3|           t          j7        j8        9                                }|                    d4t/          d5          |%                    tM          d6 |D                       d7dd8                     |                    d9t/          d:          |%                    tM          d; |D                       d7dd8                     tt          j7        ;                    tt          j<                  }|                    d<t/          d=          |%                    d> |D             d7dd8                     d#}t          j=        rd?}|'                    t/          d@          |z             |>                    t          t          j=                  A           t          jA                    }|                    dBdC|pdD           |                    | dDt/          dE                     |rt          jB        dF          \  }}|rid}	 t          j@        C                    |           n-# tl          $ r }t          j        |          }d}Y d}~nd}~ww xY w|                    |dGd3|           nd}|                    |dHt/          dI          |           |                    | dJt/          dK          dL           |s|dz  }|                    | dDt/          dM                     | D                                }t          jE        |          }t          jG        |          d         }|                    dNt/          dO          |           t          jH        |          }|                    | o|dPk    dQt/          dR          | o|dPk    o|           |                    | o|dPk    dSt/          dT          | o|           |s|dPk    r|dz  }d}d}	 | I                                }n(# t          jK        $ r}|jL        }|dz  }Y d}~nd}~ww xY w|                    |dUt/          dV          |           |                    |dWt/          dX          |           t          jM                    D ]'\  }} t)          | dYd          }!|!| |!| |          z  }(|                    | dDt/          dZ                     |s|>                    |[           |                    |d\t/          d]          |           |N                                 |S )^z;test Mercurial installation

    Returns 0 on success.
    r   rE  s   encodings   checking encoding (%s)...
Nr   s   encodingerrors.    %s
 (check that your locale is properly set)
r  r  Fs	   pythonexes    checking Python executable (%s)
s   unknowns   pythonimplementations$   checking Python implementation (%s)
s	   pythonvers   checking Python version (%s)
s   %d.%d.%drP   s	   pythonlibs   checking Python lib (%s)...
)rustexts   snis   pythonsecuritys&   checking Python security support (%s)
s   protocolr~     ,)r   fmtseps   tls1.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
s   checking Rust extensions (%s)
   missings	   installeds   hgvers    checking Mercurial version (%s)
   +s
   hgverextras%   checking Mercurial custom build (%s)
s   hgmodulepolicys   checking module policy (%s)
s	   hgmoduless#   checking installed modules (%s)...
)s   rust+cs   rust+c-allow)   cs   allow)base85bdiffmpatchosutil)r[   rR  s   extensionserrors    %s
s   compenginess-   checking registered compression engines (%s)
c              3   >   K   | ]}|                                 V  d S r   r  r   r  s     rf   r  zdebuginstall.<locals>.<genexpr>;  s*      1116688111111rh   s
   compenginer  s   compenginesavails,   checking available compression engines (%s)
c              3   f   K   | ],}|                                 |                                V  -d S r   )	availabler   rS  s     rf   r  zdebuginstall.<locals>.<genexpr>E  s7      BBAKKMMB16688BBBBBBrh   s   compenginesservers>   checking available compression engines for wire protocol (%s)
c                 ^    g | ]*}|                                 |                                +S r   )wireprotosupportr   rS  s     rf   r   z debuginstall.<locals>.<listcomp>U  s1    GGG!!2D2D2F2FGQVVXXGGGrh   s	   availables"   checking "re2" regexp engine (%s)
)re2s   templatedirss   checking templates (%s)...
rh   s    no template directories found
s   map-cmdline.defaults   defaulttemplateerrors   defaulttemplates   checking default template (%s)
s   defaulttemplatenotfounds    template '%s' not found
r   s5    (templates seem to have been installed incorrectly)
s   editors   checking commit editor... (%s)
s   vis
   vinotfoundsf    No commit editor set and can't find %s in PATH
 (specify a commit editor in your configuration file)
s   editornotfoundsV    Can't find editor '%s' in PATH
 (specify a commit editor in your configuration file)
s   usernames   checking username (%s)
s   usernameerrorsJ   checking username...
 %s
 (specify a username in your configuration file)
debuginstalls   no problems detected
)problemss   problemss1   %d problems detected, please check your install!
)Or(   r   r   r   r\   r   codecsrX   sysstrLookupErrorrF   forcebytestrr  r=   rU  osr   dirnamer  r  r	   r  r  r   sysbytesplatformpython_implementationversion_infor  rG  __doc__ImportErrorrZ  r5   supportedprotocolshassnir  r  r   r   r   r   rp   modules__name__r&   cextrN  rO  rP  rQ  r  r[   rR  	Exceptioncompengines_enginesr5  rC   supportedwireengines
SERVERROLE_re2r   boolr9   templatedirtry_open_templatefrommapfile	geteditor
expandpathrE   
shellsplitfindexeusernamer   rY   messager   r   )"r^   r   rZ  r   r\  inst	pythonlibrG  securityr  	hgmodulesrustandcrk  nopurerN  rO  rP  rQ  r[   rR  rm  wirecompenginesrX  r   r   fpeditor	editorbincmdpathrz  r  r   modhandlers"                                     rf   rY  rY    s    %%DH	ot	,	,BLLNNN HH[8(:KLLL
Choh&7889999   %d++A LL;	   IJ'' +GOOH$5bk$B$BCC			j%	(	( +*	HH	
.///!J--  
 HH	
233(8::;;  
 HH	
+,,	s'+	+  
 HH	
*++"Qz]]      7-..H~ VHH	
455
fX&&[eNN     
> 	
 	
 	
 X
; 	
 	
 	
 HH	.$_zz,@	
 	
   LNNEHH!8995;;t;L;LQ;O   HH	
344		%++d##ABB'((   IH-z:: +GOOH$5h$?$?@@			j%	(	( +*	HH1=>>   HH	
122"Qz]]   } <<HG=,,8D_WF =	 	B            E

CKKVc&kkAA -       
 Hs8}},, 	 	 	)$//CMHHHHHH	 	S,h<<<"+2244KHH	
;<<
11[11111	 	 	
 	
	 	 	 HH	
:;;
BB[BBBBB	 	 	
 	
	 	 	 "-BB O HH	(	
 	
 	GGGGG	 	 	
 	
   Cy HHQ566<===GGTYG    	AHH_=qxCHHHLLQQBCCDDD 
-.DEEB 
	C#//2222    -d33 LL5xEEEEA
!1%H#I#I1	
 	
 	
 	E&+,,		
 	
 	
  ALLsAOPP  
 \\^^F_V$$F#F++A.IHHY=>>	JJJy))GLL'%		
 	

 5%5I	 	 	 LL'%		
 	

 !		 	 	  vA H
C;;==;   iA LL+q!<==x   LL	B	
 	
 	    *,, ( (	c#~t44B'HLLXsA&?$@$@AAA #
"""LL	
?@@	   FFHHHOss   %0B 
C B>>C	I I&%I&A0V 
V/V**V/_0 0
`:``f4 4gggs
   debugknowns
   REPO ID...c                 T   t          j        |          }t          j        | ||          }|                    d          st          j        d          |                    d |D                       }|                     dd	                    d |D                       z             dS )ztest 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.
    s   knowns*   known() not supported by target repositoryc                 ,    g | ]}t          |          S r   r  r|  s     rf   r   zdebugknown.<locals>.<listcomp>  s    ,,,1A,,,rh   r%  rh   c                     g | ]}|rd pd	S )   1   0r   r   rq   s     rf   r   zdebugknown.<locals>.<listcomp>  s!    !D!D!D!*"4!D!D!Drh   N)
r(   r   r   r,  r  r   rY   knownr\   rp   )r^   r   idsr   r_   r   s         rf   
debugknownr    s     %%D72tX&&D<<!! IkGHHHJJ,,,,,--EHHW!D!De!D!D!DEEFGGGGGrh   s   debuglabelcompletes   LABEL...c                 "    t          | |g|R   dS )zEbackwards compatibility with old bash completion scripts (DEPRECATED)N)debugnamecomplete)r^   r_   r`   s      rf   debuglabelcompleter    s"     b$&&&&&&&rh   s
   debuglocks   Ls   force-free-locks   free the store lock (DANGEROUS)   Ws   force-free-wlocks'   free the working state lock (DANGEROUS)s   set-locks    set the store lock until stopped   Ss	   set-wlocks(   set the working state lock until stoppedc                 8    |                     d          r|j                            d           |                     d          r|j                            d           |                     d          s|                     d          rdS g }	 |                     d          r^	 |                    |                    d                     n4# t          j        $ r" t          j        t          d                    w xY w|                     d	          r^	 |                    |
                    d                     n4# t          j        $ r" t          j        t          d
                    w xY wt          |          r	                                  r%t          d          }                     |           n?d}|t          |          z  }                     |           	 t          j        d           n'# t"          $ r d}                     |           Y nw xY w	 t%          |  dS 	 t%          |  n# t%          |  w xY wt          j                    d} fd}| ||j        d|j
                  z  }| ||j        d|j                  z  }|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.

    force_free_locks   lockforce_free_wlocks   wlockr   	set_wlockFs   wlock is already heldset_locks   lock is already helds&   ready to release the lock (y)? $$ &Yess"   %d locks held, waiting for signal
Tg?s    signal-received releasing locks
c                 T   	  |d          }n# t           j        $ r d }Y nw xY w|r|                                 n	 |                     |          }
|t          j                 z
  }t          j        |j                  }| 	                    |          }d|v rC|
                    d          \  }}	|t          j                    k    r
d|pd|	fz  }n
d|pd|	|fz  }                    d|dz   ||fz             dS # t          $ r Y nw xY w                    d|dz   z             d	S )
NF   :s   user %s, process %ss   Nones   user %s, process %s, host %ss   %-6s %s (%ds)
r   s
   %-6s free
r   )r   LockHeldreleaselstatstatST_MTIMEr=   rz  st_uidreadlockr   socketgethostnamer   FileNotFoundError)r>   r   methodr   stager   lockerhostpidnowr^   s             rf   reportzdebuglocks.<locals>.report1	  sm   	uAA~ 	 	 	AAA	  	IIKKKKYYt__Bt}--}RY//d++6>> &T 2 2ID#v13333!74?7C:P!P!@ OG D "
 1TD[&#4NNOOOq$    	~5666qs    ##B=C= =
D
	D
)r  svfs	tryunlinkr>   r   r   r   r  rY   r   r   rU   interactivepromptchoicer   rm   rn   KeyboardInterruptr  )	r^   r_   r   lockspromptr   heldr  r  s	   `       @rf   
debuglocksr    s   Z xx!"" %	G$$$xx"## %8$$$xx!"" dhh/A&B&B qE88K   	??TZZ..////> ? ? ?k!$<"="=>>>?88J 	>>TYYu--....> > > >k!$;"<"<===>u:: 	>>## (HIIFOOF++++@C3u::%CIIcNNN(
3( , %   :		# !	  	
)++CD     B 	FF49gty111DFF48Xtz222DKsa   H= &(C H= 1D  H= (E H= 1E33H= A8G? >H= ?!H# H= "H##H= =Is   debugmanifestfulltextcaches   clears   clear the caches   adds)   add the given manifest nodes to the caches   NODEr   c                    fd}|                     d          rN                                5   |            }|                    d           	 ddd           dS # 1 swxY w Y   |r                                5  j        }|                    d          }|D ]m}	 ||                    |                   }	n:# t          j        $ r(}
t          j        t          |
          d          d}
~
ww xY w|	
                                 n	 ddd           dS # 1 swxY w Y    |            }t          |          s$|                     t          d	                     dS |                     t          d
          t          |          fz             d}|D ]t}|                    |          }t          |          }||dz   z  }|                     t          d          t          |          t!          j        |          fz             u|j                            d          j        }|                     t          d          t!          j        |          t!          j        |          fz             dS )z@show, clear or amend the contents of the manifest fulltext cachec                      j                             d          } 	 | j        S # t          $ r$ t	          d          }t          j        |          w xY w)Nrh   sO   Current revlog implementation doesn't appear to have a manifest fulltext cache
)manifestlog
getstorage_fulltextcacheAttributeErrorr   r   rY   )rd   r   r_   s     rf   getcachez,debugmanifestfulltextcache.<locals>.getcachei	  sh    '',,	### 	# 	# 	#- C +c"""	#s	   $ .Arr  T)clear_persisted_dataNrh   s   Check your manifest node idhints   cache empty
sF   cache contains %d manifest entries, in order of most to least recent:
r      s   id: %s, size %s
s   manifestfulltextcaches%   total cache data size %s, on-disk %s
)r  r   rr  r  r  rX   r   r]  rY   bytesr   rU   r\   r   peekr   r=   	bytecount_openerr  st_size)r^   r_   r  r   r  cacher   r;  r  rT  r  	totalsizer   r   r9  ondisks    `              rf   debugmanifestfulltextcacher  X	  s,   "	# 	# 	# 	# 	# xx ZZ\\ 	 	HJJEKKTK222	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
  ZZ\\ 	 	 ALL%%E     a1HH(   +a'E    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 HJJEu:: 

#$$%%%%%
#  5zzm		
 	
 	
 	 	 	F::f%%Dt99D"IHH&''3v;;t8L8L*MM    ##$<==E
788~i(($.*@*@AB	
 	
 	
 	
 	
sG   "AA#&A# !D"B>=D>C5#C00C55DD"D   debugmergestatec                 
   | j         rt          j        |          }|                                }|                                }|s|snY|s|                     d           nA|                    ||          r|                     d           n|                     d           t          j        |          }|d         sd|d<   t          j        	                    |          }| 
                    d|          }|                                 |                    d          }|                                rd|j        d	fd
|j        dffD ]\  }	}
}|                                 |                    |	           |                    t#          |
                     |j        r9t'          |j                  |k    r!|                    |j        |                    |                                 |                    d          }|                                r:|D ]6}|                                 |                    |           |j        |         }|                    |d	                    |d	         t          j        t          j        fv r|                    |d                    |                    |d                    |                    |d                    |                    |d                    |                    |d                    |                    |d                    |                    |d                    nX|d	         t          j        t          j        fv r8|                    |d                    |                    |d                     |                    d!          }t5          |                    |                                                    D ]E\  }}|                                 |                    |"           |                    |#           F|                                 8|                                 |                    d!          }t5          |                                                                          D ]z\  }}||v r
|                                D ][\  }}|                                 |                    |$           |                    |"           |                    |#           \{|                                 |                                 d%S )&zpprint merge state

    Use --verbose to print out information about whether v1 or v2 merge state
    was chosen.s   no 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})
"}r  s   commitss   localr   r  r   r  re  rn  s   files)r   )r7  )	local_keyrS   )
local_pathrP   )ancestor_pathr  )ancestor_noder  )
other_pathrh  )
other_node   )local_flags)renamed_path)rename_sides   extrasrm  r  )fileN)r  mergestatemodr    _readrecordsv1_readrecordsv2r   
_v1v2matchr(   r   r   r   r   nestedactiver   r   r   r   _labelsrU   r   r  MERGE_RECORD_UNRESOLVEDMERGE_RECORD_RESOLVEDMERGE_RECORD_UNRESOLVED_PATHMERGE_RECORD_RESOLVED_PATHr   extrasr/  	allextras)r^   r_   r`   r   ms	v1records	v2recordsr   
fm_commitsr   r   label_indexfm_filesrq   r7  	fm_extrasr  r6  r  s                      rf   debugmergestater  	  s
    
z E%d++ %%''	%%''	 	E 	E 	ENN89999]]9i00 	ENN@AAAANNCDDD%%D 
> 	[$ 
	!	&	&t	,	,B	($	/	/BLLNNN:&&J	yy{{ 	?rx#rx#(
 	? 	?#D$   """OOO&&&OOTO+++z ?c"*oo;;bj&=>>>NNyy""H	yy{{  	 	A   MMqM!!!IaLEMMaM)))Qx53   a111q222E!H555E!H555q222q222%(3333q:8   58444%(333 	22Iryy||113344 ( (1##%%%1%%%Q''''MMOOOOLLNNN		)$$Ir||~~++--.. $ $177GGII 	$ 	$DAq!!!NNN"""NNqN!!!NNN####		$
 MMOOOFFHHHHHrh   s   debugnamecompletes   NAME...c                 J   t                      }|j                                        D ]3\  }}|dk    r(|                    |                    |                     4|                    d |                                                                D                        t                      }|sdg}|D ]#|                    fd|D                        $|                     d                    t          |                               |                     d           dS )z:complete "names" - tags, open branch names, bookmark namesr  c              3   (   K   | ]\  }}}}|	|V  d S r   r   )r   tagr  tipcloseds        rf   r  z$debugnamecomplete.<locals>.<genexpr>
  sD        %S%f     rh   rh   c              3   F   K   | ]}|                               |V  d S r   )r   )r   r  re   s     rf   r  z$debugnamecomplete.<locals>.<genexpr>#
  s2      ??q||A?1??????rh   r   N)
rZ  namesr/  r   	listnames	branchmapiterbranchesr\   rp   r   )r^   r_   r`   r  r   nscompletionsre   s          @rf   r  r  
  s3    EEE J$$&& - -b;LLd++,,,	LL  )-)9)9)F)F)H)H     
 %%K u @ @????e???????HHUZZ{++,,---HHUOOOOOrh   s   debugnodemaps   dump-news1   write a (new) persistent binary nodemap on stdouts	   dump-disks   dump on-disk data on stdouts   checks-   check that the data on disk data are correct.s   metadatas-   display the on disk meta data for the nodemapc                    |d         r|                                 }|j        }t          j        |j        d          r|j                                        }nt          j        |j                  }|                     |           dS |d         rW|                                 }|j        }t          j	        |          }|$|\  }}|                     |dd                    dS dS |d         rS|                                 }|j        }t          j	        |          }| |\  }}t          j
        | |j        |          S dS |d         r |                                 }|j        }t          j	        |          }||\  }}|                     d|j        z             |                     d|j        z             |                     d	t          |j                  z             |                     d
|j        z             |                     d|j        z             |j        dz  |j        z  }|                     d|z             dS dS dS )z!write and inspect on disk nodemapdump_newnodemap_data_all	dump_diskNcheckr!   s   uid: %s
s   tip-rev: %d
s   tip-node: %s
s   data-length: %d
s   data-unused: %d
      Y@s   data-unused: %2.3f%%
)rs  rZ   r=   rU  ra   r  rK   persistent_datar\   persisted_data
check_datauidtip_revr   tip_nodedata_lengthdata_unused)	r^   r_   r   r  r   r   nm_datar  unused_percs	            rf   debugnodemapr  (
  s_   4 J "@  ^BH&899 	58,,..DD*2844D
	k	 @  ^(,,"LFDHHT!!!W  
g @  ^(,,"LFD%b"(D999  
j	 @  ^(,,"LFDHHlfj0111HH&&.8999HH'3v+?+??@@@HH*f.@@AAAHH*f.@@AAA ,u4v7IIKHH/;>?????@ @ rh   r      flagss   markers flags   record-parentss+   record parent information for the precursors   display markers relevant to REV	   exclusives0   restrict display to markers only relevant to REV   indexs   display index of the marker   deletes#   delete markers specified by indicess   [OBSOLETED [REPLACEMENT ...]]c           
      	   t          j        |          }fd|                    d          r g }|                    d          D ]f}	 |                    t	          |                     &# t
          $ r4 t          j        t          d          |z  t          d                    w xY w	                                r!t          j
        t          d                                                    5  t          j        j        |          }|                     t          d          |z             ddd           n# 1 swxY w Y   dS |+|d	         rt          j        d
          i }t!          j        |d         p|                                           |d<   t'          fd|D                       }	                                }
	                     d          }	 |                    d          }|rt+          j        |          }nd} |          }d}|d         ro|                                vrt          j
        d                                          |                                         }t'          d |D                       }j                            |||	|d         ||||            |                                 nH# t
          $ r;}t          j
        t          d          t7          j        |          z            d}~ww xY w	 |                                 n# |                                 w xY w	 |
                                 dS # |
                                 w xY w|d	         rkt=          j        |d	                   }fd|D             }tA          tC          j"        ||d                             }|#                    d            ntC          j"                  }|}d }|                    d	          r=|                    d          r(tC          j"                  }tI          |          fd}| %                    d|          }tM          |          D ]U\  }} ||          s|'                                 |                    d          r|nd}tQ          j)        |||           V|*                                 dS )zccreate arbitrary obsolete marker

    With no arguments, displays the list of obsolescence markers.c                     	 t          |           }t          |          j        j        k    rt          |S # t          $ r t          j        d          w xY w)Ns>   changeset references must be full hexadecimal node identifiers)r   rU   nodeconstantsnodelen
ValueErrorr   
InputError)r}  r  r_   s     rf   parsenodeidz"debugobsolete.<locals>.parsenodeid
  sl    	 AA1vv+333  H 	 	 	"$  	s	   48 Ar  s   invalid index value: %rs   use integers for indicesr  s6   cannot delete obsmarkers in the middle of transaction.s    deleted %i obsolescence markers
NrD  s+   cannot select revision when creating markers   userc              3   .   K   | ]} |          V  d S r   r   )r   succr  s     rf   r  z debugobsolete.<locals>.<genexpr>
  s-      ??Dkk$''??????rh   r   s   dates   record_parentss2   cannot used --record-parents on unknown changesetsc              3   >   K   | ]}|                                 V  d S r   re  r  s     rf   r  z debugobsolete.<locals>.<genexpr>
  s*      #>#>AFFHH#>#>#>#>#>#>rh   r  )rS  r   r!   r^   s   bad obsmarker input: %sc                 D    g | ]}|                                          S r   re  rf  s     rf   r   z!debugobsolete.<locals>.<listcomp>
  s%    222T!W\\^^222rh   r  )rk  	exclusivec                     | j         S r   )_datar   s    rf   rl  zdebugobsolete.<locals>.<lambda>
  s    qw rh   rm  c                     dS )NTr   )r   s    rf   rl  zdebugobsolete.<locals>.<lambda>
  s    t rh   r  c                     | v S r   r   )r   	markersets    rf   rl  zdebugobsolete.<locals>.<lambda>
  s    1	> rh   )ra   )+r(   r   r  r   r  r  r   r  r   currenttransactionrY   r   r*   deleteobsmarkersobsstorer\   r   	fromlocalrz  tupler   rD   r  rs  rS  creater0  rF   r^  r  r   ri  r  r#   
getmarkersr)  rZ  r   	enumerater   r   r   r   )r^   r_   	precursor
successorsr   indicesr6  r  r!   succsr   trr   precrS  r   r  rk  r   markerstoiter
isrelevantr   r   r   indr#  r  s    `                       @@rf   debugobsoleter5  g
  s   : %%D     xx	 )$$ 	 	As1vv&&&&   &011A5677    ""$$ 	+KLL   YY[[ 	B 	B'w??AHHQ;<<q@AAA	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	< 	">   $.tG}/MNN????J?????IIKK$	!!"233B xx((  #-d33DDD"{9--)* ?4??#4#444#k2   #oo//5==??G##>#>g#>#>#>>>G$$N#% % 	 	 	 



   k011J4KC4P4PP    



IIKKKKKAIIKKKK< 
	/&tT&\::D2222T222E"l1C   G
 LL..L////(..G#^
88F 	2 2 2 	2#.t44MGI1111J\\*D11m,, 	1 	1DAq:a==  LLNNNxx))3!!tCr1C00000
sb   "A00>B.:A EE
E
M( +C.K L8 
L$6LLL8 #M( 8MM( (M>s   debugp1copiess   revision to debugs   [-r REV]c                    t          j        |          }t          j        ||                    d          d          }|                                                                D ]\  }}|                     d||fz              dS )z$dump copy information compared to p1rD  Nr  	   %s -> %s
)r(   r   r1   r>  r  p1copiesr/  r\   r^   r_   r   rI  dstsrcs         rf   debugp1copiesr=  
       %%D

D$((6"2"2D
A
A
ACLLNN((** - -S
#s+,,,,- -rh   s   debugp2copiesc                    t          j        |          }t          j        ||                    d          d          }|                                                                D ]\  }}|                     d||fz              dS )z$dump copy information compared to p2rD  Nr7  r8  )r(   r   r1   r>  r  p2copiesr/  r\   r:  s         rf   debugp2copiesrA    r>  rh   s   debugpathcomplete   fs   fulls   complete an entire paths   normals   show only normal filesr:  s   show only added filesr;  s   show only removed filess   FILESPEC...c                 ,   fd}d}d         r|dz  }d         r|dz  }d         r|dz  }                                 |sd	g}t                      t                      }}|D ]=} |||pd
          \  }	}
|                    |	           |                    |
           >|                    |           |                     d                    fdt          |          D                                  |                     d           dS )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.c                    j         }t          j                            t          j                            t          j                    |                     }j        t          j	        z   }|j        k    r|
                    |          sg g fS t          j                            |          r|dz  }|t          |          d          }t          j	        dk    }|r |                    t          j	        d          }t          |          }d         }t                      t                      }	}|	j        |j        }}
|                                D ]\  }}|
                    |          r~|j        |v ru|r |                    dt          j	                  }|r ||           S|                    t          j	        |          }|dk    r |
|d |                     ||           ||	fS )N   /fullr   )rR  r_  r   r,  rp   r   rW   rootr(   ossepr   isdirrU   replacerZ  r  r/  r7  find)r   
acceptablerR  r(  rootdirfixpathsspeclen	fullpathsr   dirsadddiraddfilerq   r  r}  r   r_   s                  rf   completez#debugpathcomplete.<locals>.complete-  s   =wX_->-> E EFF)hn,49T__W%=%=r6M7== 	DLDCLLNN#>T) 	6<<55Dd))L	eeSUUt(EI^^%% 	 	EAr||D!! 
bh*&<&< 8		$77A GAJJJFF8>73366F1RaR5MMMMGAJJJd{rh   rh   normals   nmrC  r   rD  r  r  s   nmarr   c              3   D   K   | ]}                     |          V  d S r   )pathto)r   r   cwdr_   s     rf   r  z$debugpathcomplete.<locals>.<genexpr>\  s1      CCAs++CCCCCCrh   N)rW   rZ  r   r\   rp   r   )r^   r_   specsr   rT  rL  r   rQ  r(  rq   r  rX  s    ` `       @rf   debugpathcompleterZ    sC   &     < JH~ e
G} d
I d

++--C %%4E  xj3G441QA	LLHHUZZCCCCCVE]]CCCCCDDDHHUOOOOOrh   s   debugpathcopiess#   hg debugpathcopies REV1 REV2 [FILE])	inferrepoc                 0   t          j        ||          }t          j        ||          }t          j        |||          }t          t	          j        |||                                                    D ]\  }	}
|                     d|
|	fz              dS )z!show copies between two revisionsr8  N)r1   r>  r*  r   r   
pathcopiesr/  r\   )r^   r_   rb   rc   r&  r   ctx1ctx2r   r;  r<  s              rf   debugpathcopiesr`  `  s     T4((DT4((DdD$''A6,T4;;AACCDD - -S
#s+,,,,- -rh   s	   debugpeerc                    ddi}|                      |          5  t          j        | i |          }	 |                                du}|                                }|                     t          d          |                                z             |                     t          d          |rt          d          nt          d          z             |                     t          d          |rt          d          nt          d          z             |                                 n# |                                 w xY w	 ddd           dS # 1 swxY w Y   dS )	z+establish a connection to a peer repository)s   devels   debug.peer-requestTNs   url: %s
s
   local: %s
r  r  s   pushable: %s
)	configoverrider   r,  r   canpushr\   r   r<   r0  )r^   r   	overridesr,  r   rc  s         rf   	debugpeerre  o  s{    	*4I 
		9	%	%  wr2t$$
	JJLL,EllnnGHHQ|__txxzz1222HHQ~&&u*J!F)))!E((KLLLHH#$$W(J&			!E((K   JJLLLLDJJLLLLL                 s)   EC'D.E.EEEEs   debugpickmergetools    check for files in this revision   changedeletes!   emulate merging change and deletes   [PATTERN]...c                 F   t          j        |          }i }|d         r;|d         |d<   |                     dt          j        |d                   z             |                     |d          5  t
          j                            d          }|*|                     dt          j        |          z             |                     dd	          }|r*|                     d
t          j        |          z             t          j
        ||                    d                    }t          j        |||          }|d         }	|                    |          D ]}
||
         }| j        s|                     d          nt          j                    5  t#          j        || |
|                                d|                                v |	          \  }}ddd           n# 1 swxY w Y   |                     d|
|fz             	 ddd           dS # 1 swxY w Y   dS )af  examine 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.
    s   tool)   uis
   forcemerges   with --tool %r
s   debugmergepatternss   HGMERGENs   with HGMERGE=%r
rh  s   merges   with ui.merge=%r
rD  rf  T)r   r   s   %s = %s
)r(   r   
notenoi18nr   rb  r   environr  configr1   r>  r*  r  r:  silentr=   r~  r   	_picktoolisbinaryr   r\   )r^   r_   r&  r   rd  hgmergeuimergerI  r   changedeleter   fctxtooltoolpaths                 rf   debugpickmergetoolru    s   j %%DIG} O,0M	()
)X-=d7m-L-LMNNN			9&;	<	< 2 2"&&z22MM.(2B72K2KLMMM))E8,, 	OMM/83CG3L3LMNNNdhhv&6&677M#tT**O,HHQKK 	2 	2Dt9D \A    '+'>'@'@
 
 "+!4MMOODJJLL( " "h
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 HH\T4L01111	22 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2s8   0D#HAG"H"G&&H)G&*HHHs   debugpushkeys   REPO NAMESPACE [KEY OLD NEW]c           	         t          j        | i |          }	 |r|\  }}}|                                5 }	|	                    d||||d                                          }
ddd           n# 1 swxY w Y   |                     t          j        |
          dz              |
 |                                 S t          |
                    |                                                    D ]C\  }}|                     dt          j        |          t          j        |          fz             D	 |                                 dS # |                                 w xY w)zaccess 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.
    s   pushkey)s	   namespaces   keyrB  s   newNr   s   %s	%s
)r   r,  commandexecutorcallcommandresultr   r(   r   r0  r   listkeysr/  r\   rF   	escapestr)r^   r   	namespacekeyinfor   targetr4  oldnewr  rd   r  r6  s                rf   debugpushkeyr    s    WRX&&F 	#MCc'')) 	QMM&/ # # #	   &(( 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 IIh&q))E12225 	 vy99??AABB  1!+A..
0DQ0G0GHI    	s5   E	 .A."E	 .A22E	 5A26/E	 :A8E	 	Es	   debugpvecs   A Bc                    t          j        ||          }t          j        ||          }t          j        |          }t          j        |          }||k    rd}n||k    rd}n||k     rd}n||z  rd}|                     t          d          |z             |                     t          d          |z             |                     t          d          |j        |j        fz             |                     t          d          t          |j        |j        z
            t          j        |j	        |j	                  |
                    |          |fz             d S )	N   =   >   <   |s   a: %s
s   b: %s
s   depth(a): %d depth(b): %d
s.   delta: %d hdist: %d distance: %d relation: %s
)r1   r>  r'   ctxpvecr\   r   _depthabs_hamming_vecdistance)	r^   r_   re   r  cacbr   pbrels	            rf   	debugpvecr    sU   		4	#	#B		4	#	#B	b		B	b		B	Rxx	b	b	b HHQz]]R   HHQz]]R   HHQ-..")RY1GGHHHHH	
<==	BI%&&M"'27++KKOO	
	
    rh   s&   debugrebuilddirstate|debugrebuildstates   revision to rebuild tos   minimalsE   only rebuild files that are inconsistent with the working copy parentc                    t          j        ||          }|                                5  |j        d}|                    d          r_t          |                                                                          }t                    }||z
  }||z
  }	fd|	D             }
||
z  }                    |	                                |                                |           ddd           dS # 1 swxY w Y   dS )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.
    Nminimalc                 H    h | ]}                     |          j        |S r   )	get_entryrC  )r   rq   rR  s     rf   r  z'debugrebuilddirstate.<locals>.<setcomp>J  s/    OOO83E3Ea3H3H3NO!OOOrh   )
r1   r>  r   rR  r  rZ  rT  rt  rebuildr   )r^   r_   r]   r   rI  changedfilesmanifestfilesdirstatefilesmanifestonlydsonly
dsnotaddedrR  s              @rf   debugrebuilddirstater    sI   B 
D#
&
&C	 C C=88I 	5 3 3 5 566MMMM(=8L"]2FOOOOVOOOJ'*4LS\\^^\BBBC C C C C C C C C C C C C C C C C Cs   B9C11C58C5s   debugrebuildfncaches	   only-datas*   only look for wrong .d files (much faster)c                     t          j        |          }t          j        | ||                    d                     dS )zrebuild the fncache files	   only_dataN)r(   r   r*   rebuildfncacher  re  s      rf   debugrebuildfncacher  P  s;     %%D
"dDHH\$:$:;;;;;rh   s   debugrenames   [-r REV] [FILE]...c           
      X   t          j        |          }t          j        ||                    d                    }t          j        |||          }|                    |          D ]}||         }|                                                    |	                                          }|
                    |          }	|rB|                     t          d          |	|d         t          |d                   fz             |                     t          d          |	z             dS )zdump rename informationrD  s   %s renamed from %s:%s
r   r   s   %s not renamed
N)r(   r   r1   r>  r  r*  r  filelogrenamedfilenoderW  r\   r   r   )
r^   r_   r&  r   rI  r   r  rr  or  s
             rf   debugrenamer  b  s    %%D

D$((6"2"2
3
3Cc4&&Axx{{ 3 33xLLNN""4==??33kk# 	3HHQ122c1Q4QqT5KKLLLLHHQ*++c122223 3rh   s   debugrequires|debugrequirementsc                 d    t          |j                  D ]}|                     d|z             dS )z#print the current repo requirementsr%  N)r   r,   r\   )r^   r_   rd   s      rf   debugrequirementsr  w  sA     D%&&  
1 rh      debugrevlog   d   dumps   dump index datac                   EF t          j        |          }t          j        |d||          }|                    d          rt          |          }|                     d           d}t                      }t          |          D ]}|	                    |          }	|	dk    r|}	|
                    |          }
|                    |          }|                    |          \  }}|                    |          }||z   }|t          |                    |                    z  }|                    |           	 ||                    |          z  }n# t           $ r d}Y nw xY w|                     d||||                    |          |                    |          |                    |	          |                    |
          |                    |          |                    |          |||t          |          |fz             dS |j        }|j        }g }d}|t(          j        z  r|                    d           |t(          j        z  rd	}|                    d
           |sdg}d}d}d}d}d}d}t1          j        d           }d}d}d}d}d}d} g }!g }"g }#g d}$g d}%g d}&t1          j        d           }'g d}(i })i }*d }+t          |          }t          |          D ]}|                    |          \  }}|	                    |          },|dk    r |+|                    |          |$           |t4          k    r|dz  }|                    |          }-|,t4          k    r|!                    d           |"                    |                    |                     |#                    |-           |-dk    r|dz  }|dz  }ni|dz  }|dxx         dz  cc<    |+|-|%            |+|-|'d                    n4|!                    |!|,         dz              |"|,         }.|                    |          }/|"                    |.           |#                    |/|.z
  |-z              |-dk    r|dz  }|dz  }n|                    |          rI |+|-|&           |dz  }|                    |          }0||0xx         dz  cc<    |+|-|'|0                    nZ |+|-|(           |,|dz
  k    r|dz  }|,|k    r|dz  }n4|,|k    r| dz  } n(|,|k    r|dz  }n|,|k    r|dz  }n|,t4          k    r|dz  }t=          j        |d          r|                     ||          d         }1n!|j!                             ||          d         }1|1rtE          |1dd                   }2nd}2|2|)vr
d|)|2<   d|*|2<   |)|2xx         dz  cc<   |*|2xx         |-z  cc<   |$|%|&|(fD ]}-|-d         d|-d<   ||z
  |z
  |z
  }3||z
  | z
  }4|$d         }5|$dxx         |z  cc<   |%d         }6|dk    rd|%d<   n|%dxx         |z  cc<   |&d         }7i }8|dk    r|&dxx         |z  cc<   |'D ]/}0|'|0         d         |8|0<   |'|0         dxx         ||0         z  cc<   0|(d         }9|3dk    r|(dxx         |3z  cc<   |6|7z   |9z   }:tG          |!          |z  };tI          |!          }<tI          |#          }=d}>|:r|5|:z  }>dEdFEfd}?d<Ffd	}@d }A| %                    d|z             | %                    dd&                    |          z             |                     d            |@|:          }B |?|:          }C| %                    d|C|z  z              | %                    d|B |A||          z  z              | %                    d |B |A||z
  |          z  z              | %                    d|C|z  z              | %                    d!|B |A||          z  z              | %                    d"|B |A|||z             z  z              | %                    d#|B |A|||z             z  z              | %                    d$|B |A||z   |          z  z              tO          |          D ]0}0|                     d%|0z  |B |A||0         |          z  z              1| %                    d&|B |A|3|          z  z              | %                    d'|C|:z  z              | %                    d$|B |A|6|7z   |:          z  z              tO          |          D ]0}0|                     d%|0z  |B |A|8|0         |:          z  z              1| %                    d&|B |A|9|:          z  z              d( }D|                     d           | %                    d)|C|z  z              tO          |)          D ]H}2|                      |D|2                     |                     |B |A|)|2         |          z             I| %                    d*|C|:z  z              tO          |)          D ]H}2|                      |D|2                     |                     |B |A|*|2         |:          z             I|                     d            |?tI          |;|<|=|>                    }B| %                    d+|B|;z  z              | %                    d,|B|<z  z              | %                    d-|B|=z  z              | %                    d.|B|>z  z              |dk    r:|                     d           | %                    d/tQ          |$          z             | %                    d0tQ          |%          z             | %                    d1tQ          |&          z             tO          |'          D ]8}0|0dk    r	| %                    d2|0ftQ          |'|0                   z   z             9| %                    d3tQ          |(          z             |3dk    r9|                     d            |@|3          }B |@|3d4          }C| %                    d5|B |A||3          z  z              |dk    ro| %                    d6|C |A||          z  z              | %                    d7|C |A| |          z  z              | %                    d8|C |A|4|          z  z              |rs| %                    d9|B |A||3          z  z              | %                    d:|B |A||3          z  z              | %                    d;|B |A||3          z  z              dS dS dS )=z'show data and statistics about a revlogr  r  se   # rev p1rev p2rev start   end deltastart base   p1   p2 rawsize totalsize compression heads chainlen
r   r   s:   %5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d %11d %5d %8d
Fs   inlineTs   generaldeltas   (none)c                      dS Nr   r   r   rh   rf   rl  zdebugrevlog.<locals>.<lambda>  s    1 rh   Nr   r   c                  
    g dS )Nr  r   r   rh   rf   rl  zdebugrevlog.<locals>.<lambda>  s
    LLL rh   c                 z    |d         | |d         k     r| |d<   | |d         k    r| |d<   |dxx         | z  cc<   d S )Nr   r   rS   r   )r9  r   s     rf   addsizezdebugrevlog.<locals>.addsize  sO    Q4<4!A$;;AaD!A$;;AaD	!rh   r   s   _getsegmentforrevs   emptyNrS   s   %%%dd
s   %%%dd %s(%%5.2f%%%%)
c                 B    t          t          |                     z  S r   rU   str)r  basedfmtstrs    rf   dfmtstrzdebugrevlog.<locals>.dfmtstr]  s    SS]]**rh   c                 L    t          t          |                     d|z  fz  S )Nr   r  )r  paddingbasepcfmtstrs     rf   pcfmtstrzdebugrevlog.<locals>.pcfmtstr`  s#    s3s88}}dWn===rh   c                 <    |r| dt          |           z  |z  fS | dfS )Nd   r  )r  )r  r   s     rf   pcfmtzdebugrevlog.<locals>.pcfmtc  s/     	 3u-566%<rh   s   format : %d
s   flags  : %s
r  r   s   revisions     : s       merges    : s       normal    : s       empty     : s                      text  : s                      delta : s       snapshot  : s         lvl-%-3d :       s       deltas    : s   revision size : c                     | dk    rd| z  S | t          j        t          j                  v rdt	          |           | fz  S dt	          |           z  S )Nr  s       %s     : s       0x%s (%s)  : s       0x%s      : )r(   r   stringascii_lettersr   )	chunktypes    rf   fmtchunktypez!debugrevlog.<locals>.fmtchunktype  sX      #i//(*6+?@@@@'3y>>9*EEE&Y77rh   s   chunks        : s   chunks size   : s   avg chain length  : s   max chain length  : s   max chain reach   : s   compression ratio : s4   uncompressed data size (min/max/avg) : %d / %d / %d
s4   full revision size (min/max/avg)     : %d / %d / %d
s4   inter-snapshot size (min/max/avg)    : %d / %d / %d
s5       level-%-3d (min/max/avg)          : %d / %d / %d
s4   delta size (min/max/avg)             : %d / %d / %d
r  s   deltas against prev  : s       where prev = p1  : s       where prev = p2  : s       other            : s   deltas against p1    : s   deltas against p2    : s   deltas against other : r   ))r(   r   r   r  r  rU   r\   rZ  r   deltaparentr  r  r  rawsizer  r   ZeroDivisionErrorr  _format_version_format_flagsr-   FLAG_INLINE_DATAr   FLAG_GENERALDELTAr  defaultdictr   r  r  snapshotdepthr=   rU  _getsegmentforrevs_revlogr  sumr  r   rp   r   r(  )Gr^   r_   r  r   rd   numrevstsr  r]   dbasecbaseclenr   r   rsrC   formatr6  r   gdelta	nummergesnumemptynumemptytextnumemptydeltanumfullnumseminumsnapdepthnumprevnump1nump2numother	nump1prev	nump2prevchainlengthsr  
chainspansdatasizefullsizesemisizesnapsizedepth	deltasizechunktypecountschunktypesizesr  r   r9  baseaddrrevaddrdepthsegmentr  	numdeltasnumoprevtotalrawsize	fulltotal	semitotal	snaptotal
deltatotalr  avgchainlenmaxchainlenmaxchainspan	compratior  r  r  rI  fmt2r  r  r  sG                                                                        @@rf   debugrevlogr   ~  sm    %%D4==Axx .a&&
C	
 	
 	
 >> "	 "	CMM#&&E{{KK$$E::c??D\\#&&FB3BbBSc**+++EIIcNNN  155::o$       HH" GGCLLEE#JJGGENNGGENNGGBKKGGBKKJJ   ( qF	AEF6""  Y6## &_%%%  I HLMGG*9955LGEEH II LJJ ||H||H||H+,@,@AAMION   !ffGW~~ A* A*c""Bc""A::GAIIcNNH---==NIxx}}G"""aggcll+++d###qyyA!1Q1$h'''mA.////U 3a 7888!%(HggcllGh'''w1T9:::qyyA"c"" "h'''1,,U###q(###mE23333i(((C!G##qLG{{!Q		"!Q	b[[QJEEb[[QJEEg%%MH A455 	@**344Q7GGi223<<Q?G 	!gacl++II IO++)*OI&()N9%	"""a'"""y!!!T)!!!! 8Xy9  7?DG'!H,w6I"Y.HA;LQKKK7KKKI!||wII{{w 7 7(/2	%eQ<#661J1}}!	!I%
2Il##g-Kl##Kz??LI - 9,	K,L+ + + + +> > > > > >      NN#f,---NN#ejj&7&77888HHUOOO
(9

C79DNN&7888NN&uuY/H/H)HHIIINNcEE'I*=w$G$GGG   NN&7888NN&uuXw/G/G)GGHHHNN&
lL=$@AA
A	B   NN&
m\M%ABB
B	C   NNcEE'G*;W$E$EEE   %% 
 

'%/EE,u-w7778	
 	
 	
 	
 NN&uuY/H/H)HHIIINN&	)99:::NNcEE)i*?$K$KKK   %% 
 

'%/EE)E*I6667	
 	
 	
 	
 NN&uuZ/K/K)KKLLL8 8 8 HHUOOONN&7888O,, C C	
i(()))
uu_Y7AAABBBBNN&	)99:::O,, D D	
i(()))
uu^I6	BBBCCCCHHUOOO
'#k;iHH
I
ICNN*S;->>???NN*S;->>???NN*S<-??@@@NN*S9_<===zz

DHoo	
 	
 	
 NN@
//	   NN@
//	   && 
 
A::
Ex%e 45557	
 	
 	
 	
 NN@
	

	  
 1}}
hy!!x	1%%
&uuWi/H/H)HH	
 	
 	
 Q;;NN*TEE)W4M4M-MM   NN*TEE)W4M4M-MM   NN*TEE(G4L4L-LL    		NN*S55	3J3J-JJ   NN*S55	3J3J-JJ   NN*S5593M3M-MM    1 }"		 		s   >EE&%E&   debugrevlogindex   formats   revlog formats   FORMATs   [-f FORMAT] -c|-m|FILEc                    t          j        |          }t          j        |d||          }|                    dd          }|dvr$t          j        t          d          |z            | j        rt          }nt          }d}|D ]-}t           ||                    |                              } |dk    r| j        rA|                     dd                    |          d	                    |          fz             n|                     d
d                    |          d	                    |          fz             nd|dk    r^| j        r,|                     dd                    |          z             n+|                     dd                    |          z             |D ][}|                    |          }	|dk    r	 |                    |	          }
n# t$          $ r |j        |j        g}
Y nw xY w| j        r|                     d||                    |          |                    |          |                    |           ||	           ||
d                    ||
d                   fz             |                     d||                    |           ||	           ||
d                    ||
d                   fz             4|dk    r |                    |          }| j        r|                     d||                    |          |                    |          |                    |          |                    |          |                    |          |d         |d          ||	          f	z             |                     d||                    |          |                    |          |                    |          |d         |d          ||	          fz             ]dS )z#dump the contents of a revlog indexr  r  r   )r   r   s   unknown format %d   s*      rev    offset  length linkrev %s %s p2
s   nodeidr<  s      rev linkrev %s %s p2
r   s?      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   r   r  r  r   rY   r   r:  r   r   rU   r   r  r   ljustrjustrS  rl  r  r\   r  r  linkrevr  r   r  )r^   r_   r  r   rd   r  shortfnidlenr   r   r?  prs               rf   debugrevlogindexr    s=    %%D4!4eTBBAXXi##FVk!011F:;;;	|  E  GGAFF1II&&''{{: 		NN>??5))5;;u+=+=>?   
 NN,??5))5;;u+=+=>?    
1: 	NN$ //%((	)    NNA//%(()  
  < <vvayyQ;;0YYt__ 0 0 0k4;/0z 5

		!11	    +		!11	 	 	 	 q[[aBz C



		!		!11
    9

		!		!11	  c< <s   GG87G8s   debugrevspec   optimizes/   print parsed tree after optimizing (DEPRECATED)s	   show-revss(   print list of result revisions (default)s   show-sets+   print internal representation of result sets   no-optimizeds"   evaluate tree without optimizations   verify-optimizeds   verify optimized results   REVSPECc                 b	    t          j        |          }                     d          dd fd fdfdt          j        fdt          j        fdt          j        fg}|d	         r
|d
d         }|d         r)|d	         r!t          j        t          d                    d |D             }t                      }t                      } j        rQ|d         sI|                    d           |                    ddg           |d         r|                    d           |d         r)|d         r!t          j        t          d                    |d         dgk    r|                    |           nN|d         D ]*}||vr$t          j        t          d          |z            +|                    |d                    i }	d
}
t          j        |t          j        |                    }|D ]s\  }} ||          x|	|<   }||v s
||v rV||
k    rP|d         s|dk    r                     d|z                                  t          j        |          d           |}
t|d         r t          j        |	d                   |          } t          j        |	d                   |          }|d         s|d         Y j        rR                     dt+          j        |          d                                dt+          j        |          d           t/          |          }t/          |          }||k    rdS                      dd                                dd           t1          j        d
||          }|                                D ]\  }}}}}|d v r'|||         D ]}                     d!|z  d"           |d#v r'|||         D ]}                     d$|z  d%           |d&k    r%|||         D ]}                     d'|z             d(S t          j        |          } ||          }|d         s|d         0 j        r)                     d)t+          j        |          d           |d*         sd
S |D ]}                     d+|z             d
S ),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.
    s   revsetaliasr  c                     | S r   r   )r  s    rf   rl  zdebugrevspec.<locals>.<lambda>  s     rh   s   expandedc                 :    t          j        | j                  S r   )r0   expandaliasesrV  )r  aliasesr^   s    rf   rl  zdebugrevspec.<locals>.<lambda>  s    1$II rh   s   concatenatedr  r  s   no_optimizedNr   s   verify_optimizeds1   cannot use --verify-optimized with --no-optimizedc                     h | ]\  }}|S r   r   r  s      rf   r  zdebugrevspec.<locals>.<setcomp>  r  rh   r  r  s'   cannot use --optimize with --show-stager"  r  rX   r  r   s   show_sets   * analyzed set:
s   * optimized set:
r   s   --- analyzed
s   diff.file_arn  s   +++ optimized
s   diff.file_b)deleterJ  s   -%d
s   diff.deleted)insertrJ  s   +%d
s   diff.insertedequals    %d
r   s   * set:
s	   show_revss   %d
)r(   r   rv  r0   
foldconcatr  r  r   rY   r   rZ  r  r  r   r  r/   lookupfnr\   r  makematcherr   rF   r  r  difflibSequenceMatcherget_opcodes)r^   r_   r  r   r  r  r  showchangedr  treebystageprintedtreer  rq   arevsbrevssmr  aloahiblobhir2  funcr  r  s   `                       @rf   debugrevspecr(  U  sx   Z %%Dnn^,,G	%%&IIIII	
 
*/0	j()	z*+	F O   
T/%: 
kBCC
 
 	
 (''''JJ%%K	z )$}- )y!!!K9::: 	)NN<(((M ItK0 Ik!FGGHHHMvh&&*%%%%m$ 	D 	DA
""k!$=">">"BCCC #$}-...KKD)>)>???D  1 !$'A
??qK//DK4G4GM" )a9nna(((HHZ,T22E:::K  <";{#;<<TBB=";|#<==dCC 	k!2!:rz!:NN$j&;E&B&BE   NN%z'<U'C'CU   UUE>>1
(???
)@@@$T5%88')~~'7'7 		+ 		+#Cc3+++s3w B BAHHX\HAAAA+++s3w C CAHHX\1AHBBBBg~~s3w + +AHHX\****qd##D4::DK HT+.62:6
{J$9$$?$?GGG   
1 rh   
   debugserve   sshstdios*   run an SSH server bound to process handles   logiofds$   file descriptor to log server I/O to	   logiofiles   file to log server I/O toc                    t          j        |          }|d         s!t          j        t	          d                    d}|d         r)|d         r!t          j        t	          d                    |d         r	 t          j        t          |d                   dd          }nu# t          $ rI}|j	        t          j
        k    r t          j        t          |d                   d	d          }Y d}~n'd}~ww xY w|d         rt          |d         d
d          }t          j        | ||          }|                                 dS )zrun 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   wbs   ab)logfh)r(   r   r   rY   r   r_  fdopenr  r  errnoESPIPEr
   r@   	sshserverserve_forever)r^   r_   r   r0  r  r}  s         rf   
debugserver6    sU   * %%D Hk!EFFGGGEJ KD. Kk!HIIJJJJ 3
	>Ic$z"233T1==EE 	> 	> 	>w%,&&Ic$z"233T1==EEEEEE		>
 
l	 3T,'22!"d%888AOOs   :)B$ $
C7.?C22C7s   debugsetparentss   REV1 [REV2]c                 *   t          j        ||                                          }t          j        ||d                                          }|                                5  |                    ||           ddd           dS # 1 swxY w Y   dS )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.
    s   nullN)r1   r>  r   r   
setparents)r^   r_   rb   rc   node1node2s         rf   debugsetparentsr;    s    , dD))..00EdD'227799E	 & &u%%%& & & & & & & & & & & & & & & & & &s   $BBBs   debugsidedatac                    t          j        |          }|                    d          s*|                    d          s|                    d          r)|"t          j        dt          d                    d|}}n$|"t          j        dt          d                    t          j        |d||          }t          |d|          }	 |	                    |
                    |                    }n2# t          $ r% t          j        t          d          |z            w xY w|rt           |j                              } |j                     |                     d	t#          |          z             |D ]_\  }}|                     d
|t#          |          fz             | j        r*|                     dt'          j        |          z             ^dS dS )zcdump the side data for a cl/manifest/file revision

    Use --verbose to dump the sidedata content.r   r   r  Nr  r  r  r  s   %d sidedata entries
s    entry-%04o size %d
r+  )r(   r   r  r   r  r   r   r  r	   rM   rX   r  rY   r  r/  r)  r   rU   r  rF   ra  )	r^   r_   r  r]   r   rd   rM   r4  r  s	            rf   debugsidedatar=  )  s   
 %%Dxx H+!6!6 H$((6:J:J H?$\15I3J3JKKK5s	 q1E/F/FGGGD,t<<A9a  AF::ahhsmm,, F F Fk!=>>DEEEF E(())
/#h--?@@@" 	E 	EJCNN3sCJJ6GGHHHz Ey:+<U+C+CCDDDE E	E 	Es   
(C3 3/D"   debugssls   [SOURCE]c                    t           j        s!t          j        t	          d                    |s%|s!t          j        t	          d                    d}t          j        d|| |          \  }}t          j        |          }ddd}|j        |v rY	 |j	        t          |j        p||j                           f}nP# t          $ r" t          j        t	          d                    w xY wt          j        t	          d	                    d
dlm} t          j        t#          j                    t          j        t          j        d          }		 |	                    |           |	                    d          }
|                     t	          d          |j	        z             |                    |
d          }|s}|                     t	          d                     |                    |
          s#|                     t	          d                     nE|                     t	          d                     n"|                     t	          d                     |	                                 dS # |	                                 w xY w)a  test 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.
    s6   certificate chain building is only possible on Windowss>   there is no Mercurial repository here, and no server specifiedr   r>  i     )s   httpss   sshs   malformed port number in URLs,   only https and ssh connections are supportedr   )win32N)ssl_version	cert_reqsca_certsTs&   checking the certificate chain for %s
F)builds-   certificate chain is incomplete, updating... s   failed.
s   done.
s$   full certificate chain is available
)r(   	iswindowsr   rY   r   rG   rv  r<   schemer  r  portr  r  rA  sslwrap_socketr  PROTOCOL_TLS	CERT_NONEconnectgetpeercertr   checkcertificatechainr0  )r^   r_   sourcer   r  r<   defaultportaddrrA  r}  certrT  s               rf   debugsslrT  E  s     
kGHH
 
 	
   	+(    3T2v FH +f

C "--K
z[  	BHc#("Ek#*.EFFGDD 	B 	B 	B+a ?@@AAA	B k!KLLMMM$-		 	 	A			$}}T""
		!>??#(JKKK..t5.AA 	CIIaHIIJJJ..t44 )		!L//****		!J--((((IIa@AABBB										s   (B; ;,C'DI1 1J   debugbackupbundle)rh      recoverrh   s7   brings the specified changeset back into the repositorys%   hg debugbackupbundle [--recover HASH]c                 
   t          t          t          j        j        t          j        j                            d          dz                                 }|                    d d           t          j
                  dd<   dd	<   t          j                  fd
}                    d          }|r=t          j        |          r'|                     t#          d          |z             dS nM|r't#          d          }|                     |d           n$|                     t#          d                     dS |D ]}t          j                            |t)          j                              }	t-          j        d| |	                    d                    \  }	}
	 t1          j        |	          ni# t4          j        $ rW}t#          d          |	z  }t#          d          t9          |j                  z  }|                     ||           Y d}~d}~ww xY wt1          j        |
                    d                    \  }}|rfd|D             }|                                 5  	 tA          j!        | |d         d	                   \  }}n!# t4          j        $ r Y ddd           ~w xY w	 ddd           n# 1 swxY w Y   	 |s	  |             |r5"                                5  #                    d          5 }t          j        |          r|                     t#          d          |z             t1          j$        | |	          }tK          j&        | ||	          }tO          |tP          j)                  rtQ          j*        ||dd|	z              n|+                    dd|	z              	 ddd           ddd            |              dS 	 ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   nt)          j,        t[          j.        dt[          j/        t          j        0                    |	                                        }|                     d|1                    d          z             | j2        r.|                     d d1                    d!          |	fz             nd"d#<   t          j3        | d$          } |||           |4                                  |             #  |             w xY w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   /*.hgc                 @    t           j                            |           S r   )r_  r   getmtimer   s    rf   rl  z#debugbackupbundle.<locals>.<lambda>  s    rw//22 rh   T)r4  reverserh   s   bundleNs   forcec                 \                        d          r|                                 d}|D ]|}	|k    r d S fd| j                            |          D             }                     d          rt	          |          dk    r\|dz  }|                    | |                    }d S )Ns   newest_firstr   c                 *    g | ]}|j         k    d S )T)r  )r   r   r_   s     rf   r   z6debugbackupbundle.<locals>.display.<locals>.<listcomp>  s,       A<L<L<L<L<Lrh   s	   no_mergesrS   r   )r  rZ  rZ   rS  rU   show)	r   chlist	displayercountr  rS  limitr   r_   s	         rf   displayz"debugbackupbundle.<locals>.display  s    88O$$ 	NN 		% 		%A Ue^^   #o55a88  G xx%% #g,,!*;*;QJENN58$$$$		% 		%rh   rV  s   %s already exists in the repo
sg   Recover changesets using: hg debugbackupbundle --recover <changeset hash>

Available backup changesets:s   status.removedrn  s   no backup changesets found
rU  r   )default_branchess"   
warning: unable to open bundle %ss   
(missing parent rev %s)
r  rD  c                 :    g | ]}                     |          S r   r  )r   r]   r   s     rf   r   z%debugbackupbundle.<locals>.<listcomp>  s%    666#ELL%%666rh   s   unbundles   Unbundling %s
s   bundle:)rP  r<   z%a %H:%M, %Y-%m-%ds   
%s
2   r      s8   {label('status.modified', node|short)} {desc|firstline}
r  F)5r  filterr_  r   isfileglobr>   rp   r)  r(   r   r   getlimitr  r1   isrevsymbolrV  r   r   relpathr   rW   rG   rv  r   r,  r   r]  r   r   rz  rl  r   getremotechangesr   r   rt   r   ru   r   r   r   applybundlerv   r,  rm   r*  r+  rY  r  r  changesetdisplayerr0  )r^   r_   r&  r   backupsrb  recovernoder   backuprP  r  exr  r  checkoutr^  	cleanupfnr0  rq   rx   
backupdater_  ra  r   s    ` `                  @@rf   debugbackupbundlerw    s   2 GNDIdhmmO&D&Dx&OPP	
 	
 G
 LL22DLAAA%%DDODN%%E% % % % % % % ((:&&K t[11 	GGA899KGHHHF	 
 @
 
 			#.	////
		!344555 H H):):;;"7 !XXi00
 
 
	GD$//EE  	 	 	:;;fDC344uRW~~EDGGCdG###HHHH		
 )%488F#3#3
 
h  	76666666DYY[[ 	 	+5+FeT4	?DN, ,(vyy $   	 	 	 	 	 	 	
  )	 	 	 	 	 	 	 	 	 	 	 	 	 	 	(	 L IKKKKK  #"YY[[  $"2"2;"?"? 2*5+>> 		!$6"7"7;"GHHHKF33&1"a@@%c7+=>> 	N#/ $ # "'2$.$7      IIdKf9LMMM           H IKKKKKKG                             " &0M,rw'7'7'?'?@@  
 		)z'7'7';';<===: UIIi:+;+;B+?+?*HHIIII U # '9tU 	 vy111!!!IKKKKIIKKKKQH Hs   6GH3AH..H3K!	)J32K!3KK!KK!!K%	(K%	-T3<T3P()B8P!P(,T3P(PP(PP(T3(P,	,T3/P,	0C7T33T?s   debugsubs   revision to checks   [-r REV] [REV]c                 2   t          j        ||d           }t          |j                                                  D ]Y\  }}|                     d|z             |                     d|d         z             |                     d|d         z             Zd S )Ns   path %s
s    source   %s
r   s    revision %s
r   )r1   r>  r   r  r/  r   )r^   r_   r]   rI  r  r6  s         rf   debugsubry    s     
D#t
,
,Cs|))++,, 1 11
|a'(((
(1Q4/000
(1Q4/00001 1rh   s
   debugshellc                 D    ddl }| |d}|                    |           dS )zrun an interactive Python interpreter

    The local namespace is provided with a reference to the ui and
    the repo instance (if available).
    r   N)r^   r_   )r   )codeinteract)r^   r_   r{  imported_objectss       rf   
debugshellr~  )  s?     KKK  
 	MM(M)))))rh   s   debugsuccessorssetss   closests#   return closest successors sets onlys   [REV]c                 .   i }t           }t          }t          j        ||          D ]}||         }|                     d ||          z             t          j        ||                                |d         |          D ]}	|	ry|                     d           |                      ||	d                              |	dd         D ]5}
|                     d           |                      ||
                     6|                     d	           dS )
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)r  r  s       r   r   Nr   r   )r  r   r   ri  r\   r#   successorssetsr   )r^   r_   r  r   r  ctx2strnode2strr]   rI  succssetr   s              rf   debugsuccessorssetsr  :  s-   L EGH"4..  3i
773<<'(((.#((**d9oU
 
 
 		 		H  -!!!(1+..///$QRRL - -DHHTNNNHHXXd^^,,,,HHUOOOO		 rh   s   debugtagscachec                    t          j        |                                          }|                    d          }|D ]}||                                         }|                    |d          }|r*t          |          }|                    |          s|dz  }n|d}nd}|                     d|t          |          |fz             dS )	z/display the contents of .hg/cache/hgtagsfnodes1s   .hgtagsF)computemissings    (unknown node)NrK  s   invalids	   %d %s %s
)	tagsmodhgtagsfnodescachers  r  r   getfnoder   hasnoder\   )r^   r_   r  flogrd   r   tagsnodetagsnodedisplays           rf   debugtagscacher  r  s     %doo&7&788E99Z  D B BAw||~~>>$u>== 	)!(mmO<<)) 6#55(OO(O
!SYY!@@AAAAB Brh   s   debugtemplates   apply template on changesets   Ds   defines   define template keywords	   KEY=VALUEs&   [-r REV]... [-D KEY=VALUE]... TEMPLATEc                 X   d}|d         r>|!t          j        t          d                    t          j        ||d                   }i }|d         D ]l}	 d |                    dd          D             \  }}|r|dk    rt          |||<   ;# t          $ r% t          j        t          d	          |z            w xY w| j        r| 	                    d
          }	t          j        |          }
|                     t          j        |
          d           t          j        |
|	          }||
k    r)|                     dt          j        |          d           |t!          j        | |          }t!          j        | ||          }| j        r|                                \  }}|                     dd                    t-          |                    z             |                     dd                    t-          |                    z             |                     |                    |                     dS t          j        | ||          }| j        r|j                                        \  }}|                     dd                    t-          |                    z             |                     dd                    t-          |                    z             |D ](} |j        ||         fi t7          j        |           )|                                 dS )zparse 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.
    Nr]   rT   definec              3   >   K   | ]}|                                 V  d S r   r   rS  s     rf   r  z debugtemplate.<locals>.<genexpr>  s*      88!AGGII888888rh   r  r   rh  s    malformed keyword definition: %ss   templatealiasr   s   * expanded:
)	resourcess   * keywords: %s
r  s   * functions: %s
)r   	RepoErrorr   r   ri  r   r  rY   r  rv  r9   r  r   r  r  ri  r   templateresourcesmaketemplatersymbolsuseddefaultr   rp   r   r\   renderdefaultr  r]  r(   r  r0  )r^   r_   tmplr   r  propsr  r  r6  r  r  newtreetresr  kwdsfuncsr_  rd   s                     rf   debugtemplater    s)   $ DE{ 6</JKK   "4e55E(^ J J	J88qwwtQ'7'7888DAq !U

  E!HH 	J 	J 	J+a CDDqHIII	J 
z ..!122t$$
	&t,,e444)$88d??MM )"8"A"A5   |*2t44#B===: 	M..00KD%NN.F4LL1I1IIJJJNN/%**VE]]2K2KKLLL
''(((((,Rt<<	: 	M#+88::KD%NN.F4LL1I1IIJJJNN/%**VE]]2K2KKLLL 	A 	AAIN47@@h&8&?&?@@@@s   7B/B=s   debuguigetpasss   prompts   prompt texts   TEXTs	   [-p TEXT]c                 h    |                      |          }|d}|                     d|z             dS )zshow prompt to type passwordNs   <default response>   response: %s
)getpassr   r^   r  rd   s      rf   debuguigetpassr    s=     	

6Ay!NN$q()))))rh   s   debuguipromptc                 `    |                      |          }|                     d|z             dS )zshow plain promptr  N)r  r   r  s      rf   debuguipromptr    s3     			&ANN$q()))))rh   s   debugupdatecachesc                     |                                 5  |                                5  |                    t          j                   ddd           n# 1 swxY w Y   ddd           dS # 1 swxY w Y   dS )z'warm all known caches in the repository)cachesN)r   r   updatecachesrA   
CACHES_ALL)r^   r_   r&  r   s       rf   debugupdatecachesr    s     
 8 8tyy{{ 8 8!67778 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8s4   A/!AA/A	A/A	A//A36A3s   debugupgraderepos   extra optimization to performs   runs   performs an upgrades   backups&   keep the old repository content aroundr   s    select the changelog for upgrader   s   select the manifest for upgrades   filelogss   select all filelogs for upgradec                 J    t          j        | |f|t          |          |d|S )a0  upgrade 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  rr  )r;   upgradereporZ  )r^   r_   r  r  rr  r   s         rf   debugupgraderepor    s>    \ 
DCMM& DH  rh   s	   debugwalks   [OPTION]... [FILE]...c                    t          j        |          }t          j        d         ||          }| j        r)|                     dt          j        |          d           t          d         	                    |                    }|sdS d }| 
                    dd          rt           j        dk    rd }d	t          d
 |D                       t          fd|D                       fz  }|D ]g}|| |                    |                    |                    |          rdpdfz  }	|                     d|	                                z             hdS )z&show how files match on given patternsNr  r   c                     | S r   r   r   s    rf   rl  zdebugwalk.<locals>.<lambda>+  s    2 rh   rh  s   slashrE  c                 *    t          j        |           S r   )r=   r,  r  s    rf   rl  zdebugwalk.<locals>.<lambda>-  s    t}R(( rh   s   f  %%-%ds  %%-%ds  %%sc                 ,    g | ]}t          |          S r   r{  )r   r  s     rf   r   zdebugwalk.<locals>.<listcomp>/  s    '''#SXX'''rh   c                 T    g | ]$}t                              |                    %S r   )rU   rW  )r   r  r_   s     rf   r   zdebugwalk.<locals>.<listcomp>0  s-    444sSS!!""444rh   s   exactrh   r%  )r(   r   r1   r*  r  r   rF   r  r  r  
configboolrH  r  rW  exactr\   rstrip)
r^   r_   r&  r   r   r/  rq   rI  r  r  s
    `        rf   	debugwalkr    s}   
 %%Dd4j$--A	z I

(=a(@(@%HHHd##$$E A	}}UH%% )(.D*@*@((
#'''''((4444e44455' C  * *Adkk#GGCLL%X,
 

 	4;;==())))* *rh   s   debugwhyunstablec           	      6   t          j        |t          j        ||                    D ]o}d}|                    d          r(d                    d |d         D                       dz   }|                     d|d         ||d         |d         fz             pd	S )
z$explain instabilities of a changesetrh   s   divergentnodesr   c              3   l   K   | ]/}d |                                 |                                fz  V  0dS )s   %s (%s)N)r   phasestr)r   rI  s     rf   r  z#debugwhyunstable.<locals>.<genexpr>B  sP         #''))S\\^^!<<     rh   s   %s: %s%s %s
s   instabilitys   reasons   nodeN)r#   whyunstabler1   r>  r  rp   r\   )r^   r_   r]   r  dnodess        rf   debugwhyunstabler  ;  s     $T7+<T3+G+GHH 
 
99&'' 			  $%67     	  	^$feI.>gOP	
 	
 	
 	

 
rh   s   debugwireargs))rh      threerh   r  )rh      fourrh   r  )rh      fiverh   r  s   REPO [OPTIONS]... [ONE [TWO]]c                    t          j        |          }t          j        | ||          }	 t          j        D ]}||d         = i }|                                D ]\  }}|r|||<   t          j        |          } |j        |i |}	 |j        |i |}
| 	                    d|	z             |	|
k    r| 
                    d|
z             |                                 d S # |                                 w xY w)Nr   r%  )r(   r   r   r,  r   
remoteoptsr/  r  debugwireargsr\   rV  r0  )r^   r   valsr   r_   optr`   r  r6  res1res2s              rf   r  r  N  s    %%D72tX&&D% 	 	CSVJJLL 	 	DAq Q!$''!t!40400!t!40400
4   4<<GGGdN###



s   BC! !C7c              #     K   d }g }d}| D ]}|                                 }|s|                    d          r/|                    d          s|r||fV  |}g }d}S|s!t          j        t	          d                    t          |          t          |                                          z
  }||k    r%|r#|dxx         |                                z  cc<   |                    |           |}|r||fV  d S d S )Nr      #r   s   indented line outside of blockr   )r  r   r   rY   r   rU   lstripr   )r  activeaction
blocklines
lastindentr  r   s         rf   _parsewirelangblocksr  n  sN     LJJ    {{}} 	??4   	t$$ 	 /"J....LJJ  	D+a ABBCCCTS/// J:rNNNdkkmm+NNNNd###JJ  'J&&&&&&' 'rh   s   debugwireproto   localsshs!   start an SSH server for this repo   peers(   construct a specific version of the peer   noreadstderrs%   do not read from stderr of the remotes   nologhandshakes,   do not log I/O related to the peer handshakec           
        * t          j        |          }|d         r#|s!t          j        t	          d                    |d         r:|d         dvr0t          j        t	          d          t	          d                    |r)|d         r!t          j        t	          d                    |                                 r"|                     t	          d	                     t          t          | j	                            }d
}d
}d
}d
}d
}	|d         rt          j                    d|j        ddgz   }
t          j        t          j        t          j        |
          t          j        t          j        t          j        d          }|j        }|j        }|j        }| j        s|d         dk    rWt-          j        | |j        dd          }t-          j        | |j        dd          }t-          j        | |j        dd          }d}|d          }|d         dk    r@|                     t	          d                     t1          j        | |||||d
|          }n|d         dk    r&|                     t	          d                     d
}n|                     t	          d                     t1          j        | ||||||          }nS|r/t7          j        |          }|j        dk    r!t          j        t	          d                    |                                \  }}dd i}| j        r|                    | d!dd"d#d$           | j         rd|d%         d&<   |d         dk    rd"|d'<   tC          j"        | |fi |}	|d         dk    r%|                     t	          d                     d
}nk|d         r*t          j        t	          d(          |d         z            tG          j        | ||	)          }n!t          j        t	          d*                    d
}|D 	]q\  }}|d+v r|s!t          j        t	          d,                    d-$                    d. |D                       }tK          j&        |          }|                    |           |d/k    r|'                                 |d0k    r8|s!t          j        t	          d1                    |'                                 |(                    d2          ru|s!t          j        t	          d3                    |)                    d4d5          d5         }i }
|D ]}|*                                )                    d4d5          }tW          |          d5k    r|d         }d-}n|\  }}|(                    d6          rtK          j,        |d7d
                   }ntK          j&        |          }||
|<   ||-                    ||
f           | .                    t	          d8          |z             d9|
v rt_          |
d9         d:          5 }|
d9=  |j0        ||fi t          j1        |
          \  }}| .                    t	          d;          tK          j2        |          z             | .                    t	          d<          tK          j2        |          z             d
d
d
           n# 1 swxY w Y   |3                                5 }|4                    ||
          5                                }d
d
d
           n# 1 swxY w Y   | .                    t	          d=          tK          j6        |dd>?          z             Y|d@k    r'|!t          j        t	          dA                    g }|dBk    r| .                    t	          dC          tW          |          z             |J to          |8                    |                    D ]>\  }}| .                    t	          dD          |tK          j2        |          fz             ?d
}'|(                    dE          r|	s!t          j        t	          dF                    |)                    d4d>          } tW          |           dGk    r!t          j        t	          dH                    | d5d
         \  *}!i }"d
}#g }$|D ]_}|*                                }ts          j:        dI|          }%|%rTt          j;        |%<                    d5                    }t          j;        |%<                    d>                    }||"|<   |(                    dJ          rQt_          |)                    d4d5          dK          5 }|=                                }#d
d
d
           n# 1 swxY w Y   |(                    dL          r@t}          j?        |tW          dL          d
                   }&|$-                    |&           =t          j        t	          dM          |z            ||!z   }|$rd-$                    dN |$D                       }#tB          j@        A                    t          j;        |          |#|"          }'*fdO|'_B        	 |	/                    |'          }|=                                }#n<# t,          jC        jD        $ r%} t          |dPdQ                        Y d
}~d
}~ww xY w|jF        G                    dR          }(|(dSk    rL|                     t	          dT          tK          j6        t          jI        |#          dd>?          z             X|dUk    r|J |J                                 x|dVk    rc|r|s!t          j        t	          dW                    |J                                 |=                                 |=                                 |dXk    r9|s!t          j        t	          dY                    |K                                  |dZk    r9|s!t          j        t	          d[                    |K                                 _|(                    d\          rct          |)                    d4d5          d5                   })|s!t          j        t	          d]                    |=                    |)           |(                    d^          rct          |)                    d4d5          d5                   })|s!t          j        t	          d_                    |=                    |)           	Ot          j        t	          d`          |z            |!t          j        t	          da                    |r|J                                 |r|M                                 d
S d
S )ba  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   ssh1s   invalid value for --peers!   valid values are "raw" and "ssh1"r  s/   cannot specify --localssh with an explicit paths    (waiting for commands on stdin)
Ns   -Rr)  s
   --sshstdior   )stdinstdoutstderrbufsizer     iT)logdatar|   r  s   ssh://localserverr  r  s.   creating ssh peer for wire protocol version 1
)autoreadstderrs   using raw connection to peer
s)   creating ssh peer from handshake results
s   https*   only http:// paths are currently supported	useragents   Mercurial debugwireprotor  F)r  logdataapis)	loggingfhloggingnameloggingoptsr  r  
sendaccepts'   --peer %s not supported with HTTP peers)openers$   unsupported connection configuration)r     raw+s!   cannot call raw/raw+ on this peerrh   c              3   >   K   | ]}|                                 V  d S r   )r  r   s     rf   r  z!debugwireproto.<locals>.<genexpr>  s*      661AHHJJ666666rh   r  s   flushs   cannot call flush on this peers   commands6   cannot send commands unless peer instance is availabler   r   s   eval:r  s   sending %s command
s   PUSHFILErbs   result: %s
s   remote output: %s
r  rS   )bprefixr   s
   batchbegins   nested batchbegin not alloweds   batchsubmits#   sending batch with %d sub-commands
s   response #%d: %s
s   httprequest s+   cannot use httprequest without an HTTP peerrP   sD   invalid httprequest: expected format is "httprequest <method> <path>s   ^([a-zA-Z0-9_-]+): (.*)$s	   BODYFILE s   rbs   frame s#   unknown argument to httprequest: %sc              3   4   K   | ]}t          |          V  d S r   )r  r  s     rf   r  z!debugwireproto.<locals>.<genexpr>  s(      99Qa999999rh   c                  ,    t          j                   S r   )r(   r\  )r  s   rf   rl  z debugwireproto.<locals>.<lambda>  s    X_V%<%< rh   r   c                      d S r   r   r   rh   rf   rl  z debugwireproto.<locals>.<lambda>  s    4 rh   zContent-Typezapplication/mercurial-cbors	   cbor> %s
s   closes   readavailables(   readavailable not available on this peers   readlines#   readline not available on this peers	   ereadlines$   ereadline not available on this peers   read s   read not available on this peers   eread s    eread not available on this peers   unknown action: %ss   unclosed "batchbegin" request)Nr(   r   r   rY   r   r  r\   r  r  r   rE   hgcmdrG  
subprocessPopenrapplytonativestrPIPEr  r  r  r  r=   makeloggingfileobjectr4   	sshv1peermakepeerrG   r<   rG  authinfor   r:  r  r  r   rp   rF   unescapestrflushr   r   r  rU   evalpythonliteralr   r   r
   	_callpushr  r{  rw  rx  ry  ra  r+  _submitbatchrer*  strurlgroupr   r?   makeframefromhumanstringurlreqrequest
get_methodurlerrurlerrorr	   headersr  rB   	decodeallr0  readliner  kill)+r^   r_   r   r   blocksprocr  r  r  r  r`   r<   r  r,  ur  
openerargsbatchedcommandsrL  linesr   commandr  fieldsr4  r  r  resr  r  r   chunkr  httppathr  bodyframesr   framereqctr`  r  s+                                             @rf   debugwireprotor    s   V %%DK B Bk!?@@AAAG} 
g /   k)**788
 
 
 	

  Q[! Qk!NOOPPP	~~ :
788999&rv..//FDEFFFK sF ~I	#
 
 OH0$77/??
 
 
 
 : 		g&00.DJd  E /DKt  F /DKt  F #!/22=G##HHQIJJKKK$-	 	 	DD ']f$$HHQ899:::DDHHQDEEFFF#-  DD 
 1F K8w+a MNNOOO

X4


 : 
	!##'#'',$ $ 	 	 	 < 	<7;J}%m4
 =F""',J|$r8::z::=F""HHQ899:::DD'] 	>+<==WM   $Rf===DD k!CDDEEEO   BA BA&&& Kk!$H"I"IJJJ 886666666D)$//DKK  x Hk!$E"F"FGGGKKMMMMz** r	A k(    ll4++A.GD " ",,T155v;;!## )CEE!'JC##H-- :&8qrrCCEE&2599E!S		*&&777IIa/007:;;;d""${+T22 b[)"0$.# #'/'9$'?'?# #KC IIa00:3G3L3LLMMMII011J4H4P4PP                 ))++ @q--66==??C@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 		'(( 'T!DDDE   
 }$$*k!$D"E"EFFF OO~%% II9::o&&'   ###%d&7&7&H&HII  5		+,,:3G3N3N/OO    #OO// h	A kDEE   ll4++G7||q  k8     'qrr{FHGDF  {{}}H8$?? "/!''!**55C$OAGGAJJ77E#(GCL??<00 djjq11599 )R!wwyy) ) ) ) ) ) ) ) ) ) ) ) ) ) )__Y// 	,ES^^--. E MM%((((+@AADH   /C :xx99&99999-''(<(<dGLLC
 =<<<CNkk#&&xxzz;'   06<<00222
 00B111m$$ ' *400$q     x###JJLLLL'''  kABB   KKMMMKKMMMKKMMMM{"" Mk!$J"K"KLLLOO|## Nk!$K"L"LMMMOOx(( 	AT1--a011E Ik!$F"G"GHHHKKy)) 	AT1--a011E Jk!$G"H"HIIIKK+a 566?@@@"k!<==>>> 

 		 sO   B[%%[)	,[)	)\;;\?	\?	#ggg-)kl+ll)NFFFFr  r  r   )NN)r   )r  )r   )rh   )FNT)r&  r[  r  r|  r  r2  ri  r  r_  rb  rt  r  r  rI  r  r  r  r  rm   i18nr   r   r   r   r   r   r(   r	   r
   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   lockmodr   r    r  r!   r"   r#   r$   r%   r&   r'   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r  r9   r:   r;   r<   r  r=   r>   rV   r?   r@   
interfacesrA   utilsrB   rC   rD   rE   rF   rG   rH   r  rI   r8  rJ   r  rK   rL   rM   r  tabler   r  _tablerg   rr   ry   r   r   r  r	  r  r!  r)  r7  rP  r^  rf  rd  rc  r  r  debugrevlogoptsr  r  formatteroptsr  r  r;  r@  r  r  r  r  r  r  
dryrunoptsr  r  r  r$  r5  r<  r@  rD  rY  r  r  r  r  templateoptsr  r  r  commitopts2r5  r=  rA  rZ  walkoptsr`  re  mergetooloptsru  r  r  r  r  r  r  r   r  r(  r6  r;  r=  rT  logoptsrw  ry  r~  r  r  r  r  r  r  r  r  r  r  r  r  r   rh   rf   <module>r(     s                  				   				  



       



                         7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7p # " " " " "                               /
 U]! " " "
)
E
"
" 		2qq!566TJJJ. . KJ.( 		!2&&; ; '&;  		'W55  65 	 A233		
 A344		
 
{D!!$?"@"@AA566		
* A/ 8 
]9 ]9 ]93 2]9@&= &= &= &=R   0I I I I) ) )5 5 5 50 		vtQQ2334	lB"B C CD	gtQQDEEF
 AgJJ	 	 	4 4 4	 	4 		r11W::d;;;  <;( 		
  $& $& $&N 		R%%" " &%" 		8T11:;;<= 
& & 
&3 3 3$   		("g66Q Q 76Q, 		waa 5667	{D!!$A"B"BC	gtQQ3445	y$"@ A AB	 A$%%
 
 
9 9 9
 
9x 	w.2C0D0DEEF F F FEF  	
Kqq!=>>?@A  
1 
1 
1 
1 	g33Am	  i i i iX 	g33A	  2= 2= 2= 2=j 	 A<==		
 
haa :;;<	k4#9!:!:;A;<<		
 AJKK		
, An1 4<H <H5 4<H~ 	&AcFF 
7 7 
7 		fdAA899:A@AA		
 
fbCDN	
	
!. /0 12 A7 :{ { {; :{| 
 		y#qqzz*      " 		W2BTJJJ; ; KJ;| 	 A455AfII	
 ADEE		
 A9::		
 A566AgJJ	
)8 A455= @> >A @>B 	 ABCCAgJJ	
 A<==AgJJ	
 ADEE		
, - 4- -5 4-` 	g3344D D 54DN 	QQy\\$777< < < 87<. 		wAA01111U88<	y"aa 455qqxx@A/00AgJJ	

 A !!   < < <!  <@ 	Y''.B .B ('.Bb 	$g33Am 
   
$ 	Am	      		R  ' ' ! ' 	"w44c$GGGh h HGhV	 	AAm,,T:::H H ;:H 		AAkNN33' ' 43'
 		!4+M)N)NOA899		
 
{D!!$G"H"HIA9::		
  An% (e e) (eP 	!	hqq!3445A:;;AgJJ	
	  :
 :
 :
 :
z 		R'"66<<i i =<iX 		r11Z==11  21. 	 ABCC		
 
lE11%C#D#DEA>??		
 A>??		
 0$@ $@1 0$@N 		h11_--.A<==		
 
vr11?@@AAABB		
 
hqq!?@@A	iQQEFFG!$ %& '( A&''- 0| | |1 0|~ 	
FC/00!!F))<=AkNN 
- - 
- 	
FC/00!!F))<=AkNN 
- - 
- 		waa :;;<	y$"; < <=	xqq!9::;	z4#=!>!>?	 An	 	9 9	 	9x 	*	  - - - 	r11W::d333  430 		vsAAABBAAfIIN	otQQ'K%L%LM 	
  Ao
 
 
H2 H2
 
H2V 	"aa ?@@NNN! ! ON!H 	r11V99%%   &%6 	-	vsAA788!!F))DA+ 		
 AkNN  C C!  CB 	 A;<<		
  < < < 	
FC/00!!F))<=A 
3 3 
3  		+R55  65 	guaa8J6K6KLMMAm	  [ [ [ [|
 	iAA.//9>?@A    i i i iX 	 A@AA		
 A9::		
 A<==		
 A566AgJJ	
 
ouaa(M&N&NO	!5!!,F*G*GH7: ?   Ba aC   BaH 	 A;<<		
 
j#qq!HIIJ	lC#?!@!@A	  ! ! !H 		R>!2!233& & & 43&8 		72AA6G4H4HIIE E E JIE6 	b+D999E E E :9EP 		
 o A.// ~ ~ ~B 	
FC/00!!F))<=A 
1 1 1 
1 	T**** * +**  		:uaa FGGHIAhKK 
0 0 
0f 		BB B  B& 		vr11<==qqyyI	y"aa :;;QQ|__M A/00  5 5 5p 		y#qq00!!G**= AlOO  * * * * 		y#qq00!!G**= AlOO  * * * * 		r""8 8 #"8 	 A.//AgJJ	
 
feQQ5667	iqq!JKKL	lD!!$G"H"HI	k4#E!F!FG	k4#E!F!FG "  # "D 	'"AA&>$?$?4  * * *2 		b!!F)),,
 
 -,
$ 	  
  A&''
 
 
 
 
*'' '' ''T 		k5!!$H"I"IJ	gsAAIJJKA677		
 A=>>		
  !" AiLL)  ,T T T- ,T T Trh   