ó
€ˆtPc           @   sQ   d  d l  m Z m Z d  d l m Z d  d l Z d  d l Z d e d „ Z	 d S(   iÿÿÿÿ(   t   nullidt   short(   t   _Nc         C   s»  |  j  j } g  } t ƒ  } t ƒ  } t ƒ  } t ƒ  }	 | sK | j ƒ  } n  |  j  j ƒ  t k r¥ |	 j t ƒ | t g k r• t g t g t | ƒ f St g g  | f S|  j j	 t
 d ƒ ƒ g  }
 x7 | D]/ } | | k rê |
 j | ƒ qÈ |	 j | ƒ qÈ W|
 st |	 ƒ g  t | ƒ f St |
 ƒ } d } t j | j |
 ƒ ƒ }
 xü|
 rBg  } x|
 rW|
 j ƒ  } | d | k r~qVn  |  j j d t | d ƒ t | d ƒ f ƒ | d t k r¿n„| | k rá|  j j d ƒ qVnb| d rM| d | k rM|  j j d t | d ƒ t | d ƒ f ƒ | j | d d !ƒ | j | ƒ nö | d | k rö| d | k rö| d | k r¿| d | k r¿|  j j d	 t | d ƒ ƒ | j | d ƒ n  x4 | d d
 !D]" } | | k rÍ|	 j | ƒ qÍqÍWn  xJ | d d
 !D]; } | | k r| | k r| j | ƒ | j | ƒ qqW| j | d ƒ qVW| rG| d 7} |  j j t
 d ƒ | d t
 d ƒ ƒ|  j j d | d j t t | ƒ ƒ f ƒ xƒ t d t | ƒ d ƒ D]f } x] | j | | | d !ƒ D]A } |  j j d t | d ƒ t | d ƒ f ƒ |
 j | ƒ qóWqÒWqGqGWxf| r«g  } | d 7} |  j j t
 d ƒ | d t
 d ƒ ƒx$t | | j | ƒ ƒ D]
\ } } | j | d ƒ | d } d } xÔ | D]Ì } |  j j d | t | ƒ t | ƒ f ƒ | | k r‰| d k rL|  j j d t | ƒ ƒ | j | ƒ |	 j | ƒ n9 |  j j d t | ƒ t | ƒ f ƒ | j | | f ƒ Pn  | | d } } qÎW| } qšWqFWx@ | D]8 } | | k r³t j t
 d ƒ t | d
  ƒ ƒ ‚ q³q³Wt |	 ƒ }	 |	 t g k rA| r)|  j j t
 d ƒ ƒ qAt j t
 d ƒ ƒ ‚ n  |  j j d d j g  | D] } t | ƒ ^ qZƒ d ƒ |  j j t
 d ƒ d ƒ |  j j d | ƒ |	 t | ƒ | f S(   sn  Return a tuple (common, fetch, heads) used to identify the common
    subset of nodes between repo and remote.

    "common" is a list of (at least) the heads of the common subset.
    "fetch" is a list of roots of the nodes that would be incoming, to be
      supplied to changegroupsubset.
    "heads" is either the supplied heads, or else the remote's heads.
    s   searching for changes
i    s   examining %s:%s
i   s   branch already found
s   found incomplete branch %s:%s
i   i   s   found new changeset %s
i   t	   searchingt   unitt   queriess   request %d: %s
t    i
   s   received %s:%s
s   narrowing %d:%d %s
s   found new branch changeset %s
s    narrowed branch search to %s:%s
s   already have changeset s!   warning: repository is unrelated
s   repository is unrelateds!   found new changesets starting at s   
s   %d total queries
N(   t	   changelogt   nodemapt   sett   headst   tipR    t   addt   listt   uit   statusR   t   appendt   utilt   dequet   branchest   popleftt   debugR   t   progresst   joint   mapt   xranget   lent   zipt   betweent   errort	   RepoErrort   warnt   Abortt   None(   t   repot   remoteR
   t   forcet   mt   searcht   fetcht   seent
   seenbrancht   baset   unknownt   ht   reqt   reqcntt   rt   nt   pt   bt	   newsearcht   lt   ft   i(    (    s;   /sys/lib/python2.7/site-packages/mercurial/treediscovery.pyt   findcommonincoming   sÊ    
						""  
% !"	
%%
)	1(
   t   nodeR    R   t   i18nR   R   R   R!   t   FalseR7   (    (    (    s;   /sys/lib/python2.7/site-packages/mercurial/treediscovery.pyt   <module>   s   