
    q&f                         d dl Z d dlZddlmZ ddlmZmZ 	 d dlZej                   d Z G d d      Z G d	 d
e      Zd Zd Zd Zd Zi Zd Z e       Zd Z ee      Z e        y# e	$ r	 ddl
mZ Y Pw xY w)    N   )resourceutil)encodingerror)tomlic                 <   t        |j                               D ]  \  }}| j                  j                  |t	                     }t        |      }t        |      }t        ||z        D ]  }d}	|	|||fz  }	| j                  |	d       ! |j                  |        y)z:update config item known to the ui with the extension oness-   extension '%s' overwrites config item '%s.%s's   warn-config)configN)sorteditems_knownconfig
setdefaultitemregisterset	develwarnupdate)
uiextnameconfigtablesectionr   
knownitems	knownkeysnewkeyskeymsgs
             7/usr/lib/python3/dist-packages/mercurial/configitems.pyloadconfigtabler      s     !2!2!45 	!__//H

O	e*)g-. 	5CBCGWc**CLL^L4	5
 	% 	!    c                   &    e Zd ZdZ	 	 	 	 	 	 	 ddZy)
configitemaK  represent a known config item

    :section: the official config section where to find this item,
       :name: the official name within the section,
    :default: default value for this item,
    :alias: optional list of tuples as alternatives,
    :generic: this is a generic definition, match name using regular expression.
    Nc
                     || _         || _        || _        || _        t	        |      | _        || _        || _        || _        d | _	        |	| _
        |r%t        j                  | j                        | _	        y y N)r   namedefaultdocumentationlistaliasgenericpriorityexperimental_rein_core_extensionrecompile)
selfr   r"   r#   r&   r'   r(   r)   r$   r+   s
             r   __init__zconfigitem.__init__4   sm     	*%[
 (!2zz$)),DH r   )N Fr   F N)__name__
__module____qualname____doc__r/   r0   r   r   r   r   *   s#     -r   r   c                   @     e Zd ZdZ fdZ fdZ fdZ fdZ xZS )r   z<A specialized dictionary that can handle wild-card selectionc                 H    t         t        |           t               | _        y r!   )superr   r/   r   	_generics)r.   	__class__s    r   r/   zitemregister.__init__Q   s    lD*,r   c                 v    t         t        |   |       | j                  j                  |j                         y r!   )r8   r   r   r9   )r.   otherr:   s     r   r   zitemregister.updateU   s(    lD(/eoo.r   c                 ~    t         t        |   ||       |j                  r| j                  j                  |       y y r!   )r8   r   __setitem__r'   r9   add)r.   r   itemr:   s      r   r>   zitemregister.__setitem__Y   s2    lD-c48<<NNt$ r   c                     t         t        |   |      }||j                  s|S t	        | j
                  d       }|D ]!  }|j                  j                  |      s|c S  y )Nc                 2    | j                   | j                  fS r!   )r(   r"   )xs    r   <lambda>z"itemregister.get.<locals>.<lambda>d   s    !**aff9M r   )r   )r8   r   getr'   r
   r9   r*   match)r.   r   baseitemgenericsr@   r:   s        r   rE   zitemregister.get^   se    t05(8(8O $../MO 	D xx~~c"	 r   )	r2   r3   r4   r5   r/   r   r>   rE   __classcell__)r:   s   @r   r   r   N   s    F/%
 r   r   c                    d}| j                  |d      }|dk(  r
t        | d<   n|dk(  r
t        | d<   nw|dk(  r?t        | d   t              sJ | d   D cg c]  }|j	                          c}fd| d<   n3|dk(  rd	 | d<   n'|%d
}||| d   | d   fz  }t        j                  |      | j                  d      }|r6|D cg c]%  \  }}|j	                         |j	                         f' c}}| d<   t        | j                  d      t              r| d   j	                         | d<   | d   j	                         | d<   | d   j	                         | d<   yc c}w c c}}w )zBApply the transformations that are encoded on top of the pure datazdefault-typeNdynamicr#   	list_typelambdac                       S r!   r0   )r#   s   r   rD   zsanitize_item.<locals>.<lambda>   s    ' r   lazy_modulec                  "    t         j                   S r!   )r   r0   r   r   rD   zsanitize_item.<locals>.<lambda>   s    ("3"3 r   z*invalid default config type %r for '%s.%s'r   r"   r&   )	popdynamicdefaultr%   
isinstanceencoder   ProgrammingErrorrE   str)	r@   default_type_keydefault_typeer   r&   kvr#   s	           @r   sanitize_itemr\   w   s_    &88,d3Ly (Y		$Y		!$y/4000'+I7!188:7)Y		&3Y#>CL$y/4<@@C((-- HHWE@EFfq!!((*ahhj1FW$((9%s+y/002Y9o,,.DO<&&(DL# 8 Gs   E*Ec                      t        j                  dd      5 } t        j                  |       cddd       S # 1 sw Y   yxY w)zAReturns the deserialized TOML structure from the configitems files	   mercurials   configitems.tomlN)r   open_resourcetomllibload)fps    r   read_configitems_filerb      s6    		#	#L2E	F  "||B     s   6?c                 T   | d   D ]  }t        |       t        di |  | d   }| d   D ]{  }||d      }|D ]l  }|j                         }|j                  dd      }|d   |d<   |r| d|d	    |d
<   n|d	   |d
<   t        |       |j	                  d	d       t        di | n } y)z:Register the configitems from the *deserialized* toml filer   	templatesztemplate-applicationstemplateprefixr1   r   .suffixr"   Nr0   )r\   coreconfigitemcopyrE   rQ   )r   r@   rd   applicationtemplate_itemstemplate_itemrf   s          r   configitems_from_tomlrn      s    g d k"I45 #";z#:;+ 	#M %%'D __Xr2F))4DO"(4>*:;V#H~V$HHXt$"T"	##r   c                  .    t               } t        |        y r!   )rb   rn   )as_tomls    r   import_configitems_from_filerq      s    #%G'"r   c                     t        |i |}| j                  |j                  t                     }|j                  |v r0d}t        j                  ||j                  |j                  fz        |||j                  <   y )Ns/   duplicated config item registration for '%s.%s')r   r   r   r   r"   r   rU   )r   argskwargsr@   r   r   s         r   	_registerru      sk    t&v&D$$T\\<>BGyyG@$$SDLL$))+D%DEEGDIIr   c                 P    t        j                  t        |       }t        |_        |S r!   )	functoolspartialru   rR   )r   fs     r   getitemregisterrz      s!    )[1A%AHr   )rw   r,   utilsr   r1   r   r   r_   r`   ModuleNotFoundError
thirdpartyr   r   r   dictr   r\   rb   rn   rq   	coreitemsru   objectrR   rz   ri   r0   r   r   <module>r      s     	 
-LL!!- !-H&4 &R)@ #2#
 	 
 !+    -,-s   A+ +A98A9