§
    	^µcw  ã                   óú  — d dl Z d dlZd dlZddlmZ ddlmZmZ ddl	m
Z
mZmZmZ ddl	mZ ej        rd dlmZ ej        Zd	„ Z G d
„ d¦  «        Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd-d„Zd„ Zd„ Zd„ Zd-d„Zd.d„Zd/d„Z d-d„Z! G d„ de"¦  «        Z#i Z$d„ Z% e%dd¦  «        d „ ¦   «         Z& e%d!d!¦  «        d"„ ¦   «         Z'h d#£Z( e%d$d%¦  «        d&„ ¦   «         Z) e%d'd(¦  «        d)„ ¦   «         Z*d*„ Z+ G d+„ d,¦  «        Z,dS )0é    Né   )Ú_)ÚgetattrÚsetattr)ÚencodingÚerrorÚpycompatÚurllibcompaté   )Ú
stringutil)ÚUnionc                 óþ   — 	 t          | ¦  «        S # t          $ r Y nw xY w	 t          j        t	          j        | ¦  «        ¦  «        S # t          j        $ r% t          j        t          d¦  «        | z  ¦  «        ‚w xY w)zàReturn the port for a given network service.

    If port is an integer, it's returned as is. If it's a string, it's
    looked up using socket.getservbyname(). If there's no matching
    service, error.Abort is raised.
    s+   no port number associated with service '%s')	ÚintÚ
ValueErrorÚsocketÚgetservbynamer	   Úsysstrr   ÚAbortr   )Úports    ú9/usr/lib/python3/dist-packages/mercurial/utils/urlutil.pyÚgetportr   $   s•   € ðÝ�4‰yŒyÐøÝð ð ð Øˆðøøøð
ÝÔ#¥H¤O°DÑ$9Ô$9Ñ:Ô:Ð:øÝŒ<ð 
ð 
ð 
ÝŒkÝÐ<Ñ=Ô=ÀÑDñ
ô 
ð 	
ð
øøøs   ‚ ‘
�¢%A Á4A<c                   ó°   — e Zd ZdZdZdZ ej        d¦  «        j        Z	dd„Z
d„ Zej        d„ ¦   «         Zd	„ Z ej        e¦  «        Zd
„ Zd„ Zd„ Zd„ ZdS )Úurla†	  Reliable URL parser.

    This parses URLs and provides attributes for the following
    components:

    <scheme>://<user>:<passwd>@<host>:<port>/<path>?<query>#<fragment>

    Missing components are set to None. The only exception is
    fragment, which is set to '' if present but empty.

    If parsefragment is False, fragment is included in query. If
    parsequery is False, query is included in path. If both are
    False, both fragment and query are included in path.

    See http://www.ietf.org/rfc/rfc2396.txt for more information.

    Note that for backward compatibility reasons, bundle URLs do not
    take host names. That means 'bundle://../' has a path of '../'.

    Examples:

    >>> url(b'http://www.ietf.org/rfc/rfc2396.txt')
    <url scheme: 'http', host: 'www.ietf.org', path: 'rfc/rfc2396.txt'>
    >>> url(b'ssh://[::1]:2200//home/joe/repo')
    <url scheme: 'ssh', host: '[::1]', port: '2200', path: '/home/joe/repo'>
    >>> url(b'file:///home/joe/repo')
    <url scheme: 'file', path: '/home/joe/repo'>
    >>> url(b'file:///c:/temp/foo/')
    <url scheme: 'file', path: 'c:/temp/foo/'>
    >>> url(b'bundle:foo')
    <url scheme: 'bundle', path: 'foo'>
    >>> url(b'bundle://../foo')
    <url scheme: 'bundle', path: '../foo'>
    >>> url(br'c:\foo\bar')
    <url path: 'c:\\foo\\bar'>
    >>> url(br'\\blah\blah\blah')
    <url path: '\\\\blah\\blah\\blah'>
    >>> url(br'\\blah\blah\blah#baz')
    <url path: '\\\\blah\\blah\\blah', fragment: 'baz'>
    >>> url(br'file:///C:\users\me')
    <url scheme: 'file', path: 'C:\\users\\me'>

    Authentication credentials:

    >>> url(b'ssh://joe:xyz@x/repo')
    <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'>
    >>> url(b'ssh://joe@x/repo')
    <url scheme: 'ssh', user: 'joe', host: 'x', path: 'repo'>

    Query strings and fragments:

    >>> url(b'http://host/a?b#c')
    <url scheme: 'http', host: 'host', path: 'a', query: 'b', fragment: 'c'>
    >>> url(b'http://host/a?b#c', parsequery=False, parsefragment=False)
    <url scheme: 'http', host: 'host', path: 'a?b#c'>

    Empty path:

    >>> url(b'')
    <url path: ''>
    >>> url(b'#a')
    <url path: '', fragment: 'a'>
    >>> url(b'http://host/')
    <url scheme: 'http', host: 'host', path: ''>
    >>> url(b'http://host/#a')
    <url scheme: 'http', host: 'host', path: '', fragment: 'a'>

    Only scheme:

    >>> url(b'http:')
    <url scheme: 'http'>
    s   !~*'()+s
   /!~*'()+:\s   ^[a-zA-Z0-9+.\-]+:Tc                 ó*  — d x| _         x| _        x| _        | _        d x| _        x| _        x| _        | _        d| _        d| _	        || _
        |r"d|v r|                     dd¦  «        \  }| _        t          |¦  «        s|                     d¦  «        r	|| _        d S |                     d¦  «        r9d| _         |dd …         }|                     d	¦  «        r
