Your IP : 216.73.216.196


Current Path : /opt/alt/python35/lib/python3.5/site-packages/setuptools_scm/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/setuptools_scm/__pycache__/git.cpython-35.pyc



,�?\��
@s�ddlmZddlmZmZmZddlmZddlm	Z	m
Z
ddlZyddlmZWn"e
k
r�ddlmZYnXdZGd	d
�d
e�Zdd�Zd
d�Zdd�Zeeddd�Zdd�ZdS)�)�
Configuration)�do_ex�trace�has_command)�meta�)�isfile�joinN)�samefilez.git describe --dirty --tags --long --match *.*c@s�eZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dS)�
GitWorkdirz$experimental, may change at any timecCs
||_dS)N)�path)�selfr�r�C/opt/alt/python35/lib/python3.5/site-packages/setuptools_scm/git.py�__init__szGitWorkdir.__init__cCst|d|j�S)N�cwd)rr)r
�cmdrrrrszGitWorkdir.do_excCsLtd|�\}}}|r"dStd|�t||�sBdS||�S)Nzgit rev-parse --show-toplevelz	real root)rrr
)�cls�wd�real_wd�_�retrrr�from_potential_worktrees
z"GitWorkdir.from_potential_worktreecCs"|jd�\}}}t|�S)Nz+git status --porcelain --untracked-files=no)r�bool)r
�outrrrr�is_dirty&szGitWorkdir.is_dirtycCs9|jd�\}}}|r5td|||�dS|S)Nzgit rev-parse --abbrev-ref HEADz
branch err)rr)r
�branch�errrrrr�
get_branch*s
zGitWorkdir.get_branchcCstt|jd��S)Nz.git/shallow)rr	r)r
rrr�
is_shallow1szGitWorkdir.is_shallowcCs|jd�dS)Nzgit fetch --unshallow)r)r
rrr�
fetch_shallow4szGitWorkdir.fetch_shallowcCs0|jd�\}}}|s,|dd�SdS)Nz#git rev-parse --verify --quiet HEAD�)r)r
�rev_noderrrrr�node7szGitWorkdir.nodecCs)|jd�\}}}|jd�dS)Nzgit rev-list HEAD�
r)r�count)r
�revsrrrr�count_all_nodes<szGitWorkdir.count_all_nodesN)�__name__�
__module__�__qualname__�__doc__rr�classmethodrrrrr r#r'rrrrrsrcCs'|j�r#tjd|jf�dS)z$experimental, may change at any timez$"%s" is shallow and may cause errorsN)r�warnings�warnr)rrrr�warn_on_shallowAsr/cCs'|j�r#tjd�|j�dS)z$experimental, may change at any timez/"%s" was shallow, git fetch was used to rectifyN)rr-r.r )rrrr�fetch_on_shallowGs
r0cCs#|j�rtd|j��dS)z$experimental, may change at any timez:%r is shallow, please correct with "git fetch --unshallow"N)r�
ValueErrorr)rrrr�fail_on_shallowNsr2cCsw|std|�}td�s%dStj|j�}|dkrGdS|rW||�|jri|j}|j|�\}}}|r�|j�}|j�}	|dkr�t	dddd|	d|�St	dd|j
�d	d
|d|	d|j�d|�St|�\}
}}}	|j�}
|rQt	|
d|d|d	|d|	d|
�St	|
d|d	|d|	d|
�SdS)zQ
    :param pre_parse: experimental pre_parse action, may change at any time
    �root�gitNz0.0�distancer�dirty�configr#�gr)
rrrr�
absolute_root�git_describe_commandrr#rrr'r�_git_parse_describe)r3�describe_command�	pre_parser7rr�
unused_errrr"r6�tag�numberr#rrrr�parseVsF
		
rAcCse|jd�r(d}|dd�}nd}|jdd�\}}}t|�}||||fS)Nz-dirtyT�F�-�i����)�endswith�rsplit�int)�describe_outputr6r?r@r#rrrr;�sr;)r7r�utilsrrr�versionr�os.pathrr	r-r
�ImportErrorZwin_py31_compat�DEFAULT_DESCRIBE�objectrr/r0r2rAr;rrrr�<module>s
/	6