Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/py/_path/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/py/_path/__pycache__/svnurl.cpython-37.pyc

B

���]�:�@s�dZddlZddlZddlZddlZddlZddlmZmZddlm	Z	ddlm
Zddlm
Z
mZdZGdd	�d	ej�ZGd
d�d�Zdd
�ZGdd�d�ZdS)z�
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.
�N)�path�process)�common)�svnwc)�BuildcostAccessCache�
AgingCacheFc@s�eZdZdZedd�Zeddd�Zd>dd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd?dd�Zdd �Zd!d"�Zd@d$d%�ZdAd'd(�ZdBd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�ZdCd9d:�ZdDd<d=�ZdS)E�SvnCommandPathzZ path implementation that offers access to (possibly remote) subversion
    repositories. �)�
maxentriesi�gN@)r
Z
maxsecondsNcCsPt�|�}t||�r&|j}|j}|j}t�|�|�d�}||_||_||_|S)N�/)	�object�__new__�
isinstance�rev�auth�strpath�	svncommonZ
checkbadchars�rstrip)�clsrrr�self�r�@/opt/alt/python37/lib/python3.7/site-packages/py/_path/svnurl.pyr
s



zSvnCommandPath.__new__cCs(|jdkrd|jSd|j|jfSdS)N���z
svnurl(%r)zsvnurl(%r, %r))rr)rrrr�__repr__$s