|d
d …         }|| _        d S |                      |¦  «        r/|                     dd¦  «        }|d         r|\  | _         }d| _        |sd }| j        r	d| _        d S �n| j        r	|| _        d S |r4d|v r0|                     dd¦  «        \  }| _        |sd }| j        sd | _        |r„|                     d	¦  «        ro|d
d …                              dd¦  «        }t          |¦  «        dk    r|\  | _        }n|d         | _        d }| j        sd | _        |rt          |¦  «        sd|z   }| j        rpd| j        v rg| j                             dd¦  «        \  | _        | _        d| j        v r(| j                             dd¦  «        \  | _        | _        | j        sd | _        | j        rd| j        v rv| j                             d¦  «        r| j                             d¦  «        sB| j        | _	        | j                             dd¦  «        \  | _        | _        | j        sd | _        | j        r5| j         dk    r*| j        dvr!t%          j        t)          d¦  «        ¦  «        ‚|| _        dD ]=}t+          | |¦  «        }|�)t-          | |t.                               |¦  «        ¦  «         Œ>d S )NTó    ó   #r   ó   \\ó   bundle:ó   bundleé   ó   //r   ó   :r   Fó   ?ó   /ó   @ó   [ó   ]ó   file)s	   localhosts	   127.0.0.1s   [::1]s(   file:// URLs can only refer to localhost)ó   useró   passwdó   hostó   portó   pathó   fragment)ÚschemeÚuserÚpasswdÚhostr   ÚpathÚqueryÚfragmentÚ
_localpathÚ	_hostportÚ	_origpathÚsplitÚhasdriveletterÚ
startswithÚ_matchschemeÚlenÚrsplitÚendswithr   r   r   r   r   ÚurlreqÚunquote)Úselfr3   Ú
parsequeryÚparsefragmentÚpartsÚaÚvs          r   Ú__init__zurl.__init__‡   s  € ð =AÐ@ˆŒÐ@�d”iÐ@ $¤+°´	Ø=AÐAˆŒ	ÐA�D”IÐA ¤
¨T¬]ØˆŒØˆŒØˆŒàð 	6˜T T˜\˜\Ø"&§*¢*¨T°1Ñ"5Ô"5ÑˆD�$”-õ ˜$ÑÔð 	 4§?¢?°7Ñ#;Ô#;ð 	ØˆDŒIØˆFð �?Š?˜:Ñ&Ô&ð 	Ø#ˆDŒKØ˜˜˜”8ˆDØ�Š˜uÑ%Ô%ð  Ø˜A˜B˜B”x�ØˆDŒIØˆFà×Ò˜TÑ"Ô"ð 	(Ø—J’J˜t QÑ'Ô'ˆEØ�QŒxð (Ø$)Ñ!�”˜TØ"'�”àð ;	ØˆDØŒð Ø�”	Ø�ñð Œð Ø �”	Ø�àð &˜d d˜l˜lØ#'§:¢:¨d°AÑ#6Ô#6Ñ ��d”jØð  Ø�DØ”zð &Ø!%�D”Jð ð +˜Ÿš¨Ñ.Ô.ð +Ø˜Q˜R˜RœŸš t¨QÑ/Ô/�Ý�u‘:”: ’>�>Ø&+‘O�D”I˜t˜tà % a¤�D”IØ�DØ”yð +Ø $�D”Ið ð +¥N°4Ñ$8Ô$8ð +Ø# d™{˜àŒyð %˜T T¤YÐ.Ð.Ø'+¤y×'7Ò'7¸¸aÑ'@Ô'@Ñ$�”	˜4œ9Ø˜4œ9Ð$Ð$Ø-1¬Y¯_ª_¸TÀ1Ñ-EÔ-EÑ*�D”I˜tœ{Ø”yð %Ø $�D”Ið ”	ð
%à˜DœIÐ%Ð%à”I×(Ò(¨Ñ.Ô.ð &à37´9×3EÒ3EÀdÑ3KÔ3Kð &ð
 "&¤�”Ø'+¤y×'7Ò'7¸¸aÑ'@Ô'@Ñ$�”	˜4œ9Ø”yð %Ø $�D”Ið ”	ðà”K 7Ò*Ð*Ø”IÐ%KÐKÐKå”kÝÐAÑBÔBñô ð ð ˆŒ	ð Nð 	4ð 	4ˆAÝ˜˜aÑ Ô ˆAØˆ}Ý˜˜a¥§¢°Ñ!2Ô!2Ñ3Ô3Ð3øð	4ð 	4r   c                 ó,  — t          d¦  «        }| j        |_        | j        |_        | j        |_        | j        |_        | j        |_        | j        |_        | j        |_        | j        |_        | j        |_        | j	        |_	        | j
        |_
        |S )Ns   temporary useless value)r   r3   r/   r0   r1   r2   r4   r5   r6   r7   r8   )rB   Úus     r   Úcopyzurl.copyí   sx   € ÝÐ*Ñ+Ô+ˆØ”ˆŒØ”;ˆŒØ”ˆŒØ”;ˆŒØ”ˆŒØ”ˆŒØ”*ˆŒØ”]ˆŒ
Ø”ˆŒØ”nˆŒØ”nˆŒØˆr   c                 ó¼   — g }dD ]@}t          | |¦  «        }|�,|                     d|t          j        |¦  «        fz  ¦  «         ŒAdd                     |¦  «        z  S )N)s   schemer)   r*   r+   r,   r-   s   queryr.   s   %s: %rs   <url %s>s   , )r   Úappendr	   ÚbytestrÚjoin)rB   ÚattrsrF   rG   s       r   Ú__repr__zurl.__repr__ü   so   € àˆð	
ð 	Cð 	CˆAõ ˜˜aÑ Ô ˆAØˆ}Ø—’˜Y¨!­XÔ-=¸aÑ-@Ô-@Ð)AÑAÑBÔBÐBøØ˜UŸZšZ¨Ñ.Ô.Ñ.Ð.r   c                 ó†  — | j         r-| j        }| j        dk    rd|z   }| j        r|d| j        z   z  }|S | j        dz   }| j        s| j        s| j        r|dz  }nZ| j        rS| j        r.| j                             d¦  «        st          | j        ¦  «        r|dz  }t          | j        ¦  «        r|dz  }| j        r)|t           
                    | j        | j        ¬¦  «        z  }| j        r,|dt           
                    | j        | j        ¬¦  «        z   z  }| j        s| j        r|dz  }| j        ra| j                             d	¦  «        r| j                             d
¦  «        s#|t           
                    | j        ¦  «        z  }n
