%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/states/git.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddl
ZddlZddlZddlmZddlmZddlmZeje�Zd�Zd�Zd	�Zd
�Zd�Zed�Zed
�Z d�Z!ee"d�Z#d�Z$ed�Z%eed�Z&ed�Z'ed�Z(d�Z)deeeee*e"e"e"e"e"e"e"de*e*eeeeeedded�Z+e"e*eeeeeed�Z,edeee"e"e*e"e"eeeeeed�Z-eeeeeeeed�Z.eeeeed�Z/eeeeeed�Z0d�Z1dS( u3
States to manage git repositories and git configuration

.. important::
    Before using git over ssh, make sure your remote host fingerprint exists in
    your ``~/.ssh/known_hosts`` file.

.. versionchanged:: 2015.8.8
    This state module now requires git 1.6.5 (released 10 October 2009) or
    newer.
i(tabsolute_importtprint_functiontunicode_literalsN(tCommandExecutionError(tLooseVersion(tsixcC@s9dtkrtSttddt��}|td�kS(u'
    Only load if git is available
    ugit.versiontversioninfou1.6.5(t__salt__tFalset
_LooseVersion(tgit_ver((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt__virtual__%scC@s{|dkr|dk	s0|dkr4|dk	r4tS||koKdknrTtS|dkrm|j|�S||kSdS(u�
    Shorthand helper function for comparing SHA1s. If rev_type == 'sha1' then
    the comparison will be done using str.startwith() to allow short SHA1s to
    compare successfully.

    NOTE: This means that rev2 must be the short rev.
    usha1N(tNoneRtTruet
startswith(trev1trev2trev_type((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt_revs_equal/s
cC@s|dk	r|d SdS(Ni(R(tsha1((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt
_short_shaBscC@s2dj|�}t|�dkr.|d7}n|S(u
    Return a joined list
    u. iu.(tjointlen(tcommentstret((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt_format_commentsFs
cC@s|dk	o||kS(u<
    Short hand for telling when a new branch is needed
    N(R(tbranchtlocal_branch((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt_need_branch_changePscC@s�|dk	r||krdS|dkrDttddt��}ng}|td�krr|jd|g�n9|jd�|j|dkr�|n|�|j|�|S(us
    DRY helper to build list of opts for git.branch, for the purposes of
    setting upstream tracking branch
    ugit.versionRu1.8.0u--set-upstream-tou--set-upstreamN(RR	RRtextendtappend(RRtall_local_branchestdesired_upstreamR
R((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt_get_branch_optsWs

c
C@s�tjd|�y,td|d|d|dtd|�}Wn'tk
retjd|�d}nXtjd|�y,td	|d|d|dtd|�}Wn'tk
r�tjd
|�d}nX||fS(u@
    Return the local revision for before/after comparisons
    uChecking local revision for %sugit.revisiontusertpasswordtignore_retcodetoutput_encodinguNo local revision for %suChecking local branch for %sugit.current_branchuNo local branch for %sN(tlogtinfoRR
RR(ttargetR"R#R%t	local_revR((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt_get_local_rev_and_branchqs.





cC@stjdd|j�S(ue
    Strip the actual command that was run from exc.strerror to leave just the
    error message
    u^Command [\'"].+[\'"] failed: u(tretsubtstrerror(texc((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt
_strip_exc�scC@skdj|�|d<|r,|dcd7<n|rg|dcdjtdrRdndt|��7<n|S(NuRepository {0} is up-to-dateucommentuW, but with uncommitted changes. Set 'force_reset' to True to purge uncommitted changes.u

Changes {0}made: {1}utestuthat would be u(tformatt__opts__R(RR(Rt
local_changes((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt	_uptodate�s
	
cC@sd|d<||d<|S(Nuresultucomment(R(Rtcomment((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt
_neutral_test�s

cC@s5t|d<|r'|dt|�7}n||d<|S(Nuresultu

Changes already made: ucomment(RR(RtmsgR((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt_fail�s


cC@stt|d<dj||r(dj|�nd�|d<|rp|dcdjtdr[dndt|��7<n|S(	Nuresultu#Repository already exists at {0}{1}u# and is checked out to branch '{0}'uucommentu

Changes {0}made: {1}utestuthat would be (R
R0R1R(RR(RR((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt_already_cloned�s
"
cC@s%djt|��}t|||�S(Nu�Fetch failed. Set 'force_fetch' to True to force the fetch if the failure was due to not being able to fast-forward. Output of the fetch command follows:

{0}(R0R/R7(RR.RR6((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt
_failed_fetch�scC@s dt|�}t|||�S(NuFailed to update submodules: (R/R7(RR.RR6((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt_failed_submodule_update�sc	
C@s!d}	|dkrr|dkrB||krodj||�}	qoqr|dk	rr||krrdj||�}	qrnt|�}t|�}t|dj|r�||kr�dj||�ndj|�t||�r�dj|�nd|s�d	nd
|rdnd|rdnd|	�|�S(
NuuHEADu� The desired rev ({0}) differs from the name of the local branch ({1}), if the desired rev is a branch name then a forced update could possibly be avoided by setting the 'branch' argument to '{0}' instead.u� The default remote branch ({0}) differs from the local branch ({1}). This could be caused by changing the default remote branch, or if the local branch was manually changed. Rather than forcing an update, it may be advisable to set the 'branch' argument to '{0}' instead. To ensure that this state follows the '{0}' branch instead of the remote HEAD, set the 'rev' argument to '{0}'.ueRepository would be updated {0}{1}, but {2}. Set 'force_reset' to True{3} to force this update{4}.{5}ufrom {0} to {1}uto {0}u( (after checking out local branch '{0}')u this is not a fast-forward mergeuthere are uncommitted changesu (or 'remote-changes')u and discard these changes(RR0RR7R(
RtrevtpretpostRRtdefault_branchR2Rt
branch_msg((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt_not_fast_forward�s0$uHEADuoriginu*cY@K@s-&i|d6td6dd6id6}tjjj|�}|rbt|tjjj|dt��Sn|ryt|d�Sn|r�t|d�Sn|r�t|d	j|��Sn|
ttd
fkr�t|d�Snt	|t
j�r�t
j|�}n|t
k	rZt	|t
j�r+t
j|�}ntjj|�rWt|dj|��Snn|t
k	ovt	|t
j�r�t
j|�}n|t
k	o�t	|t
j�r�t
j|�}n|t
k	o�t	|t
j�r�t
j|�}n|t
k	o	t	|t
j�rt
j|�}n|t
k	r/t	|t
j�rH|g}n t	|t�rht|d
�Sng|D]}tjj|�^qo}x�|D]�}d|kr�ytd|t�}Wn9tk
r�}tjd|�t|dj|��SnXntjj|�r(t|dj|��Snq�Wn|t
k	oKt	|t
j�r`t
j|�}n|t
k	o|t	|t
j�r�t
j|�}nttdditd6td6��}|r�i|d6ni} tjj|�r�t|dj|��Sny%tjjj|||dt�}!Wn&tk
rI}t||j��SnXtjjj|!�}"|
rnt}n|dko}|r�t|d�Sni|d6|d6}#dtkr�td|#d<nt |#||�}$t	|$t!�r�|j"|$�|Sn|rdj||�d j|�gng}%tj#d!|�yPtd"|d#td$td%|d&|d'|d(|d)|d*td+td,|�
}&Wnbt$k
r�}t|d-jt%|���Sn4t&k
r�}d.|j'kr�t$d/��n�nXd|&kr\|&d}'xXt
j(|&�D]A\}(})|(j)d0�rO|)|'krL|(j*d0�d1}*PnnqWt
}*nt
}'t
}*t}+|r�t
},t
}-n�|dkr�|'t
k	r�|'},t
}+d2}-nt
},t
}-n�d0||&kr�|&d0|},d3j+||f�}+d4}-n�d5|d6|&kr*|&d5|d6},d7}-nvd5||&krQ|&d5|},d7}-nOt,|�d8kovt-d9�|D��r�|j.�}|},d2}-nt
},t
}-|-d2kr�|dkr�d:|,d; d<}.n
|,d; }.nf|,t
k	rd=j|-d4kr�|+n||,d; �}.n/tj/d>||,|-|+|r3d?nd�t
}.|t
k	o[|-d4d7fkrnt|d@�Sn|,t
ko~|r�|dkr�t|dAj|��Snnt0tdBdCt��}/|r�dDndE}0tjj+||0�}1g}2tjj1|1�p 	tdF|d%|d&|d,|�ry�tdG|d%|d&|d,|�}3t2tdH|d%|d&|d,|��}4t3||||�\}5}6|o�	|,t
ko�	|5t
k	r�	t|dI�Sn|5}7|6}8t4||6�r^
||3kr�	|,}7nq|}8y3tdJ||dKd%|d&|d*td,|�}7Wn5t$k
rZ
}t|dLj|t%|��|2�SnXntdM|d%|d&|dNtd,|�}9t5|5|,|-�}:y6t|o�
tdO|dd%|d&|d,|��};Wn't$k
r�
tj/dP|�t};nX|;o|:r�|
tkr|dQj|�}<t6dRr`t|ddS<|2rP|<t7|2�7}<nt8||<�Sntj9|<j:dTdU��n,tj9dV||
�t;||t7|2�|;�Sn|-d2ko�|7t
k	o�|7j)|,�r�t}=n�t}=|,t
k	rr
y1tdJ||,dKd%|d&|d*td,|�Wnt$k
r1n>X|-d4kr�||9kr�y/tdJ||+d%|d&|d*td,|�}>Wnt$k
r�nX|>|,kr�t}=nnn�|-d7krZ
||4krW
y3tdJ||dKd%|d&|d*td,|�}?Wnt$k
r
t
}?nX|?|,kr"
t}=n2|
rT
t|dWj|t<|,�t<|?���Snnn|-d2kro
t}=nn|;o�
|
d
kr�
tnt
}@|=rV|:o�
|o�
|t
kp�
||6kr�
dXj|dkr�
|.j=�n|.|5d; �|d<|Sn|@tk	rS|7t
krt}@n:tdY|dZ|7|,gd[td%|d&|d*td,|�}@nn|@tkr�|
tkr�t>|||7|,||6|*|;|2�	Snd\}An|@tkr�d]}And^}A|8t
kr�t
}BnVy<tdJ||8d_d`dagd%|d&|d*td,|�}BWnt$k
r!t}BnX||9kr?|9|db}Cntj9dc||�t
}C|,t
k	om|!|Ckr%t6dRr�ddj|tjjj|C�|"�g}D|=r�|Dj?de�n|:r#|r i|5df6|,dg6|ddh<|@tkr�t|ddS<n|Dj?dij|At<|,���nn|drCt8|t7|D��Sn;|:oN|rht7|D�|d<|Snt;||t7|D��Sntdj|dk|dl|d%|d&|d(|d)|d,|�|Ct
kr�|2j?dmj||"��|dn||ddg<n+|2j?doj|tjjj|C�|"��n|,t
k	r�t6dRr�g}D|=ra|Dj?dpj|��n|:o�|p�|t
k	o�||6kr�i|5df6|,dg6|ddh<nt4||6�r ||3kr�|Dj?dqj||.��|+r�|Dj?drj|+��nn"|Dj?dsj||At<|,���n�|:r�|r�|@tkra|Dj?dtjt<|5�t<|,���n:|Dj?duj|
ov|=rd\nd^t<|5�t<|,���n|Dj?dvj|5d; |.��n|Bo�|+r�|Dj?drj|+��nM|Bo�|+tkr|Dj?dw�n+|+o|B|+kr1|Dj?dxj|+��n|drQt8|t7|D��SnGt7|D�}E|:on|on|Er�|E|d<|Snt;||t7|D��Sn|Bo�|+r�dyj|+�}Ft@||6|3|+|/�}Gn�|Bo�|+tkr|/t0dz�krd{}Fd|g}Gnt
}GnB|+o |B|+krMd}j|+�}Ft@||6|3|+|/�}Gnt
}G|Gt
k	oh|6t
kr~t|d~|2�Snt2gtdd�|dl|d`d�d%|d&|d'|d+td*td,|�	D]$}d6|kr�|j:d5d�^q��}H|4|Hkr5t}=|H|4}I|4|H}J|Ir/|I|dd�<n|o8|Jr2x�|JD]�}Ky;t6dRr�td�||Kd`d�d%|d&|d,|�nWn8t$k
r�}|jAd�g�j?d�j|K|��nX|djAd�g�j?|K�qBW|djBd��r/|2j?d�jt6dRrd�nd�d�j+|dd����nnn|=r?yDtd�|dl|d�|	d�|%d%|d&|d'|d+td,|�}LWn#t$k
r�}tC|||2�Sn X|Lr�|2j?d�j|��ny1tdJ||,dKd%|d&|d*td,|�Wn/t$k
r'}t|d�j|||��SnX|:o3|oK|t
kpK||6kr�|dkrf|.j=�n|.|d<|dcd�j|5d; �7<|Sn|7t
kr�t}@n4tdY|dZ|7|,gd[td%|d&|d,|�}@|@|
ko�tknp|@tko|;o|
tkr<t>|||7|,||6|*|;|2�	Snnt4||6�r2|;oX|rtt|d�j|6��Sn||3kr�|dkr�|,}Mn|+r�|+n|}Md�|g}Nn|}Mg}Ntd�||Md�|d`|Nd%|d&|d,|�d�|Nkr|2j?d�j||.��n|2j?d�j|M��n|@tkr�td�|d`d�|,gd%|d&|d,|| �t|ddS<|;r�|2j?d��n|2j?d�j|.��nN|@tko�|;o�|
tk	r�td�|d%|d&|d,|�|2j?d��n|Gt
k	r:td�|d`|Gd%|d&|d,|�|2j?|F�n|@tkoVt5|7|,|-�rx|+ph|dkrtd�|dd`d�gd%|d&|d*td,|�r|/t0d��kr�d�g}Ong}Otd�|d�|,d`|Od%|d&|d,|| �|2j?d�j|.��nt|d�|2�SnWtd�|d`d�|dkr@|,n|gd%|d&|d,|| �|2j?d�j|��n|r�y?td�|d�d`d�d�gd%|d&|d'|d+td,|�Wn#t$k
r�}tD|||2�SnXnn�|r�t6dRr5d�j|�}<|dr"t8||<�Snt;|||<�SnyDtd�|dl|d�|	d�|%d%|d&|d'|d+td,|�}LWn#t$k
r�}tC|||2�Sn&X|2j?d�j||Lr�d�nd��ny/td�d�|d%|d&|d*td,|�}PWnt$k
rt
}PnXWnctEk
rv}tjFd�d�t�t	|t$�rTt%|�}<nt
j|�}<t||<|2�SnX|o�t5|P|,|-�r�t|d�|2�Sn|5|Pkr�tj#d�||5|P�t7|2�|d<i|5df6|Pdg6|ddh<nt;||t7|2��Sntjj1|�r�tjG|�}Q|rzt6dRrt|dd�<|dn||ddg<t8|d�j||��Sntj9d�||�i}Rxo|QD]g}Stjj+||S�}TytjjHjI|T�Wn2tJk
r}|jKtKjLkr||R|T<nnXq�W|Rrigt
j(|R�D]\}U}Vd�j|U|V�^q }Wt|d�jd�j+|W��|2�Snt|dd�<n|Qr�t|d�j|��Snntj9d�|�t6dRr�|dn||ddg<t8|d�j||��Sny�|
r�d�gn|r	 d�gng}X|d�kr1 |XjMd�|g�n|t
k	rb |XjMd�t
j|�d�|g�nt
}6}5yEtd�||d%|d&|d`|Xd'|d(|d)|d+td,|�Wn8t$k
r� }d�jt%|��}<t||<|2�SnX|dn||ddg<|2j?d�j|||
r !d�n|r,!d�nd��|r�$|,r�!|dkr�!d�j||�}<tjF|<|�t||<d�|2�Snn.|-d7ko�!|tdH|d%|d&|d,|�kr�!t|d�j|�|2�Sn|t
k	r�"|tdG|d%|d&|d,|�kr�"|dkr%"|,}Mn|+r1"|+n|}Mtd�||Md`d�|gd%|d&|d,|�|2j?d�j||.��nnt3|||d,|�\}5}6|6t
ko�"|,t
k	o�"d|&kr�"t|d�|2�Snt5|5|,|-�r2#td�|d`d�|,gd%|d&|d,|�|2j?d�j|.��ny<tdJ||6d_d`dagd%|d&|d*td,|�}BWnt$k
r�#t}BnX|Bo�#|+r�#dyj|+�}Ft@||6tdG|d%|d&|d,|�|+|/�}Gn�|Bo�#|+tkr$|/t0dz�kr$d{}Fd|g}Gnt
}Gn^|+o)$|B|+krr$d}j|+�}Ft@||6tdG|d%|d&|d,|�|+|/�}Gnt
}G|Gt
k	r�$td�|d`|Gd%|d&|d,|�|2j?|F�nn|o�$|,r+%y9td�|d�d`d�d�gd%|d&|d'|d,|�Wn#t$k
r'%}tD|||2�SnXny/td�d�|d%|d&|d*td,|�}PWnt$k
rs%t
}PnXWnctEk
r�%}tjFd�d�t�t	|t$�r�%t%|�}<nt
j|�}<t||<|2�SnXt7|2�}<tj#|<�|<|d<|Pt
k	r)&it
df6|Pdg6|ddh<n|S(�u�2
    Make sure the repository is cloned to the given directory and is
    up-to-date.

    name
        Address of the remote repository, as passed to ``git clone``

        .. note::
             From the `Git documentation`_, there are two URL formats
             supported for SSH authentication. The below two examples are
             equivalent:

             .. code-block:: text

                 # ssh:// URL
                 ssh://user@server/project.git

                 # SCP-like syntax
                 user@server:project.git

             A common mistake is to use an ``ssh://`` URL, but with a colon
             after the domain instead of a slash. This is invalid syntax in
             Git, and will therefore not work in Salt. When in doubt, confirm
             that a ``git clone`` works for the URL before using it in Salt.

             It has been reported by some users that SCP-like syntax is
             incompatible with git repos hosted on `Atlassian Stash/BitBucket
             Server`_. In these cases, it may be necessary to use ``ssh://``
             URLs for SSH authentication.

        .. _`Git documentation`: https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#The-SSH-Protocol
        .. _`Atlassian Stash/BitBucket Server`: https://www.atlassian.com/software/bitbucket/server

    rev : HEAD
        The remote branch, tag, or revision ID to checkout after clone / before
        update. If specified, then Salt will also ensure that the tracking
        branch is set to ``<remote>/<rev>``, unless ``rev`` refers to a tag or
        SHA1, in which case Salt will ensure that the tracking branch is unset.

        If ``rev`` is not specified, it will be assumed to be ``HEAD``, and
        Salt will not manage the tracking branch at all.

        .. versionchanged:: 2015.8.0
            If not specified, ``rev`` now defaults to the remote repository's
            HEAD.

    target
        Name of the target directory where repository is about to be cloned

    branch
        Name of the local branch into which to checkout the specified rev. If
        not specified, then Salt will not care what branch is being used
        locally and will just use whatever branch is currently there.

        .. versionadded:: 2015.8.0

        .. note::
            If this argument is not specified, this means that Salt will not
            change the local branch if the repository is reset to another
            branch/tag/SHA1. For example, assume that the following state was
            run initially:

            .. code-block:: yaml

                foo_app:
                  git.latest:
                    - name: https://mydomain.tld/apps/foo.git
                    - target: /var/www/foo
                    - user: www

            This would have cloned the HEAD of that repo (since a ``rev``
            wasn't specified), and because ``branch`` is not specified, the
            branch in the local clone at ``/var/www/foo`` would be whatever the
            default branch is on the remote repository (usually ``master``, but
            not always). Now, assume that it becomes necessary to switch this
            checkout to the ``dev`` branch. This would require ``rev`` to be
            set, and probably would also require ``force_reset`` to be enabled:

            .. code-block:: yaml

                foo_app:
                  git.latest:
                    - name: https://mydomain.tld/apps/foo.git
                    - target: /var/www/foo
                    - user: www
                    - rev: dev
                    - force_reset: True

            The result of this state would be to perform a hard-reset to
            ``origin/dev``. Since ``branch`` was not specified though, while
            ``/var/www/foo`` would reflect the contents of the remote repo's
            ``dev`` branch, the local branch would still remain whatever it was
            when it was cloned. To make the local branch match the remote one,
            set ``branch`` as well, like so:

            .. code-block:: yaml

                foo_app:
                  git.latest:
                    - name: https://mydomain.tld/apps/foo.git
                    - target: /var/www/foo
                    - user: www
                    - rev: dev
                    - branch: dev
                    - force_reset: True

            This may seem redundant, but Salt tries to support a wide variety
            of use cases, and doing it this way allows for the use case where
            the local branch doesn't need to be strictly managed.

    user
        Local system user under which to run git commands. By default, commands
        are run by the user under which the minion is running.

        .. note::
            This is not to be confused with the username for http(s)/SSH
            authentication.

        .. versionadded:: 0.17.0

    password
        Windows only. Required when specifying ``user``. This parameter will be
        ignored on non-Windows platforms.

        .. versionadded:: 2016.3.4

    update_head : True
        If set to ``False``, then the remote repository will be fetched (if
        necessary) to ensure that the commit to which ``rev`` points exists in
        the local checkout, but no changes will be made to the local HEAD.

        .. versionadded:: 2015.8.3

    force_checkout : False
        When checking out the local branch, the state will fail if there are
        unwritten changes. Set this argument to ``True`` to discard unwritten
        changes when checking out.

    force_clone : False
        If the ``target`` directory exists and is not a git repository, then
        this state will fail. Set this argument to ``True`` to remove the
        contents of the target directory and clone the repo into it.

    force_fetch : False
        If a fetch needs to be performed, non-fast-forward fetches will cause
        this state to fail. Set this argument to ``True`` to force the fetch
        even if it is a non-fast-forward update.

        .. versionadded:: 2015.8.0

    force_reset : False
        If the update is not a fast-forward, this state will fail. Set this
        argument to ``True`` to force a hard-reset to the remote revision in
        these cases.

        .. versionchanged:: 2019.2.0
            This option can now be set to ``remote-changes``, which will
            instruct Salt not to discard local changes if the repo is
            up-to-date with the remote repository.

    submodules : False
        Update submodules on clone or branch change

    bare : False
        Set to ``True`` if the repository is to be a bare clone of the remote
        repository.

        .. note:

            Setting this option to ``True`` is incompatible with the ``rev``
            argument.

    mirror
        Set to ``True`` if the repository is to be a mirror of the remote
        repository. This implies that ``bare`` set to ``True``, and thus is
        incompatible with ``rev``.

    remote : origin
        Git remote to use. If this state needs to clone the repo, it will clone
        it using this value as the initial remote name. If the repository
        already exists, and a remote by this name is not present, one will be
        added.

    fetch_tags : True
        If ``True``, then when a fetch is performed all tags will be fetched,
        even those which are not reachable by any branch on the remote.

    sync_tags : True
        If ``True``, then Salt will delete tags which exist in the local clone
        but are not found on the remote repository.

        .. versionadded:: 2018.3.4

    depth
        Defines depth in history when git a clone is needed in order to ensure
        latest. E.g. ``depth: 1`` is useful when deploying from a repository
        with a long history. Use rev to specify branch or tag. This is not
        compatible with revision IDs.

        .. versionchanged:: 2019.2.0
            This option now supports tags as well as branches, on Git 1.8.0 and
            newer.

    identity
        Path to a private key to use for ssh URLs. This can be either a single
        string, or a list of strings. For example:

        .. code-block:: yaml

            # Single key
            git@github.com:user/repo.git:
              git.latest:
                - user: deployer
                - identity: /home/deployer/.ssh/id_rsa

            # Two keys
            git@github.com:user/repo.git:
              git.latest:
                - user: deployer
                - identity:
                  - /home/deployer/.ssh/id_rsa
                  - /home/deployer/.ssh/id_rsa_alternate

        If multiple keys are specified, they will be tried one-by-one in order
        for each git command which needs to authenticate.

        .. warning::

            Unless Salt is invoked from the minion using ``salt-call``, the
            key(s) must be passphraseless. For greater security with
            passphraseless private keys, see the `sshd(8)`_ manpage for
            information on securing the keypair from the remote side in the
            ``authorized_keys`` file.

            .. _`sshd(8)`: http://www.man7.org/linux/man-pages/man8/sshd.8.html#AUTHORIZED_KEYS_FILE%20FORMAT

        .. versionchanged:: 2015.8.7
            Salt will no longer attempt to use passphrase-protected keys unless
            invoked from the minion using ``salt-call``, to prevent blocking
            waiting for user input.

        .. versionchanged:: 2016.3.0
            Key can now be specified as a SaltStack fileserver URL (e.g.
            ``salt://path/to/identity_file``).

    https_user
        HTTP Basic Auth username for HTTPS (only) clones

        .. versionadded:: 2015.5.0

    https_pass
        HTTP Basic Auth password for HTTPS (only) clones

        .. versionadded:: 2015.5.0

    onlyif
        A command to run as a check, run the named command only if the command
        passed to the ``onlyif`` option returns true

    unless
        A command to run as a check, only run the named command if the command
        passed to the ``unless`` option returns false

    refspec_branch : *
        A glob expression defining which branches to retrieve when fetching.
        See `git-fetch(1)`_ for more information on how refspecs work.

        .. versionadded:: 2017.7.0

    refspec_tag : *
        A glob expression defining which tags to retrieve when fetching. See
        `git-fetch(1)`_ for more information on how refspecs work.

        .. versionadded:: 2017.7.0

    output_encoding
        Use this option to specify which encoding to use to decode the output
        from any git commands which are run. This should not be needed in most
        cases.

        .. note::
            This should only be needed if the files in the repository were
            created with filenames using an encoding other than UTF-8 to handle
            Unicode characters.

        .. versionadded:: 2018.3.1

    .. _`git-fetch(1)`: http://git-scm.com/docs/git-fetch

    .. note::
        Clashing ID declarations can be avoided when including different
        branches from the same git repository in the same SLS file by using the
        ``name`` argument. The example below checks out the ``gh-pages`` and
        ``gh-pages-prod`` branches from the same repository into separate
        directories. The example also sets up the ``ssh_known_hosts`` ssh key
        required to perform the git checkout.

        Also, it has been reported that the SCP-like syntax for

        .. code-block:: yaml

            gitlab.example.com:
              ssh_known_hosts:
                - present
                - user: root
                - enc: ecdsa
                - fingerprint: 4e:94:b0:54:c1:5b:29:a2:70:0e:e1:a3:51:ee:ee:e3

            git-website-staging:
              git.latest:
                - name: git@gitlab.example.com:user/website.git
                - rev: gh-pages
                - target: /usr/share/nginx/staging
                - identity: /root/.ssh/website_id_rsa
                - require:
                  - pkg: git
                  - ssh_known_hosts: gitlab.example.com

            git-website-staging:
              git.latest:
                - name: git@gitlab.example.com:user/website.git
                - rev: gh-pages
                - target: /usr/share/nginx/staging
                - identity: salt://website/id_rsa
                - require:
                  - pkg: git
                  - ssh_known_hosts: gitlab.example.com

            git-website-prod:
              git.latest:
                - name: git@gitlab.example.com:user/website.git
                - rev: gh-pages-prod
                - target: /usr/share/nginx/prod
                - identity: /root/.ssh/website_id_rsa
                - require:
                  - pkg: git
                  - ssh_known_hosts: gitlab.example.com
    unameuresultuucommentuchangest	raise_excu'remote' argument is requiredu'target' argument is requiredu1'{0}' is not a valid value for the 'rev' argumenturemote-changesu='force_reset' must be one of True, False, or 'remote-changes'u$target '{0}' is not an absolute pathu*identity must be either a list or a stringusalt://u
cp.cache_fileuFailed to cache %suidentity '{0}' does not exist.u&identity '{0}' is not an absolute pathugit.config_get_regexpu
filter\.lfs\.uglobaluignore_retcodeuidentityu9Target '{0}' exists and is a regular file, cannot proceedt
https_onlyuHEADu>'rev' is not compatible with the 'mirror' and 'bare' argumentsurunasupasswordushellu#refs/heads/{0}:refs/remotes/{1}/{0}u+refs/tags/{0}:refs/tags/{0}uChecking remote revision for %sugit.remote_refstheadsttagsR"R#tidentityt
https_usert
https_passR$tsaltenvR%u Failed to check remote refs: {0}uglobal nameuHFailed to check remote refs: You may need to install GitPython or PyGit2urefs/heads/i����usha1u/ubranchu
refs/tags/u^{}utagi(cs@s|]}|tjkVqdS(N(tstringt	hexdigits(t.0tx((s3/usr/lib/python2.7/site-packages/salt/states/git.pys	<genexpr>=su
remote HEAD (iu)u	{0} ({1})u}Unable to determine remote_loc. rev is %s, remote_rev is %s, remove_rev_type is %s, desired_upstream is %s, and bare is%s setu notu_When 'depth' is used, 'rev' must be set to the name of a branch or tag on the remote repositoryu:No revision matching '{0}' exists in the remote repositoryugit.versionRurefsu.gitugit.is_worktreeugit.list_branchesu
git.list_tagsuQRemote repository is empty, cannot update from a non-empty to an empty repositoryu
git.rev_parseu	^{commit}u1Unable to get position of local branch '{0}': {1}ugit.remotestredact_authugit.diffu7git.latest: Unable to determine if %s has local changesu�{0} is up-to-date, but with uncommitted changes. Since 'force_reset' is set to True, these local changes would be reset. To only reset when there are changes in the remote repository, set 'force_reset' to 'remote-changes'.utestu
forced updateuwoulduwillug%s up-to-date, but with uncommitted changes. Since 'force_reset' is set to %s, no changes will be made.u�'{0}' is a tag, but the remote SHA1 for this tag ({1}) doesn't match the local SHA1 ({2}). Set 'force_reset' to True to force this update.uu{0} is already present and local HEAD ({1}) does not match, but update_head=False. HEAD has not been updated locally.ugit.merge_basetrefstis_ancestoru
hard-resetufast-forwardeduupdatedu@{upstream}toptsu--abbrev-refufetchu+Remote '%s' not found in git checkout at %su-Remote '{0}' would be changed from {1} to {2}uRemote would be fetcheduoldunewurevisionuRepository would be {0} to {1}ugit.remote_setturltremoteuRemote '{0}' set to {1}u => u$Remote '{0}' changed from {1} to {2}uRemote '{0}' would be fetcheduCNew branch '{0}' would be checked out, with {1} as a starting pointu#Tracking branch would be set to {0}u0Branch '{0}' would be checked out and {1} to {2}u2Repository would be fast-forwarded from {0} to {1}u'Repository would be {0} from {1} to {2}u\Local HEAD ({0}) does not match {1} but update_head=False, HEAD would not be updated locallyuTracking branch would be unsetu'Tracking branch would be updated to {0}uTracking branch was set to {0}u1.8.0uTracking branch was unsetu--unset-upstreamu"Tracking branch was updated to {0}u~Cannot set/unset upstream tracking branch, local HEAD refers to nonexistent branch. This may have been caused by cloning a remote repository for which the default branch was renamed or deleted. If you are unable to fix the remote repository, you can work around this by setting the 'branch' argument (which will ensure that the named branch is created if it does not already exist).u
git.ls_remotetcwdu--tagsunew_tagsugit.tagu-duwarningsu(Failed to remove local tag '{0}':

{1}

udeleted_tagsu;The following tags {0} removed from the local checkout: {1}uwould beuwereu, u	git.fetchtforcetrefspecsu*{0} was fetched, resulting in updated refsu;Fetch did not successfully retrieve rev '{0}' from {1}: {2}ur is already present and local HEAD ({0}) does not match, but update_head=False. HEAD has not been updated locally.ueLocal branch '{0}' has uncommitted changes. Set 'force_checkout' to True to discard them and proceed.u-bugit.checkoutu>New branch '{0}' was checked out, with {1} as a starting pointu'{0}' was checked outu	git.resetu--hardu"Uncommitted changes were discardedu Repository was hard-reset to {0}ugit.discard_local_changesu
git.branchugit.symbolic_refu--quietu1.8.1.6u	--ff-onlyu	git.mergeR;u$Repository was fast-forwarded to {0}u(Unable to fast-forward, HEAD is detachedu*Repository was reset to {0} (fast-forward)u
git.submoduleuupdateu--initu--recursiveu'Bare repository at {0} would be fetchedu%Bare repository at {0} was fetched{1}u, resulting in updated refsugit.revisionu(Unexpected exception in git.latest statetexc_infouFailed to update repositoryuRepository %s updated: %s => %suforced cloneu�Target directory {0} exists. Since force_clone=True, the contents of {0} would be deleted, and {1} would be cloned into this directory.ufRemoving contents of %s to clone repository %s in its place (force_clone=True set in git.latest state)u
  {0}
    {1}uUnable to remove
{0}u
u�Target '{0}' exists, is non-empty and is not a git repository. Set the 'force_clone' option to True to remove this directory's contents and proceed with cloning the remote repositoryu/Target %s is not found, 'git clone' is requiredu%Repository {0} would be cloned to {1}u--mirroru--bareuoriginu--originu--depthu--branchu	git.cloneuClone failed: {0}u{0} cloned to {1}{2}u
 as mirroru as bare repositoryu<%s was cloned but is empty, so {0}/{1} cannot be checked outu
Repositoryu&Revision '{0}' does not exist in cloneu6Branch '{0}' checked out, with {1} as a starting pointuERemote HEAD refers to a ref that does not exist. This can happen when the default branch on the remote repository is renamed or deleted. If you are unable to fix the remote repository, you can work around this by setting the 'branch' argument (which will ensure that the named branch is created if it does not already exist).uRepository was reset to {0}(NR
tsalttutilstargstclean_kwargsR7tinvalid_kwargsRR0t
isinstanceRtstring_typest	text_typeRtostpathtisabstlistt
expanduserRt__env__tIOErrorR&t	exceptiontbooltisfileRQtadd_http_basic_autht
ValueErrort__str__tredact_http_basic_autht
__grains__t
mod_run_checktdicttupdateR'RR/t	NameErrortmessaget	iteritemsRt	partitionRRtalltlowertwarningR	tisdirtsetR*RRR1RR5tdebugtreplaceR3Rt
capitalizeR@RR!t
setdefaulttgetR9R:t	Exceptionterrortlistdirtfilestrm_rftOSErrorterrnotENOENTR(YtnameR;R(RR"R#tupdate_headtforce_checkouttforce_clonetforce_fetchtforce_resett
submodulestbaretmirrorRRt
fetch_tagst	sync_tagstdepthRERFRGtonlyiftunlesstrefspec_branchtrefspec_tagR%tkwargsRRLt
ident_pathR.tuse_lfstlfs_optstdesired_fetch_urltredacted_fetch_urltrun_check_cmd_kwargstcretRUtall_remote_refsthead_revtrefnametrefshaR>R t
remote_revtremote_rev_typet
remote_locR
tchecktgitdirRRtall_local_tagsR)Rtbase_revtbase_branchtremotest
revs_matchR2R6thas_remote_revt
local_copytlocal_tag_sha1tfast_forwardtmerge_actiontupstreamt	fetch_urltactionstformatted_actionstupstream_actiontbranch_optstremote_tagstnew_tagstdeleted_tagsttag_namet
fetch_changestcheckout_revt
checkout_optst
merge_optstnew_revttarget_contentstremoval_errorst
target_objectttarget_pathtktvterr_stringst
clone_opts((s3/usr/lib/python2.7/site-packages/salt/states/git.pytlatest
s��n"
%


	
-

								

		
	


	


	

	
	







				
			
	

	








		







			

4



$





		


	


			



	











1

$%




	

	



			




c	
C@s�i|d6td6dd6id6}	tjj|�r�|r_tjjtjj|d��r_|	S|r�tjjtjj|d��s�td|d	|d
|d|�r�|	S|r�tdr�||	dd
<t|	dd<t|	dj	||r�dnd��St
jd||rdnd�y9tjj|�rBtj
|�ntjjj|�Wn)tk
r�}
t|	dj	||
��SXt|	dd<q�tj|�r�t|	dj	|��Sntdr�||	dd
<t|	dj	|r�dnd��Stdd|d|d|d|d|d	|d
|d|�dj	|rBdnd|�g}|rp|jdj	|��n|r�|jdj	|��ndj|�}t|�dkr�|d 7}nt
j|�||	dd
<||	d<|	S(!uU	
    Ensure that a repository exists in the given directory

    .. warning::
        If the minion has Git 2.5 or later installed, ``name`` points to a
        worktree_, and ``force`` is set to ``True``, then the worktree will be
        deleted. This has been corrected in Salt 2015.8.0.

    name
        Path to the directory

        .. versionchanged:: 2015.8.0
            This path must now be absolute

    force : False
        If ``True``, and if ``name`` points to an existing directory which does
        not contain a git repository, then the contents of that directory will
        be recursively removed and a new repository will be initialized in its
        place.

    bare : True
        If ``True``, and a repository must be initialized, then the repository
        will be a bare repository.

        .. note::
            This differs from the default behavior of :py:func:`git.init
            <salt.modules.git.init>`, make sure to set this value to ``False``
            if a bare repo is not desired.

    template
        If a new repository is initialized, this argument will specify an
        alternate template directory.

        .. versionadded:: 2015.8.0

    separate_git_dir
        If a new repository is initialized, this argument will specify an
        alternate ``$GIT_DIR``

        .. versionadded:: 2015.8.0

    shared
        Set sharing permissions on git repo. See `git-init(1)`_ for more
        details.

        .. versionadded:: 2015.5.0

    user
        User under which to run git commands. By default, commands are run by
        the user under which the minion is running.

        .. versionadded:: 0.17.0

    password
        Windows only. Required when specifying ``user``. This parameter will be
        ignored on non-Windows platforms.

      .. versionadded:: 2016.3.4

    output_encoding
        Use this option to specify which encoding to use to decode the output
        from any git commands which are run. This should not be needed in most
        cases.

        .. note::
            This should only be needed if the files in the repository were
            created with filenames using an encoding other than UTF-8 to handle
            Unicode characters.

        .. versionadded:: 2018.3.1

    .. _`git-init(1)`: http://git-scm.com/docs/git-init
    .. _`worktree`: http://git-scm.com/docs/git-worktree
    unameuresultuucommentuchangesuHEADu.gitugit.is_worktreeR"R#R%utestunewuforced initu�Target directory {0} exists. Since force=True, the contents of {0} would be deleted, and a {1}repository would be initialized in its place.ubare ueRemoving contents of %s to initialize %srepository in its place (force=True set in git.present state)uUnable to remove {0}: {1}u�Target '{0}' exists, is non-empty, and is not a git repository. Set the 'force' option to True to remove this directory's contents and proceed with initializing a repositoryu"New {0}repository would be createdugit.initRSR�ttemplatetseparate_git_dirtsharedu Initialized {0}repository in {1}uTemplate directory set to {0}uGitdir set to {0}u. iu.(R
R_R`RxRhRRR1R5R0R&RztislinktunlinkRWRXR�R�R�R7R�RRR'(
R�RTR�R�R�R�R"R#R%RR.R�Rr((s3/usr/lib/python2.7/site-packages/salt/states/git.pytpresents�S"'!
	





c/K@sKi|d6td6dd6id6}tjjj|�}|r_t|tjjj|dt��S|s{t|dj|��S|s�t|dj|��St	|t
j�s�t
j|�}n|d_k	rt	|t
j�s�t
j|�}ntjj|�st|d	j|��Sn|d_k	rGt	|t
j�rGt
j|�}n|d_k	rxt	|t
j�rxt
j|�}n|d_k	r~t	|t
j�r�|g}nt	|t�s�t|d
�Sg|D]}tjj|�^q�}x�|D]�}d|krOytd|�}WqOtk
rK}tjd
||�t|dj|��SXntjj|�s�t|dj|��Sq�Wn|d_k	r�t	|t
j�r�t
j|�}n|
d_k	r�t	|
t
j�r�t
j|
�}
ntjj|�rt|dj|��Sy%tjjj|||
dt�}Wn#tk
rR}t||j��SXtjjj|�}i|d6}dtkr�td|d<nt|||�}t	|t�r�|j |�|Sd}t!|�dkrt"d�|D��r|j#�}d}ng}t}d_}tjj$|d�}tjj%|�sbtd|d|d|d|�r�t&|||d|�d}|dkr�y-td||d|d|dtd|�Wnt'k
r�t}q�Xt}qBtd |d|d|d!td|�}||kr%|||d"kr%qBd_} ||krH||d"} nt(d#rkt)|d$j||��Std%|d&|d'|d|d|d(|d)|
d|�|j*d*j|| |��n�tjj%|�r#tj+|�}!|rt(d#rt)|d+j||��Stj,d,||�i}"xo|!D]g}#tjj$||#�}$ytjj-j.|$�Wq,t/k
r�}|j0t0j1kr�||"|$<q�q,Xq,W|"r�gt
j2|"�D]\}%}&d-j|%|&�^q�}'t|d.jd/j$|'��|�St|dd0<q#|!r#t|d1j|��Sntj,d2|�t(d#rVt)|d3j||��Sy�d4g}(|d5kr�|(j3d6|g�ntd7||d|d|d8|(d9|d(|d)|
d:t4d|�|j*d;j||��Wn`t5k
rA}tjd<d=t�t	|t'�r"t6|�})nt
j|�})t||)|�SXd>j|�d?g}*|s/	|tkrln�t(d#r�t)|d@j|��SyDtdA|d'|dBtdC|*d|d|d9|d:t4d|�}+Wn=t'k
r	}dD})|)dEt
j|�7})t||)|�SX|+r/	|j*dFj|��nd},|dkr�	td||d|d|d|�ro	|},q`
t|dGj|��Sn�y�tdH|d|d|d9|d(|d)|
dtd|�}-dI|dJ||-kr�	|-dI|dJ|},n7dK||-kr
|-dK|},nt|dGj|��SWn/t'k
r_
}t|dLj|t6|���SX|	r�
t(d#r�
t)|dMj|��StdN|d8dOdPgd|d|d|�|j*dQ�n|,|kr�
d_}.n�t(d#ri|dR6|,dS6|ddP<t)|dTj|,|��StdU||,dB|d|d|d|�|j*dVj|,|��y/tdWdX|d|d|dtd|�}.Wnt'k
r�d_}.nX|
r�tdY|dZd8d[d\gd|d|d9|d|�|j*d]�n|.d_k	ri|dR6|.dS6|ddP<n
|j*d^�t7|�})tj8|)�|)|d<|S(`u
    .. versionadded:: 2016.3.0

    Make sure a repository is cloned to the given target directory and is
    a detached HEAD checkout of the commit ID resolved from ``rev``.

    name
        Address of the remote repository.

    rev
        The branch, tag, or commit ID to checkout after clone.
        If a branch or tag is specified it will be resolved to a commit ID
        and checked out.

    target
        Name of the target directory where repository is about to be cloned.

    remote : origin
        Git remote to use. If this state needs to clone the repo, it will clone
        it using this value as the initial remote name. If the repository
        already exists, and a remote by this name is not present, one will be
        added.

    user
        User under which to run git commands. By default, commands are run by
        the user under which the minion is running.

    password
        Windows only. Required when specifying ``user``. This parameter will be
        ignored on non-Windows platforms.

      .. versionadded:: 2016.3.4

    force_clone : False
        If the ``target`` directory exists and is not a git repository, then
        this state will fail. Set this argument to ``True`` to remove the
        contents of the target directory and clone the repo into it.

    force_checkout : False
        When checking out the revision ID, the state will fail if there are
        unwritten changes. Set this argument to ``True`` to discard unwritten
        changes when checking out.

    fetch_remote : True
        If ``False`` a fetch will not be performed and only local refs
        will be reachable.

    hard_reset : False
        If ``True`` a hard reset will be performed before the checkout and any
        uncommitted modifications to the working directory will be discarded.
        Untracked files will remain in place.

        .. note::
            Changes resulting from a hard reset will not trigger requisites.

    submodules : False
        Update submodules

    identity
        A path on the minion (or a SaltStack fileserver URL, e.g.
        ``salt://path/to/identity_file``) to a private key to use for SSH
        authentication.

    https_user
        HTTP Basic Auth username for HTTPS (only) clones

    https_pass
        HTTP Basic Auth password for HTTPS (only) clones

    onlyif
        A command to run as a check, run the named command only if the command
        passed to the ``onlyif`` option returns true

    unless
        A command to run as a check, only run the named command if the command
        passed to the ``unless`` option returns false

    output_encoding
        Use this option to specify which encoding to use to decode the output
        from any git commands which are run. This should not be needed in most
        cases.

        .. note::
            This should only be needed if the files in the repository were
            created with filenames using an encoding other than UTF-8 to handle
            Unicode characters.

        .. versionadded:: 2018.3.1
    unameuresultuucommentuchangesRAu1'{0}' is not a valid value for the 'rev' argumentu4'{0}' is not a valid value for the 'target' argumentu$Target '{0}' is not an absolute pathu*Identity must be either a list or a stringusalt://u
cp.cache_fileuFailed to cache %s: %suIdentity '{0}' does not exist.u&Identity '{0}' is not an absolute pathu9Target '{0}' exists and is a regular file, cannot proceedRBurunasushellurefi(cs@s|]}|tjkVqdS(N(RIRJ(RKRL((s3/usr/lib/python2.7/site-packages/salt/states/git.pys	<genexpr>�	suhashu.gitugit.is_worktreeR"R#R%iugit.describeR$ugit.remotesRMufetchutestuRemote {0} would be set to {1}ugit.remote_setRQRRRFRGu&Remote {0} updated from '{1}' to '{2}'u�Target directory {0} exists. Since force_clone=True, the contents of {0} would be deleted, and {1} would be cloned into this directory.uhRemoving contents of %s to clone repository %s in its place (force_clone=True set in git.detached state)u
  {0}
    {1}uUnable to remove
{0}u
uforced cloneu�Target '{0}' exists, is non-empty and is not a git repository. Set the 'force_clone' option to True to remove this directory's contents and proceed with cloning the remote repositoryu/Target %s is not found, 'git clone' is requiredu%Repository {0} would be cloned to {1}u
--no-checkoutuoriginu--originu	git.cloneRPRERHu{0} cloned to {1}u*Unexpected exception in git.detached stateRVurefs/heads/*:refs/remotes/{0}/*u+refs/tags/*:refs/tags/*u&Repository remote {0} would be fetchedu	git.fetchRTRUuFetch failedu:

u1Remote {0} was fetched, resulting in updated refsuRevision '{0}' does not existugit.remote_refsu
refs/remotes/u/u
refs/tags/u Failed to list refs for {0}: {1}u,Hard reset to HEAD would be performed on {0}u	git.resetu--harduHEADu9Repository was reset to HEAD before checking out revisionuoldunewu)Commit ID {0} would be checked out at {1}ugit.checkoutu$Commit ID {0} was checked out at {1}ugit.revisionRSu
git.submoduleuupdateu--initu--recursiveuSubmodules were updatedu'Already checked out at correct revisionN(9R
RWRXRYRZR7R[RR0R\RR]R^RR_R`RaRbRcRReR&R�RhRQRiRjRkRlRmRnRoRpRRuRvRRxR*RR1R5RR�RzR�R�R�R�R�RsRRdRR/RR'(/R�R;R(RRR"R#R�R�tfetch_remotet
hard_resetR�RERFRGR�R�R%R�RRLR�R.R�R�R�R�R�Rthash_exists_locallytlocal_commit_idR�R�tcurrent_fetch_urlR�R�R�R�R�R�R�R�R6RUR�tcheckout_commit_idR�R�((s3/usr/lib/python2.7/site-packages/salt/states/git.pytdetached�snl"
%




	
	



	
	 







1


	
	


			

	












c	@sPi�d6td6dd6id6}	�d%kr<d|	d<|	St�tj�s`tj���ntjj��s�d|	d<|	S|d%k	r�t|tj�s�tj|�}n|s�d|	d<|	Sntjj	��s�t
}
nTy$td	�d
|d|d|�Wn'tk
r/}tj|�|	d<|	SXt}
g}��fd
�}
d�}|
r�t
dr�|
|	�dj��|d%k	r�dj|�nd�}t|	|�S|d%k	r�d|gnd%}y?td��d|d
|d|d|d|d|d|�Wn5tk
rB}djt|��}t|	||�SX|jdj��|d%k	rpdj|�nd��|
|	�t|�|	d<t
|	d<|	S|d%kr�t|	�||�Std�d
|d|d|�}||krt|	�||�St
dr2||	||�t|	dj|��Sy0td�d|d
|d|dt
d|�Wn2tk
r�djd |f�}d!|g}n
X|}d%}y0td"�d|d|d
|d|d|�Wn2tk
r}d#j||�}t|	||�SX|jd$j|��||	||�t|�|	d<t
|	d<|	Sd%S(&u�
    .. versionadded:: 2018.3.3,2019.2.0

    Ensure that a repository has been cloned to the specified target directory.
    If not, clone that repository. No fetches will be performed once cloned.

    name
        Address of the remote repository

    target
        Name of the target directory where repository should be cloned

    branch
        Remote branch to check out. If unspecified, the default branch (i.e.
        the one to the remote HEAD points) will be checked out.

        .. note::
            The local branch name will match the remote branch name. If the
            branch name is changed, then that branch will be checked out
            locally, but keep in mind that remote repository will not be
            fetched. If your use case requires that you keep the clone up to
            date with the remote repository, then consider using
            :py:func:`git.latest <salt.states.git.latest>`.

    user
        User under which to run git commands. By default, commands are run by
        the user under which the minion is running.

    password
        Windows only. Required when specifying ``user``. This parameter will be
        ignored on non-Windows platforms.

    identity
        Path to a private key to use for ssh URLs. Works the same way as in
        :py:func:`git.latest <salt.states.git.latest>`, see that state's
        documentation for more information.

    https_user
        HTTP Basic Auth username for HTTPS (only) clones

    https_pass
        HTTP Basic Auth password for HTTPS (only) clones

    output_encoding
        Use this option to specify which encoding to use to decode the output
        from any git commands which are run. This should not be needed in most
        cases.

        .. note::
            This should only be needed if the files in the repository were
            created with filenames using an encoding other than UTF-8 to handle
            Unicode characters.
    unameuresultuucommentuchangesu'target' argument is requiredu'target' path must be absoluteuInvalid 'branch' argumentu
git.statusR"R#R%c@s�d�|dd<dS(Nu => uchangesunew((R(R�R((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt_clone_changes-scS@s i|d6|d6|dd<dS(Nuoldunewuchangesubranch((Rtoldtnew((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt_branch_changes0sutestu{0} would be cloned to {1}{2}u with branch '{0}'u--branchu	git.cloneRPRERFRGuClone failed: {0}u{0} cloned to {1}{2}ugit.current_branchu Branch would be changed to '{0}'u
git.rev_parseR;R$u/uoriginu-bugit.checkoutu%Failed to change branch to '{0}': {1}uBranch changed to '{0}'N(RRR\RR]R^R_R`RatexistsR
RRR1R0R5RR/R7RRR8R(R�R(RR"R#RERFRGR%Rt
need_cloneR.RR�R�R4R�R6tcurrent_branchR�R�((R�R(s3/usr/lib/python2.7/site-packages/salt/states/git.pytcloned�
s�>"


	
	

	




	


cK@s�i|d6id6td6dd6}tjjj|�}|jdt�}|jdt�}	|r�t|tjjj|dt��S|r�|r�t|d	�St	|t
j�s�t
j|�}n|d$k	r�t	|t
j�s�t
j|�}q�nd
|jd
�jd�d}
tdd
|d|
d|d|d|dtd|i|d6�}|s`|S|	sgt
j|�D]9\}}
t|
�dkrvdj|dj|
��^qv}|r|d$k	r�t|djdj|���St|djdj|���Sqntdr;||d<t|djt|���S|d$krP|}nAtdd
|d|
dd$d|d|dtd|i|d6�}g}x�|D]�}yCtdd
|d|d|d|	d|d|d|i|d6�Wq�tk
rR}dj|�}|d$k	r!|d7}n|d t|�7}tj|�|j|�q�Xq�W|r|t|d!jdj|���Stdd
|d|
dd$d|d|dtd|i|d6�}xs|D]k}||kr�|||d|<ng||D]}|||kr�|^q�}|r�||d|<q�q�W|d$krH|}nAtdd
|d|
d|d|d|dtd|i|d6�}|r�gt
j|�D]'\}}
dj|dj|
��^q�}t|d"jdj|���Sd#|d<|S(%u'

    .. versionadded:: 2015.8.0

    Ensure that the named config key is not present

    name
        The name of the configuration key to unset. This value can be a regex,
        but the regex must match the entire key name. For example, ``foo\.``
        would not match all keys in the ``foo`` section, it would be necessary
        to use ``foo\..+`` to do so.

    value_regex
        Regex indicating the values to unset for the matching key(s)

        .. note::
            This option behaves differently depending on whether or not ``all``
            is set to ``True``. If it is, then all values matching the regex
            will be deleted (this is the only way to delete multiple values
            from a multivar). If ``all`` is set to ``False``, then this state
            will fail if the regex matches more than one value in a multivar.

    all : False
        If ``True``, unset all matches

    repo
        Location of the git repository for which the config value should be
        set. Required unless ``global`` is set to ``True``.

    user
        User under which to run git commands. By default, commands are run by
        the user under which the minion is running.

    password
        Windows only. Required when specifying ``user``. This parameter will be
        ignored on non-Windows platforms.

      .. versionadded:: 2016.3.4

    global : False
        If ``True``, this will set a global git config option

    output_encoding
        Use this option to specify which encoding to use to decode the output
        from any git commands which are run. This should not be needed in most
        cases.

        .. note::
            This should only be needed if the files in the repository were
            created with filenames using an encoding other than UTF-8 to handle
            Unicode characters.

        .. versionadded:: 2018.3.1


    **Examples:**

    .. code-block:: yaml

        # Value matching 'baz'
        mylocalrepo:
          git.config_unset:
            - name: foo.bar
            - value_regex: 'baz'
            - repo: /path/to/repo

        # Ensure entire multivar is unset
        mylocalrepo:
          git.config_unset:
            - name: foo.bar
            - all: True

        # Ensure all variables in 'foo' section are unset, including multivars
        mylocalrepo:
          git.config_unset:
            - name: 'foo\..+'
            - all: True

        # Ensure that global config value is unset
        mylocalrepo:
          git.config_unset:
            - name: foo.bar
            - global: True
    unameuchangesuresultuNo matching keys are setucommentuglobaluallRAu?Non-global config options require the 'repo' argument to be setu^u$ugit.config_get_regexpRStkeytvalue_regexR"R#R$R%iu	{0} ({1})u, ukMultiple values are matched by value_regex for the following keys (set 'all' to True to force removal): {0}u; uSMultivar(s) matched by the key expression (set 'all' to True to force removal): {0}utestu${0} key(s) would have value(s) unsetugit.config_unsetRuuFailed to unset '{0}'u using value_regex '{1}'u: u_Error(s) occurred unsetting values for the following keys (see the minion log for details): {0}uFailed to unset value(s): {0}uValue(s) successfully unsetN(R
RWRXRYRZtpopRR7R[R\RR]R^RtlstriptrstripRRsRR0RR1R5RR/R&R�R(R�R�trepoR"R#R%R�Rtglobal_tall_R�tpre_matchesRLtytgreedy_matchesR<tfailedtkey_nameR.R6R=tunsettpost_matches((s3/usr/lib/python2.7/site-packages/salt/states/git.pytconfig_unset�s�Z

 
3

	






-	
:
cK@s�i|d6id6td6dd6}|d#k	rG|d#k	rGt|d�Stjjj|�}|jdt�}	|r�t|tjjj	|dt��S|	r�|r�t|d	�St
|tj�s�tj
|�}n|d#k	rt
|tj�stj
|�}nd
|d
}
|g}n|d#k	r�t
|t�s|y|jd�}Wq�tk
rxtj
|�jd�}q�XnUg}xF|D]>}
t
|
tj�r�|j|
�q�|jtj
|
��q�W|}|}
|}ntdd
|d|d|d|dtd|itd6|	d6�}||krWdj|	r@dnd||
�|d<|Stdr�i|d6|d6|d<dj|	r�dnd||d#kr�dnd|
�}t||�SyEtdd
|d|d|d|d|d|d|i|	d6�}WnAtk
rD}t|dj|	r+d nd||
t|���SX||krpi|d6|d6|d|<n||kr�t|d!j|	r�d nd||
��Sd"j|	r�dnd||d#kr�dnd|
�|d<|S($u		
    .. versionadded:: 2014.7.0
    .. versionchanged:: 2015.8.0
        Renamed from ``git.config`` to ``git.config_set``. For earlier
        versions, use ``git.config``.

    Ensure that a config value is set to the desired value(s)

    name
        Name of the git config value to set

    value
        Set a single value for the config item

    multivar
        Set multiple values for the config item

        .. note::
            The order matters here, if the same parameters are set but in a
            different order, they will be removed and replaced in the order
            specified.

        .. versionadded:: 2015.8.0

    repo
        Location of the git repository for which the config value should be
        set. Required unless ``global`` is set to ``True``.

    user
        User under which to run git commands. By default, the commands are run
        by the user under which the minion is running.

    password
        Windows only. Required when specifying ``user``. This parameter will be
        ignored on non-Windows platforms.

      .. versionadded:: 2016.3.4

    global : False
        If ``True``, this will set a global git config option

    output_encoding
        Use this option to specify which encoding to use to decode the output
        from any git commands which are run. This should not be needed in most
        cases.

        .. note::
            This should only be needed if the files in the repository were
            created with filenames using an encoding other than UTF-8 to handle
            Unicode characters.

        .. versionadded:: 2018.3.1

    **Local Config Example:**

    .. code-block:: yaml

        # Single value
        mylocalrepo:
          git.config_set:
            - name: user.email
            - value: foo@bar.net
            - repo: /path/to/repo

        # Multiple values
        mylocalrepo:
          git.config_set:
            - name: mysection.myattribute
            - multivar:
              - foo
              - bar
              - baz
            - repo: /path/to/repo

    **Global Config Example (User ``foo``):**

    .. code-block:: yaml

        mylocalrepo:
          git.config_set:
            - name: user.name
            - value: Foo Bar
            - user: foo
            - global: True
    unameuchangesuresultuucommentu/Only one of 'value' and 'multivar' is permitteduglobalRAu?Non-global config options require the 'repo' argument to be setu'u,ugit.config_getRSR�R"R#R$R%uallu{0}'{1}' is already set to {2}uGlobal key utestuoldunewu{0}'{1}' would be {2} {3}uadded asuset tougit.config_settvaluetmultivaru"Failed to set {0}'{1}' to {2}: {3}uglobal key uFailed to set {0}'{1}' to {2}u{0}'{1}' was {2} {3}N(R
RR7RWRXRYRZR�RR[R\RR]R^RbtsplittAttributeErrorRRR0R1R5RR/(R�R�R�R�R"R#R%R�RR�t
value_commenttdesiredtnew_multivartitemR<R6R=R.((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt
config_set�s�]



	


	



cC@s�tj|�}|jitd6td6td6td6�|dk	r	t|t�s_|g}nx�|D]�}t|tj	�r�|r�qfny#t
d||�dkr�wfnWn;tk
r�}tj
d|�idj|�d	6td
6SXidd	6td6td
6SWn|dk	r�t|t�s0|g}nx�|D]�}t|tj	�r[|r[Pny!t
d||�dkr{PnWq7tk
r�}tj
d
|�idj|�d	6td
6SXq7Widd	6td6td
6SntS(u�
    Execute the onlyif and unless logic. Return a result dict if:

    * onlyif failed (onlyif != 0)
    * unless succeeded (unless == 0)

    Otherwise, returns ``True``
    uuse_vtubguignore_retcodeupython_shellucmd.retcodeiu0The following onlyif command raised an error: %su3onlyif raised error ({0}), see log for more detailsucommenturesultuonlyif condition is falseu
skip_watchu0The following unless command raised an error: %su3unless raised error ({0}), see log for more detailsuunless condition is trueN(tcopytdeepcopyRpRR
RR\RbRR]RRR&RfR0(t
cmd_kwargsR�R�tcommandR.((s3/usr/lib/python2.7/site-packages/salt/states/git.pyRnq
s^		


	




(2t__doc__t
__future__RRRR�R�tloggingR_R+RItsalt.utils.argsRWtsalt.utils.filestsalt.utils.urltsalt.utils.versionstsalt.exceptionsRRR	tsalt.extRt	getLoggert__name__R&RRRRRRR!R*R/RR3R5R7R8R9R:R@R
R�R�R�R�R�R�Rn(((s3/usr/lib/python2.7/site-packages/salt/states/git.pyt<module>s�	
			
					3�������������

Zerion Mini Shell 1.0