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__/svnwc.cpython-37.pyc

B

���]!��@s�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	Gdd�d�Z
Gdd�d�ZGdd	�d	�Ze�Z
d
Zejdkr�ed7Zed
Zgfdd�Zdd�Zefdd�Zdd�ZGdd�de	j�Zdd�ZGdd�de�Zdd�Zd�d�Zejek�re�ej�ejdkZe� d ej!�Z"d!d"�Z#d<d$d%�Z$d&d'�Z%Gd(d)�d)e&�Z'e� d*�Z(Gd+d,�d,e	j�Z)Gd-d.�d.�Z*Gd/d0�d0e*�Z+Gd1d2�d2�Z,d3d4�Z-e� d5�fd6d7�Z.gfd8d9�Z/Gd:d;�d;�Z0dS)=zm
svn-Command based Implementation of a Subversion WorkingCopy Path.

  SvnWCCommandPath  is the main class.

�N)�commonc@seZdZiZiZiZiZdS)�cacheN)�__name__�
__module__�__qualname__�proplist�info�entriesZprop�r
r
�?/opt/alt/python37/lib/python3.7/site-packages/py/_path/svnwc.pyrsrc@seZdZdd�Zdd�ZdS)�	RepoEntrycCs||_||_||_dS)N)�url�rev�	timestamp)�selfr
rrr
r
r�__init__szRepoEntry.__init__cCsd|j|j|jfS)Nzrepo: %s;%s  %s)r
rr)rr
r
r�__str__ szRepoEntry.__str__N)rrrrrr
r
r
rrsrc@s6eZdZdZdZdd�Zdd�Zddd	�Zd
d�ZdS)
�	RepoCachez� The Repocache manages discovered repository paths
    and their revisions.  If inside a timeout the cache
    will even return the revision of the root.
    �cCs