|| j        z  }| j        r%|dt           
                    | j        ¦  «        z   z  }| j        r|dz  }| j        r)|t           
                    | j        | j        ¬¦  «        z  }| j        r|d| j        z   z  }| j        �,|dt           
                    | j        | j        ¬¦  «        z   z  }|S )aß  Join the URL's components back into a URL string.

        Examples:

        >>> bytes(url(b'http://user:pw@host:80/c:/bob?fo:oo#ba:ar'))
        'http://user:pw@host:80/c:/bob?fo:oo#ba:ar'
        >>> bytes(url(b'http://user:pw@host:80/?foo=bar&baz=42'))
        'http://user:pw@host:80/?foo=bar&baz=42'
        >>> bytes(url(b'http://user:pw@host:80/?foo=bar%3dbaz'))
        'http://user:pw@host:80/?foo=bar%3dbaz'
        >>> bytes(url(b'ssh://user:pw@[::1]:2200//home/joe#'))
        'ssh://user:pw@[::1]:2200//home/joe#'
        >>> bytes(url(b'http://localhost:80//'))
        'http://localhost:80//'
        >>> bytes(url(b'http://localhost:80/'))
        'http://localhost:80/'
        >>> bytes(url(b'http://localhost:80'))
        'http://localhost:80/'
        >>> bytes(url(b'bundle:foo'))
        'bundle:foo'
        >>> bytes(url(b'bundle://../foo'))
        'bundle:../foo'
        >>> bytes(url(b'path'))
        'path'
        >>> bytes(url(b'file:///tmp/foo/bar'))
        'file:///tmp/foo/bar'
        >>> bytes(url(b'file:///c:/tmp/foo/bar'))
        'file:///c:/tmp/foo/bar'
        >>> print(url(br'bundle:foo\bar'))
        bundle:foo\bar
        >>> print(url(br'file:///D:\data\hg'))
        file:///D:\data\hg
        r   r   r   r"   r!   r$   )Úsafer%   r&   r'   r#   )r6   r3   r/   r5   r0   r1   r2   r;   r:   r@   ÚquoteÚ
_safecharsr?   r   Ú_safepcharsr4   )rB   Úss     r   Ú	__bytes__zurl.__bytes__  sg  € ðD Œ?ð 	Ø”	ˆAØŒ{˜iÒ'Ð'Ø ‘N�ØŒ}ð *Ø�T˜DœMÑ)Ñ)�ØˆHàŒK˜$ÑˆØŒ9ð 		˜œð 		 t¤yð 		Ø�‰JˆAˆAØŒ[ð 	Ø”	ð	àŒy×#Ò# DÑ)Ô)ð	õ ˜dœiÑ(Ô(ð	ð
 �‰JˆAÝ˜dœiÑ(Ô(ð Ø�T‘	�ØŒ9ð 	?Ø•—’˜dœi¨d¬o�Ñ>Ô>Ñ>ˆAØŒ;ð 	HØ��Ÿš T¤[°t´˜ÑGÔGÑGÑGˆAØŒ9ð 	˜œð 	Ø�‰IˆAØŒ9ð 	Ø”I×(Ò(¨Ñ.Ô.ð °4´9×3EÒ3EÀdÑ3KÔ3Kð Ø•V—\’\ $¤)Ñ,Ô,Ñ,��à�T”Y‘�ØŒ9ð 	0Ø��Ÿš T¤YÑ/Ô/Ñ/Ñ/ˆAØŒ9ð 	Ø�‰IˆAØŒ9ð 	@ð •—’˜dœi¨dÔ.>�Ñ?Ô?Ñ?ˆAØŒ:ð 	#à�˜œ
Ñ"Ñ"ˆAØŒ=Ð$Ø��Ÿš T¤]¸Ô9I˜ÑJÔJÑJÑJˆAØˆr   c                 óð   — | j         | j        }}	 d\  | _         | _        t          | ¦  «        }||c| _         | _        n# ||c| _         | _        w xY w| j         s|d fS |d || j        f| j         | j        pdffS )N)NNr   )r0   r1   Úbytesr2   )rB   r0   r1   rW   s       r   Úauthinfozurl.authinfo`  s”   € Ø”y $¤+ˆfˆð	2Ø%/Ñ"ˆDŒI�t”{Ý�d‘”ˆAà%)¨6Ð"ˆDŒI�t”{�{ø T¨6Ð"ˆDŒI�t”{Ð1Ð1Ð1Ð1ØŒyð 	Ø�t�9Ðð
 �D˜1˜dœi˜.¨$¬)°T´[Ð5GÀCÐHÐIÐIs	   �> ¾Ac                 óÊ   — | j         r| j         dk    rdS t          | j        ¦  «        rdS | j                             d¦  «        rdS | j                             d¦  «        rdS dS )Nr(   Tr   r$   F)r/   r:   r3   r;   ©rB   s    r   Úisabsz	url.isabso  ss   € ØŒ;ð 	˜4œ;¨'Ò1Ð1Ø�4Ý˜$œ)Ñ$Ô$ð 	Ø�4ØŒ9×Ò Ñ'Ô'ð 	Ø�4ØŒ9×Ò Ñ%Ô%ð 	Ø�4Øˆur   c                 óä   — | j         dk    s| j         dk    rT| j        pd}t          | j        ¦  «        r| j        dz   | j        z   }n"| j        �| j        rt          |¦  «        sd|z   }|S | j        S )Nr(   r   r$   )r/   r3   r:   r7   r2   r8   ©rB   r3   s     r   Ú	localpathzurl.localpathz  s‚   € àŒ;˜'Ò!Ð! T¤[°IÒ%=Ð%=Ø”9Ð$ ˆDõ ˜dœnÑ-Ô-ð #Ø”~¨Ñ,¨t¬yÑ8��à”	Ð%¨$¬)Ð%½NÈ4Ñ<PÔ<PÐ%à˜d‘{�ØˆKØŒ~Ðr   c                 ó>   — | j          p| j         dk    p
| j         dk    S )z?whether localpath will return something that posixfile can openr(   r   )r/   r]   s    r   Úislocalzurl.islocal‰  s.   € ð ”ˆOð (ØŒ{˜gÒ%ð(àŒ{˜iÒ'ð	
r   N)TT)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rU   rV   ÚremodÚcompileÚmatchr<   rH   rK   r   Ú	strmethodrQ   rX   Ú__str__r[   r^   ra   rc   © r   r   r   r   9   sï   € € € € € ðGð GðR €JØ €KØ �5”=Ð!7Ñ8Ô8Ô>€Lðd4ð d4ð d4ð d4ðLð ð ð Ôð/ð /ñ Ôð/ð"Nð Nð Nð` !ˆhÔ  Ñ+Ô+€GðJð Jð Jð	ð 	ð 	ðð ð ð
ð 
ð 
ð 
ð 
r   r   c                 óD   — t          t          | ¦  «        j        ¦  «        S ©N)Úboolr   r/   ©r3   s    r   Ú	hasschemerr   ’  s   € å•�D‘	”	Ô Ñ!Ô!Ð!r   c                 ót   — t          | ¦  «        o)| dd…         dk    o| dd…                              ¦   «         S )Nr   r   r"   r   )rp   Úisalpharq   s    r   r:   r:   —  s9   € å�‰:Œ:ÐC˜$˜q ˜sœ) tÒ+ÐC°°Q°q°S´	×0AÒ0AÑ0CÔ0CÐCr   c                 óJ   — t          | dd¬¦  «                             ¦   «         S )NF)rC   rD   )r   ra   rq   s    r   Úurllocalpathrv   œ  s#   € åˆt °UÐ;Ñ;Ô;×EÒEÑGÔGÐGr   c                 óü   — t                                | ¦  «        } |                      d¦  «        s|                      d¦  «        r7t          j        t          d¦  «        t          j        | ¦  «        fz  ¦  «        ‚dS )a\  check if a path / url is a potentially unsafe ssh exploit (SEC)

    This is a sanity check for ssh urls. ssh will parse the first item as
    an option; e.g. ssh://-oProxyCommand=curl${IFS}bad.server|sh/path.
    Let's prevent these potentially exploited urls entirely and warn the
    user.

    Raises an error.Abort when the url is unsafe.
    s   ssh://-s   svn+ssh://-s   potentially unsafe url: %rN)r@   rA   r;   r   r   r   r	   rN   rq   s    r   Úchecksafesshrx   ¡  sy   € õ �>Š>˜$ÑÔ€DØ‡‚�zÑ"Ô"ð 
 d§o¢o°nÑ&EÔ&Eð 
