
    	^c$                         d dl Z ddlmZmZmZ ddlmZ ej        rddlmZ	 nddlm
Z	 e	j        Ze	j        Ze	j        Zd ZddZd	 Zd
 Zd Zd ZdS )    N   )encodingpycompatutil)resourceutil)
scmwindows)scmposixc                     t          j        |           t          j                                      r?t          j        j        t          fdt          j                  D                       S gS )z@path could be a file or a directory. return a list of file pathsc              3   `   K   | ](\  }}|                     d            |          V  )dS )   .rcN)endswith).0fkjoinps      2/usr/lib/python3/dist-packages/mercurial/rcutil.py	<genexpr>z _expandrcpath.<locals>.<genexpr>"   sV       
 
1aajj6H6H
DAJJ
 
 
 
 
 
    )r   
expandpathospathisdirr   sortedlistdir)r   r   r   s    @@r   _expandrcpathr      s    A	w}}Q 
w| 
 
 
 
 
#'<??
 
 
 
 
 	
 3Jr   c                     | t           j        } g d}g }|D ]-\  }}}|| vr|                    ||| |         d|z  f           .|S )zReturn [(section, name, value, source)] config items.

    The config items are extracted from environment variables specified by env,
    used to override systemrc, but not userrc.

    If env is not provided, encoding.environ will be used.
    N))s   EDITOR   ui   editor)s   VISUALr   r   )s   PAGER   pagerr    s   $%s)r   environappend)env	checklistresultenvnamesection
confignames         r   
envrcitemsr)   (   s{     {  I
 F(1 M M$*#w
CL&7:JKLLLLMr   c                  \    t          j        d          } d t          |           D             S )z#return rc resource IDs in defaultrc   mercurial.defaultrcc                 j    g | ]0}t          j        d |          |                    d          ,d |f1S )r+   r   )r   is_resourcer   r   rs     r   
<listcomp>z(default_rc_resources.<locals>.<listcomp>B   sW       #$:A>> JJv		#  r   )r   contentsr   )rsrcss    r   default_rc_resourcesr3   ?   s:    !"899E    r   c                     dt                      f} dt          j        v re| g}t          j        d                             t          j                  D ]1}|s|                    d t          |          D                        2nd t                      D             }d }|                     |t                                           |
                    |            |                     |t                                           |S )aR  return an ordered [(type, obj)] about where to load configs.

    respect $HGRCPATH. if $HGRCPATH is empty, only .hg/hgrc of current repo is
    used. if $HGRCPATH is not set, the platform default will be used.

    if a directory is provided, *.rc files under it will be used.

    type could be either 'path', 'items' or 'resource'. If type is 'path',
    obj is a string, and is the config file path. if type is 'items', obj is a
    list of (section, name, value, source) that should fill the config directly.
    If type is 'resource', obj is a tuple of (package name, resource name).
    s   itemss   HGRCPATHc              3      K   | ]}d |fV  	dS )   pathN r   r   s     r   r   zrccomponents.<locals>.<genexpr>`   s&       H H!'1 H H H H H Hr   c                     g | ]}d |fS )s   resourcer7   r.   s     r   r0   z rccomponents.<locals>.<listcomp>b   s    JJJa+q)JJJr   c                     d | D             S )Nc                 P    g | ]#}d t           j                            |          f$S )r6   )r   r   normpathr8   s     r   r0   z2rccomponents.<locals>.<lambda>.<locals>.<listcomp>d   s:     #
 #
 #
/0Wbg&&q))*#
 #
 #
r   r7   )pathss    r   <lambda>zrccomponents.<locals>.<lambda>d   s      #
 #
49#
 #
 #
 r   )r)   r   r!   splitr   	ospathsepextendr   r3   systemrcpathr"   
userrcpath)envrc_rccomponentsr   	normpathss       r   rccomponentsrG   J   s    z||$Eh&&& !+.44X5GHH 	I 	IA    H H}Q7G7G H H HHHHH	I
 KJ3G3I3IJJJ
 
	 	YY|~~66777U###YYz||44555r   c                      dddS )zureturn a dict of default environment variables and their values,
    intended to be set before starting a pager.
    s   FRXs   -c)s   LESSs   LVr7   r7   r   r   defaultpagerenvrI   m   s     E***r   c                      dt           j        vS )z5True if repositories `.hg/hgrc` config should be reads   HGRCSKIPREPO)r   r!   r7   r   r   use_repo_hgrcrK   t   s    ("222r   )N)r    r   r   r   utilsr   	iswindowsr   scmplatformr	   fallbackpagerrB   rC   r   r)   r3   rG   rI   rK   r7   r   r   <module>rQ      s
   
			                 *+++++++)))))))'#
     .       F+ + +3 3 3 3 3r   