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

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


�8�c@sddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
Z
ddlZddlZddlZddlZddlZddlZddlZeaejZdddfZd�Zd�Zd�Zdejfd	��YZd
�Zd�Z d�Z!d
�Z"d�Z#d�Z$d�Z%e&e'd�Z(d�Z)d�Z*de+fd��YZ,de,fd��YZ-de,fd��YZ.de,fd��YZ/ie-d6e.d6e/d6Z0dS(i�N(t_ttemptycCsUtjtj|��}tj|�}|jsQtjtjj|j��}n|S(sU
    get a path or url and if it is a path expand it and return an absolute path
    (	tutilturllocalpatht
expandpathturltschemetnormpathtostpathtabspath(R
texpandedpathtu((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_expandedabspaths
	!cCs tjt|��j�dd!S(sEget a unique filename for the store hash cache of a remote repositoryii(Rtsha1Rt	hexdigest(t
remotepath((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_getstorehashcachenamescCsSd}tjj|�r@t|d�}|j�}|j�ntj|�j�S(NRtrb(	R	R
texiststopentreadtcloseRRR(tfilenametdatatfd((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt
_calcfilehashs
tSubrepoAbortcBseZdZd�ZRS(sEException class used to avoid handling a subrepo error more than oncecOs>tjj|||�|jd�|_|jd�|_dS(Ntsubrepotcause(terrortAbortt__init__tgetRR(tselftargstkw((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR!)s(t__name__t
__module__t__doc__R!(((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR'scs�fd�}|S(Ncs�y�|||�}Wntk
r1}|�ngtjk
r�}t|�}t|�dtd�|}t|d|jd|dtj���nX|S(Nt s(in subrepo %s)thintRR(	RRR t
subrelpathtstrRR*tsystexc_info(R#R$tkargstrestexRterrormsg(tfunc(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytdecoratedmethod/s	((R3R4((R3s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytannotatesubrepoerror.s
cs�tj��dd����fd��d�krC�d�nx?�jd�D].\}}�jd||�jd|��qSWi}d�krhy�x�t�dj�j��D]{\}}|j�}|s�q�ny|j	dd�\}}Wn.t
k
r'tjt
d�|d��nX|||<q�WWqhtk
rd}|jtjkre�qeqhXn�fd�}	i}
xs�d	j�D]a\}}d
}|jd�rd|kr�tjt
d
���n|j	dd�\}}|d}|j�}ntj|�j�s�t�jdt�}|r�tj|�}tj|jpUd	|�|_tj|j�|_t|�}
|	|
�}||
kr�|	|�}q�|}q�n|	|�}|j�|j|d	�|f|
tj|�<q�W|
S(s�return a state dict, mapping subrepo paths configured in .hgsub
    to tuple: (source from .hgsub, revision from .hgsubstate, kind
    (key in types dict))
    cs�|�kr�y�|j�}WnCtk
