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d ZdS )PruneTz$Prune (delete) already merged topicsz
%prog [<project>...]
c       
      C   s  g }x | j |D ]}|j|j  qW |s.d S G dd dt}||d jj}|jd |j  d }x|D ]}||jkr|j}|j  |jd|j  |j  td|j	|j
krdpd|j	f d	d
 |jstd|jf  qj|j}|j}	tdt|t|dkrdpd|	f  qjW d S )Nc               @   s   e Zd Zdd ZdS )zPrune.Execute.<locals>.Reportc             S   s"   t j| |d | jddd| _d S )Nstatusheaderbold)attr)r   __init__printerproject)selfconfig r   ?/home/qytech/356xLinux510-101server/.repo/repo/subcmds/prune.pyr
   &   s    z&Prune.Execute.<locals>.Report.__init__N)__name__
__module____qualname__r
   r   r   r   r   Report%   s   r   r   zPending Brancheszproject %s/z	%s %-33s *  )endz'(ignoring: tracking branch is gone: %s)z(%2d commit%s, %s)   s)GetProjectsextendZ
PruneHeadsr   r   r   nlrelpathprintnameZCurrentBranchZbase_existsbasecommitsdatelen)
r   optargsZall_branchesr   r   outbranchr"   r#   r   r   r   Execute   s6    


zPrune.ExecuteN)r   r   r   commonhelpSummary	helpUsager)   r   r   r   r   r      s   r   N)
__future__r   colorr   commandr   r   r   r   r   r   <module>   s   