3
_Af
                 @   s8   d dl mZ d dlmZ d dlmZ G dd deZdS )    )print_function)Coloring)PagedCommandc               @   s,   e Zd ZdZdZdZdZdd Zdd Zd	S )
OverviewTz-Display overview of unmerged project branchesz)
%prog [--current-branch] [<project>...]
a=  
The '%prog' command is used to display an overview of the projects branches,
and list any local commits that have not yet been merged into the project.

The -b/--current-branch option can be used to restrict the output to only
branches currently checked out in each project.  By default, all branches
are displayed.
c             C   s   |j dddddd d S )Nz-bz--current-branchcurrent_branch
store_truez"Consider only checked out branches)destactionhelp)
add_option)selfp r   B/home/qytech/356xLinux510-101server/.repo/repo/subcmds/overview.py_Options%   s    zOverview._Optionsc                s`  g }xX| j |D ]J  fdd j D }dd |D }|jrP fdd|D }|j| qW |sfd S G dd dt}||d jj}|jd |j  |jd	 |j  d  x|D ]} |jkr|j |j  |jd
 j	  |j  |j
}|j}	td|j jkrdpd|jt|t|dkr,dp.d|	f  x|D ]}
tdd|
f  q>W qW d S )Nc                s   g | ]} j |qS r   )GetUploadableBranch).0x)projectr   r   
<listcomp>-   s   z$Overview.Execute.<locals>.<listcomp>c             S   s   g | ]}|r|qS r   r   )r   r   r   r   r   r   /   s    c                s   g | ]}|j  jkr|qS r   )nameCurrentBranch)r   r   )r   r   r   r   1   s    c               @   s   e Zd Zdd ZdS )z Overview.Execute.<locals>.Reportc             S   s.   t j| |d | jddd| _| jd| _d S )Nstatusheaderbold)attrtext)r   __init__printerr   r   )r   configr   r   r   r   8   s    z)Overview.Execute.<locals>.Report.__init__N)__name__
__module____qualname__r   r   r   r   r   Report7   s   r#   r   zDeprecated. See repo info -o.zProjects Overviewzproject %s/z%s %-33s (%2d commit%s, %s)*    sz%-35s   - %s )GetProjectsGetBranchesr   extendr   r   r   r   nlrelpathcommitsdateprintr   r   len)r   optargsall_branchesbrr#   outbranchr.   r/   commitr   )r   r   Execute*   sB    






zOverview.ExecuteN)	r    r!   r"   commonhelpSummary	helpUsagehelpDescriptionr   r9   r   r   r   r   r      s   r   N)
__future__r   colorr   commandr   r   r   r   r   r   <module>   s   