3
_Af$                 @   s\   d dl mZ d dlZd dlmZ d dlmZ d dlmZ G dd deZ	G dd	 d	eZ
dS )
    )print_functionN)Coloring)Command)
GitCommandc               @   s   e Zd Zdd ZdS )RebaseColoringc             C   s2   t j| |d | jddd| _| jddd| _d S )Nrebaseprojectbold)attrfailred)fg)r   __init__printerr   r   )selfconfig r   @/home/qytech/356xLinux510-101server/.repo/repo/subcmds/rebase.pyr      s    zRebaseColoring.__init__N)__name__
__module____qualname__r   r   r   r   r   r      s   r   c               @   s,   e Zd ZdZdZdZdZdd Zdd Zd	S )
RebaseTz(Rebase local branches on upstream branchz*
%prog {[<project>...] | -i <project>...}
z
'%prog' uses git rebase to move local changes in the current topic branch to
the HEAD of the upstream history, useful when you have made commits in a topic
branch but need to incorporate new upstream changes "underneath" them.
c             C   s   |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 |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 |j d$d%d&dd'd d S )(Nz-iz--interactiveinteractive
store_truez(interactive rebase (single project only))destactionhelpz--fail-fast	fail_fastz&Stop rebasing after first error is hitz-fz--force-rebaseforce_rebasez!Pass --force-rebase to git rebasez--no-ffffTstore_falsezPass --no-ff to git rebase)r   defaultr   r   z-qz--quietquietzPass --quiet to git rebasez--autosquash
autosquashzPass --autosquash to git rebasez--whitespace
whitespacestoreZWSzPass --whitespace to git rebase)r   r   metavarr   z--auto-stash
auto_stashz)Stash local modifications before startingz-mz--onto-manifestonto_manifestzRebase onto the manifest version instead of upstream HEAD.  This helps to make sure the local tree stays consistent if you previously synced to a manifest.)
add_option)r   pr   r   r   _Options,   s6    zRebase._Optionsc             C   sz  | j |}t|dk}|jrX| rXtdtjd t|dkrTtd|d f tjd dS dg}|jrt|jd|j  |jr|jd |j	r|jd	 |j
s|jd
 |jr|jd |jr|jd | jjj}t|}|jtj d}xr|D ]h}	|o|jrP |	j}
|
s,|rtd|	j tjd dS q|	j|
}|js\|rtd|	j tjd dS q|d d  }|jr|jd |j|	j |j|j |jd|	j|
|j |j  |j  d}|jrdddg}t|	|j dkrd}dg}t|	|j dkr|d7 }qt|	|j dkr&|d7 }q|r|jd |jd t|	|j dkr|d7 }qW |rv|jd| |j  |S )N   z>error: interactive rebase not supported with multiple projects)filez0note: project %s is mapped to more than one pathr   r   z--whitespace=%sz--quietz--force-rebasez--no-ffz--autosquashz-iz%error: project %s has a detached HEADz4error: project %s does not track any remote branchesz--ontozproject %s: rebasing %s -> %sFzupdate-indexz	--refreshz-qTZstashpopz%i projects had errors) GetProjectslenr   printsysstderrr$   appendr"   r   r   r#   manifestmanifestProjectr   r   redirectstdoutr   CurrentBranchrelpath	GetBranch
LocalMerger(   revisionExprr   nlflushr'   r   Waitr   )r   optargsall_projectsZone_projectZcommon_argsr   outretr   cbZupbranchZneeds_stashZ
stash_argsr   r   r   ExecuteL   s    















zRebase.ExecuteN)	r   r   r   commonhelpSummary	helpUsagehelpDescriptionr+   rG   r   r   r   r   r       s    r   )
__future__r   r2   colorr   commandr   git_commandr   r   r   r   r   r   r   <module>   s   