ÝŒkÝÐ+Ñ,Ô,µÔ0@ÀÑ0FÔ0FÐ/HÑHñ
ô 
ð 	
ð
ð 
r   c                 óZ   — t          | ¦  «        } | j        rd| _        t          | ¦  «        S )z$hide user credential in a url strings   ***)r   r1   rZ   ©rJ   s    r   Úhidepasswordr{   ³  s+   € õ 	ˆA‰Œ€AØ„xð ØˆŒÝ�‰8Œ8€Or   c                 óZ   — t          | ¦  «        } dx| _        | _        t          | ¦  «        S )z7remove all authentication information from a url stringN)r   r0   r1   rZ   rz   s    r   Ú
removeauthr}   ¼  s(   € õ 	ˆA‰Œ€AØÐ€A„FˆQŒXÝ�‰8Œ8€Or   c                 ó
  — g }|€It          | j                             ¦   «         ¦  «        D ]!\  }}|D ]}|                     ||f¦  «         ŒŒ"n5| j                             |g ¦  «        D ]}|                     ||f¦  «         Œ|S )z+list all the (name, paths) in the passed ui)ÚsortedÚpathsÚitemsrM   Úget)ÚuiÚtarget_pathÚresultÚnamer€   Úpr3   s          r   Ú
list_pathsrˆ   Ä  s¦   € à€FØÐÝ! "¤(§.¢.Ñ"2Ô"2Ñ3Ô3ð 	)ð 	)‰KˆD�%Øð )ð )�Ø—’˜t Q˜iÑ(Ô(Ð(Ð(ð)ð	)ð
 ”H—L’L ¨bÑ1Ô1ð 	/ð 	/ˆDØ�MŠM˜;¨Ð-Ñ.Ô.Ð.Ð.Ø€Mr   c                 óJ   — 	 t          | d|¬¦  «        S # t          $ r Y dS w xY w)zLtry to build a path from a url

    Return None if no Path could built.
    N©Úrawloc)r3   r   )rƒ   r   s     r   Útry_pathrŒ   Ò  s>   € ð
å�B˜ SÐ)Ñ)Ô)Ð)øÝð ð ð Øˆtˆtðøøøs   ‚ ”
"¡"c              #   ó¬  K  — |snd|j         v r|j         d         D ]}|V — ŒdS d|j         v r|j         d         D ]}|V — ŒdS t          j        t          d¦  «        t          d¦  «        ¬¦  «        ‚|D ]^}||j         v r|j         |         D ]}|V — ŒŒ t	          ||¦  «        }|€(t          d¦  «        }||z  }t          j        |¦  «        ‚|V — Œ_dS )z=yields all the `path` selected as push destination by `dests`s   default-pushó   defaults"   default repository not configured!s   see 'hg help config.paths')ÚhintNó   repository %s does not exist)r€   r   ÚConfigErrorr   rŒ   Ú	RepoError)Úreporƒ   Údestsr‡   Údestr3   Úmsgs          r   Úget_push_pathsr—   Þ  sG  è è € àð Ø˜bœhÐ&Ð&Ø”X˜oÔ.ð ð �Ø����ðð à˜2œ8Ð#Ð#Ø”X˜jÔ)ð ð �Ø����ðð õ Ô#ÝÐ7Ñ8Ô8ÝÐ4Ñ5Ô5ðñ ô ð ð
 ð 
	ð 
	ˆDØ�r”xÐÐØœ $œð ð �AØ�G�G�G�Gðõ    DÑ)Ô)�Ø�<ÝÐ;Ñ<Ô<�CØ˜4‘K�CÝœ/¨#Ñ.Ô.Ð.Ø�
