File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/hg.cpython-310.pyc
o
�N�gB � @ s� d Z ddlZddlZddlZddlmZ e�e�Z dd� Z
dd� Zdd
d�Zddd
�Z
ddd�Zddd�Zddd�Zddd�Zddd�ZdS )z
Support for the Mercurial SCM
� N)�CommandExecutionErrorc C s t jj�d�du rdS dS )z&
Only load if hg is installed
�hgN)Fz9The hg execution module cannot be loaded: hg unavailable.T)�salt�utils�path�which� r r �C/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/hg.py�__virtual__ s r
c C s dd| � �gS )Nz--sshzssh -i r )Z
identity_pathr r r � _ssh_flag s r �tipFc C sF ddd|sdndd|� g}t d || |dd �}|d
dkr!|d S dS )
a�
Returns the long hash of a given identifier (hash, branch, tag, HEAD, etc)
cwd
The path to the Mercurial repository
rev: tip
The revision
short: False
Return an abbreviated commit hash
user : None
Run hg as a user other than what the minion runs as
CLI Example:
.. code-block:: bash
salt '*' hg.revision /path/to/repo mybranch
r �idz-iz--debug� �-r�cmd.run_allF��cwd�runas�python_shell�retcoder �stdout)�__salt__)r �rev�short�user�cmd�resultr r r �revision s
r c C s8 ddd|� ddg}t d || |dd�}|pt| |d d
�S )a]
Mimic git describe and return an identifier for the given revision
cwd
The path to the Mercurial repository
rev: tip
The path to the archive tarball
user : None
Run hg as a user other than what the minion runs as
CLI Example:
.. code-block:: bash
salt '*' hg.describe /path/to/repo
r �logr z
--templatez4'{{latesttag}}-{{latesttagdistance}}-{{node|short}}'�cmd.run_stdoutFr T)r )r r )r r r r �descr r r �describe<