3
_Af                 @   s<   d dl mZ d dlZd dlZd dlmZ G dd deZdS )    )print_functionN)PagedCommandc               @   sH   e Zd ZdZdZdZdZedd Zdd Z	d	d
 Z
dd Zdd ZdS )ManifestFzManifest inspection utilityz0
%prog [-o {-|NAME.xml}] [-m MANIFEST.xml] [-r]
a
  

With the -o option, exports the current manifest for inspection.
The manifest and (if present) local_manifest.xml are combined
together to produce a single manifest file.  This file can be stored
in a Git repository for use during future 'repo init' invocations.

c          
   C   s\   | j d }tjjt}tjj|}ttjj|dd}x|D ]}||7 }q>W W d Q R X |S )N
Zdocszmanifest-format.md)_helpDescriptionospathdirname__file__openjoin)selfZhelptextrfdline r   B/home/qytech/356xLinux510-101server/.repo/repo/subcmds/manifest.pyhelpDescription'   s    

zManifest.helpDescriptionc             C   sT   |j dddddd |j ddd	d
d |j dddddd |j ddddddd d S )Nz-rz--revision-as-HEADpeg_rev
store_truezSave revisions as current HEAD)destactionhelpz-mz--manifest-namez'temporary manifest to use for this synczNAME.xml)r   metavarz--suppress-upstream-revisionpeg_rev_upstreamTstore_falsezsIf in -r mode, do not write the upstream field.  Only of use if the branch names for a sha1 manifest are sensitive.)r   defaultr   r   z-oz--output-fileoutput_file-zFile to save the manifest toz
-|NAME.xml)r   r   r   r   )
add_option)r   pr   r   r   _Options1   s    
zManifest._Optionsc             C   st   |j r| jj|j d |jdkr(tj}nt|jd}| jj||j|j	d |j
  |jdkrptd|j tjd d S )NFr   w)r   r   zSaved manifest to %s)file)Zmanifest_namemanifestZOverrider   sysstdoutr   Saver   r   closeprintstderr)r   optr   r   r   r   _OutputB   s    


zManifest._Outputc             C   s   |r| j   d S )N)Usage)r   r+   argsr   r   r   ValidateOptionsR   s    zManifest.ValidateOptionsc             C   s   | j | d S )N)r,   )r   r+   r.   r   r   r   ExecuteV   s    zManifest.ExecuteN)__name__
__module____qualname__commonZhelpSummary	helpUsager   propertyr   r!   r,   r/   r0   r   r   r   r   r      s   
r   )
__future__r   r   r%   commandr   r   r   r   r   r   <module>   s   