§
    cÌcü&  ã                   ó  — d Z 	 ddlZddlmZmZmZ  ej        d¦  «        ZdZ G d„ dej	        ¦  «        Z
 G d	„ d
ej	        ¦  «        Z G d„ dej	        ¦  «        Z G d„ d¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Zdd„Zd„ ZdS )Úgoogleé    Né   )ÚerrorsÚosutilsÚ	transports   Bazaar views format (\d+)s   Bazaar views format 1
c                   ó   — e Zd ZdZdZd„ ZdS )Ú
NoSuchViewzA view does not exist.
    zNo such view: %(view_name)s.c                 ó   — || _         d S ©N)Ú	view_name©Úselfr   s     ú./usr/lib/python3/dist-packages/breezy/views.pyÚ__init__zNoSuchView.__init__.   s   € Ø"ˆŒˆˆó    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú_fmtr   © r   r   r	   r	   (   s4   € € € € € ðð ð *€Dð#ð #ð #ð #ð #r   r	   c                   ó   — e Zd ZdZdZd„ ZdS )ÚViewsNotSupportedz.Views are not supported by a tree format.
    z]Views are not supported by %(tree)s; use 'brz upgrade' to change your tree to a later format.c                 ó   — || _         d S r   ©Útree©r   r   s     r   r   zViewsNotSupported.__init__9   ó   € ØˆŒ	ˆ	ˆ	r   Nr   r   r   r   r   r   2   s5   € € € € € ðð ðH€Dðð ð ð ð r   r   c                   ó   — e Zd ZdZd„ ZdS )ÚFileOutsideViewzHSpecified file "%(file_name)s" is outside the current view: %(view_str)sc                 óH   — || _         d                     |¦  «        | _        d S )Nú, )Ú	file_nameÚjoinÚview_str)r   r$   Ú
view_filess      r   r   zFileOutsideView.__init__B   s    € Ø"ˆŒØŸ	š	 *Ñ-Ô-ˆŒˆˆr   N)r   r   r   r   r   r   r   r   r!   r!   =   s*   € € € € € ð€Dð.ð .ð .ð .ð .r   r!   c                   ó   — e Zd ZdZd„ ZdS )Ú_ViewszBase class for View managers.c                 ó*   — t          | j        ¦  «        ‚r   )ÚNotImplementedErrorÚsupports_views©r   s    r   r,   z_Views.supports_viewsJ   s   € Ý! $Ô"5Ñ6Ô6Ð6r   N)r   r   r   r   r,   r   r   r   r)   r)   G   s)   € € € € € Ø'Ð'ð7ð 7ð 7ð 7ð 7r   r)   c                   óX   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zdd„Zdd	„Z	d
„ Z
d„ Zd„ Zd„ Zd„ ZdS )ÚPathBasedViewsaÔ  View storage in an unversioned tree control file.

    Views are stored in terms of paths relative to the tree root.

    The top line of the control file is a format marker in the format:

      Bazaar views format X

    where X is an integer number. After this top line, version 1 format is
    stored as follows:

     * optional name-values pairs in the format 'name=value'

     * optional view definitions, one per line in the format

       views:
       name file1 file2 ...
       name file1 file2 ...

    where the fields are separated by a nul character ( ). The views file
    is encoded in utf-8. The only supported keyword in version 1 is
    'current' which stores the name of the current view, if any.
    c                 ó>   — || _         d| _        d | _        i | _        d S ©NF)r   Ú_loadedÚ_currentÚ_viewsr   s     r   r   zPathBasedViews.__init__g   s"   € ØˆŒ	ØˆŒØˆŒØˆŒˆˆr   c                 ó   — dS )NTr   r-   s    r   r,   zPathBasedViews.supports_viewsm   s   € Øˆtr   c                 óF   — |                       ¦   «          | j        | j        fS )zðGet the current view and dictionary of views.

        Returns: current, views where
          current = the name of the current view or None if no view is enabled
          views = a map from view name to list of files/directories
        )Ú_load_view_infor3   r4   r-   s    r   Úget_view_infozPathBasedViews.get_view_infop   s%   € ð 	×ÒÑÔÐØŒ}˜dœkÐ)Ð)r   c                 óØ   — |�||vrt          |¦  «        ‚| j                             ¦   «         5  || _        || _        |                      ¦   «          ddd¦  «         dS # 1 swxY w Y   dS )zäSet the current view and dictionary of views.

        Args:
          current: the name of the current view or None if no view is
              enabled
          views: a map from view name to list of files/directories
        N)r	   r   Ú
