
    6h                    d    S SK Jr  SSKJr  SSKJrJr  SSKJ	r	  Sr
S rS rS	 rSS jrS rS rg
)    )annotations   )hex)utilvfs)urlutils   logexchangec              #    #    [         R                  " U R                  R                  [        5      5      nUR	                  U5      (       d  gU" U5      nSnU HB  nUR                  5       nU(       d  M  US:X  a  US-  n UR                  S5      u  pgnXgU4v   MD     UR                  5         g! [         a     Md  f = f7f)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)
Nr   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      **TXX]]=1
2C::hHAFzz|Q;aKF	"&**U"3D%%%  GGI  		s*   A>CB0C0
B>:C=B>>Cc              #  d   #    [        U S5       Sh  vN   [        U S5       Sh  vN   g N N7f)z
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.
	   bookmarksN   branches)r   )r   s    r   readremotenamesr    5   s/      "$555!$444 64s   0,0.00c                (   [         R                  " U R                  R                  [        5      5      nU" USSS9nUR	                  S5        [        [        X5      5      n[        U5       H#  u  pxn	X:w  d  M  UR	                  SXxU	4-  5        M%     [        UR                  5       5       HS  u  pUS:X  a!  U H  nUR	                  SXU
4-  5        M     M,  US:X  d  M4  U(       d  M=  UR	                  SXqU
4-  5        MU     UR                  5         g )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   writeremotenamefiler/   A   s    
**TXX]]=1
2CHdt,A GGH$T45G &wu GGOte&<<= !0 U[[]+
{"1$*??@ %t4T*BBC , GGI    Nc                    U R                  5       n U(       a  [        XUS5        U(       a  [        XUS5        UR                  5         g! UR                  5         f = f)zx
save remotenames i.e. remotebookmarks and remotebranches in their
respective files under ".hg/logexchange/" directory.
r   r   N)wlockr/   release)r   r(   branches	bookmarksr2   s        r   saveremotenamesr6   Y   sE    
 JJLE)\J(KHs   (A Ac                   UR                  5       nUnU(       a+  [        R                  " UR                  R                  5      nO%[        U[        5      (       d  UR                  5       nU R                  R                  S5       H_  u  pE[        R                  " U5      n[        R                  " [        U5      5      n[        R                  " U5      nXS:X  d  Xc:X  d  M\  Un  U$    U$ )zreturns remote paths   paths)localr   pconvert_reporoot
isinstancebytesurluiconfigitemsr   
removeauth)r   r   r8   rpathpathr>   	noauthurls          r   
activepathrE   h   s     LLNE Efll//0&&

 WW((2	&&s+	 mmE#J'MM),	<9-EL 3 Lr0   c                H   [        X5      nUR                  5        nUR                  SSS05      R                  5       nSSS5        0 nU R	                  5       nUR                  5        nUR                  S0 5      R                  5       nSSS5        WR                  5        HN  u  p/ XX'   U	 H?  n
X;   d  M
  Xj   R                  5       (       a  M#  XX   R                  [        U
5      5        MA     MP     [        XUW5        g! , (       d  f       N= f! , (       d  f       N= f)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)
rE   commandexecutorcallcommandresult
unfilteredr'   obsoleteappendr   r6   )	localrepo
remoterepor(   er5   bmapr   	branchmapbranchnodesr   s              r   pullremotenamesrT      s     I2J		#	#	%MMl

 &( 	 
& D!D		#	#	%MM,3::<	 
& #*D|DJ$7$7$9$9##CI.  + I4;1 
&	% 
&	%s   #D)!D
D
D!)NN)
__future__r   r   r    r   r   r   utilsr   r   r   r    r/   r6   rE   rT    r0   r   <module>rY      s<    # 
 8	50:!<r0   