g|_dS)N)�repos)rr
r
rr*szRepoCache.__init__cCs
g|_dS)N)r)rr
r
r�clear-szRepoCache.clearNcCs`|dkrdS|dkrt��}x>|jD]}||jkr$||_||_Pq$Wt|||�}|j�|�dS)N)�timerr
rrr�append)rr
rr�entryr
r
r�put0s
z
RepoCache.putcCsRt��}x@|jD]6}|�|j�r||j|jkr<|j|jfS|jdfSqW|dfS)N���)rr�
startswithr
r�timeoutr)rr
�nowrr
r
r�getAsz
RepoCache.get)N)	rrr�__doc__rrrrrr
r
r
rr#s
rz_ -/\=$.~+%�win32�:z@:cCsXy|dStk
rRtj�d�}|��d�|�d�dd��}|�|�|SXdS)Nrzsvn -q --version�.�)�
IndexError�py�process�cmdexec�strip�join�splitr)�ver�vr
r
r�_getsvnversionUs
r.cCs*t|�}tjjjdkr&t|��dd�}|S)Nr!�$z\$)�strr&�std�sys�platform�replace)�textr
r
r�_escape_helper_sr6cCs,x&t|�D]}|��rq
||kr"q
dSWdS)NTF)r0�isalnum)r5Z
allowed_chars�cr
r
r�_check_for_bad_charsesr9cCsN|�dd�\}}|dkrJ|�dd�\}}t|t�s<t|t�rJtd|f��dS)Nz://��file�/zbad char in %r)r+r9�ALLOWED_CHARS_HOST�
ALLOWED_CHARS�
ValueError)r
�protoZuri�hostZuripathr
r
r�
checkbadcharsns

rBc@s�eZdZdZdZdd�Zeeddd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�ZGdd �d ej�ZdS)!�SvnPathBasez2 Base implementation for SvnPath implementations. r<cCs|jS)N)�strpath)rr
r
r�_geturlszSvnPathBase._geturlNzurl of this svn-path.cCs|jS)z7 return a string representation (including rev-number) )rD)rr
r
rr�szSvnPathBase.__str__cCs
t|j�S)N)�hashrD)rr
r
r�__hash__�szSvnPathBase.__hash__cKs�t�|j�}|�d|j�|_|�d|j�|_|�d�\}}}}d|krdd|ksVd|kr�td|��n:|�d|�}|�d|�}|r�|�	d�s�d|}|||d<|�d	|�|�d
|j
�|dr�d||_n
d||_|S)
a� create a modified version of this path. A 'rev' argument
            indicates a new revision.
            the following keyword arguments modify various path parts::

              http://host.com/repo/path/file.ext
              |-----------------------|          dirname
                                        |------| basename
                                        |--|     purebasename
                                            |--| ext
        r�authz!dirname,basename,purebasename,ext�basename�purebasename�extzinvalid specification %rr#�dirname�sepz%(dirname)s%(sep)s%(basename)sz%(dirname)s)�object�__new__�	__class__rrrH�
_getbyspecr?�
setdefaultrrMrD)r�kw�objrLrIrJrKZpbr
r
r�new�s&
zSvnPathBase.newc	Cs�g}|j�|j�}x�|�d�D]�}|��}|dkrN|�|j�|dd���q|dkrf|�|d�q|d}|�d�}|dkr�|d}}n|d|�||d�}}|dkr�|�|�q|d	kr�|�|�qtd
|��qW|S)a� get specified parts of the path.  'arg' is a string
            with comma separated path parts. The parts are returned
            in exactly the order of the specification.

            you may specify the following parts:

            http://host.com/repo/path/file.ext
            |-----------------------|          dirname
                                      |------| basename
                                      |--|     purebasename
                                          |--| ext
        �,rLNrrIr#�rJrKzDon't know part %r)rDr+rMr)rr*�rfind�	NameError)	r�spec�res�parts�namerI�irJrKr
r
rrQ�s&

zSvnPathBase._getbyspeccCs(t|�t|�ko&|j|jkp&|j|jkS)z3 return true if path and rev attributes each match )r0r)r�otherr
r
r�__eq__�szSvnPathBase.__eq__cCs
||kS)Nr
)rr_r
r
r�__ne__�szSvnPathBase.__ne__csH|s�St�fdd�|D��}�jf|}���j�|��j�j�}|S)z� return a new Path (with the same revision) which is composed
            of the self Path followed by 'args' path components.
        csg|]}|��j��qSr
)r)rM)�.0�arg)rr
r�
<listcomp>�sz$SvnPathBase.join.<locals>.<listcomp>)�tuplerDrPrMr*rrH)r�argsr\�newpathr
)rrr*�szSvnPathBase.joincCs|�|�}|S)z+ return the content of the given property. )Z_propget)rr]�valuer
r
r�propget�s
zSvnPathBase.propgetcCs|��}|S)z list all property names. )Z	_proplist)r�contentr
r
rr�szSvnPathBase.proplistcCs
|��jS)z2 Return the size of the file content of the Path. )r�size)rr
r
rrk�szSvnPathBase.sizecCs
|��jS)z0 Return the last modification time of the file. )r�mtime)rr
r
rrl�szSvnPathBase.mtimecCst|�S)N)r6)r�cmdr
r
r�_escape�szSvnPathBase._escapec@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
zSvnPathBase.CheckerscCs2y|j��jdkStjjk
r,|��SXdS)N�dir)�pathr�kindr&�error�Error�
_listdirworks)rr
r
rroszSvnPathBase.Checkers.dircCs0y|j��Wntjjk
r&dSXdSdS)NFT)rp�listdirr&rr�ENOENT)rr
r
rrts
z"SvnPathBase.Checkers._listdirworkscCs.y|j��jdkStjjk
r(dSXdS)Nr;F)rprrqr&rrrv)rr
r
rr;#szSvnPathBase.Checkers.filecCs,y
|j��Stjjk
r&|��SXdS)N)rprr&rrrvrt)rr
r
r�exists)s
zSvnPathBase.Checkers.existsN)rrrrortr;rwr
r
r
r�Checkerssrx)rrrr rMrE�propertyr
rrGrUrQr`rar*rirrkrlrnrrxr
r
r
rrC{s""$rCcCs@|�d�}|dkrtd|��|d|�}t�|d�}t�|�S)Nr#rzcould not parse %sz%Y-%m-%dT%H:%M:%S)rXr?r�strptime�mktime)�timestrr^�
parsedtimer
r
r�parse_apr_time/s
r~c@s eZdZdZdd�Zdd�ZdS)�PropListDictzD a Dictionary which fetches values (InfoSvnCommand instances) lazilycCs t�|dd�|D��||_dS)NcSsg|]}|df�qS)Nr
)rb�xr
r
rrd:sz)PropListDict.__init__.<locals>.<listcomp>)�dictrrp)rrpZkeynamesr
r
rr9szPropListDict.__init__cCs2t�||�}|dkr.|j�|�}t�|||�|S)N)r��__getitem__rpri�__setitem__)r�keyrhr
r
rr�=s
zPropListDict.__getitem__N)rrrr rr�r
r
r
rr7srcCstjdkrdSdS)Nr!z	LC_ALL=C rW)r2r3r
r
r
r�	fixlocaleDs
r�z* | \ / : < > ? 	 
   