lock_writer3   r4   Ú_save_view_info)r   ÚcurrentÚviewss      r   Úset_view_infozPathBasedViews.set_view_infoz   sº   € ð Ð 7°%Ð#7Ð#7Ý˜WÑ%Ô%Ð%ØŒY×!Ò!Ñ#Ô#ð 	#ð 	#Ø#ˆDŒMØˆDŒKØ× Ò Ñ"Ô"Ð"ð	#ð 	#ð 	#ñ 	#ô 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#øøøð 	#ð 	#ð 	#ð 	#ð 	#ð 	#s   ¯#AÁA#Á&A#Nc                 ó¦   — |                       ¦   «          	 |€| j        r| j        }ng S | j        |         S # t          $ r t	          |¦  «        ‚w xY w)zÏReturn the contents of a view.

        Args:
          view_Name: name of the view or None to lookup the current view

        Returns:
          the list of files/directories in the requested view
        )r7   r3   r4   ÚKeyErrorr	   r   s     r   Úlookup_viewzPathBasedViews.lookup_view‰   so   € ð 	×ÒÑÔÐð	(ØÐ Ø”=ð Ø $¤�I�Ià�IØ”;˜yÔ)Ð)øÝð 	(ð 	(ð 	(Ý˜YÑ'Ô'Ð'ð	(øøøs   –6 ©6 ¶ATc                 óà   — | j                              ¦   «         5  |                      ¦   «          || j        |<   |r|| _        |                      ¦   «          ddd¦  «         dS # 1 swxY w Y   dS )zàAdd or update a view definition.

        Args:
          view_name: the name of the view
          view_files: the list of files/directories in the view
          make_current: make this view the current one or not
        N)r   r:   r7   r4   r3   r;   )r   r   r'   Úmake_currents       r   Úset_viewzPathBasedViews.set_view�   s»   € ð ŒY×!Ò!Ñ#Ô#ð 	#ð 	#Ø× Ò Ñ"Ô"Ð"Ø%/ˆDŒK˜	Ñ"Øð *Ø )�”Ø× Ò Ñ"Ô"Ð"ð	#ð 	#ð 	#ñ 	#ô 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#øøøð 	#ð 	#ð 	#ð 	#ð 	#ð 	#s   š<A#Á#A'Á*A'c                 ó,  — | j                              ¦   «         5  |                      ¦   «          	 | j        |= n# t          $ r t          |¦  «        ‚w xY w|| j        k    rd| _        |                      ¦   «          ddd¦  «         dS # 1 swxY w Y   dS )znDelete a view definition.

        If the view deleted is the current one, the current view is reset.
        N)r   r:   r7   r4   r@   r	   r3   r;   r   s     r   Údelete_viewzPathBasedViews.delete_view¬   sï   € ð
 ŒY×!Ò!Ñ#Ô#ð 	#ð 	#Ø× Ò Ñ"Ô"Ð"ð,Ø”K 	Ð*Ð*øÝð ,ð ,ð ,Ý  Ñ+Ô+Ð+ð,øøøà˜DœMÒ)Ð)Ø $�”Ø× Ò Ñ"Ô"Ð"ð	#ð 	#ð 	#ñ 	#ô 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#øøøð 	#ð 	#ð 	#ð 	#ð 	#ð 	#s%   šB	°9¸B	¹AÁ)B	Â	BÂBc                 ó  — | j                              ¦   «         5  | j        €i }n	d| j        i}| j         j                             d|                      || j        ¦  «        ¦  «         ddd¦  «         dS # 1 swxY w Y   dS )zŸSave the current view and all view definitions.

        Be sure to have initialised self._current and self._views before
        calling this method.
        Nr<   r=   )r   r:   r3   Ú
_transportÚ	put_bytesÚ_serialize_view_contentr4   )r   Úkeywordss     r   r;   zPathBasedViews._save_view_info»   sâ   € ð ŒY×!Ò!Ñ#Ô#ð 	Nð 	NØŒ}Ð$Ø��à% t¤}Ð5�ØŒIÔ ×*Ò*Ø˜×5Ò5°hÀÄÑLÔLñNô Nð Nð	Nð 	Nð 	Nñ 	Nô 	Nð 	Nð 	Nð 	Nð 	Nð 	Nð 	Nð 	Nøøøð 	Nð 	Nð 	Nð 	Nð 	Nð 	Ns   šAA4Á4A8Á;A8c                 ó€  — | j         s¶| j                             ¦   «         5  	 | j        j                             d¦  «        }|                      |¦  «        \  }| _        |                     d¦  «        | _        n$# t          j
        $ r di c| _        | _        Y nw xY wddd¦  «         n# 1 swxY w Y   d| _         dS dS )z9Load the current view and dictionary of view definitions.r=   r<   NT)r2   r   Ú	lock_readrH   Ú	get_bytesÚ_deserialize_view_contentr4   Úgetr3   r   Ú
