3
_Af3                 @   sh   d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ d dl	m
Z
 d dlZG dd de
jeZdS )    )print_functionN)GitcAvailableCommand)GitcManifest)initc                   s8   e Zd ZdZdZdZdZ fddZ fddZ  Z	S )	GitcInitTzInitialize a GITC Client.z
%prog [options] [client name]
a  
The '%prog' command is ran to initialize a new GITC client for use
with the GITC file system.

This command will setup the client directory, initialize repo, just
like repo init does, and then downloads the manifest collection
and installs it in the .repo/directory of the GITC client.

Once this is done, a GITC manifest is generated by pulling the HEAD
SHA for each project and generates the properly formatted XML file
and installs it as .manifest in the GITC client directory.

The -c argument is required to specify the GITC client name.

The optional -f argument can be used to specify the manifest file to
use for this GITC client.
c                sF   t t| j|dd |jd}|jddddd |jd	d
ddd d S )NT)Z	gitc_initzGITC optionsz-fz--manifest-filemanifest_filez3Optional manifest file to use for this GITC client.)desthelpz-cz--gitc-clientgitc_clientz9The name of the gitc_client instance to create or modify.)superr   _Optionsadd_option_group
add_option)selfpg)	__class__ C/home/qytech/356xLinux510-101server/.repo/repo/subcmds/gitc_init.pyr   4   s    
zGitcInit._Optionsc                s   t jtj }| s$|jr<||jkr<tdtjd tjd tj	j
t j || _tt| j|| | jj}|jrtj	j|jstd|j  tjd |j}t| j|}|j| t jd | tdtj	j
tj j|  d S )NzEfatal: Please update your repo command. See go/gitc for instructions.)file   z1fatal: Specified manifest file %s does not exist.z,Please run `cd %s` to view your GITC client.)
gitc_utilsparse_clientdirosgetcwdr
   printsysstderrexitpathjoinget_gitc_manifest_dir
client_dirr   r   ExecutemanifestZmanifestFiler   existsr   repodirOverridegenerate_gitc_manifestwrapperWrapperZGITC_FS_ROOT_DIR)r   optargsr
   r   r$   )r   r   r   r#   >   s(    




zGitcInit.Execute)
__name__
__module____qualname__commonhelpSummary	helpUsagehelpDescriptionr   r#   __classcell__r   r   )r   r   r      s   
r   )
__future__r   r   r   r   commandr   manifest_xmlr   subcmdsr   r)   ZInitr   r   r   r   r   <module>   s   