File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/__pycache__/hgfs.cpython-310.pyc
Back
o ;j�{ � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl ZddlZddl ZddlZddlZddlZddlZddlZddlmZ ddlmZ ddlmZ dZdZzddlZd ZW n eyq d ZY nw e�e�Z dZ!dZ"d d� Z#dd� Z$dd� Z%dd� Z&dd� Z'dd� Z(dd� Z)dd� Z*dd� Z+dd � Z,d!d"� Z-d#d$� Z.d%d&� Z/dDd'd(�Z0dDd)d*�Z1d+d,� Z2d-d.� Z3dEd/d0�Z4dFd2d3�Z5d4d5� Z6d6d7� Z7d8d9� Z8d:d;� Z9d<d=� Z:d>d?� Z;d@dA� Z<dBdC� Z=dS )Ga� Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. After enabling this backend, branches, bookmarks, and tags in a remote mercurial repository are exposed to salt as different environments. This feature is managed by the :conf_master:`fileserver_backend` option in the salt master config file. This fileserver has an additional option :conf_master:`hgfs_branch_method` that will set the desired branch method. Possible values are: ``branches``, ``bookmarks``, or ``mixed``. If using ``branches`` or ``mixed``, the ``default`` branch will be mapped to ``base``. .. versionchanged:: 2014.1.0 The :conf_master:`hgfs_base` master config parameter was added, allowing for a branch other than ``default`` to be used for the ``base`` environment, and allowing for a ``base`` environment to be specified when using an :conf_master:`hgfs_branch_method` of ``bookmarks``. :depends: - mercurial - python bindings for mercurial (``python-hglib``) � N)�datetime)�DEFAULT_HASH_TYPE��FileserverConfigError)�tagify)�branches� bookmarks�mixed)�base� branch_method� mountpoint�rootTF�hgfs)�hgc C sh t td vrdS tst�d� dS td tvr"t�dtd t� dS tjj� d�du r2t�d� dS t S ) z- Only load if mercurial is available Zfileserver_backendFzeMercurial fileserver backend is enabled in configuration but could not be loaded, is hglib installed?Zhgfs_branch_methodz6Invalid hgfs_branch_method '%s'. Valid methods are: %sr Nz2hgfs requested but hg executable is not available.) �__virtualname__�__opts__�HAS_HG�log�error�VALID_BRANCH_METHODS�salt�utils�path�which� r r �H/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/hgfs.py�__virtual__Q s$ �� r c C s dd� | � � D �}|S )z5 Returns all branches for the specified repo c S �6 g | ]}t jj�|d �|d t jj�|d �f�qS �r � � �r r �stringutils�to_str��.0�xr r r � <listcomp>q � (��z!_all_branches.<locals>.<listcomp>)r )�repor r r r � _all_branchesj s �r* c �2 z� fdd�t | �D �d W S ty Y dS w )z9 Find the requested branch in the specified repo c � g | ] }|d � kr|�qS �r r r$ ��namer r r'