3
_Af8                 @   s@   d dl mZ d dlZd dlmZ d dlmZ G dd deZdS )    )print_functionN)Command)Progressc               @   s,   e Zd ZdZdZdZdZdd Zdd Zd	S )
CheckoutTz!Checkout a branch for developmentz#
%prog <branchname> [<project>...]
z
The '%prog' command checks out an existing branch that was previously
created by 'repo start'.

The command is equivalent to:

  repo forall [<project>...] -c git checkout <branchname>
c             C   s   |s| j   d S )N)Usage)selfoptargs r
   B/home/qytech/356xLinux510-101server/.repo/repo/subcmds/checkout.pyValidateOptions&   s    zCheckout.ValidateOptionsc             C   s   |d }g }g }| j |dd  }td| t|}x@|D ]8}|j  |j|}	|	d k	r:|	rh|j| q:|j| q:W |j  |rx$|D ]}
td|
j|f t	j
d qW t	jd n |std| t	j
d t	jd d S )Nr      zCheckout %szerror: %s/: cannot checkout %s)filezerror: no project has branch %s)GetProjectsr   lenupdateCheckoutBranchappendendprintrelpathsysstderrexit)r   r   r	   nberrsuccessall_projectspmprojectstatuspr
   r
   r   Execute*   s*    


zCheckout.ExecuteN)	__name__
__module____qualname__commonhelpSummary	helpUsagehelpDescriptionr   r"   r
   r
   r
   r   r      s   r   )
__future__r   r   commandr   progressr   r   r
   r
   r
   r   <module>   s   