zSvnCommandPath.__repr__cGs@|jdkr|j|f|��Sd|jgt|�}|j|f|��SdS)z9 execute an svn command, append our own url and revision Nz-r)r�	_svnwrite�list)r�cmd�argsrrr�_svnwithrev*s
zSvnCommandPath._svnwithrevcs`d|g}�fdd�|D�}|�|�|�d����d�|�}trRtd|���|�}|S)z, execute an svn command, append our own url zsvn %scsg|]}d��|��qS)z"%s")�_escape)�.0�item)rrr�
<listcomp>5sz,SvnCommandPath._svnwrite.<locals>.<listcomp>z"%s"� z
execing %s)�extend�append�_encodedurl�join�DEBUG�print�_svncmdexecauth)rrr�l�string�outr)rrr2s



zSvnCommandPath._svnwritecCs2t��|}|jdk	r(|d|j��7}|�|�S)z  execute an svn command 'as is' Nr#)r�	fixlocaler�makecmdoptions�_cmdexec)rrrrrr*?s
zSvnCommandPath._svncmdexecauthcCshyt�|�}WnTtjjjk
rbt��d}|j�d�dksP|j�d�dkr\tj�	|���YnX|S)N�zFile ExistsrzFile already exists)
r�cmdexec�py�Error�sys�exc_info�err�find�error�EEXIST)rrr-�errrr0FszSvnCommandPath._cmdexeccCs2t��|}|jdk	r(|d|j��7}|�|�S)z9 execute an svn command, return a pipe for reading stdin Nr#)rr.rr/�_popen)rrrrr�
_svnpopenauthQs
zSvnCommandPath._svnpopenauthcCs
t�|�S)N)�os�popen)rrrrrr<XszSvnCommandPath._popencCs|�|j�S)N)rr)rrrrr&[szSvnCommandPath._encodedurlcCs,|jr|j��pd}|j�t|�|f�dS)N)rr/�
_lsnorevcacheZdelentry�str)rrrrrr�_norev_delentry^szSvnCommandPath._norev_delentry�rcCsh|dkrtd|f��|jdd�s&t�|jdkrH|�d|�|j�f�S|�d|j|�|j�f�SdS)z, return an opened file with the given mode. )rCZrUzmode %r not supportedr1)�fileNzsvn cat "%s"zsvn cat -r %s "%s")�
ValueError�check�AssertionErrorrr=rr)r�moderrr�openbs
zSvnCommandPath.opencOsZ|j�|j�}t|�dkr*tj�|d��n,t|�dkrB|j||�S|jdd�j||�SdS)zi return the directory path of the current path joined
            with any given path arguments.
        �zbase is not valid�)�basenameN)	r�split�sep�lenr3r9�EINVALr'�new)rr�kwargsr+rrr�dirpathnszSvnCommandPath.dirpathcOs6|�dd�}|j|�}|�dd|�|�|���|S)zz create & return the directory joined with args.
        pass a 'msg' keyword argument to set the commit message.
        �msgzmkdir by py lib invocation�mkdirz-m)�getr'rrBrS)rrrRZ
commit_msgZ
createpathrrrrU{s

zSvnCommandPath.mkdir�copied by py lib invocationcCsPt|dd�dk	rtj�|d��|�d||�|�|�|�f�|�|���dS)z. copy path to target with checkin message msg.rNzrevisions are immutablezsvn copy -m "%s" "%s" "%s")�getattrr3r9rPr*rrBrS)r�targetrTrrr�copy�s
zSvnCommandPath.copy�renamed by py lib invocationcCsZt|dd�dk	rtj�|d��|�d||�|�|�|�f�|�|���|�|�dS)z6 rename this path to target with checkin message msg. rNzrevisions are immutablez"svn move -m "%s" --force "%s" "%s")rXr3r9rPr*rrBrS)rrYrTrrr�rename�szSvnCommandPath.renamer1�removed by py lib invocationcCsB|jdk	rtj�|d��|�d||�|�f�|�|���dS)zT remove a file or directory (or a directory tree if rec=1) with
checkin message msg.Nzrevisions are immutablezsvn rm -m "%s" "%s")rr3r9rPr*rrBrS)rZrecrTrrr�remove�s
zSvnCommandPath.removecCsbtj�|�}d|�|�fd|�|�fg}|jdk	rHdt|j�g|}|�dd�|�f�|S)z� export to a local path

            topath should not exist prior to calling this, returns a
            py.path.local instance
        z"%s"Nz-rz
svn export %sr#)r3r�localrrrAr*r')rZtopathrrrr�export�s
zSvnCommandPath.exportc
Os"t|dd�dk	rtj�|d��|j|�}|�dd�}x,|jdd�D]}|��rBPqBWtj�|d��||kr�|j|d	�s�|r�tj�	|�p�tj�
|��|S|�|�}|�|j
d
�d}tjj��}zT|j||d	�dd|�|�|�|�|��|�|���f}	|�|	�|�|�Wd|��X|S)
z� 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.
        rNzrevisions are immutable�dirrT)�reversezhas not any valid base!)rar1zsvn import -m "%s" "%s" "%s"z	ensure %s)rXr3r9rPr'rV�partsrF�ENOENT�ENOTDIRZEISDIRZreltorMrNrr_�mkdtemp�ensurerr&r*rBr^)
rrrRrYra�xZtocreaterL�tempdirrrrrrg�s2



zSvnCommandPath.ensurecCs|�d|�}|dd�S)NZpropgetr)r)r�name�resrrr�_propget�szSvnCommandPath._propgetcCs6|�d�}|�d�}dd�|dd�D�}t�||�S)NZproplist�
cSsg|]}|���qSr)�strip)r rhrrrr"�sz,SvnCommandPath._proplist.<locals>.<listcomp>r1)rrMrZPropListDict)rrk�linesrrr�	_proplist�s

zSvnCommandPath._proplistcCsD|��}|��}|j}x|D]\}}||kr|SqWtj�|��dS)z9 return an Info structure with svn-provided information. N)rS�_listdir_nameinforLr3r9rd)r�parent�nameinfo_seqZbnrj�inforrrrt�szSvnCommandPath.infocsZ�fdd�}�jr�j��pd}�jdk	rB�j��j�j|f|�S�j��j|f|�SdS)z8 return sequence of name-info directory entries of self csly��dd�}W�ntjjk
�rt��d}|j�d�dkrVtj	�
�|j��n�|j�d�dkrxtj	�
�|j��n�|j�d�dkr�tj	�
�|j��nj|j�d�dkr�tj	�
�|j��nH|j�d	�dkr�tj	�
�|j��n&|j���d
�dk�rtj	��|j��tj	�|j��YnX|�
d�}g}x8|D]0}|�r,t|�}|jdk�r,|�|j|f��q,W|��|S)
NZlsz-vr1znon-existent in that revisionrzE200009:zFile not foundznot part of a repositoryzUnable to openzmethod not allowedrm�.)rrr2r4r5r6r7r8r3r9rd�lower�EACCESrM�InfoSvnCommand�_namer%�sort)rkr;rorsZlslinert)rrr�builder�s4

z1SvnCommandPath._listdir_nameinfo.<locals>.builderN)rr/r�_lsrevcacheZ
getorbuildrr@)rr{rr)rrrq�s
z SvnCommandPath._listdir_nameinfocs�t�t�rt�������}t|�dkrT|d\}}|�jkrT|jdkrTtj	�
����fdd�|D�}�r|�fdd�|D�}��||�|S)zi list directory contents, possibly filter by the given fil func
            and possibly sorted.
        r1rrDcsg|]\}}��|��qSr)r')r rjrt)rrrr"sz*SvnCommandPath.listdir.<locals>.<listcomp>csg|]}�|�r|�qSrr)r rh)�filrrr"s)rrArZ	FNMatcherrqrOrL�kindr3r9reZ	_sortlist)rr}rzrsrjrt�pathsr)r}rr�listdirs

zSvnCommandPath.listdirFcCs�|��st�|dkrdp|}|dkr(dp*|}|dkrB|dkrBd}nd||f}|rVdpXd}|�d|||jf�}dd	lm}|�|�}g}	x2td|jj	�D] }
|
j
|
jkr�|	�t
�|
��q�W|	S)
z� 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.
NZHEADr1rKz-r %s:%sz-vzsvn log --xml %s %s "%s"r)�minidom)rFrGr=rZxml.domr��parse�filter�
firstChildZ
childNodesZnodeTypeZELEMENT_NODEr%rZLogEntry)rZ	rev_startZrev_end�verboseZrev_optZverbose_optZxmlpiper�Ztree�resultZlogentryrrr�logs 
zSvnCommandPath.log)NN)rC)rW)r[)r1r])NN)Nr1F) �__name__�
__module__�__qualname__�__doc__rr|rr@r
rrrr*r0r=r<r&rBrIrSrUrZr\r^r`rgrlrprtrqr�r�rrrrrs6








	
"%
rc@s&eZdZe�d�Zdd�Zdd�ZdS)rxzc^ *(?P<rev>\d+) +(?P<author>.+?) +(0? *(?P<size>\d+))? *(?P<date>\w+ +\d{2} +[\d:]+) +(?P<file>.*)$cCs�|j�|�}|��}|d|_|jddkrD|jdd�|_d|_nd|_t|d�|_|d|_|drvt|d�pxd|_t	|d	�|_
|j
d
|_dS)NrDrrrar�author�sizer�datei@B)�	lspattern�match�	groupdictryr~�intZcreated_revZlast_authorr��parse_time_with_missing_year�mtime�time)r�liner��datarrr�__init__?s

