§
    cÌcS  ã                   ón   — d Z dgZddlZddlZddlmZ  e e¦   «         d¦  «          G d„ d¦  «        ZdS )z9The core state needed to make use of bzr is managed here.ÚBzrLibraryStateé    Né   )Úlazy_importz_
from breezy import (
    config,
    osutils,
    symbol_versioning,
    trace,
    ui,
    )
c                   ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )r   aÌ  The state about how breezy has been configured.

    This is the core state needed to make use of bzr. The current instance is
    currently always exposed as breezy._global_state, but we desired to move
    to a point where no global state is needed at all.

    :ivar exit_stack: An ExitStack which can be used for cleanups that
        should occur when the use of breezy is completed. This is initialised
        in __enter__ and executed in __exit__.
    c                 óz   — || _         || _        t                               ¦   «         | _        i | _        d| _        dS )aE  Create library start for normal use of breezy.

        Most applications that embed breezy, including bzr itself, should just
        call breezy.initialize(), but it is possible to use the state class
        directly. The initialize() function provides sensible defaults for a
        CLI program, such as a text UI factory.

        More options may be added in future so callers should use named
        arguments.

        BzrLibraryState implements the Python 2.5 Context Manager protocol
        PEP343, and can be used with the with statement. Upon __enter__ the
        global variables in use by bzr are set, and they are cleared on
        __exit__.

        :param ui: A breezy.ui.ui_factory to use.
        :param trace: A breezy.trace.Config context manager to use, perhaps
            breezy.trace.DefaultConfig.
        FN)Ú_uiÚ_traceÚconfigÚCommandLineStoreÚcmdline_overridesÚconfig_storesÚstarted)ÚselfÚuiÚtraces      ú6/usr/lib/python3/dist-packages/breezy/library_state.pyÚ__init__zBzrLibraryState.__init__4   s;   € ð( ˆŒØˆŒõ "(×!8Ò!8Ñ!:Ô!:ˆÔàˆÔØˆŒˆˆó    c                 ó<   — | j         s|                      ¦   «          | S )N)r   Ú_start©r   s    r   Ú	__enter__zBzrLibraryState.__enter__Q   s   € ØŒ|ð 	Ø�KŠK‰MŒMˆMØˆr   c                 óî  — t          j        ¦   «         | _        t          j        d         dk    r3| j                             t                               d¬¦  «        ¦  «         | j         	                    ¦   «          t          j
        j        | _        | j        �/| j        t          j
        _        | j         	                    ¦   «          t          j        �t          d¦  «        ‚| t          _        d| _        dS )zDo all initialization.é   ÚfinalT)ÚoverrideNzBreezy already initialized)Ú
contextlibÚ	ExitStackÚ
exit_stackÚbreezyÚversion_infoÚcallbackÚsymbol_versioningÚsuppress_deprecation_warningsr	   r   r   Ú
ui_factoryÚ_orig_uir   Ú_global_stateÚRuntimeErrorr   r   s    r   r   zBzrLibraryState._startV   sÍ   € õ %Ô.Ñ0Ô0ˆŒåÔ˜qÔ! WÒ,Ð,ØŒO×$Ò$Ý!×?Ò?ÈÐ?ÑNÔNñPô Pð Pð 	Œ×ÒÑÔÐåœ	Ô,ˆŒØŒ8ÐØ#'¤8�FŒIÔ ØŒH×ÒÑ Ô Ð åÔÐ+ÝÐ;Ñ<Ô<Ð<Ø#�ÔØˆŒˆˆr   c                 óð  — |€3| j                              ¦   «         D ]\  }}|                     ¦   «          Œ| j                             ¦   «          t
                               ¦   «          t
                               ¦   «          t           	                    ¦   «          | j
        �| j
                             d d d ¦  «         | j                             d d d ¦  «         | j        t          _        d t           _        dS )NF)r   ÚitemsÚsave_changesr   Úcloser   Ú_flush_stdout_stderrÚ_flush_traceÚosutilsÚreport_extension_load_failuresr   Ú__exit__r	   r&   r   r%   r    r'   )r   Úexc_typeÚexc_valÚexc_tbÚkÚstores         r   r1   zBzrLibraryState.__exit__n   sÛ   € ØÐà Ô.×4Ò4Ñ6Ô6ð %ð %‘��5Ø×"Ò"Ñ$Ô$Ð$Ð$ØŒ×ÒÑÔÐÝ×"Ò"Ñ$Ô$Ð$Ý×ÒÑÔÐÝ×.Ò.Ñ0Ô0Ð0ØŒ8ÐØŒH×Ò˜d D¨$Ñ/Ô/Ð/ØŒ×Ò˜T 4¨Ñ.Ô.Ð.Øœ�ŒØ#�ÔØˆur   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r1   © r   r   r   r   (   sZ   € € € € € ð	ð 	ðð ð ð:ð ð ð
ð ð ð0ð ð ð ð r   )r:   Ú__all__r   r    r   Úglobalsr   r;   r   r   ú<module>r>      s¢   ðð" @Ð ?ð ð€ð
 Ð Ð Ð ð €€€Ø $Ð $Ð $Ð $Ð $Ð $Ø €ˆGˆG‰IŒIð ñ ô ð ðTð Tð Tð Tð Tñ Tô Tð Tð Tð Tr   