� z^([a-z]\:\\)?[^:]+$cCsdtdd�}|j}tr2|�d�t�|�s2td��x,|D]$}|tjksN||kr8td|f��q8WdS)Nr"z path may not contain a colon (:)zillegal character %r in path)	�
ILLEGAL_CHARSrD�	ISWINDOWS�remove�_reg_allow_disk�matchr?�string�	printable)rp�illegal�sp�charr
r
r�_check_pathOs


r�TcCs>t|�|j}|r,|jdkr,d||jf}n|r:d|f}|S)Nrz%s@%sz%s@HEAD)r�rDr)rpZaddatr�r
r
r�path_to_fspathZs
r�cCs�t|d�}tjjj}trtt�|�}|�dd�}|�	d�rjd|�	d��dd�||t
|�	d��d��f}q|||�}n||�}|jdkr�d||jf}n
d|f}d	|fS)
NF�\r<r:z/%s%srz%s@%sz%s@HEADz	file://%s)r�r&r1�urllib�quoter�r�r�r4�group�lenr)rp�fspathr�r�r
r
r�
url_from_pathcs



 


r�c@s*eZdZdZd
dd�Zdd�Zdd�Zd	S)�SvnAuthz/ container for auth information for Subversion TcCs||_||_||_||_dS)N)�username�password�
cache_auth�interactive)rr�r�r�r�r
r
rrxszSvnAuth.__init__cCsr|j�dd�}|j�dd�}g}|r4|�d|f�|rH|�d|f�|jsX|�d�|jsh|�d�d�|�S)N�"z\"z--username="%s"z--password="%s"z--no-auth-cachez--non-interactiver�)r�r4r�rr�r�r*)r�uname�passwd�retr
r
r�makecmdoptions~s

zSvnAuth.makecmdoptionscCsd|jfS)Nz<SvnAuth username=%s ...>)r�)rr
r
rr�szSvnAuth.__str__N)TT)rrrr rr�rr
r
r
rr�vs
r�z\s*(\d+)\s*(\S+) (.*)c@s�eZdZdZejZdndd�Zedd�ddd�Zedd�ddd	�Z	d
d�Z
dd
�Zeeddd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdodd�Zdd�Zdd �Zdpd!d"�Zdqd%d&�Zdrd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zdsd5d6�Zd7d8�Zd9d:�Z d;d<�Z!d=d>�Z"d?d@�Z#dtdBdC�Z$dudDdE�Z%dFdG�Z&e'�(dHe'j)�Z*dvdJdK�Z+dLdM�Z,dNdO�Z-dPdQ�Z.dwdRdS�Z/dxdTdU�Z0dVdW�Z1dXdY�Z2dydZd[�Z3dzd\d]�Z4d{d_d`�Z5dadb�Z6Gdcdd�dde7j8j9j:�Z:d|dfdg�Z;dhdi�Z<djdk�Z=dldm�Z>dS)}�SvnWCCommandPathz� path implementation offering access/modification to svn working copies.
        It has methods similar to the functions in os.path and similar to the
        commands of the svn client.
    NcCs\t�|�}t||�r(|j|kr"|S|j}tt|�t�rDtd|f��t	j
�|�|_||_|S)Nzbad char in wcpath %s)
rNrO�
isinstancerP�	localpathr9r0r>r?r&rp�localrH)�cls�wcpathrHrr
r
rrO�s


