
    	^cy                        d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
mZmZ ddlmZmZ e
j        Zi Z ej        e          ZdZ eddd	g  ed
           ed          fddd ed          fddd ed          fddd ed          fgej        z   ej        z   ej        z    ed          ej                  dd            ZdS )z2pull, update and merge in one command (DEPRECATED)    )_)short)cmdutilerrorexchangehglockpycompat	registrar)dateutilurlutils   ships-with-hg-core   fetch   r   revs*   a specific revision you would like to pulls   REV       editNs    invoke editor on commit messagess   force-editors    edit commit message (DEPRECATED)s   switch-parents   switch parents when mergings   hg fetch [SOURCE])helpcategory   defaultc                 p   t          j        |          }|                    d          }|rt          j        |          |d<   j                                        j                                        }	                     |          }n# t          j
        $ r d}Y nw xY w|k    r0t          j        t          d          t          d                    dx}}	                                 }                                }t          j                                       |          }	fd|	D             }	t%          |	          dk    r!t          j        t          d                    t'          j        d	| |          d
         }
t+          j        ||
          |                     t          d          t'          j        |
          z             d}|d         rL	 fd|d         D             }n6# t          j        $ r$ t          d          }t          j        |          w xY wt5          j        |          j        }|d
k    r	 t;          ||           d
S                     |          }j                            g|          d         }t%          |          dk    rYt%          |          rJ|d
         k    r+t+          j         |d
                   t;          ||           S 	 t;          ||           d
S fd|D             }|r|d
         t+          j!                   fd|D             }t%          |          dk    rH|                     t          d          t%          |          dz
  z             	 t;          ||           dS |s	 t;          ||           d
S d}|r|d         r|d
         }}nV|d
         }}|                     t          d          j        "                    |          tG          |          fz             t+          j!        |           |         }|                     t          d          |"                                tG          |          fz             t+          j$        |d          }|st          j%        | |          p(dt'          j&        '                                          z  }|                    d          p|                    d          }t          j(        |d	          })                    ||d         |d         |          }|                     t          d          j        "                    |          tG          |          fz             |t;          ||           S # t;          ||           w xY w) a  pull changes from a remote repository, merge new changes if needed.

    This finds all changes from the repository at the specified path
    or URL and adds them to the local repository.

    If the pulled changes add a new branch head, the head is
    automatically merged, and the result of the merge is committed.
    Otherwise, the working directory is updated to include the new
    changes.

    When a merge is needed, the working directory is first updated to
    the newly pulled changes. Local changes are then merged into the
    pulled changes. To switch the merge order, use --switch-parent.

    See :hg:`help dates` for a list of formats valid for -d/--date.

    Returns 0 on success.
    s   dateNs#   working directory not at branch tips'   use 'hg update' to check out branch tip)hintc                 j    g | ]/}t          |                                                   d k    -|0S )r   )lenchildren).0headrepos     -/usr/lib/python3/dist-packages/hgext/fetch.py
<listcomp>zfetch.<locals>.<listcomp>f   s;    MMM4Sd1D1D1F1F-G-G1-L-L$-L-L-Lr      sH   multiple heads in this branch (use "hg heads ." and "hg merge" to merge)r   r   s   pulling from %s
r   c                 :    g | ]}                     |          S  )lookup)r   revothers     r   r   zfetch.<locals>.<listcomp>u   s%    BBBcS))BBBr   sO   other repository doesn't support revision lookup, so a rev cannot be specified.)heads   c                      g | ]
}|k    |S r!   r!   )r   nparents     r   r   zfetch.<locals>.<listcomp>   s    ===Qfqr   c                      g | ]
}|k    |S r!   r!   )r   r(   	newparents     r   r   zfetch.<locals>.<listcomp>   s    :::!1	>>A>>>r   s[   not merging with %d other new branch heads (use "hg heads ." and "hg merge" to merge them)
Fs   switch_parents   updating to %d:%s
s   merging with %d:%s
)reminds   Automated merge with %sr   s   force_editor)editeditforms   user)editors5   new changeset %d:%s merges remote changes with local
)*r
   byteskwargsgetr   	parsedatedirstatep1branch	branchtipr   RepoLookupErrorAbortr   wlockr	   r   bailifchangedbranchheadsr   r   get_unique_pull_pathr   peerstatushidepasswordCapabilityErrorr   pullcgresultrelease	changelognodesbetweenupdatecleanr#   r   merge
logmessage
removeauthurlgetcommiteditorcommit)uir   sourceoptsdater5   
branchnoder9   r	   bheadspathrevserrmodheadsnewheadsnewchildrenfirstparentsecondparentp2ctxmessageeditoptr/   r(   r+   r$   r)   s    `                     @@@r   fetchr_   %   s>   P %%D88GD 1 *400W]F]!!##F^^F++

    


k455=>>
 
 
 	

 EDg

yy{{d###!!&))MMMM6MMMv;;??+B    +HdBGGJdD))
		!())G,@,F,FFGGG< 	''BBBBT&\BBB( ' ' '5  k#&&&' =uD999Bq==L 	eG ##F++n116(HEEaHx==A#k"2"21~''y{1~66~ 	e{ z 	eu >===+===	 	&#AIHT9%%%::::x:::x==1III  x==1$	&   X 	eU  	R 	eM  	0 $% ,5x{\,4QK\		,--~))+66k8J8JKL   HT;'''&EII)**eiikk5;N;N-OO   (5///C 	(T22 *W-?		-L-LL  hhw''D488O+D+DG,'HMMMFgWf   A IIKLL>%%a((%((34  
  	eesR   :B B$#B$"DV# *G? >V# ?3H22%V# *A?V# BV# %V# :GV# #V5)r   )__doc__mercurial.i18nr   mercurial.noder   	mercurialr   r   r   r   r	   r
   r   mercurial.utilsr   r   rC   cmdtablecommand
testedwith
commitoptscommitopts2
remoteoptsCATEGORY_REMOTE_REPO_MANAGEMENTr_   r!   r   r   <module>rl      s   9 8                                          
 ,
)
H
%
%
 #
 	 A;<<AfII	
 
gtQQBCCD	otQQ'J%K%KL	aa(F&G&GH    A8%  (M M M) (M M Mr   