NoSuchFile)r   Úview_contentrK   s      r   r7   zPathBasedViews._load_view_infoÉ   s  € àŒ|ð 
	 Ø”×$Ò$Ñ&Ô&ð <ð <ð<Ø#'¤9Ô#7×#AÒ#AÀ'Ñ#JÔ#J�Lð
 ×6Ò6°|ÑDÔDñ *�H˜dœkà$,§L¢L°Ñ$;Ô$;�D”M�Møõ !Ô+ð :ð :ð :Ø15°rÐ.�D”M 4¤; ; ;ð:øøøð<ð <ð <ñ <ô <ð <ð <ð <ð <ð <ð <øøøð <ð <ð <ð <ð  ˆDŒLˆLˆLð
	 ð 
	 s4   ¡B*£A:Á8B*Á:BÂB*ÂBÂB*Â*B.Â1B.c                 óÎ  — t           g}|D ]F}d                     |||         ¦  «        }|                     |                     d¦  «        ¦  «         ŒG|r~|                     d¦  «         t	          |¦  «        D ]Y}d                     |d                     ||         ¦  «        ¦  «        }|                     |                     d¦  «        ¦  «         ŒZd                     |¦  «        S )z:Convert view keywords and a view dictionary into a stream.z{}={}
úutf-8s   views:
z{} {}
ú r   )Ú_VIEWS_FORMAT1_MARKERÚformatÚappendÚencodeÚsortedr%   )r   rK   Ú	view_dictÚlinesÚkeyÚlineÚviewÚ	view_datas           r   rJ   z&PathBasedViews._serialize_view_content×   sÜ   € å&Ð'ˆØð 	/ð 	/ˆCØ×#Ò# C¨°#¬Ñ7Ô7ˆDØ�LŠL˜Ÿš WÑ-Ô-Ñ.Ô.Ð.Ð.Øð 	8Ø�LŠL˜Ñ%Ô%Ð%Ý˜yÑ)Ô)ð 8ð 8�Ø&×-Ò-¨d°D·I²I¸iÈ¼oÑ4NÔ4NÑOÔO�	Ø—’˜Y×-Ò-¨gÑ6Ô6Ñ7Ô7Ð7Ð7Ø�xŠx˜‰ŒÐr   c                 óÈ  — |dk    ri i fS |                      ¦   «         }t                               |d         ¦  «        }|st          d¦  «        ‚|                     d¦  «        dk    r%t          d|                     d¦  «        z  ¦  «        ‚	 i }i }d}|dd…         D ]™}|                     d	¦  «        }|r0|                     d
¦  «        }	|	                     d¦  «        }
|	||
<   ŒI|dk    rd}ŒR|                     d¦  «        dk    r|                     dd¦  «        \  }}|||<   ŒŠt          d|¦  «        ‚||fS # t          $ r}t          d|›d|›�¦  «        ‚d}~ww xY w)z>Convert a stream into view keywords and a dictionary of views.r   r   z,format marker missing from top of views filer   ó   1zcannot decode views format %sFNrT   rU   zviews:Tú=z#failed to deserialize views line %sz$failed to deserialize views content z: )	Ú
splitlinesÚ_VIEWS_FORMAT_MARKER_REÚmatchÚ
ValueErrorÚgroupÚdecodeÚsplitÚpopÚfind)r   rR   r\   rf   rK   r=   Úin_viewsr^   ÚtextÚpartsr_   ÚkeywordÚvalueÚes                 r   rO   z(PathBasedViews._deserialize_view_contentä   s½  € ð ˜3ÒÐØ�r�6ˆMØ×'Ò'Ñ)Ô)ˆÝ'×-Ò-¨e°A¬hÑ7Ô7ˆØð 	BÝØ>ñ@ô @ð @à�[Š[˜‰^Œ^˜tÒ#Ð#ÝØ/°%·+²+¸a±.´.Ñ@ñBô Bð Bð	2ØˆHØˆEØˆHØ˜a˜b˜bœ	ð +ð +�Ø—{’{ 7Ñ+Ô+�Øð +Ø ŸJšJ tÑ,Ô,�EØ Ÿ9š9 Q™<œ<�DØ"'�E˜$‘K�KØ˜XÒ%Ð%Ø#�HØØ—Y’Y˜s‘^”^ qÒ(Ð(à%)§Z¢Z°°QÑ%7Ô%7‘N�G˜UØ(-�H˜WÑ%Ð%å$Ð%JØ%)ñ+ô +ð +à˜U�?Ð"øÝð 	2ð 	2ð 	2Ý�*Ø ,  ¨a¨að1ñ 2ô 2ð 2øøøøð	2øøøs   ÂB-D= Ä=
E!ÅEÅE!r   )T)r   r   r   r   r   r,   r8   r>   rA   rD   rF   r;   r7   rJ   rO   r   r   r   r/   r/   N   sÐ   € € € € € ðð ð0ð ð ðð ð ð*ð *ð *ð#ð #ð #ð(ð (ð (ð (ð(#ð #ð #ð #ð#ð #ð #ðNð Nð Nð ð  ð  ðð ð ð%2ð %2ð %2ð %2ð %2r   r/   c                   ó8   — e Zd ZdZd„ Zd„ Zd„ ZeZeZeZ	eZ
eZdS )ÚDisabledViewszlView storage that refuses to store anything.

    This is used by older formats that can't store views.
    c                 ó   — || _         d S r   r   r   s     r   r   zDisabledViews.__init__  r   r   c                 ó   — dS r1   r   r-   s    r   r,   zDisabledViews.supports_views  s   € Øˆur   c                 ó*   — t          | j        ¦  «        ‚r   )r   r   )r   ÚaÚks      r   Ú_not_supportedzDisabledViews._not_supported  s   € Ý ¤	Ñ*Ô*Ð*r   N)r   r   r   r   r   r,   rz   r8   r>   rA   rD   rF   r   r   r   rt   rt     s`   € € € € € ðð ð
ð ð ðð ð ð+ð +ð +ð #€MØ"€MØ €KØ€HØ €K€K€Kr   rt   c                 ót   ‡— ‰€d                      | ¦  «        S d                      ˆfd„| D ¦   «         ¦  «        S )zžGet the display string for a list of view files.

    Args:
      view_files: the list of file names
      encoding: the encoding to display the files in
    Nr#   c                 ó<   •— g | ]}|                      ‰d ¦  «        ‘ŒS )Úreplace)rY   )Ú.0ÚvÚencodings     €r   ú
<listcomp>z$view_display_str.<locals>.<listcomp>,  s'   ø€ ÐLÐLÐL¸A˜!Ÿ(š( 8¨YÑ7Ô7ÐLÐLÐLr   )r%   )r'   r€   s    `r   Úview_display_strr‚   "  sD   ø€ ð ÐØ�yŠy˜Ñ$Ô$Ð$à�yŠyÐLÐLÐLÐLÀÐLÑLÔLÑMÔMÐMr   c                 ó¶   — |                       ¦   «         r@| j                             ¦   «         }|r't          j        ||¦  «        st          ||¦  «        ‚dS dS dS )zBIf a working tree has a view enabled, check the path is within it.N)r,   r=   rA   r   Úis_inside_anyr!   )r   Úrelpathr'   s      r   Úcheck_path_in_viewr†   /  ss   € à×ÒÑÔð 7Ø”Z×+Ò+Ñ-Ô-ˆ
Øð 	7�gÔ3°JÀÑHÔHð 	7Ý! '¨:Ñ6Ô6Ð6ð7ð 7ð	7ð 	7ð 	7ð 	7r   r   )Ú__docformat__ÚreÚ r   r   r   Úcompilere   rV   ÚBzrErrorr	   r   r!   r)   r/   rt   r‚   r†   r   r   r   ú<module>rŒ      s£  ðð" €ðð 
€	€	€	ðð ð ð ð ð ð ð ð ð ð %˜"œ*Ð%BÑCÔCÐ Ø2Ð ð#ð #ð #ð #ð #�”ñ #ô #ð #ðð ð ð ð ˜œñ ô ð ð.ð .ð .ð .ð .�f”oñ .ô .ð .ð7ð 7ð 7ð 7ð 7ñ 7ô 7ð 7ð{2ð {2ð {2ð {2ð {2�Vñ {2ô {2ð {2ð|!ð !ð !ð !ð !�Fñ !ô !ð !ð,
Nð 
Nð 
Nð 
Nð7ð 7ð 7ð 7ð 7r   