Your IP : 216.73.216.85


Current Path : /opt/alt/python27/lib/python2.7/site-packages/py/_path/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyc

�
%q�]c@s�dZddlZddlZddlZddlZddlZddlmZmZddlm	Z	ddlm
Zddlm
Z
mZeZdejfd��YZd	fd
��YZd�Zdfd
��YZdS(s�
module defining a subversion path object based on the external
command 'svn'. This modules aims to work with svn 1.3 and higher
but might also interact well with earlier versions.
i����N(tpathtprocess(tcommon(tsvnwc(tBuildcostAccessCachet
AgingCachetSvnCommandPathcBs.eZdZedd�Zedddd�Zd#d#d�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zdd�Zd�Zd�Zdd�Zdd�Zddd�Zd�Zd�Zd�Zd�Zd�Zd �Zd#d#d!�Zd#ded"�Z RS($sZ path implementation that offers access to (possibly remote) subversion
    repositories. t
maxentriesi�i�t
maxsecondsgN@cCswtj|�}t||�r<|j}|j}|j}ntj|�|jd�}||_||_||_|S(Nt/(	tobjectt__new__t
isinstancetrevtauthtstrpatht	svncommont
checkbadcharstrstrip(tclsRR
Rtself((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyRs		
			cCs2|jdkrd|jSd|j|jfSdS(Ni����s
svnurl(%r)ssvnurl(%r, %r)(R
R(R((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyt__repr__$scGsL|jdkr|j||�Sd|jgt|�}|j||�SdS(s9 execute an svn command, append our own url and revision s-rN(R
tNonet	_svnwritetlist(Rtcmdtargs((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyt_svnwithrev*scGs�d|g}g|D]}d|j|�^q}|j|�|jd|j��dj|�}trxd|GHn|j|�}|S(s, execute an svn command, append our own url ssvn %ss"%s"t s
execing %s(t_escapetextendtappendt_encodedurltjointDEBUGt_svncmdexecauth(RRRtltitemtstringtout((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyR2s
&
cCsFtj�|}|jdk	r9|d|jj�7}n|j|�S(s  execute an svn command 'as is' RN(Rt	fixlocaleRRtmakecmdoptionst_cmdexec(RR((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyR#?scCs�ytj|�}Wnrtjjjk
r�tj�d}|jjd�dksl|jjd�dkr�tjj	|��n�nX|S(NisFile Existsi����sFile already exists(
RtcmdexectpytErrortsystexc_infoterrtfindterrortEEXIST(RRR'te((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyR*FscCsFtj�|}|jdk	r9|d|jj�7}n|j|�S(s9 execute an svn command, return a pipe for reading stdin RN(RR(RRR)t_popen(RR((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyt
_svnpopenauthQscCs
tj|�S(N(tostpopen(RR((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyR5XscCs|j|j�S(N(RR(R((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyR [scCs>|jr|jj�pd}|jjt|�|f�dS(N(RR)Rt
_lsnorevcachetdelentrytstr(RRR((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyt_norev_delentry^strcCs�|d	kr"td|f��n|jdd�s:t�|jdkri|jd|j|j�f�S|jd|j|j|j�f�SdS(
s, return an opened file with the given mode. R=trUsmode %r not supportedtfileissvn cat "%s"ssvn cat -r %s "%s"N(R=R>(t
ValueErrortchecktAssertionErrorR
RR6RR(Rtmode((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pytopenbs		cOs�|jj|j�}t|�dkr?tjj|d��n>t|�dkra|j||�S|jdd�j||�SdS(si return the directory path of the current path joined
            with any given path arguments.
        isbase is not validtbasenametN(	RtsplittseptlenR,R2tEINVALR!tnew(RRtkwargsR$((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pytdirpathnscOsK|jdd�}|j|�}|jdd|�|j|j��|S(sz create & return the directory joined with args.
        pass a 'msg' keyword argument to set the commit message.
        tmsgsmkdir by py lib invocationtmkdirs-m(tgetR!RR<RM(RRRLt
commit_msgt
createpath((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyRO{s
scopied by py lib invocationcCsst|dd�dk	r0tjj|d��n|jd||j|�|j|�f�|j|j��dS(s. copy path to target with checkin message msg.R
srevisions are immutablessvn copy -m "%s" "%s" "%s"N(	tgetattrRR,R2RJR#RR<RM(RttargetRN((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pytcopy�s
 srenamed by py lib invocationcCs�t|dd�dk	r0tjj|d��n|jd||j|�|j|�f�|j|j��|j|�dS(s6 rename this path to target with checkin message msg. R
srevisions are immutables"svn move -m "%s" --force "%s" "%s"N(	RSRR,R2RJR#RR<RM(RRTRN((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pytrename�s	#isremoved by py lib invocationcCs^|jdk	r'tjj|d��n|jd||j|�f�|j|j��dS(sT remove a file or directory (or a directory tree if rec=1) with
checkin message msg.srevisions are immutablessvn rm -m "%s" "%s"N(	R
RR,R2RJR#RR<RM(RtrecRN((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pytremove�s cCs�tjj|�}d|j|�fd|j|�fg}|jdk	ridt|j�g|}n|jddj|�f�|S(s� export to a local path

            topath should not exist prior to calling this, returns a
            py.path.local instance
        s"%s"s-rs
svn export %sRN(	R,RtlocalRR
RR;R#R!(RttopathR((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pytexport�sc
Os�t|dd
�d
k	r0tjj|d��n|j|�}|jdd�}x?|jdt�D]}|j	�rdPqdqdWtjj
|d��||kr�|j	d|�s�|r�tjj|�p�tjj|��n|S|j
|�}|j|jd�d}tjjj�}zr|j|d|�dd	|j|�|j|j|��|j|�j�f}	|j|	�|j|�Wd
|j�X|S(s� ensure that an args-joined path exists (by default as
            a file). If you specify a keyword argument 'dir=True'
            then the path is forced to be a directory path.
        R
srevisions are immutabletdiritreverseshas not any valid base!issvn import -m "%s" "%s" "%s"s	ensure %sN(RSRR,R2RJR!RPtpartstTrueRAtENOENTtENOTDIRtEISDIRtreltoRGRHRRYtmkdtemptensureRR R#R<RX(
RRRLRTR\txttocreateREttempdirR((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyRe�s2-
cCs|jd|�}|d S(Ntpropgeti����(R(Rtnametres((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyt_propget�scCsQ|jd�}|jd�}g|dD]}|j�^q)}tj||�S(Ntproplists
i(RRGtstripRtPropListDict(RRktlinesRf((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyt	_proplist�s#cCs^|j�}|j�}|j}x$|D]\}}||kr(|Sq(Wtjj|��dS(s9 return an Info structure with svn-provided information. N(RMt_listdir_nameinfoRER,R2R`(Rtparenttnameinfo_seqtbnRjtinfo((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyRv�s	cs~�fd�}�jr'�jj�p*d}�jdk	r^�jj�j�j|f|�S�jj�j|f|�SdS(s8 return sequence of name-info directory entries of self cs�y�jdd�}Wnttjjk
r�tj�d}|jjd�dkrotj	j
�|j��n|jjd�dkr�tj	j
�|j��n�|jjd�dkr�tj	j
�|j��n�|jjd�dkrtj	j
�|j��nl|jjd	�dkr;tj	j
�|j��n9|jj�jd
�dkrttj	j�|j��ntj	j|j��nX|j
d�}g}xK|D]C}|r�t|�}|jdkr�|j|j|f�q�q�q�W|j�|S(
Ntlss-visnon-existent in that revisioni����sE200009:sFile not foundsnot part of a repositorysUnable to opensmethod not alloweds
t.(RRR+R-R.R/R0R1R,R2R`tlowertEACCESRGtInfoSvnCommandt_nameRtsort(RkR4RpRttlslineRv(R(s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pytbuilder�s4
 
N(RR)RR
t_lsrevcachet
getorbuildRR9(RRR((Rs@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyRr�scCs�t|t�r!tj|�}n|j�}t|�dkr�|d\}}||jkr�|jdkr�tj	j
|��q�ng|D]\}}|j|�^q�}|r�g|D]}||�r�|^q�}n|j||�|S(si list directory contents, possibly filter by the given fil func
            and possibly sorted.
        iiR?(
RR;Rt	FNMatcherRrRIREtkindR,R2RaR!t	_sortlist(RtfilR}RtRjRvtpathsRf((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pytlistdirs((cCs|j�st�|d	kr$dp'|}|d	kr<dp?|}|dkrc|dkrcd}nd||f}|rdp�d}|jd|||jf�}ddlm}|j|�}g}	xHtd	|j	j
�D]1}
|
j|
jkr�|	j
tj|
��q�q�W|	S(
s� return a list of LogEntry instances for this path.
rev_start is the starting revision (defaulting to the first one).
rev_end is the last revision (defaulting to HEAD).
if verbose is True, then the LogEntry instances also know which files changed.
tHEADiRFs-r %s:%ss-vssvn log --xml %s %s "%s"i����(tminidomN(RARBRR6Rtxml.domR�tparsetfiltert
firstChildt
childNodestnodeTypetELEMENT_NODERRtLogEntry(Rt	rev_starttrev_endtverbosetrev_opttverbose_opttxmlpipeR�ttreetresulttlogentry((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pytlogs 		N(!t__name__t
__module__t__doc__RR�RR9RRRRRR#R*R6R5R R<RDRMRORURVRXR[ReRlRqRvRrR�tFalseR�(((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyRs6
			
							
	
			"				%R{cBs)eZejd�Zd�Zd�ZRS(sc^ *(?P<rev>\d+) +(?P<author>.+?) +(0? *(?P<size>\d+))? *(?P<date>\w+ +\d{2} +[\d:]+) +(?P<file>.*)$cCs�|jj|�}|j�}|d|_|jddkrZ|jd |_d|_n	d|_t|d�|_|d|_|dr�t|d�p�d|_t	|d	�|_
|j
d
|_dS(NR?i����R	R\R
tauthortsizeitdatei@B(t	lspatterntmatcht	groupdictR|R�tinttcreated_revtlast_authorR�tparse_time_with_missing_yeartmtimettime(RtlineR�tdata((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyt__init__?s
	
#cCs|j|jkS(N(t__dict__(Rtother((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyt__eq__Qs(R�R�tretcompileR�R�R�(((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyR{9s		c	CsRddl}tj�}|j�}tj|jd�d�d}tj|jd�d�d}|jd�}y<d|kr�t��ntj|d	�d}d}}	Wnttk
r#tj|d
�dd!\}}	|d}|||||	ddddf	}
|
|kr$|d8}q$nX|||||	ddddf	}
|j|
�S(
s� analyze the time part from a single line of "svn ls -v"
    the svn output doesn't show the year makes the 'timestr'
    ambigous.
    i����Nis%bis%dit:s%Ys%H:%Mii(tcalendarR�tgmtimeRGtstrptimetpopR@ttimegm(ttimestrR�tt_nowttpartstmonthtdaytlasttyearthourtminutett_result((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyR�Ys&

!!t	PathEntrycBseZd�ZRS(cCs�|jjjd�|_|jd�jd�|_|jdkr�|jd�jd�|_|jr�t|jd��|_q�ndS(NsUTF-8tactiontAs
copyfrom-pathscopyfrom-rev(	R�t	nodeValuetencodeRtgetAttributeR�t
copyfrom_pathR�tcopyfrom_rev(Rtppart((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyR�us	(R�R�R�(((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyR�ts(R�R7R.R�R�R,RRtpy._pathRRRtpy._path.cacheutilRRR�R"tSvnPathBaseRR{R�R�(((s@/opt/alt/python27/lib/python2.7/site-packages/py/_path/svnurl.pyt<module>s0�*