Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/mercurial/extensions.pyc

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


��c@s�ddlZddlZddlZddlZddlZddlmZmZiZgZ	ddddgZ
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zed�Zd�Zd�Zd�Zd�Zed�Zd�ZdS(i�N(t_tgettextthbisectt	bookmarkst
parentrevspectinterhgccs3x,tD]$}t|}|r||fVqqWdS(N(t_ordert_extensions(tnametmodule((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pyt
extensionss

cCs�d}yt|}Wn^tk
rtxNtj�D]<\}}|jd|�sc|jd|�r1|}Pq1q1WnX|s�t|��n|S(s'return module with given extension namet.t/N(tNoneRtKeyErrort	iteritemstendswith(Rtmodtktv((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pytfinds
&cCs�|jdd�}tj|�}tjj|�r�tjj|jd��\}}tj	||g�\}}}tj
||||�Sytj||�SWn+tk
r�}|j
s�||_
n�nXdS(NRRR(treplacetutilt
expandpathtostpathtisdirtsplittrstriptimptfind_moduletload_moduletload_sourcetIOErrortfilename(Rtmodule_nametdtftfdtfpathtdesctexc((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pytloadpath$s!	cCs�|jd�s|jd�r+|d}n|}|tkrAdS|tkrUt|Sdt|<|r{t|d|�}nYd�}y|d|�}Wn9tk
r�}|jd|||f�||�}nX|t|<tj|�|S(Nshgext.shgext/ishgext.%scSsCt|�}|jd�}x!|dD]}t||�}q&W|S(NRi(t
__import__Rtgetattr(RRt
componentstcomp((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pytimporthDs
s*could not import hgext.%s (%s): trying %s
(	t
startswitht_ignoreR
RR*tImportErrortdebugRtappend(tuiRRt	shortnameRR/terr((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pytload4s(

		

cCs�|jd�}tt�}x�|D]�\}}|rM|ddkrMq"qMnyt|||�Wq"tk
rw�q"tk
r�}|r�|jtd�|||f�n|jtd�||f�|j�r�Sq"Xq"Wx;t|D]/}t	t
|dd�}|r�|�q��xrt|D]f}t	t
|dd�}|r-y||�Wq�tk
r�|j
jdkr��n|�q�Xq-q-WdS(	NR
it!s.*** failed to import extension %s from %s: %s
s&*** failed to import extension %s: %s
ituisetuptextsetup(tconfigitemstlenRR8tKeyboardInterruptt	ExceptiontwarnRt	tracebackR,RR
t	TypeErrort	func_codetco_argcount(R5tresulttnewindexRRtinstR:R;((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pytloadallTs>	

c
s�tj�d�st�tj||�\}}x0|j�D]"\}}||kr=|}Pq=q=W|d���fd�}t�d�|_t�d�|_t	|�}	||	d<t
|	�||<|S(s~Wrap the command named `command' in table

    Replace command in the command table with wrapper. The wrapped command will
    be inserted into the command table specified by the table argument.

    The wrapper will be called like

      wrapper(orig, *args, **kwargs)

    where orig is the original (wrapped) function, and *args, **kwargs
    are the arguments passed to it.
    t__call__ics"tj��tj��||�S(N(Rtchecksignature(targstkwargs(torigfntwrapper(s8/sys/lib/python2.7/site-packages/mercurial/extensions.pytwrap�st__doc__t
__module__(RtsafehasattrtAssertionErrortcmdutiltfindcmdRR,RPRQtlistttuple(
ttabletcommandRNtaliasestentrytaliastetkeyROtnewentry((RMRNs8/sys/lib/python2.7/site-packages/mercurial/extensions.pytwrapcommandxs


csetj�d�st���fd�}t||��tj�d�sQt�t|||��S(s�Wrap the function named funcname in container

    Replace the funcname member in the given container with the specified
    wrapper. The container is typically a module, class, or instance.

    The wrapper will be called like

      wrapper(orig, *args, **kwargs)

    where orig is the original (wrapped) function, and *args, **kwargs
    are the arguments passed to it.

    Wrapping methods of the repository object is not recommended since
    it conflicts with extensions that extend the repository by
    subclassing. All extensions that need to extend methods of
    localrepository should use this subclassing trick: namely,
    reposetup() should look like

      def reposetup(ui, repo):
          class myrepo(repo.__class__):
              def whatever(self, *args, **kwargs):
                  [...extension stuff...]
                  super(myrepo, self).whatever(*args, **kwargs)
                  [...extension stuff...]

          repo.__class__ = myrepo

    In general, combining wrapfunction() with subclassing does not
    work. Since you cannot control what other extensions are loaded by
    your end users, you should play nicely with others by using the
    subclass trick.
    RIcs��||�S(N((RKRL(RMRN(s8/sys/lib/python2.7/site-packages/mercurial/extensions.pyRO�s(RRRRSR,tsetattr(t	containertfuncnameRNRO((RMRNs8/sys/lib/python2.7/site-packages/mercurial/extensions.pytwrapfunction�s!cCs2ddl}tjjtjj|j��}ytj|�}Wntk
rTiSXi}x�|D]�}|jd�r�|j	dd�d}tjj
||�}nQ|}tjj
||d�}tjj|�s�qbn|r�jj|�}n||ksb|tksb|dkr qbn|||<qbW|S(	s~find paths of disabled extensions. returns a dict of {name: path}
    removes /__init__.py from packages if strip_init is Truei�Ns.pyRiis__init__.pyt__init__(
thgextRRtdirnametabspatht__file__tlistdirtOSErrorRtrsplittjointexistsR(t
strip_initRftextpathtfilestextsR]RR((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pyt_disabledpaths�s*!

$cCs�g}|j�}x7|d dks2|j�rK|j�}|sPqqW|d }|dksn|dkr�d}xv|r�j�j|�r�|j|�d}|r�|j|�nPn
|s�dS|j|�|j�}q{WndSdj|�S(	s�return the top-level python documentation for the given file

    Loosely inspired by pydoc.source_synopsis(), but rewritten to
    handle triple quotes and to return the whole text instead of just
    the synopsisit#is"""s'''itN(treadlinetstripRRRR4R
Rm(tfileREtlinetstart((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pyt
_moduledoc�s* 

	
cCscyt|�}Wntk
r$dSXt|�}|j�|rUt|�j�dStd�SdS(sBretrieve help synopsis of a disabled extension (without importing)Nis(no help text available)(topenR!R{tcloseRt
splitlinesR(RRxtdoc((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pyt
_disabledhelp�s

cCs�y1ddlm}td�|jj�D��SWntk
rDnXt�}|sXiSi}x9|j�D]+\}}t|�}|rk|||<qkqkW|S(sCfind disabled extensions from hgext. returns a dict of {name: desc}i�(t	__index__css3|])\}}|tkr|t|�fVqdS(N(RR(t.0RR(((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pys	<genexpr>s	(RfR�tdicttdocsRR2RsR�(R�tpathsRrRRR((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pytdisabled
s	
	cCsuy:ddlm}|tkr#dSt|jj|��SWntk
rMnXt�}||krqt||�SdS(s;find a specific disabled extension from hgext. returns desci�(R�N(	RfR�RRR�tgetR2RsR�(RR�R�((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pytdisabledext#s
	cs�tdt�}|s'tj|��n��fd�}d}|j|d�}|rl||||�}n|s�x9|j�D](\}}||||�}|rPqqWn|r�d|jkr�|Stj|��dS(sUimport disabled extensions until cmd is found.
    returns (cmdname, extname, module)Rocs�yt|d|�}Wntk
r+dSXy+tj|t|di���\}}WnPtjtjfk
rwdStk
r��jt	d�|��j
�dSXx1|D]}|j|�r�|}Pq�q�W|d}|||fS(Nshgext.%stcmdtables&warning: error finding commands in %s
i(R*R?RTRUR,terrortAmbiguousCommandtUnknownCommandR@RRAR0(tcmdRRRRZR[tc(tstrictR5(s8/sys/lib/python2.7/site-packages/mercurial/extensions.pyRU:s&
	"



t
DEPRECATEDN(RstTrueR�R�R
tpopRRP(R5R�R�R�RUtextRR((R�R5s8/sys/lib/python2.7/site-packages/mercurial/extensions.pytdisabledcmd2s cCsli}x_t�D]T\}}t|j�p4td�}|jd�d}|j�dj�||<qW|S(s+return a dict of {name: desc} of extensionss(no help text available)Ri�i(R
RRPRRR~Rw(RrtenameR�R((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pytenabled`s(RRRRTR�ti18nRRRRR1R
RR*R8RHR`RdtFalseRsR{R�R�R�R�R�(((s8/sys/lib/python2.7/site-packages/mercurial/extensions.pyt<module>s&$				 	$	!	*	 			.

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].