
    6h(                        S SK Jr  S SKrS SKrS SKrSSKJr  SSKJrJ	r	J
r
Jr  SSKJr  0 r0 r\
R                   " \\5      rS r\" SS	S
9S 5       r0 rS rSS jr   SS jr     SS jrg)    )annotationsN   )_)errorpycompat	registrarrequirements)
stringutilc                     g )N )argskwargss     8/usr/lib/python3/dist-packages/mercurial/admin/verify.py	noop_funcr      s    
    s   working-copy.dirstates   dirstate)aliasc                   U R                  [        S5      5        UR                  R                  5       u  p4X   R	                  5       nX   R	                  5       nSn[
        R                  UR
                  ;   nU(       a  UR                  5       OS n	UR                  R                  XVX95       H  n
U R                  U
5        US-  nM     U$ )Ns   checking dirstate
r      )
statusr   dirstateparentsmanifestr	   NARROW_REQUIREMENTnarrowmatchverifywarn)uirepooptionsparent1parent2m1m2errors	is_narrownarrow_matchererrs              r   check_dirstater(      s    IIa&'(}},,.G				!B				!BF//43D3DDI+4T%%'$N}}##BGD
! E Mr   c                0   [        U R                  5       S SS9 Hx  u  p#UnUR                  S5      nUSS  H  nUR                  U0 5      nUnM     UR	                  US   5      c
  X#4XES   '   MW  U[
        Ld  Mb  Sn[        R                  " U5      e   g)zqCreate a pyramid of checks of the registered checks.
It is a name-based hierarchy that can be arbitrarily nested.c                    U S   $ )Nr   r   )xs    r   <lambda>build_pyramid.<locals>.<lambda>8   s    1Q4r   T)keyreverse   .Ns2   intermediate checks need to use `verify.noop_func`)sorteditemssplit
setdefaultgetr   r   ProgrammingError)	tablefull_pyramidentryfunccursorlevelslevelcurrent_nodems	            r   build_pyramidrA   5   s     ekkmNT"CR[E!,,UB7L!F ! ::fRj!)"'F":"EA((++ Or   c                r   Uc  [         nUc  [        nU S:X  a  U$ 0 nUR                  U 5      nUc{  UR                  U 5      nUb  Un UR                  U 5      nOUU R                  SS5      n[	        U5      S:X  a1  UR                  US   5      nUb  SXgS   4-  n UR                  U 5      nOU nU R                  S5      nUbJ  U(       d  [        X5        [        R                  5         [        R                  UR                  5       5        O[        U[        5        [        n	U Hz  n
U	R                  U
5      n	U	b  M  [        R                  " [        U5      [        U5      -   U 5      n[        R                  " U5      n[        R                  " [        SU -  5      US9e   [!        U	["        5      (       a|  [        U	R                  5       5      nU(       aZ  UR%                  5       u  p[!        U["        5      (       a   UR'                  UR                  5       5        O
US   XNS   '   U(       a  MZ  U$ XTU '   U$ )	a>  Find all checks for a given name and returns a dict of
(qualified_check_name, check_function)

# Examples

Using a full qualified name:
"working-copy.dirstate" -> {
    "working-copy.dirstate": CF,
}

Using a *prefix* of a qualified name:
"store.revlogs" -> {
    "store.revlogs.changelog": CF,
    "store.revlogs.manifestlog": CF,
    "store.revlogs.filelog": CF,
}

Using a defined alias:
"revlogs" -> {
    "store.revlogs.changelog": CF,
    "store.revlogs.manifestlog": CF,
    "store.revlogs.filelog": CF,
}

Using something that is none of the above will be an error.
s   fullr0   r   r   r   s   %s.%ss   unknown check %shint)verify_tableverify_alias_tabler6   r4   lenrA   pyramidclearupdater3   r   
getsimilarlistsimilarity_hint
InputErrorr   
isinstancedictpopextend)namer8   alias_tabler9   checkscheckqualified_namer4   r=   subtreer>   rD   stackcurrent_namer:   s                  r   find_checksr[   E   s   6 }(wF IIdOE}$.%!DIIdOEJJtQ'E5zQ!,q!:!-#~Qx&@@D!IIdOE ZZF%.|))+,eW%G++e$?##D$5U$CTJD((.D""1%84%?#@tLL  '4  W]]_%"'))+L%&&U[[]+ $)8Qx  e M tMr   c           	       ^! U R                  S5        [        R                  " [        5      nU(       d  [        R
                  " [        S5      5      e[        U5       GHm  nUR                  S5      n[        S5      n	[        R                  " [        S5      U-  U	S9n
[        U5      S:w  a  U
eUu  pU(       d  U
eUR                  S5      n[        U5      S:w  a  U
eUu  m!nU(       d  U
eS	UT!4-  n[        UUUUS
9nU GH  nUR                  U5      nUc&  [        S5      n[        R                  " UUT!4-  5      e[        US5      (       d   e[        UR                  S5      (       d$  [        R                  " [        S5      UT!4-  5      e [        U!4S jUR                  R                    5       5      nUu  nnnSn[%        U[&        5      (       a?  [(        R*                  " U5      nUc#  [        R                  " [        S5      X4-  5      eUnOt[%        U[,        5      (       a?  [(        R.                  " U5      nUc#  [        R                  " [        S5      X4-  5      eUnO [        R0                  " S[3        U5      5      eT!UU   ;   a$  [        R                  " [        S5      T!U4-  5      eUc   eUUU   T!'   GM     GMp     UR5                  5        H  u  nnUU;  d  M  0 UU'   M     UR5                  5        GH  u  nnUR                  U5      nX   n0 nUc   eUR                  c   e[        UR                  S5      (       d   eUR                  R                   (       ag  UR                  R                    Vs0 s H   nUS   [6        R8                  " US   5      _M"     nnU(       a  UR5                  5        H  u  nn U UU'   M     [:        R<                  " U5      n[>        R@                  " U40 UD6X'   U R                  SX4-  5        GM     U$ ! ["         a%    [        R                  " [        S5      UT!4-  5      ef = fs  snf )zGiven a dict of checks (fully qualified name to function), and a list
of options as given by the user, pass each option down to the right check
function.s#   passing options to check functions
s   `checks` required   :s@   syntax is 'check:option=value', eg. revlogs.changelog:copies=yess   invalid option '%s'rC   r      =s   %s:%sr8   rT   r9   Ns0   specified option '%s' for unselected check '%s'
r;   r   s   check '%s' has no option '%s'c              3  <   >#    U  H  oS    T:X  d  M  Uv   M     g7f)r   Nr   ).0ooption_names     r   	<genexpr>pass_options.<locals>.<genexpr>   s       '1!qT[5HAA1s   	s   '%s' is not a boolean ('%s')s   '%s' is not a list ('%s')s   unsupported type %ss   duplicated option '%s' for '%s'r   r   s   merged options for '%s': '%r'
)!debugcollectionsdefaultdictrP   r   Errorr   r2   r4   rN   rG   r[   r6   hasattrr;   nextr   StopIterationrO   boolr
   	parseboolrL   	parselistr7   typer3   copydeepcopyr   	strkwargs	functoolspartial)"r   rU   r   r8   rT   r9   	to_modifyoptionr4   rD   option_error
check_nameoption_valuevaluepathmatching_checksrS   rV   msgmatching_option_nametyp
_docstringas_typedas_boolas_listfcmd_optionsr;   merged_optionsrb   kvrc   s"                                    @r   pass_optionsr      sM    HH45''-Ikk!0122/T"0
 ''$%.T
 u:?#( 
""4(u:?"U:{33%#%	
 $DJJt$E}LM&&sdK-@'@AA5&))))5::y11&&674:MM "& '$zz11' # &5"E3
H#t$$$..u5?**9:d]J  #C&&$..u5?**674-G  #,,-CT#YOOio-&&89[$<OO   +++/7	$,c $A "j <<>ay  IdO "
 $-??#4
K

:&!   zz%%%uzz9----:: 49::3E3E3Ea!dmmAaD))3E   '--/DAq()N1% 0$$^4&..t?w?
3z6KKL' $5* M} ! &&674:MM hs   )P#	'Q#/Qc           
     R   0 nUc  / nUc  / nU HF  n[        UUUUS9n	SR                  U	5      n
UR                  SX4-  5        UR                  U	5        MH     UR	                  5        VVs0 s H  u  pU[
        R                  " XU 5      _M     nnn[        UUUUUUS9nU$ s  snnf )a  Given a list of function names and optionally a list of
options, return matched checks with merged options (command line options
values take precedence on default ones)

It runs find checks, then resolve options and returns a dict of matched
functions with resolved options.
r_   s   , s    found checks '%s' for name '%s'
)r[   joinrf   rJ   r3   rt   ru   r   )r   r   namesr   r8   rT   r9   funcsrS   matchedmatched_namesnr   rU   s                 r   
get_checksr   &  s      E} #%	
 

7+
58MMNW  <A;;=I=41Q	!!!..=EI 
!F M Js   ,$B#)NNN)NNNNN)
__future__r   rg   rq   rt   i18nr    r   r   r   r	   utilsr
   rE   rF   verify_checkrV   r   r(   rH   rA   r[   r   r   r   r   r   <module>r      s    #     7 7   |-?@ {3 4$ , [D @L 
0r   