3
ÝPf†$ ã @ sÔ d dl mZ d dlZd dlZd dlZd dlmZ d dlm Z d dl
mZmZ d dl
mZ d dlmZmZ ejdƒZejd ƒZejd
ƒZejdƒZejdƒZejd
ƒZejeƒZG dd„ deƒZdd„ Zejeƒ dS )é )Úabsolute_importN)Úparse)ÚLink)ÚrmtreeÚdisplay_path)Ú
indent_log)ÚvcsÚVersionControlz
url="([^"]+)"zcommitted-rev="(\d+)"z URL: (.+)zRevision: (.+)z\s*revision="(\d+)"z(.*)c s� e Zd ZdZdZdZd"Zdd „ Zd
d„ Zdd
„ Z dd„ Z
dd„ Zdd„ Zdd„ Z
‡ fdd„Zdd„ Zdd„ Zdd„ Zdd„ Zed d!„ ƒZ‡ ZS )#Ú
SubversionÚsvnz.svnÚcheckoutúsvn+sshúsvn+httpú svn+httpsúsvn+svnc C s´ |j dƒj| jƒ s td| ƒ‚| jd|gdddid�}tj|ƒ}|sftjdt |ƒƒ tj
d |ƒ d
S |jdƒjƒ }t
j|ƒ}|s¦tjdt |ƒƒ tj
d |ƒ |d
fS ||jdƒfS )z/Returns (url, revision), where both are stringsú/zBad directory: %sÚinfoFZLANGÚC)Úshow_stdoutZ
extra_environz'Cannot determine URL of svn checkout %sz!Output that cannot be parsed:
%sNé z,Cannot determine revision of svn checkout %s)NN)ÚrstripÚendswithÚdirnameÚAssertionErrorÚrun_commandÚ_svn_url_reÚsearchÚloggerÚwarningr ÚdebugÚgroupÚstripÚ_svn_revision_re)ÚselfÚlocationÚoutputÚmatchÚurl© r( ú /usr/lib/python3.6/subversion.pyÚget_info s,
zSubversion.get_infoc C st | j ƒ \}}t||ƒ}| j|ƒ}tjd||ƒ tƒ �6 tjj|ƒrJt |ƒ | j
dg| ||g dd� W dQ R X dS )z@Export the svn repository at the url to the destination locationz!Exporting svn repository %s to %sÚexportF)r N)Úget_url_revÚget_rev_optionsÚremove_auth_from_urlr r r ÚosÚpathÚexistsr r )r# r$ r' ÚrevÚrev_optionsr( r( r) r+ ; s
zSubversion.exportc C s | j dg| ||g ƒ d S )NÚswitch)r )r# Údestr' r3 r( r( r) r4 J s zSubversion.switchc C s | j dg| |g ƒ d S )NÚupdate)r )r# r5 r3 r( r( r) r6 M s zSubversion.updatec C st | j ƒ \}}t||ƒ}| j|ƒ}|r.d| }nd}| j||||ƒrptjd||t|ƒƒ | jddg| ||g ƒ d S )Nz (to revision %s)Ú zChecking out %s%s to %sr z-q)r, r- r. Zcheck_destinationr r r r )r# r5 r' r2 r3 Zrev_displayr( r( r) ÚobtainP s
zSubversion.obtainc C sf x`|D ]X}t |ƒj}|sqd|kr@dj|jdƒd d… ƒjƒ }n|}||jkr|jddƒd S qW d S )Nú-r ú#r éÿÿÿÿ)r Úegg_fragmentÚjoinÚsplitÚlowerÚkey)r# ÚdistZdependency_linksr' r<