o ]LbK@sddlmZddlZddlmZmZmZddlmZej r$ddlm Z nddlm Z e j Z e jZe jZdd Zdd d Zd d ZddZddZddZdS))absolute_importN)encodingpycompatutil) resourceutil) scmwindows)scmposixcsBt|tjrtjjtfddtDSgS)z@path could be a file or a directory. return a list of file pathsc3s(|]\}}|dr|VqdS).rcN)endswith).0fkjoinp2/usr/lib/python3/dist-packages/mercurial/rcutil.py #s  z _expandrcpath..)r expandpathospathisdirrsortedlistdir)rrrr _expandrcpaths  rcCsR|durtj}gd}g}|D]\}}}||vrq|||||d|fq|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))sEDITORuieditor)sVISUALrr)sPAGERpagerrs$%s)renvironappend)env checklistresultenvnamesection confignamerrr envrcitems)sr'cCstd}ddt|DS)z#return rc resource IDs in defaultrcmercurial.defaultrccSs*g|]}td|r|drd|fqS)r(r )r is_resourcer r rrrr Cs z(default_rc_resources..)rcontentsr)rsrcsrrrdefault_rc_resources@s r/cCsdtf}dtjvr*|g}tjdtjD]}|sq|ddt|Dq|SddtD}dd}||t | |||t |S) aRreturn 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). sitemssHGRCPATHcss|]}d|fVqdS)pathNrr rrrrraszrccomponents..cSsg|]}d|fqS)sresourcerr*rrrr,csz rccomponents..cSsdd|DS)NcSsg|] }dtj|fqS)r0)rrnormpathr1rrrr,esz2rccomponents....r)pathsrrreszrccomponents..) r'rrsplitr ospathsepextendrr/ systemrcpathr userrcpath)envrc _rccomponentsr normpathsrrr rccomponentsKs   r=cCs dddS)zureturn a dict of default environment variables and their values, intended to be set before starting a pager. sFRXs-c)sLESSsLVrrrrrdefaultpagerenvns r>cCs dtjvS)z5True if repositories `.hg/hgrc` config should be reads HGRCSKIPREPO)rrrrrr use_repo_hgrcus r?)N) __future__rrrrrutilsr iswindowsr scmplatformr fallbackpagerr8r9rr'r/r=r>r?rrrrs     #