%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/hg.pyo

�
���^c	@@s�dZddlmZmZmZddlZddlZddlZddlZ	ddl
mZddlm
Z
mZeje�Ze	jjj�r�dndZd�Zddeddeeed	�Zd
�Zd�Zd�ZdS(
u�
Interaction with Mercurial repositories
=======================================

Before using hg over ssh, make sure the remote host fingerprint already exists
in ~/.ssh/known_hosts, and the remote host has this host's public key.

.. code-block:: yaml

    https://bitbucket.org/example_user/example_repo:
        hg.latest:
          - rev: tip
          - target: /tmp/example_repo
i(tabsolute_importtprint_functiontunicode_literalsN(tCommandExecutionError(t_failt
_neutral_testuhg.exeuhgcC@stdt�S(u&
    Only load if hg is available
    ucmd.has_exec(t__salt__t	HG_BINARY(((s2/usr/lib/python2.7/site-packages/salt/states/hg.pyt__virtual__!sc	C@si|d6td6dd6id6}	|s5t|	d�Stjj|�o_tjjdj|��}
|
r�t|	||||||||�	}	n�tjj|�r�t|	||�}|dk	r�|Snt	j
d|�td	r�t|	d
j||��St
|	||||||�|	S(u�
    Make sure the repository is cloned to the given directory and is up to date

    name
        Address of the remote repository as passed to "hg clone"

    rev
        The remote branch, tag, or revision hash to clone/pull

    target
        Target destination directory path on minion to clone into

    clean
        Force a clean update with -C (Default: False)

    user
        Name of the user performing repository management operations

        .. versionadded:: 0.17.0

    identity
        Private SSH key on the minion server for authentication (ssh://)

        .. versionadded:: 2015.5.0

    force
        Force hg to clone into pre-existing directories (deletes contents)

    opts
        Include additional arguments and options to the hg command line

    update_head
        Should we update the head if new changes are found? Defaults to True

        .. versionadded:: 2017.7.0

    unameuresultuucommentuchangesu"target option is requiredu{0}/.hgu.target %s is not found, "hg clone" is requiredutestu+Repository {0} is about to be cloned to {1}N(tTrueRtostpathtisdirtformatt_update_repot_handle_existingtNonetlogtdebugt__opts__Rt_clone_repo(tnametrevttargettcleantusertidentitytforcetoptstupdate_headtrett
is_repositorytfail((s2/usr/lib/python2.7/site-packages/salt/states/hg.pytlatest(s&."
'

c	
C@s<tjd|�td|d|dd�}	|	sHt|dj|��Stdrqdj||	�}
t||
�Sy,td	|d|d
|d|d|�}Wn(tk
r�}t|d
<||d<|SX|tkrd|k}
|
r�d|d<n
d|d<|S|rVy!td||d|d|�Wq�tk
rR}t|d
<||d<|SXnLy!td|dd|d|�Wn(tk
r�}t|d
<||d<|SXtdd|d|dd�}|	|krdj|	|�}tj	d||�dj|�|d<||dd<n"d|kr8t|dj|��S|S(uQ
    Update the repo to a given revision. Using clean passes -C to the hg up
    u;target %s is found, "hg pull && hg up is probably required"uhg.revisionRRu.u%Seems that {0} is not a valid hg repoutestuDRepository {0} update is probably required (current revision is {1})uhg.pullRRt
repositoryuresultucommentuno changes founduKUpdate is probably required but update_head=False so we will skip updating.u=No changes found and update_head=False so will skip updating.u	hg.updateRutiptcwdu
{0} => {1}uRepository %s updated: %suRepository {0} updated.uchangesurevisionuerror:uAn error was thrown by hg:
{0}(
RRRRR
RRRtFalsetinfo(RRRRRRRRRtcurrent_revttest_resulttpull_outterrtchangestnew_revt
revision_text((s2/usr/lib/python2.7/site-packages/salt/states/hg.pyRqs`
,



!

!

cC@sltj|�}|s5tjd|�tj|�n3|r[tjd|�tj|�n
t|d�SdS(Nu?target %s found, but directory is empty, automatically deletinguPtarget %s found and is not empty. Since force option is in use, deleting anyway.u"Directory exists, and is not empty(R
tlistdirRRtshutiltrmtreeR(RRRt	not_empty((s2/usr/lib/python2.7/site-packages/salt/states/hg.pyR�s	c	C@s$y)td||d|d|d|�}Wn(tk
rS}t|d<||d<|SXtjj|�sst||�S|r�ytd||d|�Wq�tk
r�}t|d<||d<|SXntdd	|d|�}	d
j||�}
tj	|
�|
|d<||dd<|	|dd
<|S(Nuhg.cloneRRRuresultucommentu	hg.updateuhg.revisionR#uRepository {0} cloned to {1}uchangesunewurevision(
RRR$R
RRRR
RR%(RRRRRRRtresultR)R+tmessage((s2/usr/lib/python2.7/site-packages/salt/states/hg.pyR�s,)






(t__doc__t
__future__RRRtloggingR
R.tsalt.utils.platformtsalttsalt.exceptionsRtsalt.states.gitRRt	getLoggert__name__Rtutilstplatformt
is_windowsRRRR$R	R!RRR(((s2/usr/lib/python2.7/site-packages/salt/states/hg.pyt<module>s*	A	A	

Zerion Mini Shell 1.0