�
�
�
ð
	ð 
	r   c              #   óˆ   K  — |sdg}|D ]7}||j         v r|j         |         D ]}|V — ŒŒ t          |d|d¬¦  «        }|V — Œ8dS )zDyields all the `(path, branch)` selected as pull source by `sources`rŽ   NF)Úvalidate_path)r€   r3   )r“   rƒ   ÚsourcesÚsourcer‡   s        r   Úget_pull_pathsrœ   ú  s„   è è € àð Ø�,ˆØð ð ˆØ�R”XÐÐØ”X˜fÔ%ð ð �Ø����ðõ �R˜˜v°UÐ;Ñ;Ô;ˆAØˆGˆGˆGˆGðð r   c                 ó@  — |€g }n|g}t          t          |||¦  «        ¦  «        }t          |¦  «        dk    r^|€$t          d¦  «        }|t          |¦  «        | fz  }n$t          d¦  «        }|t          |¦  «        | |fz  }t	          j        |¦  «        ‚|d         S )a5  return a unique `path` or abort if multiple are found

    This is useful for command and action that does not support multiple
    destination (yet).

    Note that for now, we cannot get multiple destination so this function is "trivial".

    The `action` parameter will be used for the error message.
    Nr   ó9   default path points to %d urls while %s only supports oneó5   path points to %d urls while %s only supports one: %sr   )Úlistr—   r=   r   r   r   )Úactionr“   rƒ   r•   r”   r–   s         r   Úget_unique_push_pathr¢     s­   € ð €|Øˆˆà�ˆÝ•  b¨%Ñ0Ô0Ñ1Ô1€EÝ
ˆ5�z„z�Q‚€Øˆ<ÝØLñô ˆCð •C˜‘J”J Ð'Ñ'ˆCˆCåÐLÑMÔMˆCØ•C˜‘J”J ¨Ð-Ñ-ˆCÝŒk˜#ÑÔÐØ�Œ8€Or   rm   c                 ó˜  — g }|€Jd|j         v r+|                     d„ |j         d         D ¦   «         ¦  «         nŒ|                     d¦  «         nv||j         v r+|                     d„ |j         |         D ¦   «         ¦  «         nBt          ||¦  «        }|�|                     |j        ¦  «         n|                     |¦  «         t          |¦  «        dk    r^|€$t          d¦  «        }|t          |¦  «        | fz  }n$t          d¦  «        }|t          |¦  «        | |fz  }t          j        |¦  «        ‚t          |d         |¦  «        S )	a?  return a unique `(path, branch)` or abort if multiple are found

    This is useful for command and action that does not support multiple
    destination (yet).

    Note that for now, we cannot get multiple destination so this function is "trivial".

    The `action` parameter will be used for the error message.
    NrŽ   c              3   ó$   K  — | ]}|j         V — Œd S ro   rŠ   ©Ú.0r‡   s     r   ú	<genexpr>z'get_unique_pull_path.<locals>.<genexpr>0  ó$   è è € Ð?Ð? Q˜œÐ?Ð?Ð?Ð?Ð?Ð?r   c              3   ó$   K  — | ]}|j         V — Œd S ro   rŠ   r¥   s     r   r§   z'get_unique_pull_path.<locals>.<genexpr>7  ó$   è è € Ð;Ð; Q˜œÐ;Ð;Ð;Ð;Ð;Ð;r   r   rž   rŸ   r   ©
r€   ÚextendrM   rŒ   r‹   r=   r   r   r   Úparseurl)r¡   r“   rƒ   r›   Údefault_branchesÚurlsr3   r–   s           r   Úget_unique_pull_pathr°   #  s^  € ð €DØ€~Ø˜œÐ!Ð!Ø�KŠKÐ?Ð?¨"¬(°:Ô*>Ð?Ñ?Ô?Ñ?Ô?Ð?Ð?ð �KŠK˜
Ñ#Ô#Ð#Ð#à�R”XÐÐØ�KŠKÐ;Ð;¨"¬(°6Ô*:Ð;Ñ;Ô;Ñ;Ô;Ð;Ð;õ ˜B Ñ'Ô'ˆDØÐØ—’˜DœKÑ(Ô(Ð(Ð(à—’˜FÑ#Ô#Ð#Ý
ˆ4�y„y�A‚~€~Øˆ>ÝØLñô ˆCð •C˜‘I”I˜vÐ&Ñ&ˆCˆCåÐLÑMÔMˆCØ•C˜‘I”I˜v vÐ.Ñ.ˆCÝŒk˜#ÑÔÐÝ�D˜”GÐ-Ñ.Ô.Ð.r   c                 ó¦  — g }|€Jd| j         v r+|                     d„ | j         d         D ¦   «         ¦  «         nŒ|                     d¦  «         nv|| j         v r+|                     d„ | j         |         D ¦   «         ¦  «         nBt          | |¦  «        }|�|                     |j        ¦  «         n|                     |¦  «         t          |¦  «        dk    r[|€"t          d¦  «        }|t          |¦  «        z  }n#t          d¦  «        }|t          |¦  «        |fz  }t          j        |¦  «        ‚|d         }t          ||¦  «        \  }}|||fS )	z@return the `(origsource, path, branch)` selected as clone sourceNrŽ   c              3   ó$   K  — | ]}|j         V — Œd S ro   rŠ   r¥   s     r   r§   z!get_clone_path.<locals>.<genexpr>Q  r¨   r   c              3   ó$   K  — | ]}|j         V — Œd S ro   rŠ   r¥   s     r   r§   z!get_clone_path.<locals>.<genexpr>X  rª   r   r   s:   default path points to %d urls while only one is supporteds6   path points to %d urls while only one is supported: %sr   r«   )	rƒ   r›   r®   r¯   r3   r–   r   Ú
clone_pathÚbranchs	            r   Úget_clone_pathr¶   L  sk  € à€DØ€~Ø˜œÐ!Ð!Ø�KŠKÐ?Ð?¨"¬(°:Ô*>Ð?Ñ?Ô?Ñ?Ô?Ð?Ð?ð �KŠK˜
Ñ#Ô#Ð#Ð#à�R”XÐÐØ�KŠKÐ;Ð;¨"¬(°6Ô*:Ð;Ñ;Ô;Ñ;Ô;Ð;Ð;õ ˜B Ñ'Ô'ˆDØÐØ—’˜DœKÑ(Ô(Ð(Ð(à—’˜FÑ#Ô#Ð#Ý
ˆ4�y„y�A‚~€~Øˆ>ÝØMñô ˆCð •3�t‘9”9ÑˆCˆCåÐMÑNÔNˆCØ•C˜‘I”I˜vÐ&Ñ&ˆCÝŒk˜#ÑÔÐØ
ˆqŒ'€CÝ! #Ð'7Ñ8Ô8Ñ€J�Ø�
˜FÐ"Ð"r   c                 óx   — t          | ¦  «        }d}|j        r|j        }d|_        t          |¦  «        ||pg ffS )z5parse url#branch, returning (url, (branch, branches))N)r   r5   rZ   )r3   ÚbranchesrJ   rµ   s       r   r­   r­   o  sD   € åˆD‰	Œ	€AØ€FØ„zð Ø”ˆØˆŒ
Ý�‰8Œ8�f˜h˜n¨"Ð-Ð-Ð-r   c                   ó    — e Zd ZdZd„ Zdd„ZdS )r€   z”Represents a collection of paths and their configs.

    Data is initially derived from ui instances and the config files they have
    loaded.
    c           	      óH  — t                                | ¦  «         t          j                             d¦  «        }|                     dd¬¦  «        D �]x\  }}|sŒ	|                     d|¦  «        \  }}|                     d|¦  «        }|||f}|j         	                    ||¦  «        }	| 	                    d¦  «        }