zSvnWCCommandPath.__new__cCs
t|j�S)N)r0r�)r�r
r
r�<lambda>��zSvnWCCommandPath.<lambda>zstring pathcCs|jdd�jS)Nr)�usecache)rr)r�r
r
rr��r��revisioncCs|jt|dd�kS)Nr�)r��getattr)rr_r
r
rr`�szSvnWCCommandPath.__eq__cCs:t|dd�dkr |��}|j|_t|jtjj�s4t�|jS)N�_url)	r�rr
r�r�r&�builtinZ_basestring�AssertionError)rrr
r
rrE�s
zSvnWCCommandPath._geturlzurl of this WC itemcCst|�S)N)r6)rrmr
r
rrn�szSvnWCCommandPath._escapecCs|j�|�S)z! pickle object into path location)r��dump)rrTr
r
rr��szSvnWCCommandPath.dumpcCs|��}tj�|j�S)z* return current SvnPath for this WC-item. )rr&rp�svnurlr
)rrr
r
rr��szSvnWCCommandPath.svnurlcCs
d|jS)Nz	svnwc(%r))rD)rr
r
r�__repr__�szSvnWCCommandPath.__repr__cCs
t|j�S)N)r0r�)rr
r
rr�szSvnWCCommandPath.__str__cCs|jdkrdS|j��S)NrW)rHr�)rr
r
r�_makeauthoptions�s
z!SvnWCCommandPath._makeauthoptionscCs.|rt|�pg}|�|���|j|f|��S)N)�listrr��_svn)rrmrfr
r
r�_authsvn�szSvnWCCommandPath._authsvnc
	sRd|g}�fdd�|D�}|�|�|�d���j��t�d�|�}yJz*d}tj�|�}dtj|<t	j
�|�}Wd|r�|tj|<ntj|=XWn�t	j
jjk
�rLt
��d}|j��}	|	�d	�d
kr�t	j����n|	�d�d
kr�t	j����|	�d�d
k�s:|	�d
�d
k�s:|	�d�d
k�s:|	�d�d
k�rFt	j�|	���YnX|S)Nzsvn %scsg|]}��|��qSr
)rn)rb�item)rr
rrd�sz)SvnWCCommandPath._svn.<locals>.<listcomp>z"%s"r��LC_MESSAGES�Cr:z	not foundrzE200009:zfile existszfile already existszw150002:zcan't create directory)�extendrrnrDr�r*�os�environrr&r'r(rsr2�exc_info�err�lower�findrrrv�EEXIST)
rrmrf�lr�r�Zhold�out�eZstrerrr
)rrr��s8



zSvnWCCommandPath._svncCs|�d|g�dS)z switch to given URL. �switchN)r�)rr
r
r
rr��szSvnWCCommandPath.switchcCs�g}|dkr|j}|dks"|dkrDtjjjdkrnt�dkrn|d7}n*t�dkr\|d|7}n|�dt|��|�|�|�d|�dS)	z$ checkout from url to local wcpath. Nrr!z1.3z@HEADz@%dz-r�co)	r
r&r1r2r3r.rr0r�)rr
rrfr
r
r�checkout�s



zSvnWCCommandPath.checkout�HEADTcCs&d|g}|s|�d�|�d|�dS)z= update working copy item to given revision. (None -> HEAD). z-rz--non-interactiveZupN)rr�)rrr��optsr
r
r�updates
zSvnWCCommandPath.update�wcCs|j�||�dS)z) write content into local filesystem wc. N)r��write)rrj�moder
r
rr�
szSvnWCCommandPath.writecGs|j|jj|�|jd�S)z0 return the directory Path of the current Path. )rH)rPr��dirpathrH)rrfr
r
rr�szSvnWCCommandPath.dirpathcCs4|��}|jdd�r|��|jdd�r0|��|S)Nr)ro)r��check�_ensuredirs�mkdir)r�parentr
r
rr�szSvnWCCommandPath._ensuredirscOsd|j|�}|��r*|jdd�r&|��|S|�dd�r>|��S|��}|��|�d�|��|S)z� ensure that an args-joined path exists (by default as
            a file). if you specify a keyword argument 'directory=True'
            then the path is forced  to be a directory path.
        F)�	versionedrorrW)r*r��addrr�r�r�)rrf�kwargs�pr�r
r
r�ensures

zSvnWCCommandPath.ensurecGs$|r|j|���S|�d�|SdS)z1 create & return the directory joined with args. r�N)r*r�r�)rrfr
r
rr�/s
zSvnWCCommandPath.mkdircCs|�d�dS)z add ourself to svn r�N)r�)rr
r
rr�7szSvnWCCommandPath.addr:cCsP|std��|jdd�s,tj�|���dSg}|r>|�d�|jd|��dS)z� remove a file or a directory tree. 'rec'ursive is
            ignored and considered always true (because of
            underlying svn semantics.
        z!svn cannot remove non-recursivelyT)r�Nz--forcer�)r�)r�r�r&rpr�r�rr�)r�rec�force�flagsr
r
rr�;s
zSvnWCCommandPath.removecCs tj�dt|�t|�f�dS)z copy path to target.zsvn copy %s %sN)r&r'r(r0)r�targetr
r
r�copyJszSvnWCCommandPath.copycCs tj�dt|�t|�f�dS)z rename this path to target. zsvn move --force %s %sN)r&r'r(r0)rr�r
r
r�renameNszSvnWCCommandPath.renamecCs|�d���}|std��dS)z( set a lock (exclusive) on the resource �lockz!unknown error in svn lock commandN)r�r)r?)rr�r
r
rr�RszSvnWCCommandPath.lockcCs,|�d���}|�d�r(t|dd���dS)z unset a previously set lock �unlockzsvn:�N)r�r)r�	Exception)rr�r
r
rr�Ys
zSvnWCCommandPath.unlockcCsy|��WnYnXdS)z$ remove any locks from the resource N)r�)rr
r
r�cleanup`szSvnWCCommandPath.cleanuprcCs�|rtd��nd}|rd}nd}|r*d}nd}yd|||f}|�|�}WnBtjjjk
r�d|||f}|�|�}t|��||�}YnXt|��||�}|S)z2 return (collective) Status object for this file. z1XXX cannot perform status() on external items yetrWz--non-recursivez-uz$status -v --xml --no-ignore %s %s %szstatus -v --no-ignore %s %s %s)	r?r�r&r'r(rs�WCStatus�
fromstring�XMLWCStatus)rZupdatesr�Z	externalsrmr��
rootstatusr
r
r�statushs(

zSvnWCCommandPath.statuscCs*g}|dk	r|�d|�|�d|�}|S)zj return a diff of the current path against revision rev (defaulting
            to the last one).
        Nz-r %d�diff)rr�)rrrfr�r
