
    	^c                        d Z ddlmZ ddlmZmZmZmZmZ dZ	i Z
 ej        e
          Z ee	ddg            ee	dd            ee	d	d
           i Z ej        e          Zd Zd Z	 ddZd Zd ZddZd Zd ZdS )a?  implements bookmark-based branching (EXPERIMENTAL)

 - Disables creation of new branches (config: enable_branches=False).
 - Requires an active bookmark on commit (config: require_bookmark=True).
 - Doesn't move the active bookmark on update, only on commit.
 - Requires '--rev' for moving an existing bookmark.
 - Protects special bookmarks (config: protect=@).

 flow related commands

    :hg book NAME: create a new bookmark
    :hg book NAME -r REV: move bookmark to revision (fast-forward)
    :hg up|co NAME: switch to bookmark
    :hg push -B .: push active bookmark
    )_)	bookmarkscommandserror
extensions	registrars   bookflow   protect   @   require-bookmarkT   enable-branchesFc                    |j         j        }|r||                     t          d          v r$t	          j        t          d          |z            t          ||          s3t	          j        t          d          t          d          |z            n=|                     t          dd          r!t	          j        t          d                    d	S )
Nr	   s'   cannot commit, bookmark %s is protectedsA   cannot commit, working directory out of sync with active bookmarks   run 'hg up %s'hintr   Ts(   cannot commit without an active bookmarkr   )	
_bookmarksactive
configlistMY_NAMEr   Abortr   cwd_at_bookmark
configbool)uirepokwargsr   s       0/usr/lib/python3/dist-packages/hgext/bookflow.pycommit_hookr   '   s    _#F JR]]7J7777+<==F   tV,, 	+X  ())F2	   	 
w 3T	:	: Jk!GHHIII1    c                 F    t          |          dk    r | |||          S dS )N   F)len)origr   parentsnodes       r   bookmarks_updater#   :   s.    
7||qtD'4((( ur   Nc                     |s4|j         }|D ]*}||v r$t          j        t          d          |z            + | ||||||          S )Ns8   bookmark %s already exists, to move use the --rev option)r   r   r   r   )	r    r   trnamesrevforceinactivemarksnames	            r   bookmarks_addbookmarksr,   C   sz      	 	 	Du}}kS      4b%eX666r   c                 <    t          ||            | ||g|R i |S N)r   )r    r   r   argsoptss        r   commands_commitr1   S   s4    D4D(4(((4(((r   c                      | ||g|R i |}|j         j        }|r5t          ||          s%|                    t	          d          |z             |S )NsB   working directory out of sync with active bookmark, run 'hg up %s')r   r   r   warnr   )r    r   r   r/   r0   rcr   s          r   commands_pullr5   X   s    	b$	&	&	&	&	&	&B_#F 
odF33 

  		
 	
 	
 Ir   c                     |rM|                     d          s8|                     d          s#t          j        t          d          d           | |||fi |S )Ncleanr'   s@   creating named branches is disabled and you should use bookmarkss   see 'hg help bookflow'r   )getr   r   r   )r    r   r   labelr0   s        r   commands_branchr:   f   sz     
TXXg&& 
txx 
kS  +	
 
 
 	
 4D%((4(((r   c                 R    | j         |         }|                     d          }||k    S )N   .)r   lookup)r   markmark_idcur_ids       r   r   r   q   s*    od#G[[FWr   c                    t          j        t          dt                     t          j        t          dt                     t          j        t          j        dt                     t          j        t          j        dt                     | 
                    t          d          s't          j        t          j        dt                     d S d S )Ns   updates   addbookmarkss   commits   pullr   s   branch)r   wrapfunctionr   r#   r,   wrapcommandr   tabler1   r5   r   r   r:   )r   s    r   uisetuprE   w   s    Iy2BCCCI8NOOO8>9oFFF8>7MBBB=="455 Kx~y/JJJJJK Kr   )NFFr.   )__doc__mercurial.i18nr   	mercurialr   r   r   r   r   r   configtable
configitemcmdtablecommandr   r#   r,   r1   r5   r:   r   rE    r   r   <module>rN      su                        !Y!+..
 

7J ' ' ' 

7' . . . 

7& . . .
)
H
%
%  &   <A7 7 7 7 ) ) )
  ) ) ) )  K K K K Kr   