File: //kunden/lib/python3/dist-packages/breezy/__pycache__/cmd_version_info.cpython-39.pyc
a
�*�^ � @ sx d Z ddlmZ ddlmZ ee� d� ddlmZ ddlmZ ddl m
Z
mZ dd lm
Z
d
d� ZG dd
� d
e�ZdS )z>Commands for generating snapshot information about a brz tree.� )�absolute_import� )�lazy_importzs
from breezy import (
branch,
version_info_formats,
workingtree,
)
from breezy.i18n import gettext
)�errors)�Command)�Option�RegistryOption)� text_typec C sB zt �| �W S ty< t �� }t�td��| |���Y n0 dS )z�Convert a string passed by the user into a VersionInfoFormat.
This looks in the version info format registry, and if the format
cannot be found, generates a useful error exception.
z:No known version info format {0}. Supported types are: {1}N)�version_info_formatsZget_builder�KeyErrorZget_builder_formatsr �BzrCommandError�gettext�format)r Zformats� r �9/usr/lib/python3/dist-packages/breezy/cmd_version_info.py�_parse_version_info_format( s ��r c
@ sl e Zd ZdZeddddd�eddd �ed
dd �edd
d �eddd �ededd�dgZdgZdZ ddd�Z
dS )�cmd_version_infoa& Show version information about this tree.
You can use this command to add information about version into
source code of an application. The output can be in one of the
supported formats or in a custom format based on a template.
For example::
brz version-info --custom \
--template="#define VERSION_INFO \"Project 1.2.3 (r{revno})\"\n"
will produce a C header file with formatted string containing the
current revision number. Other supported variables in templates are:
* {date} - date of the last revision
* {build_date} - current date
* {revno} - revision number
* {revision_id} - revision id
* {branch_nick} - branch nickname
* {clean} - 0 if the source tree contains uncommitted changes,
otherwise 1
r zSelect the output format.T)zbreezy.version_info_formats�format_registry)Zvalue_switchesZ
lazy_registry�allz!Include all possible information.)�helpzcheck-cleanzCheck if tree is clean.zinclude-historyzInclude the revision-history.zinclude-file-revisionsz(Include the last revision for each file.�templatezTemplate for the output.)�typer �revisionz location?�replaceNFc
C s� |rt |�dkrt�td���|d u r*d}|d u r<tj�� }ztj� |�d } W n$ tj
yt tj�
|�}
d } Y n0 | j}
|r�d}d}d}|r�d}d}d|v r�d}|d ur�|d �|
�}nd }||
| |||||d�}|�| j� d S )Nr z@brz version-info --revision takes exactly one revision specifier�.r Tz{clean})Zworking_treeZcheck_for_cleanZinclude_revision_history�include_file_revisionsr �revision_id)�lenr r r
r
r �getZworkingtreeZWorkingTreeZopen_containingZ
NoWorkingTree�branchZBranch�openZas_revision_idZgenerateZoutf)
�self�locationr r Zcheck_cleanZinclude_historyr r r Zwt�br Zbuilderr r r �runb sB �
�zcmd_version_info.run)NNFFFFNN)�__name__�
__module__�__qualname__�__doc__r r r Z
takes_optionsZ
takes_argsZ
encoding_typer$ r r r r r 7 s4 �
���� �r N)r( Z
__future__r r �globals� r Zcommandsr Zoptionr r Zsixishr r r r r r r �<module> s