r
rr��s
zSvnWCCommandPath.diffcCs�|�d�}g}|��}tj�|j���}x\tt||��D]J\}\}}t	�
|�}|s`td|f��|��\}	}
}|�
t|	�|
|f�q8W|S)z[ return a list of tuples of three elements:
            (revision, commiter, line)
        �blamez:output line %r of svn blame does not match expected format)r��
splitlinesr&rpr�r
�	readlines�	enumerate�zip�	rex_blamer�r?�groupsr�int)rr��resultZ
blamelinesZ	reallinesr^Z	blameline�line�mrr]�_r
r
rr��s


zSvnWCCommandPath.blamez.*Committed revision (\d+)\.$rWcCsld|�dd�f}|s|d7}|�|�}ytj|=Wntk
rHYnX|rh|j�|�}t|�d��SdS)z/ commit with support for non-recursive commits zcommit -m "%s" --force-logr�z\"z -Nr:N)	r4r�rr�KeyError�_rex_commitr�r�r�)r�msgr�rmr�r�r
r
r�commit�s
zSvnWCCommandPath.commitcGsNtjj��}z2|�d�}|�|�|jd|dt|�f|��Wd|��XdS)z* set property name to value on this path. rh�propsetz--fileN)	r&rpr��mkdtempr*r�r�r0r�)rr]rhrf�dr�r
r
rr��s

zSvnWCCommandPath.propsetcCs|�d|�}|dd�S)z! get property name on this path. riNr)r�)rr]r[r
r
rri�szSvnWCCommandPath.propgetcCs|�d|�}|dd�S)z$ delete property name on this path. �propdelNr)r�)rr]r[r
r
rr��szSvnWCCommandPath.propdelcCsP|r|�d�}t||�S|�d�}|�d�}dd�|dd�D�}t||�SdS)z� return a mapping of property names to property values.
If rec is True, then return a dictionary mapping sub-paths to such mappings.
zproplist -Rr�
cSsg|]}|���qSr
)r))rbr�r
r
rrd�sz-SvnWCCommandPath.proplist.<locals>.<listcomp>r:N)r��make_recursive_propdictr+r)rr�r[�linesr
r
rr�s



zSvnWCCommandPath.proplistcCs|r|�d�}n
|�d�}|S)zK revert the local changes of this path. if rec is True, do so
recursively. z	revert -R�revert)r�)rr�r�r
r
rr�s
zSvnWCCommandPath.revertcKs*|r|jjf|�}n|j}|j||jd�S)a� create a modified version of this path. A 'rev' argument
            indicates a new revision.
            the following keyword arguments modify various path parts:

              http://host.com/repo/path/file.ext
              |-----------------------|          dirname
                                        |------| basename
                                        |--|     purebasename
                                            |--| ext
        )rH)r�rUrPrH)rrSr�r
r
rrU�szSvnWCCommandPath.newcOs&|s|S|jj||�}|j||jd�S)z� return a new Path (with the same revision) which is composed
            of the self Path followed by 'args' path components.
        )rH)r�r*rPrH)rrfr�r�r
r
rr*�szSvnWCCommandPath.joincCs
|otj�|�}|�sy|�d�}Wnjtjjjk
r�t�	�d}|j
�d�dkrhtj�
||j
��n |j
�d�dkr�tj�
||j
���YnX|��dks�|���d�dkr�tj�
||��t|�}tjjjdkr�|j|jkr�tj�
|d	d
|j|jf��|tj|<|S)z9 return an Info structure with svn-provided information. rr:z$Path is not a working copy directoryrzis not under version controlrWznot a versioned resourcer!znot a versioned resource:z	 %s != %s)rrrr�r&r'r(rsr2r�r�r�rrrvr)r��InfoSvnWCCommandr1r3rpr�)rr�r�outputr�r
r
rr�s*

zSvnWCCommandPath.infocCstt|t�rt�|�}dd�}g}xB|j�|�D]2}|j||jd�}||�r.|rV||�r.|�|�q.W|�	||�|S)z� return a sequence of Paths.

        listdir will return either a tuple or a list of paths
        depending on implementation choices.
        cSs
|jdkS)Nz.svn)rI)rpr
r
r�notsvn$sz(SvnWCCommandPath.listdir.<locals>.notsvn)rH)
r�r0rZ	FNMatcherr�rurPrHrZ	_sortlist)rZfil�sortr�pathsr�r�r
r
rrus

zSvnWCCommandPath.listdir�rcCst|j|�S)z, return an opened file with the given mode. )�openrD)rr�r
r
rr	/szSvnWCCommandPath.opencCs|j�|�S)N)r�rQ)rrZr
r
rrQ3szSvnWCCommandPath._getbyspecc@seZdZdd�Zdd�ZdS)zSvnWCCommandPath.CheckerscCs||_|j|_dS)N)�	svnwcpathr�rp)rrpr
r
rr7sz"SvnWCCommandPath.Checkers.__init__c	Cs�y|j��}Wnrtjjtjjfk
r.dStjjjk
r�t	�
�d}|j�d�dkrbdS|j�
��d�dkrzdS�YnXdSdS)NFr:zis not a working copyrznot a versioned resourceT)r
rr&rrrvr�r'r(rsr2r�r�r�r�)r�sr�r
r
rr�:sz#SvnWCCommandPath.Checkers.versionedN)rrrrr�r
r
r
rrx6srxFcCs"|��st�|dkrdp|}|dkr(dp*|}|dkrB|dkrBd}nd||f}|rVdpXd}t�}|��}|d||||jf}tj|tjtjdd	�}	|	��\}
}t	j
�|
t�
��}
t�\}}
y|�|
�}Wn|
k
r�td
��YnXg}x0td|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.
Nr�r:rWz-r %s:%sz-vzsvn log --xml %s %s %s "%s"T)�stdout�stderr�shellzno such revision)r�r�r�r�rD�
subprocess�Popen�PIPE�communicater&r�Z_totextr2�getdefaultencoding�	importxml�parseStringr?�filter�
firstChild�
childNodes�nodeType�ELEMENT_NODEr�LogEntry)rZ	rev_startZrev_end�verboseZrev_optZverbose_optZ
locale_envZauth_optrm�popenrr
�minidom�
ExpatErrorZtreer��logentryr
r
r�logIs6
zSvnWCCommandPath.logcCs
|��jS)z2 Return the size of the file content of the Path. )rrk)rr
r
rrksszSvnWCCommandPath.sizecCs
|��jS)z0 Return the last modification time of the file. )rrl)rr
r
rrlwszSvnWCCommandPath.mtimecCst|j|j|jf�S)N)rFrDrPrH)rr
r
rrG{szSvnWCCommandPath.__hash__)NN)N)NN)r�T)r�)r:r:)rrr)N)rWr:)r)r)r:)NN)r)Nr:F)?rrrr r�rMrOryrDrr`rEr
rnr�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��re�compile�DOTALLr�r�r�rir�rrrUr*rrur	rQr&rpr�rxr!rkrlrGr
r
r
rr��sh


