
    	^c                     X    d dl mZ d dlmZmZ d dlmZ dZd Z	d Z
d Zdd	Zd
 Zd ZdS )   )hex)utilvfs)urlutils   logexchangec              #     K   t          j        | j                            t                              }|                    |          sdS  ||          }d}|D ]U}|                                }|s|dk    r|dz  }	 |                    d          \  }}}|||fV  F# t          $ r Y Rw xY w|                                 dS )z
    reads a file from .hg/logexchange/ directory and yields it's content
    filename: the file to be read
    yield a tuple (node, remotepath, name)
    N    r       )	vfsmodr   joinremotenamedirexistsstripsplit
ValueErrorclose)	repofilenamer   flinenolinenoderemoternames	            7/usr/lib/python3/dist-packages/mercurial/logexchange.pyreadremotenamefiler      s       *TX]]=11
2
2C::h HAF  zz|| 	Q;;aKF	"&**U"3"3D&%%%%%% 	 	 	D	 GGIIIIIs   ? B  
B-,B-c              #   f   K   t          | d          D ]}|V  t          | d          D ]}|V  dS )a  
    read the details about the remotenames stored in .hg/logexchange/ and
    yields a tuple (node, remotepath, name). It does not yields information
    about whether an entry yielded is branch or bookmark. To get that
    information, call the respective functions.
    	   bookmarks   branchesN)r   )r   bmentrybranchentrys      r   readremotenamesr!   4   s^       &dL99  )$<<       c                 `   t          j        | j                            t                              } ||dd          }|                    d           t          t          | |                    }t          |          D ]'\  }}}	||k    r|                    d|||	fz             (t          |                                          D ]O\  }
}|dk    r!|D ]}|                    d|||
fz             ,|dk    r|r|                    d|||
fz             P|	                                 d S )N   wT)
atomictemps   0

s	   %s %s %s
r   r   )
r
   r   r   r   writesetr   sorteditemsr   )r   
remotepathnamesnametyper   r   olddatar   oldpathr   namens               r   writeremotenamefiler1   B   sS   
*TX]]=11
2
2CHdt,,,A GGH$T84455G &w > >guj  GGOtWe&<<===U[[]]++ D D
d{"" A A1j$*??@@@@A%% D4T*BBCCCGGIIIIIr"   Nc                     |                                  }	 |rt          | ||d           |rt          | ||d           |                                 dS # |                                 w xY w)z
    save remotenames i.e. remotebookmarks and remotebranches in their
    respective files under ".hg/logexchange/" directory.
    r   r   N)wlockr1   release)r   r*   branches	bookmarksr3   s        r   saveremotenamesr7   Z   ss    
 JJLLE 	Kj)\JJJ 	Ij(KHHHs   (A A*c                    |                                 }|}|rt          j        |j        j                  }nt          |t                    s|j        }| j        	                    d          D ]^\  }}t          j        |          }t          j        t          |                    }t          j        |          }||k    s||k    r|} n_|S )zreturns remote paths   paths)localr   pconvert_reporoot
isinstancebytes_urluiconfigitemsr   
removeauth)r   r   r9   rpathpathurl	noauthurls          r   
activepathrG   i   s     LLNNE E fl/00&&  W((22 
 
	c&s++	 mE#JJ''M),,	%<<9--EE . Lr"   c                    t          | |          }|                                5 }|                    dddi                                          }ddd           n# 1 swxY w Y   i }|                                 }|                                5 }|                    di                                           }ddd           n# 1 swxY w Y   |                                D ]U\  }}	g ||<   |	D ]H}
|
|v rB||
                                         s(||                             t          |
                     IVt          | |||           dS )z
    pulls bookmarks and branches information of the remote repo during a
    pull or clone operation.
    localrepo is our local repository
    remoterepo is the peer instance
    s   listkeyss	   namespacer   Ns	   branchmap)
rG   commandexecutorcallcommandresult
unfilteredr)   obsoleteappendr   r7   )	localrepo
remoterepor*   er6   bmapr   	branchmapbranchnodesr   s              r   pullremotenamesrV      s    Iz22J		#	#	%	% MMl
 

 &(( 	               D!!D		#	#	%	% =MM,33::<<	= = = = = = = = = = = = = = = #** / /V 	/ 	/Dt||DJ$7$7$9$9|V##CII...	/ Iz4;;;;;s#   +AA #A )CC
C
)NN)r   r    r   r   r
   utilsr   r   r   r!   r1   r7   rG   rV    r"   r   <module>rZ      s                     
   8    0     :!< !< !< !< !<r"   