zInfoSvnCommand.__init__cCs|j|jkS)N)�__dict__)r�otherrrr�__eq__QszInfoSvnCommand.__eq__N)r�r�r��re�compiler�r�r�rrrrrx9srxcCs�ddl}t��}|��}t�|�d�d�d}t�|�d�d�d}|�d�}y*d|kr^t��t�|d�d}d}}	WnZtk
r�t�|d	�d
d�\}}	|d}|||||	ddddf	}
|
|kr�|d8}YnX|||||	ddddf	}
|�|
�S)z� analyze the time part from a single line of "svn ls -v"
    the svn output doesn't show the year makes the 'timestr'
    ambigous.
    rNz%br1z%d��:z%Yz%H:%M��)�calendarr��gmtimerM�strptime�poprE�timegm)Ztimestrr�Zt_nowZtparts�month�day�last�year�hour�minuteZt_resultrrrr�Ys&
r�c@seZdZdd�ZdS)�	PathEntrycCsX|jj�d�|_|�d��d�|_|jdkrT|�d��d�|_|jrTt|�d��|_dS)NzUTF-8�action�Az
copyfrom-pathzcopyfrom-rev)	r�Z	nodeValue�encoderZgetAttributer�Z
copyfrom_pathr�Zcopyfrom_rev)rZppartrrrr�us
zPathEntry.__init__N)r�r�r�r�rrrrr�tsr�)r�r>r5r�r�r3rrZpy._pathrrrZpy._path.cacheutilrrr(ZSvnPathBaserrxr�r�rrrr�<module>s +