!




&





		



*r�c@s@eZdZdZddd�Zddd�Ze�d�Zd
d	d
�Z	e
e	�Z	dS)r�)�modified�added�conflict�	unchanged�external�deleted�
prop_modified�unknown�update_available�
incomplete�kindmismatch�ignored�locked�replacedNcCs8||_||_||_||_x|jD]}t||g�q WdS)N)r�r�modrev�author�	attrnames�setattr)rr�rr3r4r]r
r
rr�szWCStatus.__init__TcKsXi}x:|jD]0}||ks ||rxt||�D]}d||<q,WqW|��}|rT|��|S)Nr:)r5r��keysr)rrrSr�r]rpr�r
r
r�allpath�szWCStatus.allpathz$\s+(\d+|-)\s+(\S+)\s+(.+?)\s{2,}(.*)c	Cst||||�}d}�x�|�d�D�]�}|��s0q |dd�|dd�}}	|\}
}}}
}}}}|
dkr�|�dd�d}|
dkr�|j|dd�}|j�|�q |
dkr�|j|jj|dd�|jd	�}|j	�|�q |
d
kr |j|dd�}|j
�|�q tj�|	�}|�s�|dk�r0|	��}|j|dd�}|j
�|�q |���d�d
k�r\t|	�d�d���}q |���d�d
k�rrq td|��n|��\}}}}|j|dd�}|
dk�r�|jdd��s�td��|j�|�n�|
dk�s�|
dk�r�|j�|�n�|
dk�r|j�|�n�|
dk�r|j�|�nl|
dk�r6|j�|�nT|
dk�rN|j�|�n<|
dk�rf|j�|�n$|
���s~|j�|�ntd|
��|dk�r�|j�|�|dk�s�|dk�r�|j�|�|dk�r�|j
�|�||kr ||_ ||_!||_"|r ||_#q q W|S)z4 return a new WCStatus object from data 's'
        Nr��z?XIr:�?)�abs�X)rH�I�*zagainst revision:rr"zstatus on externalzcould not parse line %r�M)r;z3didn't expect a directory with changed content here�A�+�Dr��~�!�Rzreceived flag %r�L�K)$r�r+r)r*r,rrPr�rHr)r0�_rex_statusr�r-r�r�r�r?r�r�r�r%r&r*r'r/r.r2r(�NotImplementedErrorr+r1rr3r4�
