HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/git/refs/__pycache__/head.cpython-310.pyc
o

;j�(�@s�dZddgZddlmZmZddlmZddlmZddl	m
Z
dd	lmZdd
l
mZmZmZmZddlmZmZerHddlmZdd
lmZdedefdd�ZGdd�de�ZGdd�de
�ZdS)zcSome ref-based objects.

Note the distinction between the :class:`HEAD` and :class:`Head` classes.
�HEAD�Head�)�GitConfigParser�SectionConstraint)�GitCommandError)�	join_path�)�	Reference)�SymbolicReference)�Any�Sequence�
TYPE_CHECKING�Union)�
Commit_ish�PathLike��RemoteReference)�Repo�string�returncCs$|�d�r|�d�r|dd�S|S)N�"r���)�
startswith�endswith)r�r�A/opt/saltstack/salt/lib/python3.10/site-packages/git/refs/head.py�strip_quotessrc
s�eZdZdZdZdZdZefdddeddf�fd	d
�
Zde	fdd�Z
		
		ddeee	e
fdededeeeedfdeddfdd�Z�ZS)rzqSpecial case of a :class:`~git.refs.symbolic.SymbolicReference` representing the
    repository's HEAD reference.Z	ORIG_HEADr�repor�pathrNcs.||jkrtd|j|f��t��||�dS)Nz&HEAD instance must point to %r, got %r)�
_HEAD_NAME�
ValueError�super�__init__)�selfrr��	__class__rrr".s
z
HEAD.__init__cCst|j|j�S)z�
        :return:
            :class:`~git.refs.symbolic.SymbolicReference` pointing at the ORIG_HEAD,
            which is maintained to contain the previous value of HEAD.
        )r
r�_ORIG_HEAD_NAME�r#rrr�	orig_head3szHEAD.orig_headTF�commit�index�working_tree�paths�kwargsc
Ks~d}|r
d}|r
d}|rd}|std��z|jjj||d|fi|��W|Sty>}z
|jdkr3�WYd}~|Sd}~ww)a.Reset our HEAD to the given commit optionally synchronizing the index and
        working tree. The reference we refer to will be set to commit as well.

        :param commit:
            :class:`~git.objects.commit.Commit`, :class:`~git.refs.reference.Reference`,
            or string identifying a revision we should reset HEAD to.

        :param index:
            If ``True``, the index will be set to match the given commit.
            Otherwise it will not be touched.

        :param working_tree:
            If ``True``, the working tree will be forcefully adjusted to match the given
            commit, possibly overwriting uncommitted changes without warning.
            If `working_tree` is ``True``, `index` must be ``True`` as well.

        :param paths:
            Single path or list of paths relative to the git root directory
            that are to be reset. This allows to partially reset individual files.

        :param kwargs:
            Additional arguments passed to :manpage:`git-reset(1)`.

        :return:
            self
        z--softz--mixedNz--hardz?Cannot reset the working tree if the index is not reset as wellz--r)r r�git�resetr�status)r#r)r*r+r,r-�mode�errrr/;s&#�

���z
HEAD.reset)rTFN)�__name__�
__module__�__qualname__�__doc__rr&�	__slots__rr"r
r(rr�str�boolrrr/�
__classcell__rrr$rr%s0
�������c@s�eZdZdZdZdZdZedd�ddd	d
dede	d
df
dd��Z
dedd
dfdd�Zd
edfdd�Z
d$deded
dfdd�Zd$dede	d
edfdd�Zded
eefdd�Zd
eefd d!�Zd
eefd"d#�ZdS)%ra�A Head is a named reference to a :class:`~git.objects.commit.Commit`. Every Head
    instance contains a name and a :class:`~git.objects.commit.Commit` object.

    Examples::

        >>> repo = Repo("/path/to/repo")
        >>> head = repo.heads[0]

        >>> head.name
        'master'

        >>> head.commit
        <git.Commit "1c09f116cbc2cb4100fb6935bb162daa4723f455">

        >>> head.commit.hexsha
        '1c09f116cbc2cb4100fb6935bb162daa4723f455'
    z
refs/heads�remote�mergeF)�forcerr�headszUnion[Head, str]r=r-rNcOs$d}|rd}|jj|g|�R�dS)z�Delete the given heads.

        :param force:
            If ``True``, the heads will be deleted even if they are not yet merged into
            the main development stream. Default ``False``.
        z-dz-DN)r.�branch)�clsrr=r>r-�flagrrr�delete�szHead.delete�remote_reference)rNcCs�ddlm}|durt||�std|��|���A}|dur7|�|j�|�|j�t|�	��dkr6|�
