
    6hM             	         % S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	r	S SK
r
S SKrS SKrS SKrS SKrS SKJrJrJrJrJrJrJrJrJrJrJrJr  SSKJr  SSKJr  SSKJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+  SSK,J-r-  SS	K.J/r/J0r0J1r1J2r2J3r3  \\\4\44   \54   r6\\4\7\S
   4   r8\\4\44   r9\" SSS9r:\+Rv                  r;SRy                  S \=" \)R|                  \?" S5      5       5       5      r@S\AS'   SrBS\AS'   SSSSS.rCS\AS'   S rDS rE " S S5      rFS*S  jrG\5" 5       rH/ rIS!\AS"'    " S# S5      rJSqKS$\AS%'   S+S& jrLS,S' jrMS-S( jrNS.S) jrOg)/    )annotationsN)AnyCallableDictListNoReturnOptionalTupleTypeTypeVarUnioncastoverload   )_)hex)colorconfigconfigitemsencodingerror
extensions	formatterloggingutilprogresspycompatscmutilutil)rcutil)dateutilprocutilresourceutil
stringutilurlutil_PromptChoice_Tuiui)bound    c              #  R   #    U  H  oR                  5       (       a  M  Uv   M     g 7fN)isalnum).0cs     ./usr/lib/python3/dist-packages/mercurial/ui.py	<genexpr>r0   L   s      0!		AA0s   '	'   bytes
_keepalnums  
[ui]
# The rollback command is dangerous. As a rule, don't use it.
rollback = False
# Make `hg status` report copy information
statuscopies = yes
# Prefer curses UIs when available. Revert to plain-text with `text`.
interface = curses
# Make compatible commands emit cwd-relative paths by default.
relative-paths = yes

[commands]
# Grep working directory by default.
grep.all-files = True
# Refuse to perform an `hg update` that would cause a file content merge
update.check = noconflict
# Show conflicts information in `hg status`
status.verbose = True
# Make `hg resolve` with no action (like `-m`) fail instead of re-merging.
resolve.explicit-re-merge = True

[diff]
git = 1
showfunc = 1
word-diff = 1
tweakrcs  # example user config (see 'hg help config' for more info)
[ui]
# name and email, e.g.
# username = Jane Doe <jdoe@example.com>
username =

# We recommend enabling tweakdefaults to get slight improvements to
# the UI over time. Make sure to set HGPLAIN in the environment when
# writing scripts!
# tweakdefaults = True

# uncomment to disable color in command output
# (see 'hg help color' for details)
# color = never

# uncomment to disable command output pagination
# (see 'hg help pager' for details)
# paginate = never

[extensions]
# uncomment the lines below to enable some popular extensions
# (see 'hg help extensions' for more info)
#
# histedit =
# rebase =
# uncommit =
s  # example repository config (see 'hg help config' for more info)
[paths]
default = %s

# path aliases to other clones of this repo in URLs or filesystem paths
# (see 'hg help config.paths' for more info)
#
# default:pushurl = ssh://jdoe@example.net/hg/jdoes-fork
# my-fork         = ssh://jdoe@example.net/hg/jdoes-fork
# my-clone        = /home/jdoe/jdoes-clone

[ui]
# name and email (local to this repository, optional), e.g.
# username = Jane Doe <jdoe@example.com>
s  # example repository config (see 'hg help config' for more info)
[paths]
# path aliases to other clones of this repo in URLs or filesystem paths
# (see 'hg help config.paths' for more info)
#
# default         = http://example.com/hg/example-repo
# default:pushurl = ssh://jdoe@example.net/hg/jdoes-fork
# my-fork         = ssh://jdoe@example.net/hg/jdoes-fork
# my-clone        = /home/jdoe/jdoes-clone

[ui]
# name and email (local to this repository, optional), e.g.
# username = Jane Doe <jdoe@example.com>
s  # example system-wide hg config (see 'hg help config' for more info)

[ui]
# uncomment to disable color in command output
# (see 'hg help color' for details)
# color = never

# uncomment to disable command output pagination
# (see 'hg help pager' for details)
# paginate = never

[extensions]
# uncomment the lines below to enable some popular extensions
# (see 'hg help extensions' for more info)
#
# blackbox =
# churn =
)s   users   cloneds   locals   globalzDict[bytes, bytes]samplehgrcsc                L    [         R                  " [         R                  U 5      $ r+   )r   rapplystrurl)
maybebytess    r/   _maybestrurlr:      s    ??8??J77r)   c                L    [         R                  " [         R                  U 5      $ r+   )r   r7   bytesurl)maybestrs    r/   _maybebytesurlr>      s    ??8,,h77r)   c                  4    \ rS rSrSrS	S jrS rS rS rSr	g)
httppasswordmgrdbproxy   z)Delays loading urllib2 until it's needed.c                    S U l         g r+   _mgrselfs    r/   __init__httppasswordmgrdbproxy.__init__   s	    	r)   c                f    U R                   c  [        R                  5       U l         U R                   $ r+   )rD   urlreqhttppasswordmgrwithdefaultrealmrE   s    r/   _get_mgrhttppasswordmgrdbproxy._get_mgr   s&    99>>@DIyyr)   c                    U R                  5       R                  [        U5      [        U5      [        U5      [        U5      5      $ r+   )rL   add_passwordr:   )rF   realmurisuserpasswds        r/   rO   #httppasswordmgrdbproxy.add_password   s;    }}++ 	
 	
r)   c                |    U R                  5       n[        UR                  [        U5      [        U5      5      5      $ r+   )rL   r>   find_user_passwordr:   )rF   rP   urimgrs       r/   rV   )httppasswordmgrdbproxy.find_user_password   s4    mmo""<#6S8IJ
 	
r)   rC   NreturnNone)
__name__
__module____qualname____firstlineno____doc__rG   rL   rO   rV   __static_attributes__ r)   r/   r@   r@      s    3


r)   r@   c                 "    [         R                  er+   )r   SignalInterrupt)argss    r/   
_catchtermrg      s    


r)   r   _reqexithandlersc                  v   \ rS rSrSsStS jjrSuS jr\SvS j5       rSuS jrSwS jr	SuS jr
\R                  SxS	 j5       r\R                  S
 5       rSyS jrSzS jr S{ SuS jjr S{ SuS jjr S{ SuS jjr S|   S}S jjrSuS jrS~SuS jjrS rSuS jrSSuS jjrS rSS jr\S4S jr\S4S jrS r\S4S jr \S4S jr!\S4S jr"\SS4S jr#\S4S  jr$\S4S! jr%\S4S" jr&\S4S# jr'S$ r(SS% jr)SS& jr*SS' jr+SS( jr,S) r-S* r.SsSS+ jjr/SS, jr0SS- jr1\2Rf                  S. 5       r4\5S/ 5       r6\2Rf                  S0 5       r7\6Rp                  S1 5       r6\5S2 5       r9\9Rp                  S3 5       r9\5S4 5       r:\:Rp                  S5 5       r:\5S6 5       r;\;Rp                  S7 5       r;\R                   S     SS8 jj5       r< S       SS9 jjr=SS: jr>SS; jr?SS< jr@SS= jrASS> jrBSS? jrCSS@ jrDSSA jrESSB jrFSSC jrGSuSD jrHSSE jrISF rJSG rK\R                  SH 5       rLSuSI jrMSSJ jrNSsSSK jjrO\5SL 5       rPSM rQSSN jrRSO rSSSP jrTSQ rU  S     SSR jjrV\WR                  (       a  \YSSS j5       rZ\YSST j5       rZSSU jrZ\WR                  (       a$  \Y        SSV j5       r[\Y        SSW j5       r[SSX jr[\\SSY j5       r]SSSZ jjr^ S~     SS[ jjr_SS\ jr`SS] jraSS^ jrbSS_ jrcSS` jrd\`re\crf\arg\Brh     S           SSa jjri     S           SSb jjrjSSc jrkSSSd jjrlSe rm\2Rf                  SSf j5       rnSuSg jro S|       SSh jjrpSi rqSuSj jrrSuSk jrsSSl jrt S       SSm jjru S       SSn jjrvSo rw\R                  SSSp jj5       rxSSq jrySrrzg)r'      Nc                   / U l         / U l        SU l        S=U l        =U l        =U l        U l        SU l        [        R                  U l
        [        R                  " 5       U l        [        R                  " 5       U l        [        R                  " 5       U l        [        5       U l        [        5       U l        SU l        0 U l        SU l        SU l        SU l        SU l        0 U l        0 U l        SU l        SU l        U(       Ga*  UR8                  U l        UR:                  U l        UR<                  U l        UR>                  U l        UR@                  U l         URB                  U l!        URD                  U l"        URF                  RI                  5       U l#        URJ                  U l%        URL                  U l&        URN                  U l'        UR                  RI                  5       U l        UR                  RI                  5       U l        UR                  RI                  5       U l        UR                   RI                  5       U l        UR"                  RI                  5       U l        URP                  U l(        UR$                  U l        UR&                  U l        UR(                  U l        UR,                  U l        UR0                  RI                  5       U l        UR2                  RI                  5       U l        U RS                  5         URT                  U l*        URV                  U l+        O[X        RZ                  U l        [X        R\                  U l        [X        R^                  U l        SU l        U R`                  U l         U Rb                  U l!        SU l"        0 U l#        SU l%        SU l&        SU l'        [d        RP                  U l(        [g        5       U l*        [h        Rj                  " [l        5      U l+        U Ro                  SS5      nSU;   a  U RP                  U l8        g0 U l8        U H0  nX0RP                  ;   d  M  U RP                  U   U Rp                  U'   M2     g)zCreate a fresh new ui object if no src given

Use uimod.ui.load() to create a ui which knows global and user configs.
In most cases, you should use ui.copy() to create a copy of an existing
ui object.
NFT   experimentals   exportableenviron   *)9_buffers_bufferstates_bufferapplylabelsquietverbose	debugflagtracebackflag_reportuntrustedr   	coreitems_knownconfigr   _ocfg_tcfg_ucfgset_trustusers_trustgroups	callhooks_path_to_rootinsecureconnectionslogblockedtimes
_colormode_readlineprompt_terminfoparams_styles_uninterruptibleshowtimestamp_fout_ferr_fin_fmsg_fmsgout_fmsgerr_finoutredirected_loggerscopypageractive_disablepager_tweakedenviron	fixconfighttppasswordmgrdb_blockedtimesr!   stdoutstderrstdinfoutferrr   r@   collectionsdefaultdictint
configlist_exportableenviron)rF   srcallowedks       r/   rG   ui.__init__   s?       #'JOO
OT\ODNT5G $'11]]_
]]_
]]_
5E#( $$! %"DJDJDIDJLLDMLLDM%(%:%:D"LL--/DM"D!$!2!2DLLDM)DJ)DJ)DJ"335D # 0 0 5 5 7D;;DL ]]DN!$!2!2D'*'>'>D$!nnDO#&#6#6#;#;#=D ;;++-DLNN%(%:%:D"!$!2!2D!DJ!DJ DIDJ IIDM IIDM%*D"DM$D!&D!DM $++DL%;%=D"!,!8!8!=D///3GH7?&*llD#&(D#$15aD++A. r)   c                    U R                   R                  5         U R                  R                  5         U R                  R                  5         g r+   )rx   
new_sourcery   rz   rE   s    r/   _new_sourceui._new_sourceJ  s2    





