Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/src/cmd/hg/mercurial/ui.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�
�c@s�ddklZddkZddkZddkZddkZddkZddkZddkZddk	Z	ddk
Z
ddkZhed<ed<ed<ed<e
d<e
d<e
d	<e
d
<Zdefd��YZdS(
i�(t_Nt1tyesttruetont0tnotfalsetofftuicBs�eZd'd�Zd�Zd�Zd'ed'd'd�Zd'd�Zd�Z	d�Z
ed�Zd'ed�Zeed	�Z
d'ed
�Zed�Zed�Zed
�Zd�Zd�Zd�Zd'd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zdd�Zdd�Zd'd'd�Zd�Z d �Z!d!�Z"d"�Z#d#�Z$d$�Z%d%�Z&ddd'd&�Z'RS((cCsg|_t|_|_|_|_t|_ti�|_	ti�|_
ti�|_t�|_
t�|_|oh|i
i�|_
|ii�|_|i	i�|_	|i
i�|_
|ii�|_|i�n+x'ti�D]}|i|dt�q�S(Nttrust(t_bufferstFalsetquiettverboset	debugflagt
_tracebacktTruet_reportuntrustedtconfigt_ocfgt_tcfgt_ucfgtsett_trustuserst_trustgroupstcopyt	fixconfigtutiltrcpatht
readconfig(tselftsrctf((s./mercurial/ui.pyt__init__s$		
cCs
|i|�S(N(t	__class__(R((s./mercurial/ui.pyR&scCs�ti|�}ti|�otSn|i|i}}d|jp
d|jotSnti|i�}ti|i	�}||jp ||jp|ti�jotSn|i
o$|itd�|||f�nt
S(Nt*s6Not trusting file %s from untrusted user %s, group %s
(RtfstattisownerRRRtusernametst_uidt	groupnametst_gidRtwarnRR(RtfpR!tstttusersttgroupstusertgroup((s./mercurial/ui.pyt_is_trusted)s-
c

CsRyt|�}Wn%tj
o|pdSn�nXti�}|p|p|i||�}y |i||d|d|�WnCtij
o4}	|o�n|itd�t	|	��nX|o'|i
i|�|i
i|i�n|i
i|�|i
i|i�|djotiid�}n|id|�dS(NtsectionstremapsIgnored: %s
t~troot(topentIOErrorRR2treadterrortConfigErrorR+RtstrRtupdateRRtNonetostpatht
expanduserR(
RtfilenameR6R
R3R4R,tcfgttrustedtinst((s./mercurial/ui.pyR<s,  "
c	Cs�|p
ti�}x�|i|i|ifD]�}xw|id�D]f\}}|oSd|joFtii|�o2|id|tii	tii
||���qBqBWq,W|idd�|_|ip|idd�|_
|io|idd�|_|i
o|iot|_|_
n|iddt�|_|iddt�|_|ii|id	d
��|ii|id	d��dS(Ntpathss://R	tdebugRR
treport_untrustedt	tracebackRDtuserstgroups(R?tgetcwdRRRtitemsR@tisabsRtnormpathtjoint
configboolRRR
RRRRRR=t
configlistR(RR6tctntp((s./mercurial/ui.pyRYs (: cCsDx3|i|i|ifD]}|i|||�qW|i�dS(N(RRRRR(RtsectiontnametvalueRC((s./mercurial/ui.pyt	setconfignscCs|o
|ip|iS(N(RR(Rt	untrusted((s./mercurial/ui.pyt_datasscCs |i|�i||�pdS(Ntnone(R[tsource(RRVRWRZ((s./mercurial/ui.pytconfigsourcevscCs�|i|�i|||�}|ioi|oa|ioW|ii||�}|dj	o1||jo$|itd�|||f�q�n|S(Ns3ignoring untrusted configuration option %s.%s = %s
(R[tgetRRRR>RGR(RRVRWtdefaultRZRXtuvalue((s./mercurial/ui.pyRyscCst|i||d|�}|djo|Sn|i�tjo&titd�|||f��nt|i�S(Ns%s.%s not a boolean ('%s')(RR>tlowert	_booleansR:R;R(RRVRWR`RZtv((s./mercurial/ui.pyRQ�s
cCsf|i||d|�}|djo|pg}nt|t�o|idd�i�}n|S(s.Return a list of comma/space separated stringsRZt,t N(RR>t
isinstancet
basestringtreplacetsplit(RRVRWR`RZtresult((s./mercurial/ui.pyRR�s
cCs||i|�jS(s&tell whether section exists in config.(R[(RRVRZ((s./mercurial/ui.pythas_section�scCs�|i|�i|�}|ioy|oq|iogxd|ii|�D]L\}}|ii||�|jo$|itd�|||f�qGqGWn|S(Ns3ignoring untrusted configuration option %s.%s = %s
(	R[RMRRRRR_RGR(RRVRZRMtkRd((s./mercurial/ui.pytconfigitems�sccsm|i|�}xW|i�D]I}x@|i||�D],\}}||t|�idd�fVq5WqWdS(Ns
s\n(R[R3RnR<Ri(RRZRCRVRWRX((s./mercurial/ui.pyt
walkconfig�s
cCsItiid�}|d
jo|idd�}n|d
jotiid�}n|d
jo2|idd�o|itd�dd
�}n|d
joQy7dti	�t
i�f}|itd	�|�Wq�
j
oq�n|ptitd
���nd|jo#titd�t|���n|S(sAReturn 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 ui.askusername is True, ask the user, else use
        ($LOGNAME or $USER or $LNAME or $USERNAME) + "@full.hostname".
        tHGUSERR	R'tEMAILtaskusernamesenter a commit username:R`s%s@%ss&No username found, using '%s' instead
sPlease specify a username.s
susername %s contains a newline
N(R?tenvironR_R>RRQtpromptRRtgetusertsockettgetfqdnR+tKeyErrortAborttrepr(RR0((s./mercurial/ui.pyR'�s$

 
	
#cCs!|ipti|�}n|S(s>Return a short representation of a user name or email address.(RRt	shortuser(RR0((s./mercurial/ui.pyR{�scCsf|id|�}|oId|jo<|id|||id|�f�|idd�}n|S(NRFs%%s((deprecated '%%' in path %s=%s from %s)
t%(RR+R^Ri(RtlocRU((s./mercurial/ui.pyt_path�s	cCsyd|jp"tiitii|d��o|Sn|i|�}|o |dj	o|i|�}n|p|S(s:Return repository location relative to cwd or from [paths]s://s.hgN(R?R@tisdirRPR~R>(RR}R`R@((s./mercurial/ui.pyt
expandpath�s/cCs|iig�dS(N(Rtappend(R((s./mercurial/ui.pyt
pushbuffer�scCsdi|ii��S(Nt(RPRtpop(R((s./mercurial/ui.pyt	popbuffer�scGsn|io9|idig}|D]}|t|�q"~�n(x$|D]}tiit|��qJWdS(Ni�(RtextendR<tsyststdouttwrite(Rtargst_[1]ta((s./mercurial/ui.pyR��s

9cGs�ygtiiptii�nx$|D]}tiit|��q(Wtiiptii�nWn/tj
o#}|iti	jo�q�nXdS(N(
R�R�tclosedtflushtstderrR�R<R8terrnotEPIPE(RR�R�RE((s./mercurial/ui.pyt	write_err�s"cCs:ytii�WnnXytii�WnnXdS(N(R�R�R�R�(R((s./mercurial/ui.pyR��scCs7|iddd�}|djotii�Sn|S(NR	tinteractive(RQR>R�tstdintisatty(Rti((s./mercurial/ui.pyR��s
R�cCs�tii�o1yddk}|iWqAtj
oqAXnt|�}tidjo&|o|ddjo|d }n|S(Ni�s
s
(	R�R�R�treadlinetread_history_filet	Exceptiont	raw_inputR?tlinesep(RRtR�tline((s./mercurial/ui.pyt	_readline�s	(tycCs�|i�p|i|d|d�|Sny*|i|d�}|p|Sn|SWn(tj
otitd���nXdS(shPrompt user with msg, read response.
        If ui is not interactive, the default is returned.
        Rfs
sresponse expectedN(R�R�R�tEOFErrorRRyR(RtmsgR`tr((s./mercurial/ui.pyRts
icCs�g}|D]$}|||id�di�q~}x_toW|i|||�}|i�|jo|i|i��Sn|itd��q;WdS(sVPrompt user with msg, read response, and ensure it matches
        one of the provided choices. The index of the choice is returned.
        choices is a sequence of acceptable responses with the format:
        ('&None', 'E&xec', 'Sym&link') Responses are case insensitive.
        If ui is not interactive, the default is returned.
        t&isunrecognized response
N(tindexRbRRtR�R(RR�tchoicesR`R�tstrespsR�((s./mercurial/ui.pytpromptchoices8
cCsb|i�p|Snyti|p
td��SWn(tj
otitd���nXdS(Ns
password: sresponse expected(R�tgetpassRR�RRy(RRtR`((s./mercurial/ui.pyR�.s
cGs|ip|i|�ndS(N(R
R�(RR�((s./mercurial/ui.pytstatus4scGs|i|�dS(N(R�(RR�((s./mercurial/ui.pyR+6scGs|io|i|�ndS(N(RR�(RR�((s./mercurial/ui.pytnote8scGs|io|i|�ndS(N(RR�(RR�((s./mercurial/ui.pyRG:scCs�tidddddt�\}}z�ti|d�}|i|�|i�|i�}ti	d||fdh|d	<d
ti
dtd��t|�}|i
�}|i�Wdti|�X|S(
Ntprefixs
hg-editor-tsuffixs.txtttexttws%s "%s"RsRptonerrt	errprefixsedit failed(ttempfiletmkstempRR?tfdopenR�tcloset	geteditorRtsystemRyRR7R9tunlink(RR�R0tfdRWR!teditortt((s./mercurial/ui.pytedit<s

cCs|ioti�n|iS(s�print exception traceback if traceback printing enabled.
        only to call in exception handler. returns true if traceback
        printed.(RRIt	print_exc(R((s./mercurial/ui.pyRIRs
cCsLtiid�p9|idd�p&tiid�ptiidd�S(sreturn editor to usetHGEDITORR	R�tVISUALtEDITORtvi(R?RsR_R(R((s./mercurial/ui.pyR�ZscCs�|djp|iodSn|od|}n|od|}n|o5d||}tid||||||f�ntid||||f�dS(slshow a progress message

        With stock hg, this is simply a debug message that is hidden
        by default, but with extensions or GUI tools it may be
        visible. 'topic' is the current operation, 'item' is a
        non-numeric marker of the current position (ie the currently
        in-process file), 'pos' is the current numeric position (ie
        revision, bytes, etc.), units is a corresponding unit label,
        and total is the highest expected pos.

        Multiple nested topics may be active at a time. All topics
        should be marked closed by setting pos to None at termination.
        NRfgY@s%s:%s %s/%s%s (%4.2g%%)
s%s:%s %s%s
(R>RR	RG(Rttopictpostitemtunitttotaltunitstpct((s./mercurial/ui.pytprogressas	N((t__name__t
__module__R>R"RR2RRRRYR[R^RRQRRRlRnRoR'R{R~R�R�R�R�R�R�R�R�RtR�R�R�R+R�RGR�RIR�R�(((s./mercurial/ui.pyR	sJ											
													(ti18nRR�R�R?RvR�R�RIRRR:RRRctobjectR	(((s./mercurial/ui.pys<module>s
T$(&

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].