�n|�|j|j�|�|jt
�|j��Wd�|SWd�|S1s]wY|S)aConfigure this branch to track the given remote reference. This will
        alter this branch's configuration accordingly.

        :param remote_reference:
            The remote reference to track or None to untrack any references.

        :return:
            self
        rrNzIncorrect parameter type: %rr)r;r�
isinstancer �
config_writerZ
remove_option�k_config_remote�k_config_remote_ref�len�optionsZremove_sectionZ	set_valueZremote_namer�to_full_pathZremote_head)r#rCr�writerrrr�set_tracking_branch�s,

�
�
�
�
�
�
zHead.set_tracking_branchcCstddlm}|��}|�|j�r8|�|j�r8t|jt�t	|�
|j����}|�t|�
|j�|j��}||j|�SdS)z�
        :return:
            The remote reference we are tracking, or ``None`` if we are not a tracking
            branch.
        rrN)
r;r�
config_readerZ
has_optionrFrGrrrJr�	get_valuer�name)r#r�reader�refZremote_refpathrrr�tracking_branch�s�zHead.tracking_branch�new_pathcCs2d}|rd}|jj�|||�d|j|f|_|S)a�Rename self to a new path.

        :param new_path:
            Either a simple name or a path, e.g. ``new_name`` or ``features/new_name``.
            The prefix ``refs/heads`` is implied.

        :param force:
            If ``True``, the rename will succeed even if a head with the target name
            already exists.

        :return:
            self

        :note:
            Respects the ref log, as git commands are used.
        z-mz-Mz%s/%s)rr.r?�_common_path_defaultr)r#rSr=rArrr�rename�szHead.rename)rrcKsN||d<|ddur|�d�|jjj|fi|��|jjjr#|jjS|jjS)a�Check out this head by setting the HEAD to this reference, by updating the
        index to reflect the tree we point to and by updating the working tree to
        reflect the latest index.

        The command will fail if changed working tree files would be overwritten.

        :param force:
            If ``True``, changes to the index and the working tree will be discarded.
            If ``False``, :exc:`~git.exc.GitCommandError` will be raised in that
            situation.

        :param kwargs:
            Additional keyword arguments to be passed to git checkout, e.g.
            ``b="new_branch"`` to create a new branch at the given spot.

        :return:
            The active branch after the checkout operation, usually self unless a new
            branch has been created.
            If there is no active branch, as the HEAD is now detached, the HEAD
            reference will be returned instead.

        :note:
            By default it is only allowed to checkout heads - everything else will leave
            the HEAD detached which is allowed and possible, but remains a special state
            that some tools might not be able to handle.
        �fF)�poprr.�checkout�headZis_detachedZ
active_branch)r#r=r-rrrrX�s

z
Head.checkout�	read_onlycCs*|r|j��}n|j��}t|d|j�S)Nzbranch "%s")rrMrErrO)r#rZ�parserrrr�_config_parsers
zHead._config_parsercC�|jdd�S)z�
        :return:
            A configuration parser instance constrained to only read this instance's
            values.
        T�rZ�r\r'rrrrM�zHead.config_readercCr])z�
        :return:
            A configuration writer instance with read-and write access to options of
            this head.
        Fr^r_r'rrrrE$r`zHead.config_writer)F)r3r4r5r6rTrFrG�classmethodr9rrBrrLrRrrUrXrrr\rMrErrrrr|s&&	N)r6�__all__Z
git.configrrZgit.excrZgit.utilrZ	referencer	Zsymbolicr
�typingrrr
rZ	git.typesrrZgit.refsrZgit.reporr8rrrrrrr�<module>sW