re}|jtjkrJ�n�jtd�|�dSX�j||||��ntjtd�|��dS(Ns(warning: subrepo spec file %s not found
ssubrepo spec file %s not found(	RtIOErrorterrnotENOENTtwarnRtparseRR (tftsectionstremapRterr(tctxtpRtui(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRDss.hgsubtsubpathss.hgsubstateR)is?invalid subrepository revision specifier in .hgsubstate line %dcs�x��jd�D]�\}}|jd�}tjdd|�}ytj|||d�}Wqtjk
r�}tjtd��jd|�|f��qXqW|S(NRBs
string-escapes\\\\([0-9]+)s\\\1is#bad subrepository pattern in %s: %s(	titemstencodetretsubRRR Rtsource(tsrctpatterntreplte(R@(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR=js$Rthgt[t]smissing ] in subrepo sourcetabortN( tconfigtNonetconfigitemstsettconfigsourcet	enumerateRt
splitlinestlstriptsplitt
ValueErrorRR RR6R7R8RCt
startswithRtisabst
_abssourcet_repotFalset	posixpathtjoinR
RR,tstripR"tpconvert(R?RAR
RHtrevtitltrevisionR>R=tstatetkindtparenttjoinedtremapped((R?R@RRAs5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRg>s\
&)


2cCsQgt|�D]}d||d|f^q
}|jddj|�d�dS(s=rewrite .hgsubstate in (outer) repo with these subrepo statess%s %s
is.hgsubstateRN(tsortedtwwriteR`(trepoRgtstlines((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt
writestate�s1cs.||kr|j�}n|j}|j}|j}i}�jjd|||f�d�fd�}	x�t|j��D]�\}
}|j|
t�}|}
|j|
�j	�r�|d|ddf}
n||kr�
}n|
|krv||
}|
|ks||kr%|||
<q~q%|
|krg|	|
d|�|j|
�j||�|||
<q%|
d|dkr�jj
td�|
|d|dftd	�td
�fd�rs|	|
d|�|j|
�j||�|||
<qsq%|
d|dkrC|	|
d|�|j|
�j||�|||
<q%|	|
d
|�|j|
�j|�|||
<q~|
|kr�|	|
d�|j|
�j
�q~|tkr�|	|
d�|||
<q~q~�jj
td�|
td�td�fd�r~|	|
d�|j|
�j
�q~q~Wx�|j��D]�\}
}|
|krZq<q<|
|kr�|	|
d|�|j|
�j|�|||
<q<|||
kr<�jj
td�|
td�td�fd�dkr|	|
d|�|j|
�j|�|||
<qq<q<Wt�|�dS(s{delegated from merge.applyupdates: merging of .hgsubstate file
    in working context, merging context and ancestor contextssubrepo merge %s %s %s
Rcs4|rd|}n�jjd|||f�dS(Ns%s:%s:%ss  subrepo %s: %s %s
(RAtdebug(Rotmsgtr(Rn(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRr�s
iit+sother changed, getsU subrepository sources for %s differ
use (l)ocal source (%s) or (r)emote source (%s)?s&Locals&Remotesprompt changed, getsother side changed, getsboth sides changed, merge withsremote removed, removeslocal added, keepsW local changed subrepository %s which remote removed
use (c)hanged version or (d)elete?s&Changeds&Deletes
prompt removesremote added, getsW remote changed subrepository %s which local removed
use (c)hanged version or (d)elete?sprompt recreateN(tp1tsubstateRARrRlt	iteritemsR"t	nullstateRFtdirtytpromptchoiceRtmergetremoveRCRq(Rntwctxtmctxtactxt	overwritets1ts2tsatsmRrRoRetatldRt((Rns5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytsubmerge�s�				


		




		

		$cCsl|r(td�t|�||f}ntd�t|�||f}|j|td�td�fd�S(NsV subrepository sources for %s differ
use (l)ocal source (%s) or (r)emote source (%s)?
so subrepository sources for %s differ (in checked out version)
use (l)ocal source (%s) or (r)emote source (%s)?
s&Locals&Remotei(RR+R{(RARFRztlocaltremoteRs((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt
_updateprompt�s		cCsR|}xtj|d�r'|j}q	W|jjtj�}|jt|�dS(s9return path to this (sub)repo as seen from outermost repot
_subparenti(RtsafehasattrR�troottrstripR	tseptlen(RnRiR@((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytreporelpath�s

cCs?tj|d�r|jStj|d�s2|jSt|j�S(s7return path to this subrepo as seen from outermost repot_relpathR](RR�R�t_pathR�R](RF((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR+s
cCs~tj|d�r�tj|j�}|j�r:t|�Stj|j�|_t	|j
|dt�}|r\tjtj|��}tj
|jp�d|j�|_tj|j�|_t|�Sn�tj|d�r�jS|r|jjdd�r|jjdd�S|jjdd�r7|jjdd�S|j|jkr\tjj|j�S|rztjtd���nd	S(
s�return pull/push path of repo - either based on parent repo .hgsub info
    or on the top repo config. Abort or return None if no source found.R�RORt_subtoppathtpathssdefault-pushtdefaults(default path for subrepository not foundN(RR�Rt
_subsourceR[R,R_RR
R\R�R^RbR`R�RARPt
sharedpathR	tdirnameR R(RntpushRORGRi((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR\s*
!
ccsltj|j|�}|jtj|j|��x4t|j��D] \}}||j|�fVqDWdS(sfind subrepos in ctx1 or ctx2N(tdicttfromkeysRwtupdateRlRxRF(tctx1tctx2RBtsubpathR?((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytitersubrepos)scCs�ddl}|atj|jj�|�|j|}|dtkrhtjt	d�|d��nt|d|||d �S(s>return instance of the right subrepo class for subrepo in pathi�Nisunknown subrepo type %s(
RLtscmutiltpathauditorR]R�RwttypesRR R(R?R
thRg((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR3s
 tabstractsubrepocBs�eZd�Zed�Zd�Zd�Zd�Zd�Zed�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�ZRS(cCstS(s�
        returns true if the repository has not changed since it was last
        cloned from or pushed to a given repository.
        (R^(R#R
((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt
storecleanGscCs
t�dS(s�returns true if the dirstate of the subrepo is dirty or does not
        match current stored state. If ignoreupdate is true, only check
        whether the subrepo has uncommitted changes in its dirstate.
        N(tNotImplementedError(R#tignoreupdate((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRzNscCs
t�dS(spcurrent working directory base state, disregarding .hgsubstate
        state and working directory modificationsN(R�(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt	basestateUscCstS(s7check if path is a subrepository within this repository(R^(R#R
((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytchecknestedZscCs
t�dS(s�commit the current changes to the subrepo with the given
        log message. Use given user and date if possible. Return the
        new state of the subrepo.
        N(R�(R#ttexttusertdate((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytcommit^scCs
t�dS(sTremove the subrepo

        (should verify the dirstate is not dirty first)
        N(R�(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR}escCs
t�dS(sTrun whatever commands are needed to put the subrepo into
        this state
        N(R�(R#RgR�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR"lscCs
t�dS(s/merge currently-saved state with the new state.N(R�(R#Rg((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR|rscCs
t�dS(shperform whatever action is analogous to 'hg push'

        This may be a no-op on some systems.
        N(R�(R#topts((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�vscCsgS(N((R#RAtmatchtdryruntlistsubrepostprefixtexplicitonly((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytadd}scKsgggggggfS(N((R#trev2R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytstatus�scKsdS(N((R#RAtdiffoptstnode2R�R�R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytdiff�scCsdS(Ni((R#RAtdestR�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytoutgoing�scCsdS(Ni((R#RARGR�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytincoming�scCs
t�dS(sreturn filename iteratorN(R�(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytfiles�scCs
t�dS(sreturn file dataN(R�(R#tname((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytfiledata�scCsdS(sreturn file flagsR((R#R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt	fileflags�sc
Cs\|dk	r:g|j�D]}||�r|^q}n|j�}t|�}t|�}|jtd�|ddtd�d|�x�t|�D]�\}	}
|j|
�}d|kr�dp�d}d	|k}
|jt	j
j||j|
�||
|j
|
��|jtd�||	d
dtd�d|�q�W|jtd�|d�|S(Nsarchiving (%s)itunitR�ttotaltxi�i�Rei(RQR�R�R+tprogressRRUR�taddfileR	R
R`R�R�(R#RAtarchiverR�R�R;R�R�trelpathRdR�tflagstmodetsymlink((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytarchive�s".cCsdS(sv
        walk recursively through the directory tree, finding all files
        matched by the match function
        N((R#R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytwalk�scCs
ggfS(N((R#RAR�R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytforget�scOs#|jd|d|df�gS(Ns)%s: reverting %s subrepos is unsupported
ii(R9(R#RARwtpatsR�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytrevert�s	N(R&R'R�R^RzR�R�R�R}R"R|R�R�R�R�R�R�R�R�R�RQR�R�R�R�(((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�Es*																	t	hgsubrepocBsveZd�Zd�Zd�Zd�Zd�Zd�Zed��Z	ed��Z
ed��Zed	��Zedd
��Zeed��Zd�Zd
�Zed��Zed��Zd�Zeed��Zed��Zed��Zed��Zed��Zed��Zd�Zd�Zd�Zed��Zed��Z d�Z!RS(c
Cs
||_||_|j}|j|�}t}tjjtjj|d��sgt	}t
j|�ntj
|j|d|�|_xNdgD]C\}}|jj||�}	|	r�|jjj|||	�q�q�W|jjjddd�|j||d|�dS(	Ns.hgtcreateRAtcommitsubrepost_usedassubrepotTruei(suiR�(R�t_stateR]twjoinR^R	R
RR`R�RtmakedirsRLt
repositorytbaseuiRARPt	setconfigt	_initrepo(
R#R?R
RgRtR�R�Rotktv((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR!�s			! cCs�t}|jj�}|j|�}y:x3|j|�D]"}||j�kr7t}Pq7q7WWntk
rwt}nX|r�y|j�t}Wq�tk
r�q�Xn|j�|S(N(	R�R]tlockt_calcstorehasht_readstorehashcachetnextR^t
StopIterationtrelease(R#R
tcleanR�t	itercachetfilehash((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s$





ccs]d}dt|�VxA|D]9}tjj|jj|��}d|t|�fVqWdS(s�calculate a unique "store hash"

        This method is used to to detect when there are changes that may
        require a push to a given remote path.t	bookmarkssstore/phaserootssstore/00changelog.is# %s
s%s = %s
N(s	bookmarkssstore/phaserootssstore/00changelog.i(RR	R
RR]R`R(R#Rtfilelisttrelnametabsname((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s

cCs(|jjtjjddt|���S(s*get a unique path for the store hash cachetcachet	storehash(R]R`R	R
R(R#R((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_getstorehashcachepath�scCsN|j|�}tjj|�s%dSt|d�}|j�}|j�|S(s7read the store hash cache for a given remote repositoryRRt(R�R	R
RRt	readlinesR(R#Rt	cachefileRt	pullstate((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s
cCs�|j|�}|jj�}t|j|��}tjj|�}tjj|�smt	j
|dt�nt|d�}|j
|�|j�|j�dS(s�cache the current store hash

        Each remote repo requires its own store hash cache, because a subrepo
        store may be "clean" versus a given remote repo, but not versus another
        t
notindexedtwN(R�R]R�tlistR�R	R
R�RRR�R�Rt
writelinesRR�(R#RR�R�R�tcachedirR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_cachestorehash�s

cs�|�j_|�j_|r��jjdddt���jd���fd�}t�jdt�}t�jtdt�}|d|�||kr�|d|�n�j�ndS(	NthgrcR�R�s[paths]
cs=|r9�jd||f��jjjd||�ndS(Ns%s = %s
R�(twriteR]RAR�(tkeytvalue(tfpR#(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt
addpathconfigsROR�sdefault-push(	R]R�R�topenerR�R�R\R^R(R#t
parentrepoRGR�R�tdefpathtdefpushpath((R�R#s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�s

c	Cs4tj||j|||tjj||j�|�S(N(tcmdutilR�R]R	R
R`R�(R#RAR�R�R�R�R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�$scKs�yA|jd}|j|}|j|}|jj|||�SWnUtjk
r�}|jjjtd�|t|�f�gggggggfSXdS(Nis*warning: error "%s" in subrepository "%s"
(	R�R]R�RtRepoLookupErrorRAR9RR+(R#R�R�trev1R�R�tinst((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�)s


c	Ks�yutj|jd�}|dk	r7tj|�}ntj||j||||dtj||j	�dt
|�Wn?tjk
r�}|jj
jtd�|t|�f�nXdS(NiR�R�s*warning: error "%s" in subrepository "%s"
(tnodetbinR�RQRtdiffordiffstatR]R_R`R�R�RRRAR9RR+(	R#RAR�R�R�R�R�tnode1R((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�5scCs�|j|jd�tj|||||�}|jd}|j|}x`|jD]U}t||�}	tj||�}
||	j||t	j
j||j�|
�7}qSW|S(NRLi(shg(
t_getR�R�R�R]RwRtmatchmodt
narrowmatcherR	R
R`R�(R#RAR�R�R�R�RcR?R�Rotsubmatch((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�Es

	)cCs^|jd}|dkr$|r$tS|jd}||j�j�krT|rTtS|j�S(NiR(R�R�R]RQRvthexRz(R#R�RtR�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRzRs

cCs|jdj�S(Nt.(R]R(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�]scCs|jj|jj|��S(N(R]t_checknestedR�(R#R
((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�`scCsy|jt�s |jdj�S|jjjdt|��|jj|||�}|sl|jdj�Stj|�S(NRscommitting subrepo %s
(	RzR�R]RRARrR+R�R(R#R�R�R�tn((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�cscCs@|jjjtd�t|��tj|jtjt	�dS(Nsremoving subrepo %s
(
R]RAtnoteRR+RLR�RtnullidR^(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR}os#cCs�|\}}}||jkr�||j_t|j�}tj|ji|�}t|j�dkr|jjjtd�t	|�|f�|jj
}tj|jj
�tj|jj
ji||jjdt�\}}|j�|_|j||dt�|j|�q�|jjjtd�t	|�|f�|j|�}	|jd�}
|jj|�tj|jj|j|
|�|	r�|j|�q�ndS(Niscloning subrepo %s from %s
R�R�spulling subrepo %s from %s
R�(R]R�R\RLtpeerR�RAR�RR+R�tshutiltrmtreeR
tcloneR�R�R^R�R�R�R�R�tlistkeystpullR�tupdatefromremote(R#RgRGRfRhtsrcurltotherRtclonedtcleansubtremotebookmarks((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRvs2
cCsP|j|�|\}}}|jjjd|j�tj|j||�dS(Nsgetting subrepo %s
(RR]RARrR�RLt
updaterepo(R#RgR�RGRfRh((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR"�s
cs��j���jd��j�d��j��������fd�}�jd}�j�r���kr�t�jj�|j����r�|�q�q�|�n|�dS(NRics���kr[�j��j�kr[�jjjdt���tj�j�d�nf��kr��jjjdt���n:�jjjdt���tj�j�ddt�dS(Nsupdating subrepo %s
isskipping subrepo %s
smerging subrepo %s
tremind(	tbranchR]RARrR+RLR�R|R^((tanctcurtdstR#Rg(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt	mergefunc�s$ (RR]tancestorRQRzR�RA(R#RgR(R~((R%R&R'R#Rgs5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR|�s



$

cCsG|jd�}|jd�}|jd�}|jd}|j}x6t|�D](}|j|�j|�dkrPtSqPWt|jt�}|s�|j	|�r�|jj
jtd�t
|�|f�dSn|jj
jtd�t
|�|f�tj|ji|d6|�}	|jj|	|d|�}
|j|�|
S(	Ntforcet
new_branchtsshRis4no changes made to subrepo %s since last push to %s
spushing subrepo %s to %s
t	newbranch(R"R]RwRlRFR�R^R\R�R�RAR�RR+RQRLRR�(R#R�R*R-R,tctsubsRotdsturlRR0((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s*
		
cCs%tj||jt|jt�|�S(N(RLR�R]R\R�(R#RAR�R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��scCs%tj||jt|jt�|�S(N(RLR�R]R\R^(R#RARGR�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��scCs$|jd}|j|}|j�S(Ni(R�R]tmanifest(R#RcR?((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s

cCs"|jd}|j||j�S(Ni(R�R]R(R#R�Rc((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s
cCs'|jd}|j|}|j|�S(Ni(R�R]R�(R#R�RcR?((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s

cCs|jd}|j|�S(N(R]RQR�(R#R�R?((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s
cCs.tj||j|tjj||j�t�S(N(RR�R]R	R
R`R�R�(R#RAR�R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��scOs�|jtd�|d�|jd�s�|j�}d|d<|d|d<g}|jd�sodg}n|j|||�n|j|d	t�dS(
Nsreverting subrepo %s
it	no_backupR�iRctallsset:modified()R�(R�RR"tcopyRQt
filerevertR�(R#RARwR�R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s
cOsg|j|d}|jjj�}|jd�r>dg}ng}tj||j||||�dS(NRcR3sset:modified()(R]tdirstatetparentsR"RR�(R#RAR�R�R?R7((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR5
sN("R&R'R!R�R�R�R�R�R5R�R�R�R�RQR�R^RzR�R�R�R}RR"R|R�R�R�R�R�R�R�R�R�R5(((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s@					
	
						t
svnsubrepocBs�eZd�Zded�Zed��Zd�Zd�Zd�Z	ed�Z
d�Zed	��Z
ed
��Zeed��Zed��Zd
�Zed��Zd�ZRS(cCsh||_||_||_|jj|_tjd�|_|jsdtj	t
d�|j��ndS(Ntsvns+'svn' executable not found for subrepo '%s'(R�R�t_ctxR]RAt_uiRtfindexet_exeR R(R#R?R
Rg((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR!s				RcCs�|jg}i}|jj�sQtj|d<|ddkrQ|jd�qQn|j|�|dk	r�tj	j
|jjj
|j|�}|j|�nttj�}|jd�}|r�||d<|d=nd	|d
<tj|ddd
tjdtjdtjdtd||�}	|	j�\}
}|j�}|s�|	jrktj|pbd|	j��n|r�|jj|d�q�n|
|fS(NtstdiniR�tcheckoutR�s--non-interactivetLC_ALLtLANGtCtLC_MESSAGEStbufsizei�t	close_fdststdouttstderrtuniversal_newlinestenvsexited with code %ds
(supdatescheckoutscommit(R=R;tinteractivet
subprocesstPIPEtappendtextendRQR	R
R`R:R]torigrootR�R�tenvironR"tPopenRtclosefdsR�tcommunicateRat
returncodeR R9(R#tcommandsRtfailoktcmdtextrakwR
RItlc_allR@RFRG((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_svncommands6

$


	cCsy|jddgdd�\}}tjd|�}|sQtjtd���nt|jd��t|jd��fS(Ns	--versions--quietRs
^(\d+)\.(\d+)s cannot retrieve svn tool versionii(	RZRQREtsearchRR Rtinttgroup(R#toutputR>tm((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_svnversionBs
!cCs�|jddg�\}}tjjj|�}|jd�}d\}}|r�t|djd��pmd}|djd�}|r�t|djd��p�d}q�n||fS(	Ntinfos--xmltentryt0iRfR�(RcRc(RZtxmltdomtminidomtparseStringtgetElementsByTagNameR,tgetAttribute(R#R^R>tdoctentriestlastrevRctcommits((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_wcrevsJs%cCs|j�dS(Ni(Rn(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_wcrevYsc
Cs~|jddg�\}}ggg}}}tjjj|�}x�|jd�D]�}|jd�}|suqTn|djd�}	|djd�}
|jd�}|	d	kr�|j|�n|	d
kr�j|�n|	dks�dkrT|j|�qTqTWxT|D]L}xC|D];}||ksJ|j|t	j
�r"ttt|�fSq"WqWt|�t
t|�fS(s�Return (changes, extchanges, missing) where changes is True
        if the working directory was changed, extchanges is
        True if any of these changes concern an external entry and missing
        is True if any change is a missing entry.
        R�s--xmlRbs	wc-statusititemtpropsR
texternaltmissingRtnormaltunversionedtnone(RRtRuRr(RRvRt(RZRdReRfRgRhRiRMRZR	R�R�tboolR^(
R#R^R>t	externalstchangesRsRjRKRoRpRqR
text((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt
_wcchanged\s,

"cCs:|j�ds6|jd|j�ks/|r6tSntS(Nii(R{R�RnR^R�(R#R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRzyscCsh|j�\}}||krdy,|jdd|jd|fg�|SWqdtjk
r`qdXn|S(NR�s%s@%si(RnRZR�RR (R#RlRc((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�s$c
Cs!|j�\}}}|s%|j�S|rCtjtd���n|ratjtd���n|jdd|g�\}}|jj|�tj	d|�}	|	s�j
�s�tjtd���ntj|j�d��n|	j�d}	|jj|jd	d
|	g�d�|	S(Nscannot commit svn externalss!cannot commit missing svn entriesR�s-msCommitted revision ([0-9]+).sfailed to commit svn changesi�iR�s-r(
R{R�RR RRZR;R�RER[RaRVtgroups(
R#R�R�R�tchangedt
extchangedRst
commitinfoR>tnewrev((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s"
&cCs�|j�r-|jjtd|j��dS|jjtd�|j�d�}|jjj|j�}t	j
|d|�ytjtj
j|��Wntk
r�nXdS(Ns-not removing repo %s because it has changes.
sremoving subrepo %s
cSst|tjk	r�ntj|�}|jtj@dkr@�ntj|tj|j�tjB�tj|�dS(Ni(R	R}tstattst_modetS_IWRITEtchmodtS_IMODE(tfunctionR
texcinfoRo((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytonerror�s#R�(RzR;R9RR�RR:R]R�RRR	t
removedirsR
R�tOSError(R#R�R
((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR}�s	

cCs|r|jddg�ndg}|jdkrD|jd�n|jd|d|df�|j|d	t�\}}tjd
|�s�|kr�|j�d ttfkr�|j�|j	|d
t�dSt
j|p�j�d��n|j
j|�dS(NR�s--recursiveR?iis--forces%s@%siRVsChecked out revision [0-9]+.s-is already a working copy for a different URLiR�i�(ii(RZR`RMR�RER[R{R^R}R"RR RVR;R�(R#RgR�R$R�R>((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR"�s	
"cCs�|jd}|d}|j�}||kr|||kpH|j�d}t|j||||�r||j|t�q|ndS(Nii(R�RoR{R�R;R"R^(R#RgtoldtnewtwcrevRz((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR|�s

cCstS(N(R�(R#R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��scCs�|jdddg�d}tjjj|�}g}x}|jd�D]l}t|jd��}|dkrtqGndjd	�|jd
�dj	D��}|j
|jd��qGW|S(NR�s--recursives--xmliRbRhtfileRcss*|] }|j|jkr|jVqdS(N(tnodeTypet	TEXT_NODER(t.0R.((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pys	<genexpr>�sR�sutf-8(RZRdReRfRgRhR,RiR`t
childNodesRMRD(R#R^RjR�RKRhR�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��scCs|jdg|�dS(Ntcati(RZ(R#R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s(R&R'R!R^RZt
propertycacheR`RnRoR{RzR�R5R�R}R"R|R�R�R�(((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR8s 	
$				
	t
gitsubrepocBs:eZd�Zd�Zded�Zded�Zdedd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zeed��Zd�Zeed��Zed��Zed��Zed��Zed��Zdd�Zed��ZRS(cCsz||_||_||_tjjt|j�|�|_|jj	|�|_
|j|_|jj|_
|j�dS(N(R�R:R�R	R
R`R�R]R�R�t_abspathR�RAR;t
_ensuregit(R#R?R
Rg((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR!�s			!cCs/y%d|_|jdg�\}}WnXtk
r}|jdksUtjdkr[�nd|_|jdg�\}}nXtjd|�}|s�|jj	t
d��dSt|jd��|jd�|jd	�f}|dkrt
jt
d���n%|dkr+|jj	t
d��ndS(Ntgits	--versionitntsgit.cmds ^git version (\d+)\.(\d+)\.(\d+)scannot retrieve git versioniiiis,git subrepo requires at least 1.6.0 or lateri(iii(iii(t_gitexecutablet	_gitnodirR�R7R	R�RER[R;R9RR\R]RR (R#toutR>RKR_tversion((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�s"		0cCs|j|d|d|�dS(NRItstreami(t_gitdir(R#RURIR�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_gitcommandscCs"|j|d|d|d|j�S(NRIR�tcwd(R�R�(R#RURIR�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�sc	Cs5|jjd|jdj|�f�d}|jjrMttjd�}nt	j
|jg|ddd|d|dtj
d	t	jd
|�}|r�|jdfS|jj�j�}|j�|jdkr(|jdkr(|d}|dkr||jfStjd||j|jf��n||jfS(s�Calls the git command

        The methods tries to call the git command. versions prior to 1.6.0
        are not supported and very probably fail.
        s%s: git %s
R)R�RDi�R�RIRERFRGiiscat-filessymbolic-refsgit %s error %d in %sN(scat-filessymbolic-ref(R;RrR�R`RQtquietRR	tdevnullRKRQR�RRRRLRFRRatwaitRTR (	R#RURIR�R�terrpipeR@tretdatatcommand((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR� s$&



	cCs#tjjtjj|jd��S(Ns.git(R	R
RR`R�(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_gitmissingAscCs|jddg�S(Ns	rev-parsetHEAD(R�(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt	_gitstateDscCs1|jdddg�\}}|r-d}n|S(Nssymbolic-refR�s--quiet(R�RQ(R#tcurrentR>((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_gitcurrentbranchGs	cCsO|jddd|g�}|jd�d}|jd�td�}||S(NR�tshows-ns
isURL: (R�RXtindexR�(R#R�R�tlineRd((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt
_gitremoteMscCs(|jdd|g�\}}|dkS(Nscat-files-ei(R�(R#RfR�tcode((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_githavelocallySscCs"|jd||g�}||kS(Ns
merge-base(R�(R#tr1tr2tbase((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_gitisancestorWscCs|jdddg�dkS(NRPs--bools	core.barettrue(R�(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt
_gitisbare[scCs|jdddg�dS(s�This must be run before git diff-index.
        diff-index only looks at changes to file stat;
        this command looks at file contents and updates the stat.supdate-indexs-qs	--refreshN(R�(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_gitupdatestat^scCs�i}i}|jdddg�}x�|jd�D]�}|jd�\}}|jd�ru|jd�ruq4n|jd�r�|jd�r�q4n|||<|j|g�j|�q4W||fS(	screturns 2 things:
        a map from git branch to revision
        a map from revision to branchessfor-each-refs--formats%(objectname) %(refname)s
R)srefs/heads/s
refs/remotes/s/HEAD(R�RXRZtendswitht
setdefaultRM(R#t
branch2revt
rev2branchR�R�Rftref((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt
_gitbranchmapds
cCs�i}x�|D]�}|jd�r(q
n|jdd�d}|jdd|g�}|r
|jdd|g�}||d||jdd�df<q
q
W|S(s4return map of remote branch to local tracking branchs
refs/remotes/t/iRPsbranch.%s.remotesbranch.%s.mergesrefs/remotes/%s/%s(RZRXR�(R#tbranchesttrackingtbtbnameR�R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_gittrackingxs
+cCsQd|kr>|jd�}|dkr>d|| kr>|Sn||_t|�S(Ns://t:i�R�(tfindR�R\(R#RGtcolon((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR\�s	cCs�|j�rZ|j|�}|jjtd�|j|f�|jd||jg�n|j|�rmdS|jjtd�|j|j	d�f�|j
dg�|j|�s�tjtd�||jf��ndS(Nscloning subrepo %s from %s
Rspulling subrepo %s from %s
torigintfetchs)revision %s does not exist in subrepo %s
(
R�R\R;R�RR�R�R�R�R�R�RR (R#RGRf((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_fetch�scCs�|j�r|jddkS|j�r-tS|rQ|jd|j�krQtS|j�|jdddg�\}}|dkS(NiRs
diff-indexs--quietR�(R�R�R�R�R�R�R�(R#R�R�R�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRz�s 
cCs
|j�S(N(R�(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��scs�|\}�}�s#�j�dS�j|���j�r��jdddg��j��kr��jdddg�dSnH�j��kr��r��jddg��jdddg�ndS�j�\}}��fd�����fd�}�|kr|�dS|�}d}	xK|D]C}
|
d	krV�d	g�dS|	r3|
jd
�r3|
}	q3q3W|	r��|	g�dS�j|j	��}|d}||kr�'|D]}
|
|kr�|
}Pq�q�Wn||kr|j
dd
�d
}
�d|
|g�nd�j||||�r{||�j�krb�||g�n�jdd|g�n|�dS(NRPs	core.baretfalsetresets--hardR�csGdg}�r2�jddg�|jd�n�j||�dS(NR?R�R�s-f(R�RM(R$RW(R�R#(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR?�s
	csG�jjtd��j��jjtd���d�g�dS(Ns)checking out detached HEAD in subrepo %s
s5check out a git branch if you intend to make changes
s-q(R;R9RR�((R?RfR#(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytrawcheckout�ssrefs/heads/masters
refs/remotes/iR�is-bR|s--ff(
R}R�R�R�R�R�RQRZR�tkeysRXR�R�(R#RgR�RGRhR�R�R�R�tfirstlocalbranchR�R�R�R�((R?R�RfR#s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR"�s^








cCs�|j�r+tjtd�|j��nddd|g}tjj�}|re|d|g7}n|r�tj|d�|d<n|j	|d|�|j
�S(	Nssubrepo %s is missingR�s-as-ms--authors%Y-%m-%dT%H:%M:%S %1%2tGIT_AUTHOR_DATERI(R�RR RR�R	RPR4tdatestrR�R�(R#R�R�R�RWRI((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�s	cs�\}�}�j|���jd��jdg���j��jdddg�\}}����fd�}�j�r�j��kr�j��jdkp�|dk}t�j�|�jdd �d �r��q�n|�dS(	Ns
merge-baseis
diff-indexs--quietR�csL��kr�j��n,��jdkrH�jdd�g�ndS(NiR|s--no-commit(R"R�R�((R�RfR#Rg(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR(sii(	R�R�R�R�R�RzR�R�R;(R#RgRGRhR�R�R(Rz((R�RfR#Rgs5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR|s
%c	Cs�|jd�}|jds tS|j�rKtjtd�|j��n|j�\}}|jd|kr�x/||jdD]}|j	d�r�tSq�WnxI|j
�D];\}}|j	d�r�|j|jd|�r�Sq�q�Wdg}|r
|jd�n|j
�}|r�|j|jd|�sY|jjtd�|j�tS|jjtd�|jd	d
�d
|jf�|j|d|g�tS|jjtd�|j|jdf�tSdS(
NR*issubrepo %s is missingsrefs/remotes/origin/R�s--forces/unrelated git branch checked out in subrepo %s
s pushing branch %s of subrepo %s
R�iR�s<no branch checked out in subrepo %s
cannot push revision %s
(R"R�R�R�RR RR�R�RZRxR�RMR�R;R9R^R�RXR�(	R#R�R*R�R�R�RfRWR�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�.s<
	!cCs�|j�rdS|j�r=|jjtd�|j�dS|jjtd�|j�|jdddg�x�tj	|j
�D]r}|dkr�q�ntjj|j
|�}tjj
|�r�jj|�r�j|�q�tj|�q�WdS(Ns-not removing repo %s because it has changes.
sremoving subrepo %s
RPs	core.bareR�s.git(R�RzR;R9RR�RR�R	tlistdirR�R
R`tisdirtislinkRRR}(R#R;R
((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR}Vs%cCs�d}|j\}}|s|S|j||�|jd|gdt�}tjd|dd�}	t|�}
|jtd�|
ddtd	��x�	|	�D]�\}}|j
�r�q�n|r�||j�r�q�n|j�r�j
}
n|	j|�j�}
|jtjj||j|j�|j|j�|
�|d
7}|jtd�|
|d
dtd	��q�W|jtd�|
d�|S(NiR�R�tfileobjR�sr|sarchiving (%s)R�R�i(R�R�R�R�ttarfileRR+R�RRUR�R�tissymtlinknametextractfileRR�R	R
R`R�R�RQ(R#RAR�R�R�R�RGRft	tarstreamttarR�RdRaR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR�ks0&!
cKsa|jd}|j�s |r9gggggggfSggg}}}|j�|rod||g}nd|g}|j|�}x�|jd�D]�}	|	jd�}
|
dkr�q�n|	|
d|	|
d}}|dkr�j|�q�|dkr|j|�q�|d	kr�|j|�q�q�Wg}
}}}||||
|||fS(
Nis	diff-trees
diff-indexs
s	i�tMtAtD(R�R�R�R�RXR�RM(R#R�R�RtmodifiedtaddedtremovedR�R�R�ttabR�R;tdeletedtunknowntignoredR�((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s,

N(R&R'R!R�RQR^R�R�R�R�R�R�R�R�R�R�R�R�R�R\R�R5RzR�R"R�R|R�R}R�R�(((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR��s8	
	!													
	S( RLR9R�(1R7R	REtxml.dom.minidomRdRR_R-R�RKR�ti18nRRPR�RRRRR�R�R
RQRLR�RyRRRR RR5RgRqR�R�R�R+R^R�R\R�RtobjectR�R�R8R�R�(((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt<module>s<T$`		
				Z		U				
	v���

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.