|
�)t          j        |
¦  «        rt          j        |¦  «        }n|g}g }|D ]Ó}t          j                             |¦  «        }t          j                             |¦  «        }t          |¦  «        s\t          j                             |¦  «        s=t          j                             t          j                             |	|¦  «        ¦  «        }t          ||||¬¦  «        }|                     |¦  «         ŒÔ|| |<   �Œzt'          |                      ¦   «         ¦  «        D ]5\  }}g }|D ]&}|                     t-          ||| ¦  «        ¦  «         Œ'|| |<   Œ6d S )Nó   ~ó   pathsT)Ú	ignoresubó
   multi-urls)r‹   Ú
suboptions)ÚdictrH   Úosr3   Ú
expanduserÚconfigitemsÚconfigsuboptionsÚconfigsourceÚ_path_to_rootr‚   r   Ú	parseboolÚ	parselistÚ
expandvarsrr   r^   ÚnormpathrO   rM   r   r�   r¬   Ú_chain_path)rB   rƒ   Ú	home_pathr†   ÚvalueÚ_valueÚsub_optsrW   Úroot_keyÚrootÚ	multi_urlÚ	base_locsr€   Úlocr‡   Ú	old_pathsÚ	new_pathss                    r   rH   zpaths.__init__€  s  € Ý�Š�dÑÔÐå”G×&Ò& tÑ,Ô,ˆ	àŸ>š>¨(¸d˜>ÑCÔCð 	ñ 	‰KˆD�%àð ØØ!×2Ò2°8¸TÑBÔBÑˆF�HØ—’ ¨$Ñ/Ô/ˆAØ˜e QÐ'ˆHØÔ#×'Ò'¨°)Ñ<Ô<ˆDà Ÿš ]Ñ3Ô3ˆIØÐ$­Ô)=¸iÑ)HÔ)HÐ$Ý&Ô0°Ñ7Ô7�	�	à"˜G�	àˆEØ ð  ð  �Ý”g×(Ò(¨Ñ-Ô-�Ý”g×(Ò(¨Ñ-Ô-�Ý  ‘~”~ð D­b¬g¯mªm¸CÑ.@Ô.@ð DÝœ'×*Ò*­2¬7¯<ª<¸¸cÑ+BÔ+BÑCÔC�CÝ˜˜T¨#¸(ÐCÑCÔC�Ø—’˜Q‘”��ØˆD�‰J‰Jå% d§j¢j¡l¤lÑ3Ô3ð 	#ð 	#‰OˆD�)ØˆIØð ;ð ;�Ø× Ò ¥¨Q°°DÑ!9Ô!9Ñ:Ô:Ð:Ð:Ø"ˆD�‰JˆJð		#ð 	#r   Nc                 ór  — d}|                      |d¦  «         |€K|sd}nt          |t          t          f¦  «        s|f}|D ]"}	 | |         d         c S # t          $ r Y Œw xY wdS |sdS || v r| |         d         S t          ||¦  «        }|€$t          j        t          d¦  «        |z  ¦  «        ‚|j	        S )a  Return a ``path`` from a string, falling back to default.

        ``name`` can be a named path or locations. Locations are filesystem
        paths or URIs.

        Returns None if ``name`` is not a registered path, a URI, or a local
        path to a repo.
        s9   getpath is deprecated, use `get_*` functions from urlutils   6.0Nrm   r   r�   )
Ú
deprecwarnÚ
isinstanceÚtupler    ÚKeyErrorrŒ   r   r’   r   r‹   )rB   rƒ   r†   Údefaultr–   Úkr3   s          r   Úgetpathzpaths.getpath¤  sþ   € ð KˆØ
�Š�c˜6Ñ"Ô"Ð"àˆ<Øð %Ø��Ý ­%µ¨Ñ7Ô7ð %Ø"˜*�Øð ð �ðØ œ7 1œ:Ð%Ð%Ð%øÝð ð ð Ø�Hðøøøà�4ð ð 	Ø�4Ø�4ˆ<ˆ<Ø˜”:˜a”=Ð õ ˜B Ñ%Ô%ˆDØˆ|Ý”o¥aÐ(GÑ&HÔ&HÈ4Ñ&OÑPÔPÐPØ”;Ðs   ÁAÁ
A!Á A!ro   )rd   re   rf   rg   rH   rÞ   rm   r   r   r€   r€   y  sB   € € € € € ðð ð"#ð "#ð "#ðH#ð #ð #ð #ð #ð #r   r€   c                 ó   ‡ ‡— ˆˆ fd„}|S )aý  Decorator used to declare a path sub-option.

    Arguments are the sub-option name and the attribute it should set on
    ``path`` instances.

    The decorated function will receive as arguments a ``ui`` instance,
    ``path`` instance, and the string value of this option from the config.
    The function should return the value that will be set on the ``path``
    instance.

    This decorator can be used to perform additional verification of
    sub-options and to change the type of sub-options.
    c                 ó    •— ‰| ft           ‰<   | S ro   )Ú_pathsuboptions)ÚfuncÚattrÚoptions    €€r   Úregisterzpathsuboption.<locals>.registerÜ  s   ø€ Ø#'¨ ,�˜ÑØˆr   rm   )rä   rã   rå   s   `` r   Úpathsuboptionræ   Í  s)   øø€ ðð ð ð ð ð ð €Or   s   pushurls   pushlocc                 ó   — t          |¦  «        }|j        s2t          d¦  «        }||j        |fz  }|                      |¦  «         d S |j        r1|                      t          d¦  «        |j        z  ¦  «         d |_        t          |¦  «        S )Ns-   (paths.%s:pushurl not a URL; ignoring: "%s")
