File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/svn.cpython-310.pyc
o
�N�g�* � @ s� d Z ddlZddlZddlZddlmZ e�dej�Z dd� Z
dd� Zdd
d�Zd dd
�Z
d dd�Zd dd�Zd dd�Zd!dd�Zd"dd�Zd dd�Zd dd�Z d#dd�ZdS )$z
Subversion SCM
� N)�CommandExecutionErrorz^([^:]+):\s+(\S.*)$c C s t jj�d�du rdS dS )z'
Only load if svn is installed
�svnN)Fz;The svn execution module cannot be loaded: svn unavailable.T)�salt�utils�path�which� r r �D/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/svn.py�__virtual__ s r
c
K s� dd| g} t |�}|r|�d|g� |r|�d|g� | �|� td | fd||d�|��}|d } | d kr:|d
S t|d d d
�| � ��)a
Execute svn
return the output of the command
cmd
The command to run.
cwd
The path to the Subversion repository
user
Run svn as a user other than what the minion runs as
username
Connect to the Subversion server as another user
password
Connect to the Subversion server with this password
.. versionadded:: 0.17.0
opts
Any additional options to add to the command line
kwargs
Additional options to pass to the run-cmd
r z--non-interactivez
--usernamez
--passwordzcmd.run_allF)Zpython_shell�cwdZrunas�retcoder �stdout�stderr�
� )�list�extendZ__salt__r �join)
�cmdr �user�username�password�opts�kwargs�options�resultr r r r �_run_svn s$
���r �strc
C s� t � }|dkr|�d� |r|tjj�|�7 }td| ||||�}|dv r&|S g }|�d�D ]
} |�t� | �� q-|dkr>|S |dkrIdd � |D �S d
S )a�
Display the Subversion information from the checkout.
cwd
The path to the Subversion repository
targets : None
files, directories, and URLs to pass to the command as arguments
svn uses '.' by default
user : None
Run svn as a user other than what the minion runs as
username : None
Connect to the Subversion server as another user
password : None
Connect to the Subversion server with this password
.. versionadded:: 0.17.0
fmt : str
How to fmt the output from info.
(str, xml, list, dict)
CLI Example:
.. code-block:: bash
salt '*' svn.info /path/to/svn/repo
�xmlz--xml�info)r r r r �dictc S s g | ]}t |��qS r )r )�.0�tmpr r r �
<listcomp>y s zinfo.<locals>.<listcomp>N)
r �appendr r �args�shlex_splitr �split�_INI_RE�findall)
r �targetsr r r �fmtr �infosZ info_listZ infosplitr r r r H s
�r c G �* ||f7 }|r||f7 }t d| ||||�S )a�
Download a working copy of the remote Subversion repository
directory or file
cwd
The path to the Subversion repository
remote : None
URL to checkout
target : None
The name to give the file or directory working copy
Default: svn uses the remote basename
user : None
Run svn as a user other than what the minion runs as
username : None
Connect to the Subversion server as another user
password : None
Connect to the Subversion server with this password
.. versionadded:: 0.17.0
CLI Example:
.. code-block:: bash
salt '*' svn.checkout /path/to/repo svn://remote/repo
�checkout�r �r �remote�targetr r r r r r r r. | �
r. c G r- )a�
.. versionadded:: 2014.1.0
Switch a working copy of a remote Subversion repository
directory
cwd
The path to the Subversion repository
remote : None
URL to switch
target : None
The name to give the file or directory working copy
Default: svn uses the remote basename
user : None
Run svn as a user other than what the minion runs as
username : None
Connect to the Subversion server as another user
password : None
Connect to the Subversion server with this password
CLI Example:
.. code-block:: bash
salt '*' svn.switch /path/to/repo svn://remote/repo
�switchr/ r0 r r r r4 � r3 r4 c G �, |r
|t tjj�|��7 }td| ||||�S )ax
Update the current directory, files, or directories from
the remote Subversion repository
cwd
The path to the Subversion repository
targets : None
files and directories to pass to the command as arguments
Default: svn uses '.'
user : None
Run svn as a user other than what the minion runs as
password : None
Connect to the Subversion server with this password
.. versionadded:: 0.17.0
username : None
Connect to the Subversion server as another user
CLI Example:
.. code-block:: bash
salt '*' svn.update /path/to/repo
�update��tupler r r% r&