update_rev)�data�
rootwcpathrr3r4r�rJr�r��restZc0Zc1Zc2Zc3Zc4Zc5Zx6Zc7�fnr�r�r
r
rr��s�










zWCStatus.fromstring)NNN)T)NNN)rrrr5rr8r"r#rHr��staticmethodr
r
r
rr�s
	


]r�c@seZdZddd�Zee�ZdS)r�NcCst||||�}d}t�\}}y|�|�}	Wn,|k
rVt��d}
tt|
���YnX|	�d�}|rv|d�d�|_	�x�|	�d�D�]x}|�d�}
|�d�d	}|�d
�}|dkr�|j
|
dd�}|j�|�q�n�|d
k�r|j
|jj
|
dd�|jd�}|j�|�q�nN|dk�r0|j
|
dd�}|j�|�q�n&|dk�rV|j
|
dd�}|j�|�q�|�d�}|dk�st|dk�r�d}d}d}d}n�|dk�r�n||�d�d	}|�r|�d�}d}|�d�}|�r�x|d	jD]}||j7}�q�Wd}x$|�d�d	jD]}||j7}�q�W|j
|
dd�}|dk�s<|jdd��s<td��ddddd ��||�}t||�}|�|�|�d!�}|d"k�r�|j�|�||k�r�||_||_||_||_|�d#�}|�r�|d	}|�d
�}|d$k�r�|j�|�|�d%�}t|�r�|j �|�q�W|S)&zL parse 'data' (XML string as outputted by svn st) into a status obj
        Nr:Zagainstrr�rrpz	wc-statusrr��unversioned)r;r))rHr0r.r&�none�0r:rWr2r�r4�dater%)r;z2did't expect a directory with changed content herer(r,r')�normalrPZ