s:   ("#fragment" in paths.%s:pushurl not supported; ignoring)
)r   r/   r   r†   Úwarnr5   rZ   )rƒ   r3   rÍ   rJ   r–   s        r   Úpushurlpathoptionré   ã  sž   € åˆE‰
Œ
€AàŒ8ð ÝÐAÑBÔBˆØ�”	˜5Ð!Ñ!ˆØ
�Š�‰ŒˆØˆtð 	„zð Ø
�ŠÝðñô ð Œiñ	ñ	
ô 	
ð 	
ð ˆŒ
å�‰8Œ8€Or   s   pushrevc                 ó   — |S ro   rm   )rƒ   r3   rÍ   s      r   Úpushrevpathoptionrë   ü  s   € à€Lr   >   ó   ignoreó   mirrorrŽ   s   bookmarks.modes   bookmarks_modec                 ó”   — |t           vr6|j        }|€d}t          d¦  «        }|||fz  }|                      |¦  «         |dk    rd }|S )Nó   *s2   (paths.%s:bookmarks.mode has unknown value: "%s")
rŽ   )ÚSUPPORTED_BOOKMARKS_MODESr†   r   rè   )rƒ   r3   rÍ   Ú	path_namer–   s        r   Úbookmarks_mode_optionrò     sa   € àÕ-Ð-Ð-Ø”Iˆ	ØÐàˆIÝÐFÑGÔGˆØ�	˜5Ð!Ñ!ˆØ
�Š�‰ŒˆØ�
ÒÐØˆØ€Lr   r¾   s
   multi_urlsc                 óŠ   — t          j        |¦  «        }|€,|                      t          d¦  «        |j        z  ¦  «         d}|S )Ns.   (paths.%s:multi-urls not a boolean; ignoring)
F)r   rÇ   rè   r   r†   )rƒ   r3   rÍ   Úress       r   Úmultiurls_pathoptionrõ     sL   € å
Ô
˜uÑ
%Ô
%€CØ
€{Ø
�ŠÝÐ@ÑAÔAÀDÄIÑMñ	
ô 	
ð 	
ð ˆØ€Jr   c                 ó€  — g }| j         j        dk    r|                     | ¦  «         �n”| j         j        �J ‚|                     | j         j        ¦  «        }|€9t          d¦  «        }|| j        | j         j        fz  }t          j	        |¦  «        ‚|D �](}|  
                    ¦   «         }|j        j        dk    r9t          d¦  «        }||j        |j         j        fz  }t          j	        |¦  «        ‚|j         |_         |j        |_        |j        |_        |j        €|j        |_        n2|j                             dd¦  «        d         }d||j        fz  |_        |j         
                    ¦   «         }	|	                     |j        ¦  «         |                     ||	¦  «         |                     |¦  «         �Œ*|S )	z<return the result of "path://" logic applied on a given pathr-   Ns)   cannot use `%s`, "%s" is not a known paths4   cannot use `%s`, "%s" is also defined as a `path://`r   r   r   s   %s#%s)r   r/   rM   r3   r‚   r2   r   r‹   r   r   rK   Úraw_urlrÔ   rµ   r>   Ú_all_sub_optsÚupdateÚ_own_sub_optsÚ_apply_suboptions)
Ú	base_pathrƒ   r€   rÖ   Ú	sub_pathsÚmÚsubpathr3   Úbaser¿   s
             r   rË   rË   "  s¨  € à€IØ„}Ô˜wÒ&Ð&Ø×Ò˜Ñ#Ô#Ð#Ñ#àŒ}Ô!Ð)Ð)Ð)Ø—I’I˜iœmÔ0Ñ1Ô1ˆ	ØÐÝÐ>Ñ?Ô?ˆAØ�)Ô" I¤MÔ$6Ð7Ñ7ˆAÝ”+˜a‘.”.Ð Ø ð 	#ñ 	#ˆGØ—>’>Ñ#Ô#ˆDØŒÔ%¨Ò0Ð0ÝÐMÑNÔN�Ø�d”k 4¤8¤=Ð1Ñ1�Ý”k !‘n”nÐ$Ø”{ˆDŒHØ!œ.ˆDŒKØ”{ˆDŒHØŒ{Ð"Ø%œn�”�à”{×)Ò)¨$°Ñ2Ô2°1Ô5�Ø&¨$°´Ð)<Ñ<�”Ø Ô.×3Ò3Ñ5Ô5ˆJØ×Ò˜dÔ0Ñ1Ô1Ð1Ø×"Ò" 2 zÑ2Ô2Ð2Ø×Ò˜TÑ"Ô"Ð"Ñ"ØÐr   c                   óR   — e Zd ZdZ	 	 	 	 	 d
d„Zd„ Zd„ Zd„ Zd„ Ze	d	„ ¦   «         Z
dS )r3   z4Represents an individual path and its configuration.NTc                 ó<  — |€|�J ‚|�J ‚|�J ‚dS |st          d¦  «        ‚t          |¦  «        }d}|j        r|j        }d|_        || _        |                     ¦   «         | _        || _        || _        || _        d|z  | _        |r|  	                    ¦   «          | 
                    dd¦  «        \  }}	i | _        |�.|                     ¦   «         | _        |	                     |¦  «         |	                     ¦   «         | _        |                      ||	¦  «         dS )aÞ  Construct a path from its config options.

        ``ui`` is the ``ui`` instance the path is coming from.
        ``name`` is the symbolic name of the path.
        ``rawloc`` is the raw location, as defined in the config.
        ``pushloc`` is the raw locations pushes should be made to.

        If ``name`` is not defined, we require that the location be a) a local
        filesystem path with a .hg directory or b) a URL. If not,
        ``ValueError`` is raised.
        Ns   rawloc must be defineds   %sr¼   rï   )r   r   r5   rK   r÷   rµ   r†   r‹   rÔ   Ú_validate_pathrÄ   rú   rù   rø   rû   )