r)   c                >   U " 5       n[         R                  " 5        H  u  p#nUS:X  a  UR                  USS9  M  US:X  a  UR                  USS9  M6  US:X  a  UR	                  5         [        5       nU HO  u  pgpUR                  R                  XgX5        UR                  R                  XgX5        UR                  U5        MQ     U H  nUR                  US9  M     M  [        R                  " SU-  5      e   UR                  5         UR	                  5         U$ )z,Create a ui and load global and user configss   pathT)trusts   resources   itemssections   unknown rctype: %s)r   rccomponents
readconfigread_resource_configr   r{   ry   rz   addr   r   ProgrammingError_maybetweakdefaults)
clsu_lvltfsectionsr   namevaluesources
             r/   loadui.loadO  s     E --/JDQG|Qd+k!&&q&5h5450G5 GGKKu=GGKKu=LL) 56  (GKKK0  ( ,,-BQ-FGG# 0$ 	
	r)   c                   U R                  SS5      (       d  g U R                  (       d  U R                  S5      (       a  g SU l        [        R                  " 5       nUR	                  S[
        5        U HH  nUR                  U5       H0  u  p4U R                  X#5      (       a  M  U R                  X#US5        M2     MJ     g )N   uis   tweakdefaultsTs   <tweakdefaults>)	
configboolr   plainr   parser4   items	hasconfig	setconfig)rF   tmpcfgr   r   r   s        r/   r   ui._maybetweakdefaultsj  s    u&677==DJJ'788 '1G%||G4~~g44NN7%9KL  5 r)   c                $    U R                  U 5      $ r+   )	__class__rE   s    r/   r   ui.copy~  s    ~~d##r)   c                x    U R                   (       a  U R                   R                  5         [        5       U l        g)z;Clear internal state that shouldn't persist across commandsN)_progbar
resetstater@   r   rE   s    r/   r   ui.resetstate  s$    ==MM$$&!7!9r)   c              #    #    [         R                  " 5       n S v   U R                  US-   ==   [         R                  " 5       U-
  S-  -  ss'   g ! U R                  US-   ==   [         R                  " 5       U-
  S-  -  ss'   f = f7f)Ns   _blocked  )r   timerr   )rF   key	starttimes      r/   timeblockedsectionui.timeblockedsection  s|      JJL		s[01

y(6 1Ds[01

y(6 1s   B	A 4B	5BB	c              #  t  ^ #    T R                  SS5      nU(       a'  T R                  SS5      (       a  T R                  5       nT R                  (       d  U(       d  Sv   gU 4S jn[        R                  " U5          ST l        Sv   ST l         SSS5        g! ST l        f = f! , (       d  f       g= f7f)a  Mark an operation as unsafe.

Most operations on a repository are safe to interrupt, but a
few are risky (for example repair.strip). This context manager
lets you advise Mercurial that something risky is happening so
that control-C etc can be blocked if desired.
rl   s   nointerrupts   nointerrupt-interactiveonlyNc                 n   > T R                  [        S5      5        T R                  [        S5      5        g)Ns   shutting down cleanly
s4   press ^C again to terminate immediately (dangerous)
T)warnr   rE   s   r/   r    ui.uninterruptible.<locals>.warn  s/    IIa234IIJK r)   TF)r   interactiver   r!   uninterruptible)rF   enabledr   s   `  r/   r   ui.uninterruptible  s      ///>Bt;
 
 &&(G   	 %%d+.(,%(-% ,+
 ).% ,+s6   A:B8=B'?B
B'	B8	B$$B''
B51B8c                0    [         R                   " X X5      $ r+   )r   )rF   topicoptss      r/   r   ui.formatter  s    ""4u;;r)   c                   [         R                  " U5      n[         R                  " U5      (       a  gU R                  U R                  pTSU;   d  SU;   a  g[         R
                  " UR                  5      n[         R                  " UR                  5      nXd;   d  Xu;   d  U[         R
                  " 5       :X  a  gU R                  (       a  U R                  [        S5      X&U4-  5        g)NTrm   s6   not trusting file %s from untrusted user %s, group %s
F)r   fstatisownerr|   r}   usernamest_uid	groupnamest_gidru   r   r   )rF   fpr   sttuserstgroupsrR   groups           r/   _trustedui._trusted  s    ZZ^<<**D,=,=6>TW_}}RYY'ryy)>U-1H  II+ E"	# r)   Fc                     [         R                  " US   US   5      nU R                  SU-  XbX4U5        g ! [         a    U(       d   g e f = f)Nr   r   s   resource:%s.%s)r"   open_resourceOSError_readconfig)rF   r   rootr   r   remapr   s          r/   r   ui.read_resource_config  sY    	++DGT!W=B 	$b	
  		s   7 A
Ac                t     [        US5      nU R                  XX#XE5        g ! [         a    U(       d   g e f = f)Nrb)openr   r   )rF   filenamer   r   r   r   r   s          r/   r   ui.readconfig  sA    	h%B 	tHD  		s   " 77c                   U   [         R                   " 5       nU=(       d    U=(       d    U R                  X!5      n UR                  XXVS9  S S S 5        U R                  WWU5        g ! [        R                   aE  n	U(       a  e U R                  [        S5      U	R                  U	R                  4-  5         S n	A	NpS n	A	ff = f! , (       d  f       N~= f)N)r   r   s   ignored %s: %s
)
r   r   readr   ConfigErrorr   r   locationmessage_applyconfig)
rF   r   r   r   r   r   r   cfgtrustedinsts
             r/   r   ui._readconfig  s     --/CF%F4==+FGF  	#w- $$ 		)*dmmT\\-JJ  Rs.   9CA))C=;B=8C=CC
Cc                    [         R                   " 5       nUR                  " 5        H  u  u  pVnUR                  XVXr5        M     U R                  USU5        g)a  Add configitems from a non-file source.  Unlike with ``setconfig()``,
they can be overridden by subsequent config file reads.  The items are
in the same format as ``configoverride()``, namely a dict of the
following structures: {(section, name) : value}

Typically this is used by extensions that inject themselves into the
config file load procedure by monkeypatching ``localrepo.loadhgrc()``.
TN)r   r   r{   r  )rF   r   r   r   r  r   r   r   s           r/   applyconfigui.applyconfig  sK     mmo&1&7&7&9"OWUGGG51 ': 	#tT*r)   c                   U R                  5       (       ay  S H  nXAS   ;   d  M  US   U	 M     UR                  S5       H  u  pEUS   U	 M     UR                  S5       H  u  pEUS   U	 M     UR                  S5       H  u  pEUS   U	 M     U R                  S5      (       a   UR                  S5       H  u  pEUS   U	 M     U R                  S5      (       a   UR                  S5       H  u  pEUS   U	 M     U R                  S5      (       a   UR                  S5       H  u  pEUS   U	 M     U(       a@  U R                  R                  U5        U R                  R                  U R                  5        U R
                  R                  U5        U R
                  R                  U R                  5        Uc  [        R                  R                  S	5      nU R                  US
9  g )N)
   debugs   fallbackencoding   quiets   slashs   logtemplate   message-outputs   statuscopiess   style	   traceback   verboser   s   defaultss   commandss   command-templatess   aliass   revsetaliass   templatealias   ~)r   )
r   r   ry   updaterx   rz   ospath
expanduserr   )rF   r  r  r   r   vs         r/   r  ui._applyconfig  s   ::<< E
?E
1 		+.$Q' /		+.$Q' /		"67,-a0 8 ::h		(+M!$ ,::n%%		.1'* 2::&''		"23()!, 4 JJc"JJdjj)

#

$**%<77%%d+DD!r)   c                >   US;   Ga  U=(       d    [         R                  " 5       nU R                  U R                  U R                  4 H  nUR                  S5       H  u  pEUnU R                  SU5      =(       d    SnXEU4nXR                  ;  a  XR                  U'   SU;   a  MK  U(       d  MT  SU;   a6  Uc  SnU R                  [        S5      XEU4-  5        UR                  SS5      nXV:w  d  M  UR                  SXE5        M     M     US	;   Ga'  [        U 5      u  U l        U l        U R                  S
S5      U l        U R                   =(       d    U R                  S
S5      U l        U R                   (       + =(       a    U R                  S
S5      U l        U R"                  (       a  U R$                  (       a  S=U l        U l        U R                   =(       d    U R                  S
S5      U l        U R                  S
S5      U l        U R                  S
S5      U l        U R                  S
S5      U l        US;   aV  U R.                  R1                  U R3                  SS5      5        U R4                  R1                  U R3                  SS5      5        US;   a  U R                   (       an  [7        5       n	U R                  SS5      (       a  U	R9                  S5        U	(       a4  [:        R<                  " U R>                  U	5      n
U RA                  SU
5        g g g g )N)N   pathsr  s   none   :s   %%nones(   (deprecated '%%' in path %s=%s from %s)
   %)Nr   r   r  r  r  Fs   report_untrusteds   timestamp-outputr  s   logblockedtimes)N   trustedr  s   userss   groups)N   develr   r  s   debug.extensionss	   extension)!r   getcwdry   rz   rx   r   configsourcer   r   r   replacealter_selectmsgdestsr   r   r   rs   rr   rq   ru   r   rt   r   r|   r  r   r}   r{   r   r   fileobjectloggerr   	setlogger)rF   r   r   r.   npold_psroot_keytrackedloggers              r/   r   ui.fixconfig9  s   && ,8??,DZZTZZ7GGH-DAE))(A6A'A !ayH'9'997;**84qy  z9 &A		JK Qi( IIeT2z!/) . 8. m#+:4+@(DM4=!__UH=DN>>OT__UJ-ODL!^^+Px0PDJ||

,11
T\$(NN %doo*7D! "&8K!LD!%!ED#'??5:L#MD ((##DOOJ$IJ$$T__Z%KL--$..eGx)<==L)$55djj'Jx0 	 3A-r)   c                    U R                   R                  X5      U R                  R                  X5      U R                  R                  X5      4$ r+   )rx   backupry   rz   )rF   r   items      r/   backupconfigui.backupconfigq  sB    JJg,JJg,JJg,
 	
r)   c                    U R                   R                  US   5        U R                  R                  US   5        U R                  R                  US   5        g )Nr   r      )rx   restorery   rz   )rF   datas     r/   restoreconfigui.restoreconfigx  sD    

47#

47#

47#r)   c                    U R                   U R                  U R                  4 H  nUR                  XX45        M     U R	                  US9  U R                  5         g )Nr   )rx   ry   rz   r{   r   r   )rF   r   r   r   r   r  s         r/   r   ui.setconfig}  sG    JJ

DJJ7CGGG51 8w'  "r)   c                R    U=(       a    U R                   =(       d    U R                  $ r+   )rz   ry   )rF   	untrusteds     r/   _dataui._data  s    'TZZ54::5r)   c                B    U R                  U5      R                  X5      $ r+   )r<  r   rF   r   r   r;  s       r/   r  ui.configsource  s    zz)$++G::r)   c                :    U R                  XX4S9nU[        L a  gU$ )z+return the plain string version of a config)defaultr;  N)_config_unsetrF   r   r   rB  r;  r   s         r/   r   	ui.config  s+    7  
 F?r)   c                  ^ U=pVU R                   R                  U0 5      R                  U5      nX4/nUb3  UR                  b&  UR                  [        R                  " U 5      ;   a  S nUbS  UR	                  UR
                  5        [        UR                  5      (       a  UR                  5       nO(UR                  nOSn	XU4-  n	U R                  U	SS5        U[        L aD  Uc  UnOUR                  [        R                  L a  S nSn	XU4-  n	U R                  U	SS5        OXUnOUUbR  UR                  [        R                  La5  X6:w  a0  Sn	XU[        R                  " U5      4-  n	U R                  U	SS5        / n
U R                  U5      mU H0  u  pTR                  " XS 5      nUc  M  U
R                  XU45        M2     U
(       a  U4S jn[!        XS9S   nU R"                  (       a`  U(       dY  U R$                  (       aH  U HB  u  pU R&                  R                  X5      nUc  M%  X:w  d  M,  U R)                  S	XU4-  5        MD     U$ )
Ns+   accessing unregistered config item: '%s.%s'r3  s   warn-config-unknowns7   config item requires an explicit default value: '%s.%s's   warn-config-defaultsP   specifying a mismatched default value for a registered config item: '%s.%s' '%s'c                6   > TR                   " U S   U S   5      $ )Nr   r   )level)xr   s    r/   rI  ui._config.<locals>.level  s    ||AaD!A$//r)   )r   3   ignoring untrusted configuration option %s.%s = %s
)rw   getin_core_extensionr   extendaliascallablerB  	develwarnrD  r   dynamicdefaultr   bytestrr<  appendmaxrs   ru   rz   debug)rF   r   r   rB  r;  r   itemdefaultr/  
alternatesmsg
candidatesr(  r%  	candidaterI  uvaluer   s                   @r/   rC  
ui._config  s+   %%  $$Wb155d;o&
 6 6 B %%)>)>t)DDdjj)%%"lln"ll@CT?"CNN3#9:f|!;!;;P&sA'=>#K$>$>>&-  T8#3#3G#<==CNN3#9:
I&DA

1.I$!!1"34  0 
.q1E>>)0E0E"-%&/JJ(+,.9 # r)   c                    U R                   R                  U0 5      R                  U5      nUc  [        X45      eUR                  $ )zreturn the default value for a config option

The default is returned "raw", for example if it is a callable, the
callable was not called.
)rw   rM  KeyErrorrB  )rF   r   r   r/  s       r/   config_defaultui.config_default  sC       $$Wb155d;<G?++||r)   c                   U R                  XX4S9nU R                  U5      n0 nSU-  nUR                  U5       H-  u  pU	R                  U5      (       d  M  XU	[	        U5      S '   M/     U R
                  (       as  U(       dl  U R                  (       a[  UR                  5        HG  u  pU R                  R                  USX)4-  5      nUc  M*  X:w  d  M1  U R                  SXX4-  5        MI     XW4$ )a^  Get a config option and all sub-options.

Some config options have sub-options that are declared with the
format "key:opt = value". This method is used to return the main
option and all its declared sub-options.

Returns a 2-tuple of ``(option, sub-options)``, where `sub-options``
is a dict of defined sub-options where keys and values are strings.
r;  s   %s:Ns   %s:%ss6   ignoring untrusted configuration option %s:%s.%s = %s
)
r   r<  r   
startswithlenrs   ru   rz   rM  rW  )rF   r   r   rB  r;  mainr5  subprefixr   r  r]  s               r/   configsuboptionsui.configsuboptions  s     {{7'{Gzz)$$JJw'DA||F##()Ac&km$% ( >>)0E0E		TI1EF%&+JJ+.5Q-GH $ yr)   c                   U R                  XX45      nUc  g[        R                  R                  U5      (       a  SU;  a  U R	                  XU5      nSU;   an  [        R                  R                  UR                  S5      S   5      n[        R                  R                  U[        R                  R                  U5      5      nU$ )zEget a path config item, expanded relative to repo root or config
fileNs   ://r  r   )	r   r  r  isabsr  dirnamersplitjoinr  )rF   r   r   rB  r;  r  r   bases           r/   
configpathui.configpath  s     KKw:9ww}}Q6?##G9=Cs{wwszz$'7':;GGLLrww'9'9!'<=r)   c                   U R                  XX4S9nUc  U$ U[        L a  U[        L a  gU$ [        U[        5      (       a  U$ [        R
                  " U5      nUc$  [        R                  " [        S5      XU4-  5      eU$ )a  parse a configuration element as a boolean

>>> u = ui(); s = b'foo'
>>> u.setconfig(s, b'true', b'yes')
>>> u.configbool(s, b'true')
True
>>> u.setconfig(s, b'false', b'no')
>>> u.configbool(s, b'false')
False
>>> u.configbool(s, b'unknown')
False
>>> u.configbool(s, b'unknown', True)
True
>>> u.setconfig(s, b'invalid', b'somevalue')
>>> u.configbool(s, b'invalid')
Traceback (most recent call last):
    ...
ConfigError: foo.invalid is not a boolean ('somevalue')
rd  Fs   %s.%s is not a boolean ('%s'))	rC  rD  
isinstanceboolr#   	parseboolr   r   r   )rF   r   r   rB  r;  r  bs          r/   r   ui.configbool  s    * LLLE9H;& NaH  #9##23wa6HH  r)   c                   U R                  X#XF5      nUc  U$  U" U5      $ ! [        [        R                  4 aH    Uc   [        R
                  " UR                  5      n[        R                  " [        S5      X#XW4-  5      ef = f)a  parse a configuration element with a conversion function

>>> u = ui(); s = b'foo'
>>> u.setconfig(s, b'float1', b'42')
>>> u.configwith(float, s, b'float1')
42.0
>>> u.setconfig(s, b'float2', b'-4.25')
>>> u.configwith(float, s, b'float2')
-4.25
>>> u.configwith(float, s, b'unknown', 7)
7.0
>>> u.setconfig(s, b'invalid', b'somevalue')
>>> u.configwith(float, s, b'invalid')
Traceback (most recent call last):
    ...
ConfigError: foo.invalid is not a valid float ('somevalue')
>>> u.configwith(float, s, b'invalid', desc=b'womble')
Traceback (most recent call last):
    ...
ConfigError: foo.invalid is not a valid womble ('somevalue')
s   %s.%s is not a valid %s ('%s'))	r   
ValueErrorr   
ParseErrorr   sysbytesr]   r   r   )rF   convertr   r   rB  descr;  r  s           r/   
configwithui.configwith0  s    2 KKw:9H	1:E,,- 	|(()9)9:##34t7OO 	s
   ! A"Bc                4    U R                  [        XUSU5      $ )a  parse a configuration element as an integer

>>> u = ui(); s = b'foo'
>>> u.setconfig(s, b'int1', b'42')
>>> u.configint(s, b'int1')
42
>>> u.setconfig(s, b'int2', b'-42')
>>> u.configint(s, b'int2')
-42
>>> u.configint(s, b'unknown', 7)
7
>>> u.setconfig(s, b'invalid', b'somevalue')
>>> u.configint(s, b'invalid')
Traceback (most recent call last):
    ...
ConfigError: foo.invalid is not a valid integer ('somevalue')
s   integer)r  r   rF   r   r   rB  r;  s        r/   	configintui.configintU  s     & Y
 	
r)   c                &   U R                  XX45      nU[        L a  U[        L a  SnUn[        U[        5      (       d  U$  [        R
                  " U5      $ ! [        R                   a%    [        R                  " [        S5      XU4-  5      ef = f)a-  parse a configuration element as a quantity in bytes

Units can be specified as b (bytes), k or kb (kilobytes), m or
mb (megabytes), g or gb (gigabytes).

>>> u = ui(); s = b'foo'
>>> u.setconfig(s, b'val1', b'42')
>>> u.configbytes(s, b'val1')
42
>>> u.setconfig(s, b'val2', b'42.5 kb')
>>> u.configbytes(s, b'val2')
43520
>>> u.configbytes(s, b'unknown', b'7 MB')
7340032
>>> u.setconfig(s, b'invalid', b'somevalue')
>>> u.configbytes(s, b'invalid')
Traceback (most recent call last):
    ...
ConfigError: foo.invalid is not a byte quantity ('somevalue')
r   s#   %s.%s is not a byte quantity ('%s'))
rC  rD  ru  r2   r   	sizetointr   r|  r   r   rE  s         r/   configbytesui.configbytesl  s    , WG?F?& E%''L	>>%(( 	##89%() 	s   A 9Bc                    U R                  [        R                  XUSU5      n[        U[        5      (       a  [        R                  " U5      $ Uc  / $ U$ )aX  parse a configuration element as a list of comma/space separated
strings

>>> u = ui(); s = b'foo'
>>> u.setconfig(s, b'list1', b'this,is "a small" ,test')
>>> u.configlist(s, b'list1')
['this', 'is', 'a small', 'test']
>>> u.setconfig(s, b'list2', b'this, is "a small" , test ')
>>> u.configlist(s, b'list2')
['this', 'is', 'a small', 'test']
s   list)r  r#   	parselistru  r2   )rF   r   r   rB  r;  r  s         r/   r   ui.configlist  sR     OO  ''9
 a''**YIr)   c                    U R                  XX45      (       a#  U R                  [        R                  XUSU5      $ U[        L a  gU$ )zparse a configuration element as a tuple of ints

>>> u = ui(); s = b'foo'
>>> u.setconfig(s, b'date', b'0 0')
>>> u.configdate(s, b'date')
(0, 0)
s   dateN)r   r  r    	parsedaterD  r  s        r/   
configdateui.configdate  sI     ;;wg99??""G7GY  fr)   c                    U R                   R                  U0 5      R                  U5      nSnUb8  [        UR                  5      (       a  UR                  5       nU$ UR                  nU$ )z,returns the default value of the config itemN)rw   rM  rQ  rB  )rF   r   r   r/  rX  s        r/   configdefaultui.configdefault  sc      $$Wb155d;%%"lln  #llr)   c                B    U R                  U5      R                  X5      $ r+   )r<  hasitemr?  s       r/   r   ui.hasconfig  s    zz)$,,W;;r)   c                (    XR                  U5      ;   $ )z&tell whether section exists in config.)r<  )rF   r   r;  s      r/   has_sectionui.has_section  s    **Y///r)   c                   U R                  U5      R                  U5      nU(       a  U Vs/ s H  nSUS   ;  d  M  UPM     nnU R                  (       as  U(       dl  U R                  (       a[  U R                  R                  U5       H<  u  pgU R
                  R                  X5      U:w  d  M&  U R                  SXU4-  5        M>     U$ s  snf )Nr  r   rL  )r<  r   rs   ru   rz   ry   rM  rW  )rF   r   r;  	ignoresubr   ir   r  s           r/   r   ui.configitems  s    

9%++G4 %:1QqT)9QE:>>)0E0E

((1::>>'-2JJ(+2q/: 2  ;s
   CCc              #    #    U R                  U5      nU(       d  U S h  vN   g U R                  5       n[        US 5      n[        US 5      nUc  Ub  Uc  Uv   [        US 5      nOjUc  Uv   [        US 5      nOVUSS USS :X  a  Uv   [        US 5      n[        US 5      nO-USS USS :  a  Uv   [        US 5      nOUv   [        US 5      nUb  M  Ub  M  g g  N7f)Nr   r3  )_walk_config_walk_knownnext)rF   r;  	all_knowndefinedknowncurrent_definedcurrent_knowns          r/   
walkconfigui.walkconfig  s    ##I.  "w-UD))]-F&## $UD 1&%%"&w"5q#q';;%%"&w"5 $UD 1q#oa&::## $UD 1%%"&w"5! )]-F s   C CB4C C C c              #    #    [        U R                  R                  5       5       H  u  p[        UR                  5       5       H  u  p4UR                  (       a  M  [	        UR
                  5      (       a  UR                  5       nO,UR
                  [        R                  L a  SnOUR
                  nXR                  U4v   M     M     g 7f)Ns	   <DYNAMIC>)	sortedrw   r   genericrQ  rB  r   rS  r   )rF   r   r   r   r  rB  s         r/   r  ui._walk_known  s     $T%6%6%<%<%>?NGu{{}-99AII&&iikGYY+"<"<<*GiiGvvw.. . @s   C
Cc              #     #    U R                  U5      nUR                  5        H#  nU R                  X15       H  u  pEX4U4v   M     M%     g 7fr+   )r<  r   r   )rF   r;  r  r   r   r   s         r/   r  ui._walk_config  sF     jj#||~G#//CU**  D &s   A
Ac                |   S[         R                  ;  a  S[         R                  ;  a  g[         R                  R                  SS5      R                  5       R	                  S5      nS[         R                  R                  SS5      R	                  S5      ;  a  UR                  S5        U(       a  U(       a  X;  $ g)	a  is plain mode active?

Plain mode means that all configuration variables which affect
the behavior and output of Mercurial should be
ignored. Additionally, the output should be stable,
reproducible and suitable for use in scripts or applications.

The only way to trigger plain mode is by setting either the
`HGPLAIN' or `HGPLAINEXCEPT' environment variables.

The return value can either be
- False if HGPLAIN is not set, or feature is in HGPLAINEXCEPT
- False if feature is disabled by default and not included in HGPLAIN
- True otherwise
s   HGPLAINs   HGPLAINEXCEPTFr)      ,s   +strictflagss   strictflagsT)r   r   rM  stripsplitrU  )rF   feature
exceptionss      r/   r   ui.plain  s    " h... (8(88  !137==?EEdK 	 ("2"2"6"6z3"G"M"M#
 
 n-z,,r)   c                V   [         R                  R                  S5      nUc4  U R                  SS5      nUb  [        R
                  R                  U5      nUc  [         R                  R                  S5      nUc	  U(       a  U$ Uc0  U R                  SS5      (       a  U R                  [        S5      SS9nUct  U R                  5       (       d_   S	[        R                  " 5       [         R                  " [        R                  " 5       5      4-  nU R!                  [        S
5      U-  5        U(       d'  [$        R&                  " [        S5      [        S5      S9eSU;   a6  [$        R&                  " [        S5      [(        R*                  " U5      -  5      eU$ ! ["         a     Nxf = f)a  Return default username to be used in commits.

Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL
and stop searching if one of these is set.
If not found and acceptempty is True, returns None.
If not found and ui.askusername is True, ask the user, else use
($LOGNAME or $USER or $LNAME or $USERNAME) + "@full.hostname".
If no username could be found, raise an Abort error.
   HGUSERNr   s   usernames   EMAILs   askusernames   enter a commit username:rB  s   %s@%ss&   no username found, using '%s' instead
s   no username supplieds+   use 'hg config --edit' to set your username)hint   
s   username %r contains a newline
)r   r   rM  r   r  r  
expandvarsr   promptr   r   r!   getuser
strtolocalsocketgetfqdnr   r`  r   Abortr   rT  )rF   acceptemptyrR   s      r/   r   ui.username%  st    ##I.<;;uk2Dww))$/<##''1D<KK<DOOE>BB;;q!<=t;LD< 0 0 2 2$$&''(89#  		!FG$NO ++)*IJ  D=++569I9I$9OO    s   AF 
F('F(c                T    U R                   (       d  [        R                  " U5      nU$ )z>Return a short representation of a user name or email address.)rr   r#   	shortuser)rF   rR   s     r/   r  ui.shortuserN  s    ||''-Dr)   c                .    [         R                  " U 5      $ r+   )r$   pathsrE   s    r/   r  ui.pathsT  s    }}T""r)   c                    U R                   $ r+   )r   rE   s    r/   r   ui.foutX      zzr)   c                :    U R                  U R                  5        g r+   )_isattyr   rE   s    r/   _fout_is_a_ttyui._fout_is_a_tty\  s    TZZ r)   c                d    Xl         [        U 5      u  U l        U l        S[	        U 5      ;   a  U ?g g )Nr  )r   r"  r   r   varsr  rF   r   s     r/   r   r  `  s1    
'6t'<$t}tDz)# *r)   c                    U R                   $ r+   )r   rE   s    r/   r   ui.ferrg  r  r)   c                @    Xl         [        U 5      u  U l        U l        g r+   )r   r"  r   r   r  s     r/   r   r  k      
'6t'<$t}r)   c                    U R                   $ r+   r   rE   s    r/   finui.finp  s    yyr)   c                    Xl         g r+   r  r  s     r/   r  r  t  s    	r)   c                    U R                   $ )zMStream dedicated for status/error messages; may be None if
fout/ferr are used)r   rE   s    r/   fmsgui.fmsgx  s     zzr)   c                @    Xl         [        U 5      u  U l        U l        g r+   )r   r"  r   r   r  s     r/   r  r  ~  r  r)   c              #     #    U R                  XUS9   S v   U R                  5         g ! U R                  5         f = f7f)N)r   subproclabeled)
pushbuffer	popbufferrF   r   r  r  s       r/   silent	ui.silent  s3      	egF	NNDNNs   >) >;>c                    U R                   R                  / 5        U R                  R                  XU45        X0l        g)a  install a buffer to capture standard output of the ui object