conflictedrQ�props)rQrTzrepos-status)r&r%r�)!r�rrr2r�r?r0ZgetElementsByTagName�getAttributerJr*r,rrPr�rHr)r0r.r�	nodeValuer�r�rr�r+rr3r4rSr-r�r1)rKrLrr3r4r�rJrr�docr�ZurevelsZentryelrpZstatuselZ
itemstatusr�rSZcommitelZ
author_elsr8Zitemattrname�attrZpropsstatusZ
rstatuselsZ	rstatuselZritemstatusZlockelsr
r
rr��s�	




















zXMLWCStatus.fromstring)NNN)rrrr�rOr
r
r
rr��s
ir�c@seZdZdd�Zdd�ZdS)rcCs6i}xL|�d�D]>}|��sq|�dd�\}}|���dd�}|��}|||<qWy|d|_Wntk
r|td��YnX|dd	kr�d
p�|d|_yt|d�|_	Wntk
r�d|_	YnXt
j�|d�|_|j�
�|_
d
|kr�t|d
�|_d|k�r|d|_d|k�r2t|d�|_|jd|_dS)Nr�r"r:r�rWr
zNot a versioned resourceZnodekind�	directoryror�rpZlastchangedrevZlastchangedauthorZlastchangeddatei@B)r+r)r�r4r
r�r?rqr�rr&rpr�rkZcreated_revZlast_author�parse_wcinfotimerlr)rrr�r�r�rhr
r
rrjs4


zInfoSvnWCCommand.__init__cCs|j|jkS)N)�__dict__)rr_r
r
rr`�szInfoSvnWCCommand.__eq__N)rrrrr`r
r
r
rris)rcCs>t�d|�}|std|��|��\}}t�|d�}t�|�S)z# Returns seconds since epoch, UTC. z&(\d+-\d+-\d+ \d+:\d+:\d+) ([+-]\d+) .*ztimestring %r does not matchz%Y-%m-%d %H:%M:%S)r"r�r?r�rrz�calendar�timegm)r|r��timezoner}r
r
rr[�sr[zProperties on '(.*)':cCs�dd�|�d�D�}i}x�|r�|�d�}|�|�}|sBtd|��|��d}|j|dd�}g}	x.|r�|d�d�r�|�d���}
|	�|
�qbW|	s�t	d	��t
||	�||<qW|S)
z5 Return a dictionary of path->PropListDict mappings. cSsg|]}|r|�qSr
r
)rbr�r
r
rrd�sz+make_recursive_propdict.<locals>.<listcomp>r�rz could not parse propget-line: %rr:)r;z  zmust have found properties!)r+�popr�r?r�r*rr)rr�r)ZwcrootrZrexrZpdictr�r�rpr�Z	propnamesZpropnamer
r
rr�s 

rcCs2|r|Sddlm}ddlm}|�||g�|S)Nr)r)r)Zxml.domr�xml.parsers.expatrr�)rrrr
r
rr�src@seZdZdd�Zdd�ZdS)rcCs�t|�d��|_x�td|j�D]�}|j|jkr|jdkrD|jj	|_
q|jdkrh|jr`|jj	|_q�d|_q|jdkr�|jj	}t|�|_
q|jdkrg|_x0td|j�D] }|j|jkr�|j�t|��q�WqWdS)Nr�r4r�rWrSr)r�rVrrrrrZnodeNamerrWr4r�r~rSZstrpathsrZ	PathEntry)rr Zlpartr|Zppartr
r
rr�s"



zLogEntry.__init__cCsd|j|j|jfS)Nz#<Logentry rev=%d author=%s date=%s>)rr4rS)rr
r
rr��szLogEntry.__repr__N)rrrrr�r
r
r
rr�sr)T)1r r�r2rr"r]r&rZpy._pathrrrrZrepositoriesr>r3r=r.r6r9rBZPathBaserCr~r�rr�r+r�rMr�r�r#r=r�r�r�r�rNr�r�r�r�r�rr[rrrr
r
r
r�<module>sT(		(

	
5



	
q~l-