rB   rƒ   r†   r‹   r¿   r™   rJ   rµ   Ú_pathrÏ   s
             r   rH   zpath.__init__F  s4  € ð& ˆ:à�<�<�<Ø�>�>�>ØÐ%Ð%Ð%ØˆFàð 	8ÝÐ6Ñ7Ô7Ð7õ �‰KŒKˆØˆØŒ:ð 	Ø”ZˆFØˆAŒJàˆŒà—v’v‘x”xˆŒØˆŒàˆŒ	ØˆŒØ˜1‘9ˆŒàð 	"Ø×ÒÑ!Ô!Ð!à×-Ò-¨h¸Ñ=Ô=‰ˆˆxØˆÔØÐ!Ø!+§¢Ñ!2Ô!2ˆDÔØ�OŠO˜JÑ'Ô'Ð'Ø%Ÿ]š]™_œ_ˆÔà×Ò˜r 8Ñ,Ô,Ð,Ð,Ð,r   c                 óº   — |                       ¦   «         }| j                             ¦   «         D ],\  }}t          |dd¦  «        }|�
 |¦   «         }||j        |<   Œ-|S )zmake a copy of this path objectrK   N)Ú	__class__Ú__dict__r�   r   )rB   ÚnewrÝ   rG   Únew_copys        r   rK   z	path.copy  sf   € à�nŠnÑÔˆØ”M×'Ò'Ñ)Ô)ð 	 ð 	 ‰DˆAˆqÝ˜q &¨$Ñ/Ô/ˆHØÐ#Ø�H‘J”J�ØˆCŒL˜‰OˆOØˆ
r   c                 ó–   — | j         s=| j        j        s3|                      | j        ¦  «        st          d| j        z  ¦  «        ‚d S d S d S )Ns1   location is not a URL or path to a local repo: %s)r†   r   r/   Ú_isvalidlocalpathrÔ   r   r‹   r]   s    r   r  zpath._validate_path‰  su   € ð ”	ð	à”H”Oð	ð ×*Ò*¨4¬8Ñ4Ô4ð	õ
 ðØ"œkñ*ñô ð ð	ð 	ð 	ð 	ð 	ð 	r   c                 ó¾   — t                                ¦   «         D ]B\  }\  }}||vrt          | |d ¦  «         Œ ||| ||         ¦  «        }t          | ||¦  «         ŒCd S ro   )rá   r�   r   )rB   rƒ   Úsub_optionsÚ	suboptionrã   râ   rÍ   s          r   rû   zpath._apply_suboptions–  s   € õ (7×'<Ò'<Ñ'>Ô'>ð 	'ð 	'Ñ#ˆI‘|˜˜dØ Ð+Ð+Ý˜˜d DÑ)Ô)Ð)Øà�D˜˜T ;¨yÔ#9Ñ:Ô:ˆEÝ�D˜$ Ñ&Ô&Ð&Ð&ð	'ð 	'r   c                 ó®   — 	 t           j                             t           j                             |d¦  «        ¦  «        S # t          t
          f$ r Y dS w xY w)zêReturns True if the given path is a potentially valid repository.
        This is its own function so that extensions can change the definition of
        'valid' in this case (like when pulling from a git repo into a hg
        one).s   .hgF)rÁ   r3   ÚisdirrO   Ú	TypeErrorr   r`   s     r   r  zpath._isvalidlocalpath¢  sR   € ð
	Ý”7—=’=¥¤§¢¨d°FÑ!;Ô!;Ñ<Ô<Ð<øå�:Ð&ð 	ð 	ð 	Ø�5�5ð	øøøs   ‚<? ¿AÁAc                 ó|   — i }t                                ¦   «         D ]\  }\  }}t          | |¦  «        }|�|||<   Œ |S )z{Return sub-options and their values for this path.

        This is intended to be used for presentation purposes.
        )rá   r�   r   )rB   ÚdÚsuboptrã   Ú_funcrÍ   s         r   r¿   zpath.suboptions­  sQ   € ð ˆÝ%4×%:Ò%:Ñ%<Ô%<ð 	"ð 	"Ñ!ˆF‘M�T˜5Ý˜D $Ñ'Ô'ˆEØÐ Ø!��&‘	øØˆr   )NNNNT)rd   re   rf   rg   rH   rK   r  rû   r  Úpropertyr¿   rm   r   r   r3   r3   C  s—   € € € € € Ø>Ð>ð ØØØØð7-ð 7-ð 7-ð 7-ðrð ð ðð ð ð
'ð 
'ð 
'ð	ð 	ð 	ð ð
ð 
ñ „Xð
ð 
ð 
r   r3   ro   )Nrm   )rm   )-rÁ   Úrerh   r   Úi18nr   r	   r   r   Ú r   r   r
   r   ÚTYPE_CHECKINGÚtypingr   r@   r   r   rr   r:   rv   rx   r{   r}   rˆ   rŒ   r—   rœ   r¢   r°   r¶   r­   rÀ   r€   rá   ræ   ré   rë   rð   rò   rõ   rË   r3   rm   r   r   ú<module>r     sj  ðð 
€	€	€	Ø Ð Ð Ð Ø €€€à Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ð ð ðð ð ð ð ð ð
 Ôð ðð ð ð ð ð ð 
Ô	€ð
ð 
ð 
ð*V
ð V
ð V
ð V
ð V
ñ V
ô V
ð V
ðr
"ð "ð "ð
Dð Dð Dð
Hð Hð Hð

ð 
ð 
ð$ð ð ðð ð ðð ð ð ð	ð 	ð 	ðð ð ð8
ð 
ð 
ðð ð ð ð8&/ð &/ð &/ð &/ðR #ð  #ð  #ð  #ðF.ð .ð .ð .ðNð Nð Nð Nð NˆDñ Nô Nð Nðb €ðð ð ð, €ˆz˜:Ñ&Ô&ðð ñ 'Ô&ðð0 €ˆz˜:Ñ&Ô&ðð ñ 'Ô&ððð ð Ð ð €Ð Ð"3Ñ4Ô4ðð ñ 5Ô4ðð €ˆ}˜mÑ,Ô,ðð ñ -Ô,ððð ð ðBuð uð uð uð uñ uô uð uð uð ur   