If error is True, the error output will be captured too.

If subproc is True, output from subprocesses (typically hooks) will be
captured too.

If labeled is True, any labels associated with buffered
output will be handled. By default, this has no effect
on the output returned, but extensions and GUI tools may
handle this argument and returned styled output. If output
is being buffered so it can be captured and parsed or
processed, labeled should not be set to True.
N)rn   rU  ro   rp   r  s       r/   r  ui.pushbuffer  s5    " 	R !!57";<")r)   c                    U R                   R                  5         U R                   (       a  U R                   S   S   U l        OSU l        SR                  U R                  R                  5       5      $ )z2pop the last buffer and return the buffered outputr3  Nr)   )ro   poprp   rp  rn   rE   s    r/   r  ui.popbuffer  sY     &*&8&8&<Q&?D#&*D#xx))+,,r)   c                    XR                   L a  [        U R                  5      $ XR                  L a.  [        U R                  =(       a    U R                  S   S   5      $ g)Nr  r   F)r   rv  rn   r   ro   )rF   dests     r/   _isbufferedui._isbuffered  sN    ::&&::**Ht/A/A"/Ea/HIIr)   c                d    U R                   (       a  U R                  (       d  gU R                  SL $ )zcheck if write skips the labelTN)rn   rp   r   rE   s    r/   canwritewithoutlabelsui.canwritewithoutlabels  s#    ==!8!8$&&r)   c                     U R                   S:g  $ )z.check if write calls with labels are batchable   win32)r   rE   s    r/   canbatchlabeledwritesui.canbatchlabeledwrites  s     (**r)   c                  ^ ^ T R                   nT R                  (       as  UR                  SS5      mT(       a;  T R                  (       a*  T R                  S   R	                  UU 4S jU 5       5        gT R                  S   R	                  U5        gUR                  ST R
                  5      (       d  T R                  5         SR                  U5      n[        R                  " 5       n T R                  S:X  a$  [        R                  " T UR                  U40 UD6  OCT R                  b$  UR                  SS5      mT R                  UT5      nUR                  U5         T R$                  S==   [        R                  " 5       U-
  S	-  -  ss'   g! [         a  n[         R"                  " U5      eSnAff = f! T R$                  S==   [        R                  " 5       U-
  S	-  -  ss'   f = f)
a  write args to output

By default, this method simply writes to the buffer or stdout.
Color mode can be set on the UI class to have the output decorated
with color modifier before being written to stdout.

The color used is controlled by an optional keyword argument, "label".
This should be a string containing label names separated by space.
Label names take the form of "topic.type". For example, ui.debug()
issues a label of "ui.debug".

Progress reports via stderr are normally cleared before writing as
stdout and stderr go to the same terminal. This can be skipped with
the optional keyword argument "keepprogressbar". The progress bar
will continue to occupy a partial line on stderr in that case.
This functionality is intended when Mercurial acts as data source
in a pipe.

When labeling output for a specific command, a label of
"cmdname.type" is recommended. For example, status issues
a label of "status.modified" for modified files.
labelr)   r  c              3  H   >#    U  H  nTR                  UT5      v   M     g 7fr+   r  r-   ar  rF   s     r/   r0   ui.write.<locals>.<genexpr>       (Lt!Au)=)=t   "Nkeepprogressbarr     stdio_blockedr   )r   rn   rM  rp   rO  r  
_progclearrp  r   r   r   r   
win32printwriter  r   r   
StdioErrorr   )rF   rf   r   r  rZ  r   errr  s   `      @r/   r  ui.write  s   . zz ==HHWc*E00b!(((Lt(LL  b!((. xx)4+>+>??OOhhtn JJL		(*   tzz3?$???. HHWc2E**S%0C

3 /0

y(5 0  	(""3''	( /0

y(5 0s7   +3F F; AF !F; 
F8F33F88F; ;2G-c                D    U R                   " U R                  /UQ70 UD6  g r+   )_writer   )rF   rf   r   s      r/   	write_errui.write_err  s    DJJ...r)   c                F  ^ ^ T R                  U5      (       as  UR                  SS5      mT(       a;  T R                  (       a*  T R                  S   R	                  UU 4S jU 5       5        g T R                  S   R	                  U5        g T R
                  " U/UQ70 UD6  g )Nr  r)   r  c              3  H   >#    U  H  nTR                  UT5      v   M     g 7fr+   r  r  s     r/   r0   ui._write.<locals>.<genexpr>   r  r  )r  rM  rp   rn   rO  _writenobuf)rF   r  rf   r   r  s   `   @r/   r  	ui._write  s{    D!!HHWc*E00b!(((Lt(LLb!((.T1D1D1r)   c                   UR                  SU R                  5      (       d  U R                  5         SR                  U5      n[        R
                  " 5       n XR                  L a6  [        U R                  SS5      (       d  U R                  R                  5         [        USS5      (       a  UR                  " U40 UD6  OtU R                  S:X  a#  [        R                  " XR                  U40 UD6  OAU R                  b#  UR                  SS5      nU R                  XF5      nUR                  U5        XR                  L a"  [        USS5      (       d  UR                  5         U R(                  S==   [        R
                  " 5       U-
  S	-  -  ss'   g ! [         a  nXR                  L ar  UR                   [         R"                  [         R$                  [         R&                  4;   a5   S nAU R(                  S==   [        R
                  " 5       U-
  S	-  -  ss'   g [*        R,                  " U5      eS nAff = f! U R(                  S==   [        R
                  " 5       U-
  S	-  -  ss'   f = f)
Nr  r)   closedF
structuredr  r  r  r   )rM  r  r  rp  r   r   r   getattrr   flushr  r   r   r  r  r   errnoEPIPEEIOEBADFr   r   r  )rF   r  rf   r   rZ  r   r  r	  s           r/   r  ui._writenobuf  s   xx)4+>+>??OOhhtn JJL	 	zz!'$**h*N*N

  "t\511 

3'$'H,   zz3?$???. HHWc2E**S0C

3 zz!'$%*H*H

 /0

y(5 0  	(zz!cii		4 '  /0

y(5 0 ""3''	( /0

y(5 0s2   DF 
H="AH8-I  "H88H==I   2I2c                R   U R                   =(       a    UR                  S5      S;   nU(       aG  S[        R                  " [        R                  R                  5       R                  5       5      -  4U-   n[        U R                  U/UQ70 UD6  U(       a  UR                  5         g g )Ntype>      noter     error   status   warnings   [%s] )
r   rM  r   rT  datetimenow	isoformat_writemsgwithr  r  )rF   r  rf   r   	timestamps        r/   	_writemsgui._writemsg0  s    && 
488F+; @
 ,
	 ""8#4#4#8#8#:#D#D#FGH D 	dkk47$7$7JJL r)   c                8    [        U R                  U/UQ70 UD6  g r+   )r'  r  )rF   r  rf   r   s       r/   _writemsgnobufui._writemsgnobufA  s    d&&<t<t<r)   c                "   [         R                  " 5       n  U R                  R                  5          U R                  R                  5         U R                  S==   [         R                  " 5       U-
  S-  -  ss'   g ! [         a]  nUR
                  [
        R                  [
        R                  [
        R                  4;  a  [        R                  " U5      e S nANS nAff = f! [         a]  nUR
                  [
        R                  [
        R                  [
        R                  4;  a  [        R                  " U5      e S nANS nAff = f!  U R                  R                  5         f ! [         a]  nUR
                  [
        R                  [
        R                  [
        R                  4;  a  [        R                  " U5      e S nAf S nAff = f= f! U R                  S==   [         R                  " 5       U-
  S-  -  ss'   f = f)Nr  r   )r   r   r   r  r   r  r  r  r  r   r  r   r   )rF   r   r	  s      r/   r  ui.flushD  s   JJL		
4

  "
4JJ$$&
 /0

y(5 0  099U[[%))U[[$II**3// J0  4yyeii(MM#..s33 N44JJ$$& 4yyeii(MM#..s33 N4 /0

y(5 0s   A> C( >
C%AC E  C%%E (
E2AE
G 
EG GE/.G/
G9AGGGGG 2Hc                ^    U R                  SS5      (       a  g[        R                  " U5      $ )Nr      nonttyF)r   r!   isatty)rF   fhs     r/   r  
ui._isattyX  s%    ??5),,r""r)   c                    U R                   (       a  U R                  U R                  4$ [        R                  " U R                  U R                  5      u  pX4U R                  U R                  4:g  U l         X4$ )zDuplicate ui streams and redirect original if they are stdio

Returns (fin, fout) which point to the original ui fds, but may be
copy of them. The returned streams can be considered "owned" in that
print(), exec(), etc. never reach to them.
)r   r   r   r!   protectstdiorF   r  r   s      r/   protectfinoutui.protectfinout]  sb     !! 99djj(())$))TZZ@	"%DJJ0G!Gyr)   c                    X4U R                   U R                  4:X  a  g[        R                  " U R                   U R                  X5        SU l        g)z7Restore ui streams from possibly duplicated (fin, fout)NF)r   r   r!   restorestdior   r7  s      r/   restorefinoutui.restorefinoutl  s@    ;499djj11diiS? "'r)   c              #     #    U R                  5       u  p X4v   U R                  X5        g! U R                  X5        f = f7f)z.Run code block with protected standard streamsN)r8  r<  r7  s      r/   protectedfinoutui.protectedfinoutu  s?      &&(		*)Os)Ds)s   A- AA  Ac                    SU l         g )NT)r   rE   s    r/   disablepagerui.disablepager~  s
    !r)   c                n   U R                   (       d  U R                  (       a  gUR                  S5      (       d  XR                  SS5      ;   d  U R	                  SS5      (       a  U R	                  SSU-   S5      (       ar  [
        R                  R                  S	5      S
:X  dO  U R                  5       (       a:  U R                  5       (       d%  U R                  (       d  S[        R                  ;   a  g[        R                  (       a'  [        [        SS5      S:X  a  U R!                  S5        gU R#                  SS[$        R&                  5      nU(       d  g0 n[$        R(                  " 5       R+                  5        H  u  pEU[
        R                  ;  d  M  XSU'   M!     U R!                  S[,        R.                  " U5      -  5        U R1                  5         U R                  5       n[3        [4        S5      (       a)  [4        R4                  " [4        R6                  [8        5        U R;                  X#5      (       ai  SU l        U R=                  SSUS5        U R=                  SSSS5        U R>                  nXpR#                  SSU5      :w  a  [@        RB                  " U 5        ggU RE                  5         g)a  Start a pager for subsequent command output.

Commands which produce a long stream of output should call
this function to activate the user's preferred pagination
mechanism (which may be no pager). Calling this function
precludes any future use of interactive functionality, such as
prompting the user or activating curses.

Args:
  command: The full, non-aliased name of the command. That is, "log"
           not "history, "summary" not "summ", etc.
Ns   internal-always-s   pagers   ignorer   s   paginates   attend-T   TERM   dumbs
   --debuggerfrozenconsole_exes+   pager is unavailable with py2exe packaging
s   starting pager for command %s
SIGPIPE	   formatted   interactiveFs   colors	   pagermode)#r   r   re  r   r   r   r   rM  	formattedr   rn   r   sysargv	iswindowsr  sysrW  r   r   fallbackpagerdefaultpagerenvr   r#   pprintr  hasattrsignalrI  rg   	_runpagerr   r   r   setuprB  )rF   commandpagercmdpagerenvr   r   wasformattedcms           r/   pagerui.pager  s    !1!1!!"566 x;;??5+66??8Z'-A4HH##G,7 >>##zz||}} 0 00
  '#x">-"OJJFG;;x63G3GH!11399;KD8+++!& < 	

.1B1B71KK	
 	

~~'69%%MM&..*5>>(--#D NN5,hGNN5.%B B[[<<<D! = r)   c                  ^^^^ TS:X  a  g[        U4S jS 5       5      n[        R                  (       aD  U(       d=  [        R                  " T5      nU(       d  U R                  [        S5      T-  5        gUm [        R                  " [        R                  " T5      US[        R                  [        R                  [        R                  [        R                  [        R                  " [        R                  " U5      5      S9m[        R"                  S:w  ad  [$        R&                  " [        R                  R)                  5       5      m[$        R&                  " [        R                  R)                  5       5      m[$        R*                  " TR,                  R)                  5       [        R                  R)                  5       5        U R/                  [        R                  5      (       aK  [$        R*                  " TR,                  R)                  5       [        R                  R)                  5       5        U R0                  UUU4S	 j5       ng
! [          a(    U(       d  U R                  [        S5      T-  5         ge f = f)zActually start the pager and set up file descriptors.

This is separate in part so that extensions (like chg) can
override how a pager is invoked.
s   catFc              3  ,   >#    U  H	  oT;   v   M     g 7fr+   rc   )r-   r.   rW  s     r/   r0   ui._runpager.<locals>.<genexpr>  s     H*GQL*Gs   s   |&;<>()$`\"' 	
*?[#~=%s+   missing pager command '%s', skipping pager
r  )shellbufsize	close_fdsr   r   r   env   OpenVMSc                   > [        [        S5      (       a3  [        R                  " [        R                  [        R                  5        [        R
                  S:X  a  T R                  5         [        R                  " T[        R                  R                  5       5        [        R                  " T[        R                  R                  5       5        T R                  R                  5         T R                  5         g )NSIGINTre  )rS  rT  rg  SIG_IGNr   sysplatformkillr  dup2r!   r   filenor   r   closewait)r\  stderrfdstdoutfds   r/   	killpagerui._runpager.<locals>.killpager  s    vx((fmmV^^<##z1

GGHhoo4467GGHhoo4467KKJJLr)   T)anyr   rN  r!   findexer   r   
subprocessPopentonativestrclosefdsPIPEr   r   tonativeenvshellenvironFileNotFoundErrorri  r  duprl  rk  r   r  atexit)	rF   rW  rd  ra  fullcmdrq  r\  ro  rp  s	    `    @@@r/   rU  ui._runpager  s    f
 H*GHHe &&w/G		EFP G	$$$$W-"++ oo(()>)>s)CD	E& :-vvhoo4467Hvvhoo4467H
""$hoo&<&<&>?<<((GGEKK&&((//*@*@*BC			 
		 ; ! 			EFP 	s   ;BI .JJc                    [         $ r+   )rh   rE   s    r/   _exithandlersui._exithandlers  s    r)   c                @    U R                   R                  XU45        U$ )zrregister a function to run after dispatching a request

Handlers do not stay registered across request boundaries.)r  rU  )rF   funcrf   kwargss       r/   r~  	ui.atexit  s"     	!!4v"67r)   c                   [        SS/5      nSS/SS/S.nXR                  5       ;  a  [        SU-  5      e[        X1   5      nX$:  a  [        SU-  5      eU R                  5       (       d#  [        R
                  R                  S5      S:X  a  gSnU R                  SS	5      nXb;   a  [        [        U5      nUnU R                  SS
U-  5      nX;   a  [        [        U5      nUbE  XV:w  a@  Ub  U R                  [        S5      U4-  5        OU R                  [        S5      Xg4-  5        Ub$  Xx:w  a  U R                  [        S5      XU4-  5        U$ )a  what interface to use for interactive console features?

The interface is controlled by the value of `ui.interface` but also by
the value of feature-specific configuration. For example:

ui.interface.histedit = text
ui.interface.chunkselector = curses

Here the features are "histedit" and "chunkselector".

The configuration above means that the default interfaces for commands
is curses, the interface for histedit is text and the interface for
selecting chunk is crecord (the best curses interface available).

Consider the following example:
ui.interface = curses
ui.interface.histedit = text

Then histedit will use the text interface and chunkselector will use
the default curses interface (crecord at the moment).
s   texts   curses)s   chunkselectors   histedits   Unknown feature requested %ss1   Feature %s does not handle all default interfacesrE  rF  r   s	   interfaces   interface.%ss#   invalid value for ui.interface: %s
s.   invalid value for ui.interface: %s (using %s)
s1   invalid value for ui.interface.%s: %s (using %s)
)	frozensetkeysr{  r   r   r   rM  r   r   r2   r   r   )	rF   r  alldefaultsfeatureinterfacesavailableinterfacesdefaultinterfacer  choseninterfacer   s	            r/   	interfaceui.interface%  s   ,  ) 45 
 	
 0022<wFGG'(9(BC, DwN  ::<<8++//8GC #KK|,#E1~!1KK89#"5!nO=-2}		!CDtKL		HI*+ =_1IIGH/0
 r)   c                f    U R                  SS5      nUc  U R                  U R                  5      $ U$ )a  is interactive input allowed?

An interactive session is a session where input can be reasonably read
from `sys.stdin'. If this function returns false, any attempt to read
from stdin should fail with an error, unless a sensible default has been
specified.

Interactiveness is triggered by the value of the `ui.interactive'
configuration variable or - if it is unset - when `sys.stdin' points
to a terminal device.

This function refers to input only; for output, see `ui.formatted()'.
r   rK  )r   r  r   rF   r  s     r/   r   ui.interactives  s3     OOE>29 <<		**r)   c                    S[         R                  ;   a   [        [         R                  S   5      $ [        R
                  " U 5      S   $ ! [         a     N%f = f)z$how wide is the terminal in columns?s   COLUMNSr   )r   r   r   r{  r   termsizerE   s    r/   	termwidthui.termwidth  sW    )))8++J788 %a((  s   A 
AAc                    U R                  5       (       a  gU R                  SS5      nUc  U R                  U R                  5      $ U$ )a  should formatted output be used?

It is often desirable to format the output to suite the output medium.
Examples of this are truncating long lines or colorizing messages.
However, this is not often not desirable when piping output into other
utilities, e.g. `grep'.

Formatted output is triggered by the value of the `ui.formatted'
configuration variable or - if it is unset - when `sys.stdout' points
to a terminal device. Please note that `ui.formatted' should be
considered an implementation detail; it is not intended for use outside
Mercurial or its extensions.

This function refers to output only; for input, see `ui.interactive()'.
This function always returns false when in plain mode, see `ui.plain()'.
Fr   rJ  )r   r   r  r   r  s     r/   rL  ui.formatted  sA    " ::<<OOE<09 <<

++r)   c                   U R                  U R                  5      =(       ai    U R                  U R                  5      =(       aG    [        R                  " U R                  5      =(       a     [        R
                  " U R                  5      nU(       a   SS KnUR                    U R                  S:X  d  U(       d<  U(       d  0 nU R                  " U R                  U4SS0UD6  U R                  5         SnO/U R                  n SU l        U R                  US5      S-   nXPl        U R                  S	5         U(       au  U R                  5         [         R"                  " U5      n[         R$                  " ['        U5      5      n[(        R*                  S
:X  a  UR-                  S5      (       a  US S nOU R                  R/                  [(        R0                  " U5      5        U R                  R                  5         U R                  R                  5       nU(       d  [2        eUR5                  [(        R*                  5      nS S S 5        U$ ! [         a    Sn GNf = f! XPl        f = f! , (       d  f       W$ = f)Nr   Fr  r     prompt    Ts	   ui.prompt   stdios   
   r  )r  r   r   r!   isstdinisstdoutreadlineread_history_file	Exceptionr   r,  r   r  r   r  r   r   strfromlocalr  inputr   	oslinesependswithr  rT  EOFErrorrstrip)rF   r  
promptoptsusereadliner  wasreadlinepromptlines          r/   	_readlineui._readline  s    LL# .TZZ(.  +. !!$**-	 	 	$   **
 ??h&k
v,59C JJLF $ 4 49'+$FL9D@'8$ $$X.

!..v6**5=9 %%0T]]55I5I9D

  !1!1&!9:

  "yy))+"N{{8#5#56 /" M  $#$" (9$ /." s+   I I  7DI+II I(+
I:c                    g r+   rc   rF   rZ  rB  s      r/   r  	ui.prompt      r)   c                    g r+   rc   r  s      r/   r  r    r  r)   c                     U R                  XS9$ )zXPrompt user with msg, read response.
If ui is not interactive, the default is returned.
r  )_promptr  s      r/   r  r    s     ||C|11r)   c                    g r+   rc   rF   rZ  rB  r   s       r/   r  
ui._prompt        r)   c                    g r+   rc   r  s       r/   r  r    r  r)   c                   0 UESU0EnU R                  5       (       dH  U R                  " U R                  US4SS0UD6  U R                  U R                  U=(       d    SSSS9  U$  U R                  XS	9nU(       d  UnU R	                  S
S5      (       a%  U R                  U R                  U=(       d    SSSS9  U$ ! [
         a    [        R                  " 5       ef = f)NrB  r  r  r  r)   r  s
   promptecho)r  )r  r  r   )r   r)  r   r  r   r  r   ResponseExpected)rF   rZ  rB  r   rs        r/   r  r    s    +$+	7+!!NN4==#tL)LtLNNw~#u=   N
	+c;Aum44MM18U   H 	+((**	+s   'AB= = Cc                $   [         R                  " SU 5      nUc   eUR                  S5      nUR                  S5      R                  S5       Vs/ s H  o3R	                  S5      PM     nnS nX$ Vs/ s H
  oe" U5      PM     sn4$ s  snf s  snf )a  Extract prompt message and list of choices from specified prompt.

This returns tuple "(message, choices)", and "choices" is the
list of tuple "(response character, text without &)".

>>> ui.extractchoices(b"awake? $$ &Yes $$ &No")
('awake? ', [('y', 'Yes'), ('n', 'No')])
>>> ui.extractchoices(b"line\nbreak? $$ &Yes $$ &No")
('line\nbreak? ', [('y', 'Yes'), ('n', 'No')])
>>> ui.extractchoices(b"want lots of $$money$$?$$Ye&s$$N&o")
('want lots of $$money$$?', [('s', 'Yes'), ('o', 'No')])
s   (?s)(.+?)\$\$([^$]*&[^ $].*)r   r3  s   $$r  c                z    U R                  S5      nXS-   US-    R                  5       U R                  SSS5      4$ )N   &r   r3  r)   )indexlowerr   )r(  ampidxs     r/   choicetuple&ui.extractchoices.<locals>.choicetuple;  s=    WWT]FaZ&1*-335qyysA7NNNr)   )rematchr   r  r  )r  mrZ  r&  choicesr  r(  s          r/   extractchoicesui.extractchoices   s    ( HH5v>}}ggaj*+''!**:*:5*AB*AQ774=*AB	O g6gk!ng677 C 7s   B3Bc                <   U R                  U5      u  p4U VVs/ s H  u  pVUPM	     nnn U R                  X7U   US9nUR                  5       U;   a  UR                  UR                  5       5      $ U R	                  U R
                  [        S5      5        Mm  s  snnf )a5  Prompt user with a message, read response, and ensure it matches
one of the provided choices. The prompt is formatted as follows:

   "would you like fries with that (Yn)? $$ &Yes $$ &No"

The index of the choice is returned. Responses are case
insensitive. If ui is not interactive, the default is
returned.
)rB  r  s   unrecognized response
)r  r  r  r  r)  r   r   )rF   r  rB  rZ  r  r  r   respss           r/   promptchoiceui.promptchoiceA  s     **62&'wtqw'S.'JAwwyE!{{1779--NN4==!,F*GH  (s   Bc                   U R                  5       (       d  U$  U R                  U R                  U=(       d    [        S5      SSS9  U R	                  S5         U R                  SS5      (       aA  U R                  R                  5       nU(       d  [        eUR                  S5      sS S S 5        $ [        R                  " 5       sS S S 5        $ ! , (       d  f       g = f! [         a    [        R                  " 5       ef = f)	Ns
   password: r  T)r  passwordr  r   r1  r  )r   r)  r   r   r   r   r   r  r  r  r   get_passwordr   r  )rF   r  rB  ls       r/   getpass
ui.getpassU  s     !!N	+NN*!M*	   ((2??5)44		**,A&88E? 32  ,,. 322  	+((**	+s6   ?C  AC'	C  1C	C  
CC  C    D c                l    U R                   (       d#  U R                  " U R                  /UQ7SS0UD6  gg)zawrite status message to output (if ui.quiet is False)

This adds an output label of "ui.status".
r  r"  N)rq   r)  r   rF   rZ  r   s      r/   status	ui.statusn  s/    
 zzNN4==G3GyG$G r)   c                H    U R                   " U R                  /UQ7SS0UD6  g)zUwrite warning message to output (stderr)

This adds an output label of "ui.warning".
r  r#  Nr)  r   r  s      r/   r   ui.warnv  s#    
 	t}}DD:DtDr)   c                H    U R                   " U R                  /UQ7SS0UD6  g)zQwrite error message to output (stderr)

This adds an output label of "ui.error".
r  r!  Nr  r  s      r/   r   ui.error}  s#    
 	t}}BcB8BTBr)   c                l    U R                   (       a#  U R                  " U R                  /UQ7SS0UD6  gg)zVwrite note to output (if ui.verbose is True)

This adds an output label of "ui.note".
r  r   N)rr   r)  r   r  s      r/   noteui.note  s/    
 <<NN4==EEwEE r)   c                    U R                   (       aE  U R                  " U R                  /UQ7SS0UD6  U R                  SSSR	                  U5      5        gg)zbwrite debug message to output (if ui.debugflag is True)

This adds an output label of "ui.debug".
r  r  s   %sr)   N)rs   r)  r   logrp  r  s      r/   rW  ui.debug  sG    
 >>NN4==F#FxFFHHXuchhsm4 r)   c                >   Uc  U R                  S5        SSS.nUb4  UR                  S5      b  U R                  S5        UR                  U5        UnUS:X  a  Sn	OU(       a  S	U-  n	OUS   n	S n
U R                  S
S5      (       a  Un
[        R
                  " SUS   -   S-   XS9u  p [        R                  " US5       nUR                  [        R                  " U5      5        S S S 5        SU0nSU;   a  UR                  S[        US   5      05        S H  nX;   d  M
  UR                  SX?   05          O   U(       a  UR                  SU05        U(       a  UR                  SU05        U R                  5       nU R                  SUU4-  U[        R                  [!        S5      SS9  [        R"                  " [        R$                  " U5      5      n[        R&                  " U5        U$ ! , (       d  f       GN= f! [        R&                  " U5        f = f)NsA   action is None but will soon be a required parameter to ui.edit()   editors   .txt)   prefix   suffixr  s>   extra.suffix is not None but will soon be ignored by ui.edit()s   diffs   .diffs
   .%s.hg.txtrl   s   editortmpinhgs   hg-r     -)ri  suffixdirwbr  s   transplant_sources
   HGREVISION)s   intermediate-sources   sources   rebase_sources
   HGEDITFORMs
   HG_PENDINGs   %s "%s"s   edit failed)r   onerr	errprefix
blockedtag)rR  rM  r  r   r   mkstempr  fdopenr  r   tonativeeolr   	geteditorsystemr   CanceledErrorr   fromnativeeolreadfileunlink)rF   textrR   extraeditformpendingrepopathactionextra_defaultsr  rdirfdr   r   r   r  editorr   s                     r/   editui.edit  s    >NN*
 !
 yy#/, !!%(WF"V+F9%F???,<==D%%E),,t3F

	2t$((./ % !$'G#u,"C.B(C$DE O>NNM5<#@A O x89w78^^%FKK~-))N+$   ""4==#67AIIdO? %$: IIdOs+   *H &G2'9H $B6H 2
H<H Hc                   Uc  UR                  S[        5      SS nSU-   nU R                  n[        S U R                   5       5      (       a  U nU R                  U5         U R                  XX8S9n	SSS5        W	(       aN  U(       aG  S[        R                  " U5      S   [        R                  " U	5      4-  n
U(       a  SXZ4-  n
U" U
5      eU	$ ! , (       d  f       Ne= f)	zexecute shell command with appropriate output stream. command
output will be redirected if fout is not stdout.

if command fails and onerr is None, return status, else raise onerr
object as exception.
Nis   unknown_system_c              3  *   #    U  H	  oS    v   M     g7fr   Nrc   )r-   r(  s     r/   r0   ui.system.<locals>.<genexpr>  s     0/t/s   r   cwdouts   %s %sr   s   %s: %s)
	translater3   r   rs  ro   r   
_runsystemr!   
shellsplitexplainexit)rF   cmdr   r  r  r  r  	cmdsuffixr  rcerrmsgs              r/   r  	ui.system  s      dJ7=I+i7Jjj0T//000C$$Z03HB 1%##C(+$$R(! F "i%88-	 10s   "C
C c                ,    [         R                  " XX4S9$ )zSactually execute the given shell command (can be overridden by
extensions like chg)r  )r!   r  )rF   r  r   r  r  s        r/   r  ui._runsystem	  s     sFFr)   c           
        U R                   (       d  U(       GaP  Uc  [        R                  " 5       n[        US   SS5      nUb  [        R
                  " US   5      n[        R
                  " US   5      n[        R                  " US   US   5      nU R                  S[        R                  " SR                  USS 5      5      [        R                  " SR                  U5      5      [        R                  " SR                  U5      5      5        OU[        R                  " US   US   US   5      nU R                  [        R                  " SR                  U5      5      5        U R                   =(       d    U$ )	zprint exception traceback if traceback printing enabled or forced.
only to call in exception handler. returns true if traceback
printed.Nr   causer3  r   s#   Traceback (most recent call last):
 r  )rt   rO  exc_infor  	traceback	format_tbformat_exception_onlyr  r   r  rp  format_exception)rF   excforcer  causetbexctbexconlyoutputs           r/   r  ui.traceback  s'    {llnCFGT2E #--eAh7!++CF3#99%(E!HM ;''cr
(;<''(89''(89	 #33CFCFCFKx222776?CD!!*U*r)   c                   [         R                  S:X  a  SnO2[         R                  (       a  SnO[         R                  (       a  SnOSn[        R
                  R                  S5      =(       d    U R                  SSU5      $ )	zreturn editor to uses   plan9   Es   vims   notepad.exes   vis   HGEDITORr   r  )r   ri  isdarwinrN  r   r   rM  r   )rF   r  s     r/   r  ui.geteditor(  sj    8+ F
 F#FF##K0 
DKK9f5
 	
r)   c                    U R                   (       dC  U R                  (       d2  U R                  SS5      (       d  [        R                  " U 5      (       d  g[        U 5      $ )z,setup the progbar singleton to the ui object   progresss   disableN)rq   rs   r   r   shouldprint
getprogbarrE   s    r/   r   ui._progbar>  sB     JJ~~{J77''--$r)   c                    [        5       (       d  gU R                  b7  U R                  R                  (       a  U R                  R                  5         ggg)z:clear progress bar output if any. use it before any outputN)haveprogbarr   printedclearrE   s    r/   r  ui._progclearJ  s:    }}==$)>)>MM! *?$r)   c                   ^  [        T R                  SS5      (       a  U 4S jnO'T R                  b  T R                  R                  nOS n[        R                  " T XAX#5      $ )z0Create a progress helper for the specified topicr  Fc           
     D   > TR                   R                  S SU UUUUS9  g )Nr-  )r  r   posr/  unittotal)r   r  )r   r8  r/  r9  r:  rF   s        r/   	updatebar"ui.makeprogress.<locals>.updatebar[  s/    ##$ $ r)   c                    g r+   rc   )r   r8  r/  r9  r:  s        r/   r;  r<  j  s    r)   )r  r   r   r   r   )rF   r   r9  r:  r;  s   `    r/   makeprogressui.makeprogressQ  sT     4==,66	 ]]&..I iDDr)   c                8    U R                   R                  U5      $ )z=Returns a logger of the given name; or None if not registered)r   rM  )rF   r   s     r/   	getloggerui.getloggero  s    }}  &&r)   c                     X R                   U'   g)zInstall logger which can be identified later by the given name

More than one loggers can be registered. Use extension or module
name to uniquely identify the logger instance.
N)r   )rF   r   r+  s      r/   r$  ui.setloggers  s     %dr)   c                x   U R                   (       d  gU R                   R                  5        Vs/ s H  oUR                  U5      (       d  M  UPM     nnU(       d  gX#-  n[        R                  " U5      nU R                   n0 U l          U H  n	U	R                  XXt5        M     Xl         gs  snf ! Xl         f = f)a  hook for logging facility extensions

event should be a readily-identifiable subsystem, which will
allow filtering.

msgfmt should be a newline-terminated format string to log, and
*msgargs are %-formatted into it.

**opts currently has no defined meanings.
N)r   valuesr*  r   byteskwargsr  )
rF   eventmsgfmtmsgargsr   r  activeloggersrZ  registeredloggersr+  s
             r/   r  ui.log{  s     }}$(MM$8$8$:O$:qii>N$:O##D) MM	.'

42 ( .M P .Ms   B,B,
B1 1B9c                N    U R                   b  [        R                  " XU5      $ U$ )a&  style msg based on supplied label

If some color mode is enabled, this will add the necessary control
characters to apply such color. In addition, 'debug' color mode adds
markup showing which label affects a piece of text.

ui.write(s, 'label') is equivalent to
ui.write(ui.label(s, 'label')).
)r   r   
colorlabel)rF   rZ  r  s      r/   r  ui.label  s&     ??&##Du55
r)   c           
        U R                  SS5      (       d  Ub  U R                  SU5      (       d  gSU-   nUS-  nU R                  (       ag  [        R                  " XU R                  U R
                  5        U R                  SSUSR                  [        R                  " U5      5      4-  5        g[        R                  " 5       n[        R                  " US	5      nXR   SS
 u  pgn[        R                  " U5      [        R                  " U5      pU R                  SXXx4-  5        U R                  SSXXx5        AAg)zpissue a developer warning message

Use 'stacklevel' to report the offender some layers further up in the
stack.
r     all-warningsNs   devel-warn: r   s	   develwarns	   %s at:
%sr)   r3     s   %s at: %s:%d (%s)
)r   rt   r   debugstacktracer   r   r  rp  getstackframesinspectcurrentframegetouterframesr   r}  r  )	rF   rZ  
stacklevelr   curframecalframefnamelinenor  s	            r/   rR  ui.develwarn  s    x99~T__Xv%F%F#a
  $**djjIHH!4!4Z!@ABC ++-H--h:H"*"6q";E4"++E2H4E4Ed4K4NN1S4NNOHH4c&
 r)   c                    U R                  SS5      (       d  U R                  SS5      (       d  gUSU-  -  nU R                  XSS9  g)zissue a deprecation warning

- msg: message explaining what is deprecated and how to upgrade,
- version: last version where the API will be supported,
r  rR  s   deprec-warnNsF   
(compatibility will be dropped after Mercurial-%s, update your code.))rY  r   )r   rR  )rF   rZ  versionrY  s       r/   
deprecwarnui.deprecwarn  sR     OOHo66x88# 	 	s.Ir)   c                    U R                   $ )zGThe environment variables that are safe to export, e.g. through
hgweb.
)r   rE   s    r/   exportableenvironui.exportableenviron  s     &&&r)   c              #    #    0 n UR                  5        H/  u  u  pEnU R                  XE5      X4U4'   U R                  XEXb5        M1     Sv   UR                  5        H  u  pxU R                  U5        M     SU;   a  U R	                  SS9  gg! UR                  5        H  u  pxU R                  U5        M     SU;   a  U R	                  SS9  f f = f7f)zContext manager for temporary config overrides
`overrides` must be a dict of the following structure:
{(section, name) : value}N)r   r  r   r   )r   r0  r   r6  r   )	rF   	overridesr   backupsr   r   r   __r.  s	            r/   configoverrideui.configoverride  s     
 	.*3//*;&+/+<+<W+K$(we< +< %mmo
""6* . !I-u- .	 &mmo
""6* . !I-u- .s   CAB ACACCc                    U R                  SS5      nUb   [        R                  " U5      $ [        R                  " 5       $ ! [        R                   a#    [        R
                  " [        S5      U-  5      ef = f)zProvide an estimate for the available system memory in Bytes.

This can be overriden via ui.available-memory. It returns None, if
no estimate can be computed.
r   s   available-memorys+   ui.available-memory value is invalid ('%s'))r   r   r  r   r|  r   r   _estimatememory)rF   r   s     r/   estimatememoryui.estimatememory  sx     E#67~~e,,
 ##%%	 ## ''DEM s   A 7A9)'r   rp   rn   ro   r   r   r   r   r   r   r   r   r   r   rw   r   rx   r   r   ru   r   ry   r   r}   r|   r   rz   r   r~   rs   r   r   r   r   r   rq   r   rt   rr   r+   )r   zOptional[ui]r[   r\   rZ   )r   z
Type[_Tui]r[   r&   )rF   r&   r[   r&   )r   r2   )r   r2   )r   r2   r[   rv  )NFNN)r)   N)r   _ConfigItemsr[   r\   )NN)r)   )F)FF)r  Optional[bytes]r[   rv  )rR   r2   r[   r2   )FFF)r   rv  r  rv  r  rv  )r   rv  r  rv  r  rv  r[   r\   )r[   r2   r[   rv  rf   r2   r   _MsgOptsr[   r\   )rW  r2   r[   r\   )rW  r2   r[   rv  )r  r2   r[   r2   )r[   r   )r  N)r  r2   r  zOptional[Dict[str, _MsgOpts]]r[   r2   )rZ  r2   rB  r2   r[   r2   )rZ  r2   rB  r\   r[   rq  )   y)rZ  r2   rB  r2   r   rt  r[   r2   )rZ  r2   rB  r\   r   rt  r[   rq  )r  r2   r[   z!Tuple[bytes, List[_PromptChoice]])r   )r  r2   rB  r   r[   r   )r  rq  rB  rq  r[   rq  )rZ  r2   r   rt  r[   r\   )NNNNN)r  r2   rR   r2   r  zOptional[Dict[bytes, Any]]r  rq  r   rq  r[   r2   )r  r2   r  rq  r  z&Optional[Callable[[bytes], Exception]]r  rq  r  rq  r[   r   )r  r2   r  rq  r[   r   )NF)r"  rv  )r[   Optional[progress.progbar])r   r2   r9  r2   r:  Optional[int]r[   zscmutil.progress)rZ  r2   r  r2   r[   r2   r	  )rZ  r2   rY  r   r   rq  r[   r\   )r3  )rZ  r2   r`  r2   rY  r   r[   r\   )rg  rp  r   r2   )r[   rw  ){r]   r^   r_   r`   rG   r   classmethodr   r   r   r   
contextlibcontextmanagerr   r   r   r   r   r   r   r  r  r   r0  r6  r   r<  r  rD  r   rC  ra  rj  rr  r   r  r  r  r   r  r  r   r  r   r  r  r  r   r   r  r   propertycacher  propertyr   r  setterr   r  r  r  r  r  r  r  r  r  r  r  r  r)  r,  r  r  r8  r<  r?  rB  r\  rU  r  r~  r  r   r  rL  r  typingTYPE_CHECKINGr   r  r  staticmethodr  r  r  r  r   r   r  rW  statusnoi18n
notenoi18n
warnnoi18nwritenoi18nr  r  r  r  r  r   r  r>  rA  r$  r  r  rR  ra  rd  rj  rn  rb   rc   r)   r/   r'   r'      s{   _AB 
  4M($:    .  .D<2 BF
	
 FJ
E	
E JN.	.& ;?+'+	+$)"V61p
$
#6; -3e  .4u AF
 7= : 17%  17% #L /545#J 06 
. 285 #J 17% , 17%  	<064/+B'R 
# #   
! ! 
[[$ $   
[[= =   	ZZ   
 
[[= = JO,0CG  KP**,0*CG*	**-'+
8t/	2(T"=(#
' * *"O bFP    L\,)< 48>> 2> 
	>@ 		 
	 
	 
	2 			',	6>		 
	
 
		'+	5=		 
	
+( 8 8@I* JN+%+7F+	+2HECF5 LJJK -1$("&II I *	I "I  I 
I\ #8<%)&*!! 	!
 6! #! $! 
!FG
+4
, 
	  	 " GKEE"'E6CE	E<'%.6 JN  &) 7F 	 L 	JJ J 	J
 
J,' . .$&r)   rv  _progresssingletonc                H    [         c  [        R                  " U 5      q [         $ r+   )r  r   progbar)r'   s    r/   r/  r/  	  s!    ! &--b1r)   c                     [         S L$ r+   )r  rc   r)   r/   r2  r2  	  s    T))r)   c                ^   U R                  SS5      nUS:X  aA  U R                  (       a  U R                  U R                  4$ U R                  U R                  4$ US:X  a  U R                  U R                  4$ US:X  a  U R                  U R                  4$ [        R
                  " SU-  5      e)Nr   r  s   channelr  s   stderrs)   invalid ui.message-output destination: %s)r   r  r   r   r   r  )r'   r   s     r/   r"  r"  	  s    99U-.Dz7777BGG## 77BGG##xwwyww
++BTI
JJr)   c                    SU;   a<  [        USS5      (       d*  UR                  SS5      SUR                  S5      -  -   US'   U " U/UQ70 UD6  g)zWrite ui message with the given ui._write*() function

The specified message type is translated to 'ui.<type>' label if the dest
isn't a structured channel, so that the message will be colorized.
r  r  Fr  r)   s    ui.%sN)r  rM  r  )r  r  rf   r   s       r/   r'  r'  (	  sR     ~gdL%@@#.TXXf=M1MMW	$r)   )r[   r   )r'   r'   r[   zprogress.progbarrr  )r'   r'   rs  )P
__future__r   r   ry  r$  r  rV  r  r  rT  r  ru  rO  r  r~  r   r   r   r   r   r	   r
   r   r   r   r   r   i18nr   noder   r  r   r   r   r   r   r   r   r   r   r   r   r   configurationr   utilsr    r!   r"   r#   r$   r2   objectrp  rv  rt  r%   r&   rJ   rp  mapbytechrranger3   __annotations__r4   r5   r:   r>   r@   rg   rD  rh   r'   r  r/  r2  r"  r'  rc   r)   r/   <module>r     s   #      	 	    
           "  E%,'/0 d?334eUl#vT"	 HH 8##U3Z0 
E 
 86sK# K\88
 
4  
  $ [ & [ &@A 26 . 5*K 	r)   