§
    cÌcüU  ã                   óò  — d Z ddlZddlmZ ddlZddlZddlZddlZddlZddl	m	Z	  e	 e
¦   «         d¦  «         ddlmZ dadadaej        Z ej        d¦  «        Zd	„ Zd
„ Zd„ Z G d„ de¦  «        Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd1d„Zd„ Z d„ Z!d„ Z"d„ Z#d2d„Z$d2d„Z%d„ Z&d„ Z'd3d„Z(d Z)d3d!„Z*d"„ Z+d4d$„Z,d%„ Z-d&„ Z.d5d'„Z/d(„ Z0d)„ Z1d*„ Z2 G d+„ d,ej3        ¦  «        Z4 G d-„ d.¦  «        Z5 G d/„ d0e5¦  «        Z6dS )6aŠ  Messages and logging.

Messages are supplied by callers as a string-formatting template, plus values
to be inserted into it.  The actual %-formatting is deferred to the log
library so that it doesn't need to be done for messages that won't be emitted.

Messages are classified by severity levels: critical, error, warning, info,
and debug.

They can be sent to two places: stderr, and `$XDG_CACHE_HOME/breezy/brz.log`.
For purposes such as running the test suite, they can also be redirected away
from both of those two places to another location.

`brz.log` gets all messages, and full tracebacks for uncaught exceptions.
This trace file is always in UTF-8, regardless of the user's default encoding,
so that we can always rely on writing any message.

Output to stderr depends on the mode chosen by the user.  By default, messages
of info and above are sent out, which results in progress messages such as the
list of files processed by add and commit.  In debug mode, stderr gets debug messages too.

Errors that terminate an operation are generally passed back as exceptions;
others may be just emitted as messages.

Exceptions are reported in a brief form to stderr so as not to look scary.
BzrErrors are required to be able to format themselves into a properly
explanatory message.  This is not true for builtin exceptions such as
KeyError, which typically just str to "0".  They're printed in a different
form.
é    N)ÚStringIOé   )Úlazy_importzI
from breezy import (
    bedding,
    debug,
    osutils,
    ui,
    )
)ÚerrorsÚbrzc                  ód   — t           j                             ¦   «          t          j        | i |¤Ž dS )zbOutput a note to the user.

    Takes the same parameters as logging.info.

    :return: None
    N)ÚuiÚ
ui_factoryÚ
clear_termÚ_brz_loggerÚinfo©ÚargsÚkwargss     ú./usr/lib/python3/dist-packages/breezy/trace.pyÚnoter   g   s4   € õ „M×ÒÑÔÐÝÔ�dÐ%˜fÐ%Ð%Ð%Ð%Ð%ó    c                  ód   — t           j                             ¦   «          t          j        | i |¤Ž d S ©N)r	   r
   r   r   Úwarningr   s     r   r   r   u   s2   € Ý„M×ÒÑÔÐÝÔ˜Ð( Ð(Ð(Ð(Ð(Ð(r   c                  ó(   — t          j        | i |¤Ž dS )ziShow an error message to the user.

    Don't use this for exceptions, use report_exception instead.
    N)r   Úerrorr   s     r   Ú
show_errorr   z   s    € õ
 Ô�tÐ&˜vÐ&Ð&Ð&Ð&Ð&r   c                   ó   — e Zd ZdZd„ Zd„ ZdS )Ú_Bytesz.Compat class for displaying bytes on Python 2.c                 ó<   — dt                                | ¦  «        z   S )NÚb)ÚstrÚ__repr__©Úselfs    r   r   z_Bytes.__repr__…   s   € Ø•S—\’\ $Ñ'Ô'Ñ'Ð'r   c                 ó.   — |                       dd¦  «        S )NÚasciiÚreplace)Údecoder    s    r   Ú__unicode__z_Bytes.__unicode__ˆ   s   € Ø�{Š{˜7 IÑ.Ô.Ð.r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r&   © r   r   r   r   ‚   s8   € € € € € Ø8Ð8ð(ð (ð (ð/ð /ð /ð /ð /r   r   c                 ó†  — t           €d S t          t           dd ¦  «        �t           j        rd S t          | t          ¦  «        r|                      dd¦  «        } |r| |z  }n| }t          j        ¦   «         }d                     |t          z
  |¦  «        }t            	                    | 
                    d¦  «        ¦  «         d S )NÚclosedr#   r$   z{:0.3f}  {}
úutf-8)Ú_trace_fileÚgetattrr-   Ú
isinstanceÚbytesr%   ÚtimeÚformatÚ_brz_log_start_timeÚwriteÚencode)Úfmtr   ÚoutÚnows       r   Úmutterr;   Œ   s¹   € ÝÐØˆõ 	•˜X tÑ,Ô,Ð8½kÔ>PÐ8Øˆõ �#•uÑÔð -Ø�jŠj˜ )Ñ,Ô,ˆàð Ø�D‰jˆˆàˆÝ
Œ)‰+Œ+€CØ
×
 Ò
  Õ':Ñ!:¸CÑ
@Ô
@€CÝ×Ò�c—j’j Ñ)Ô)Ñ*Ô*Ð*Ð*Ð*r   c                 ó  — ddl }t          ¦   «         }| €d}n| dz   }|                     ||¬¦  «         |                     ¦   «                              ¦   «         }d                     |dd…         ¦  «        }t          |dz   g||fz   ¢R Ž  dS )zÿPerform a mutter of fmt and args, logging the call trace.

    :param stacklevel: The number of frames to show. None will show all
        frames.
    :param fmt: The format string to pass to mutter.
    :param args: A list of substitution variables.
    r   Nr   )ÚlimitÚfileú
éþÿÿÿz
Called from:
%s)Ú	tracebackr   Úprint_stackÚgetvalueÚ
splitlinesÚjoinr;   )Ú
stacklevelr8   r   rA   Úoutfr=   Úformatted_linesÚformatted_stacks           r   Úmutter_callsiterJ   ¢   s¥   € ð ÐÐÐÝ‰:Œ:€DØÐØˆˆà˜Q‘ˆØ×Ò ¨DÐÑ1Ô1Ð1Ø—m’m‘o”o×0Ò0Ñ2Ô2€OØ—i’i °°°Ô 4Ñ5Ô5€OÝ
ˆ3Ð%Ñ%ÐD¨°Ð0BÑ)BÐDÐDÐDÐDÐDÐDr   c                 óÀ   — dd l }	 t          j         | ¦  «        |j                 }|dk    rd S | dz   }t                               | |¦  «         d S # t
          $ r Y d S w xY w)Nr   i  @ z.old)ÚstatÚosÚST_SIZEÚosutilsÚrenameÚOSError)Útrace_fnamerL   ÚsizeÚ	old_fnames       r   Ú_rollover_trace_mayberU   ¶   sz   € Ø€K€K€KðÝŒw�{Ñ#Ô# D¤LÔ1ˆØ�7Š?ˆ?ØˆFØ &Ñ(ˆ	Ý�Š�{ IÑ.Ô.Ð.Ð.Ð.øÝð ð ð Øˆˆðøøøs   †%A ­ A Á
AÁAc                  ó¶   — t           j                             d¦  «        } | r| S t           j                             t
                               ¦   «         d¦  «        S )z�Return the brz log filename.

    :return: A path to the log file
    :raise EnvironmentError: If the cache directory could not be created
    ÚBRZ_LOGzbrz.log)rM   ÚenvironÚgetÚpathrE   ÚbeddingÚ	cache_dir)Úbrz_logs    r   Ú_get_brz_log_filenamer^   Â   sF   € õ Œj�nŠn˜YÑ'Ô'€GØð ØˆÝŒ7�<Š<�×)Ò)Ñ+Ô+¨YÑ7Ô7Ð7r   c                  óà  — d„ } 	 t          ¦   «         at          t          ¦  «          | t          ¦  «        }|                     d¦  «         |                     ¦   «         dk    r?|                     d¦  «         |                     d¦  «         |                     d¦  «         |S # t
          $ r<}t          j                             d                     |¦  «        ¦  «         Y d}~nd}~ww xY wdS )	zöOpen the brz.log trace file.

    If the log is more than a particular length, the old file is renamed to
    brz.log.old and a new file is started.  Otherwise, we append to the
    existing file.

    This sets the global _brz_log_filename.
    c                 óø  — t           j        t           j        z  t          j        z  }	 	 t          j        | |¦  «        }n§# t          $ r }|j        t          j        k    r‚ Y d}~nd}~ww xY w	 t          j        | |t           j	        z  t           j
        z  d¦  «        }t                               | ¦  «         n.# t          $ r }|j        t          j        k    r‚ Y d}~nd}~ww xY wŒ¾t          j        |dd¦  «        S )a  Open existing log file, or create with ownership and permissions

        It inherits the ownership and permissions (masked by umask) from
        the containing directory to cope better with being run under sudo
        with $HOME still set to the user's homedir.
        TNi¶  Úabr   )rM   ÚO_WRONLYÚO_APPENDrO   ÚO_TEXTÚopenrQ   ÚerrnoÚENOENTÚO_CREATÚO_EXCLÚcopy_ownership_from_pathÚEEXISTÚfdopen)ÚfilenameÚflagsÚfdÚes       r   Ú_open_or_create_log_filez/_open_brz_log.<locals>._open_or_create_log_fileÙ   s  € õ ”�bœkÑ)­G¬NÑ:ˆð	ðÝ”W˜X uÑ-Ô-�ØøÝð ð ð Ø”7�eœlÒ*Ð*Øð +Ð*Ð*Ð*Ð*øøøøðøøøðÝ”W˜X u­r¬zÑ'9½B¼IÑ'EÀuÑMÔM�õ
 ×0Ò0°Ñ:Ô:Ð:Øøõ ð ð ð Ø”7�eœlÒ*Ð*Øð +Ð*Ð*Ð*Ð*øøøøðøøøð	õ Œy˜˜T 1Ñ%Ô%Ð%s-   ©? ¿
A)Á	A$Á$A)Á-0B8 Â8
C"ÃCÃC"ó   
é   s=   this is a debug log for diagnosing/reporting problems in brz
s=   you can delete or truncate this file, or include sections in
s8   bug reports to https://bugs.launchpad.net/brz/+filebug

zfailed to open trace file: {}
N)	r^   Ú_brz_log_filenamerU   r6   ÚtellrQ   ÚsysÚstderrr4   )rq   Úbrz_log_filerp   s      r   Ú_open_brz_logry   Î   s0  € ð&ð &ð &ð2FÝ1Ñ3Ô3ÐÝÕ/Ñ0Ô0Ð0à/Ð/Õ0AÑBÔBˆØ×Ò˜5Ñ!Ô!Ð!Ø×ÒÑÔ !Ò#Ð#Ø×ÒØQñSô Sð Sà×ÒØQñSô Sð Sà×ÒØMñOô Oð Oð Ðøåð Fð Fð Fõ 	Œ
×ÒÐ:×AÒAÀ!ÑDÔDÑEÔEÐEÐEÐEÐEÐEÐEøøøøðFøøøð ˆ4s   …BB% Â%
C+Â/2C&Ã&C+c                  ól  — t                                t          d¬¦  «        } t          ¦   «         }|�+|                     |                      d¦  «        dz   ¦  «         t          |dd¦  «        }t          j        t          j
        ¬¦  «        }t          j        d	¦  «                             |¦  «         |S )
a¶  Configure default logging: messages to stderr and debug to brz.log

    This should only be called once per process.

    Non-command-line programs embedding breezy do not need to call this.  They
    can instead either pass a file to _push_log_file, or act directly on
    logging.getLogger("brz").

    Output can be redirected away by calling _push_log_file.

    :return: A memento from push_log_file for restoring the log state.
    Úlocal)ÚtimezoneNr.   rr   zA[%(process)5d] %(asctime)s.%(msecs)03d %(levelname)s: %(message)sz%Y-%m-%d %H:%M:%S)Ústreamr   )rO   Úformat_local_dater5   ry   r6   r7   Úpush_log_fileÚloggingÚStreamHandlerrv   rw   Ú	getLoggerÚ
addHandler)Ú
start_timerx   ÚmementoÚstderr_handlers       r   Úenable_default_loggingr‡     s­   € õ ×*Ò*Õ+>Ø4;ð +ñ =ô =€Jå ‘?”?€LØÐØ×Ò˜:×,Ò,¨WÑ5Ô5¸Ñ=Ñ>Ô>Ð>ÝØØLØñô €Gõ Ô*µ#´*Ð=Ñ=Ô=€NÝÔ�eÑÔ×'Ò'¨Ñ7Ô7Ð7Ø€Nr   c                 ót  — t          | dt          j        ¬¦  «        }|€d}|                     t          j        ||¦  «        ¦  «         t          j        d¦  «        }|j        dd…         }|j        dd…= |                     |¦  «         |                     t          j        ¦  «         t          }| a	d|||| fS )zøIntercept log and trace messages and send them to a file.

    :param to_file: A file-like object to which messages will be sent.

    :returns: A memento that should be passed to _pop_log_file to restore the
        previously active logging.
    r.   ©ÚlevelNz%(levelname)8s  %(message)sr   Úlog_memento)
ÚEncodedStreamHandlerr€   ÚDEBUGÚsetFormatterÚ	Formatterr‚   Úhandlersrƒ   ÚsetLevelr/   )Úto_fileÚ
log_formatÚdate_formatÚnew_handlerÚ
brz_loggerÚold_handlersÚold_trace_files          r   r   r   ,  s½   € õ ' w°½w¼}ÐMÑMÔM€KØÐØ2ˆ
Ø×Ò�WÔ.¨z¸;ÑGÔGÑHÔHÐHåÔ" 5Ñ)Ô)€JØÔ& q q qÔ)€LØÔ˜A˜A˜AÐà×Ò˜+Ñ&Ô&Ð&Ø×Ò�œÑ&Ô&Ð&õ !€Nà€KØ˜<¨°nÀgÐNÐNr   c                 óÒ   — | \  }}}}}|a t          j        d¦  «        }|                     |¦  «         |                     ¦   «          ||_        |�|                     ¦   «          dS dS )zÑUndo changes to logging/tracing done by _push_log_file.

    This flushes, but does not close the trace file (so that anything that was
    in it is output.

    Takes the memento returned from _push_log_file.r   N)r/   r€   r‚   ÚremoveHandlerÚcloser�   Úflush)ÚentryÚmagicr—   r•   r˜   Únew_trace_filer–   s          r   Úpop_log_filer    N  s�   € ð JOÑF€UˆL˜+ ~°~à €KÝÔ" 5Ñ)Ô)€JØ×Ò˜[Ñ)Ô)Ð)ð ×ÒÑÔÐØ&€JÔØÐ!Ø×ÒÑÔÐÐÐð "Ð!r   c                  óP   — ddl } t          |                      ¦   «         ¦  «         dS )zÌLog the last exception to the trace file only.

    Used for exceptions that occur internally and that may be
    interesting to developers but not to users.  For example,
    errors loading plugins.
    r   N)rA   r;   Ú
format_exc)rA   s    r   Úlog_exception_quietlyr£   b  s0   € ð ÐÐÐÝ
ˆ9×ÒÑ!Ô!Ñ"Ô"Ð"Ð"Ð"r   c                 óv   — | a t          | dk     ¦  «         t          j                             | dk     ¦  «         dS )z]Set the verbosity level.

    :param level: -ve for quiet, 0 for normal, +ve for verbose
    r   N)Ú_verbosity_levelÚ_update_logging_levelr	   r
   Úbe_quietr‰   s    r   Úset_verbosity_levelr¨   m  s<   € ð ÐÝ˜% !š)Ñ$Ô$Ð$Ý„M×Ò˜5 1š9Ñ%Ô%Ð%Ð%Ð%r   c                  ó   — t           S )zHGet the verbosity level.

    See set_verbosity_level() for values.
    ©r¥   r+   r   r   Úget_verbosity_levelr«   x  s
   € õ
 Ðr   Tc                 óJ   — | rt          d¦  «         d S t          d¦  «         d S )Néÿÿÿÿr   )r¨   ©Úquiets    r   r§   r§   €  s2   € Øð Ý˜BÑÔÐÐÐå˜AÑÔÐÐÐr   c                 óž   — | r&t                                t          j        ¦  «         dS t                                t          j        ¦  «         dS )zHide INFO messages if quiet.N)r   r‘   r€   ÚWARNINGÚINFOr®   s    r   r¦   r¦   ‡  sB   € àð +Ý×Ò�Wœ_Ñ-Ô-Ð-Ð-Ð-å×Ò�Wœ\Ñ*Ô*Ð*Ð*Ð*r   c                  ó   — t           dk     S )z Is the verbosity level negative?r   rª   r+   r   r   Úis_quietr´   �  ó   € å˜aÒÐr   c                  ó   — t           dk    S )z Is the verbosity level positive?r   rª   r+   r   r   Ú
is_verboser·   ”  rµ   r   Ú c                 ó†   — t           j        dk    rddlm} |                     | |¬¦  «         dS t          | |¬¦  «         dS )zWrite out a memory dump.Úwin32r   )Ú
win32utils)ÚmessageÚshortN)rv   ÚplatformÚbreezyr»   Údebug_memory_win32apiÚ_debug_memory_proc)r¼   r½   r»   s      r   Údebug_memoryrÂ   ™  sY   € å
„|�wÒÐØ%Ð%Ð%Ð%Ð%Ð%Ø×(Ò(°ÀÐ(ÑFÔFÐFÐFÐFå 7°%Ð8Ñ8Ô8Ð8Ð8Ð8r   )ÚVmPeakÚVmSizeÚVmRSSc                 óÎ  — 	 t          dt          j        ¦   «         z  d¦  «        }n# t          $ r Y d S w xY w	 |                     ¦   «         }|                     ¦   «          n# |                     ¦   «          w xY w| rt          | ¦  «         |                     ¦   «         D ]D}|st          |¦  «         Œt          D ](}| 	                    |¦  «        rt          |¦  «          nŒ)ŒEd S )Nz/proc/%s/statusÚrb)
re   rM   ÚgetpidrQ   Úreadr›   r   rD   Ú_short_fieldsÚ
startswith)r¼   r½   Ústatus_fileÚstatusÚlineÚfields         r   rÁ   rÁ   ¥  s  € ðÝÐ,­r¬y©{¬{Ñ:¸DÑAÔAˆˆøÝð ð ð ØˆˆðøøøðØ×!Ò!Ñ#Ô#ˆà×ÒÑÔÐÐøˆ×ÒÑÔÐÐøøøØð ÝˆW‰ŒˆØ×!Ò!Ñ#Ô#ð ð ˆØð 	Ý�‰JŒJˆJˆJå&ð ð �Ø—?’? 5Ñ)Ô)ð Ý˜‘J”J�JØ�Eðøðð s   ‚$' §
5´5¹A" Á"A8c                 ó`  — dd l }	 	 |                     dd¬¦  «        \  }}t          j        |d¦  «        }ddlm} |                     |¦  «         |                      d|z  ¦  «         na# t          $ r& |                      d¦  «         t          ¦   «          Y n2t          $ r& |                      d	¦  «         t          ¦   «          Y nw xY w|�|                     ¦   «          d S |�t          j        |¦  «         d S d S # |�|                     ¦   «          w |�t          j        |¦  «         w w xY w)
Nr   Úbrz_memdumpz.json)ÚprefixÚsuffixÚw)ÚscannerzMemory dumped to %s
z'Dumping memory requires meliae module.
z Exception while dumping memory.
)ÚtempfileÚmkstemprM   rl   ÚmeliaerÕ   Údump_gc_objectsr6   ÚImportErrorr£   ÚBaseExceptionr›   )Úerr_filerÖ   ro   ÚnameÚ	dump_filerÕ   s         r   Ú_dump_memory_usagerß   º  sm  € Ø€O€O€Oðð	$Ø×'Ò'¨}ÀWÐ'ÑMÔM‰HˆB�Ýœ	 " cÑ*Ô*ˆIØ&Ð&Ð&Ð&Ð&Ð&Ø×#Ò# IÑ.Ô.Ð.Ø�NŠNÐ2°TÑ9Ñ:Ô:Ð:Ð:øÝð 	$ð 	$ð 	$Ø�NŠNÐEÑFÔFÐFÝ!Ñ#Ô#Ð#Ð#Ð#Ýð 	$ð 	$ð 	$Ø�NŠNÐ>Ñ?Ô?Ð?Ý!Ñ#Ô#Ð#Ð#Ð#ð	$øøøð Ð Ø�OŠOÑÔÐÐÐØˆ^ÝŒH�R‰LŒLˆLˆLˆLð ˆ^øð Ð Ø�OŠOÑÔÐÐØˆ^ÝŒH�R‰LŒLˆLˆLð øøøs6   ‡A"A* Á)C= Á*-CÂC= Â,CÃC= ÃCÃC= Ã=0D-Fc                 óf   — | j         }| j        }|dv s|r|dk    r|S d                     ||¦  «        S )z¶Give name of error class including module for non-builtin exceptions

    If `unqualified_breezy_errors` is True, errors specific to breezy will
    also omit the module prefix.
    )ÚbuiltinsÚ
exceptionsÚ__main__zbreezy.errorsz{}.{})r'   r(   r4   )ÚeclassÚunqualified_breezy_errorsÚ
class_nameÚmodule_names       r   Ú_qualified_exception_namerè   Ð  sL   € ð ”€JØÔ#€KØÐ<Ð<Ð<Ø%ð =Ø*5¸Ò*HÐ*HØÐØ�>Š>˜+ zÑ2Ô2Ð2r   c                 óØ  — t          ¦   «          dt          j        v rt          | |¦  «         t          j        S | \  }}}t          |t          ¦  «        r!|                     d¦  «         t          j        S t          |t          ¦  «        rT|                     d¦  «         dt          j        v rt          |¦  «         n|                     d¦  «         t          j        S t          |t          ¦  «        r?t          |¦  «                             d¦  «        rt          | |d¦  «         t          j        S t          |dd	¦  «        st          | |¦  «         t          j        S t          |t           ¦  «        r\t          |d
d¦  «        t"          j        k    r!|                     d¦  «         t          j        S t          | |¦  «         t          j        S t'          | |¦  «         t          j        S )zÎReport an exception to err_file (typically stderr) and to brz.log.

    This will show either a full traceback or a short message as appropriate.

    :return: The appropriate exit code for this error.
    r   zbrz: interrupted
zbrz: out of memory
Úmem_dumpz)Use -Dmem_dump to dump memory to a file.
zNo module named z7You may need to install this Python library separately.Úinternal_errorTrf   Nzbrz: broken pipe
)r£   ÚdebugÚdebug_flagsÚprint_exceptionr   Ú
EXIT_ERRORr1   ÚKeyboardInterruptr6   ÚMemoryErrorrß   rÚ   r   rË   Úreport_user_errorr0   ÚEnvironmentErrorrf   ÚEPIPEÚ
report_bugÚEXIT_INTERNAL_ERROR)Úexc_inforÜ   Úexc_typeÚ
exc_objectÚexc_tbs        r   Úreport_exceptionrû   Þ  sÓ  € õ ÑÔÐØ•%Ô#Ð#Ð#Ý˜ (Ñ+Ô+Ð+ÝÔ Ð Ø#+Ñ €Hˆj˜&Ý�*Õ/Ñ0Ô0ð *Ø�ŠÐ+Ñ,Ô,Ð,ÝÔ Ð Ý	�J¥Ñ	,Ô	,ð *Ø�ŠÐ-Ñ.Ô.Ð.Ø�Ô*Ð*Ð*Ý˜xÑ(Ô(Ð(Ð(à�NŠNÐGÑHÔHÐHÝÔ Ð Ý	�J¥Ñ	,Ô	,ð *Ý�J‘”×*Ò*Ð+=Ñ>Ô>ð*åØ�hØEñ	Gô 	Gð 	Gõ Ô Ð Ý�ZÐ!1°4Ñ8Ô8ð *Ý˜( HÑ-Ô-Ð-ÝÔ Ð Ý	�JÕ 0Ñ	1Ô	1ð 
*Ý�:˜w¨Ñ-Ô-µ´Ò<Ð<Ø�NŠNÐ/Ñ0Ô0Ð0ÝÔ$Ð$õ 	˜( HÑ-Ô-Ð-ÝÔ Ð å�8˜XÑ&Ô&Ð&ÝÔ)Ð)r   c                 óâ   — dd l }| \  }}}|                     d                     t          |¦  «        |¦  «        ¦  «         |                     d¦  «         |                     ||||¬¦  «         d S )Nr   zbrz: ERROR: {}: {}
r?   )r>   )rA   r6   r4   rè   rî   )r÷   rÜ   rA   rø   rù   rú   s         r   rî   rî     s…   € ØÐÐÐØ#+Ñ €Hˆj˜&Ø‡N‚NÐ)×0Ò0Ý! (Ñ+Ô+¨Zñ9ô 9ñ :ô :ð :à‡N‚N�4ÑÔÐØ×Ò˜h¨
°FÀÐÑJÔJÐJÐJÐJr   c                 ó´   — |                      d                     t          | d         ¦  «        ¦  «        ¦  «         |r|                      d|z  ¦  «         dS dS )a  Report to err_file an error that's not an internal error.

    These don't get a traceback unless -Derror was given.

    :param exc_info: 3-tuple from sys.exc_info()
    :param advice: Extra advice to the user to be printed following the
        exception.
    zbrz: ERROR: {}
r   z%s
N)r6   r4   r   )r÷   rÜ   Úadvices      r   rò   rò     s_   € ð ‡N‚NÐ%×,Ò,­S°¸!´Ñ-=Ô-=Ñ>Ô>Ñ?Ô?Ð?Øð (Ø�Š�v ‘Ñ'Ô'Ð'Ð'Ð'ð(ð (r   c                 ó*   — ddl m}  || |¦  «         dS )z8Report an exception that probably indicates a bug in brzr   )rõ   N)Úbreezy.crashrõ   )r÷   rÜ   rõ   s      r   rõ   rõ   #  s,   € à'Ð'Ð'Ð'Ð'Ð'Ø€Jˆx˜Ñ"Ô"Ð"Ð"Ð"r   c                  óþ   — 	 t           j                             ¦   «          t           j                             ¦   «          d S # t          $ r Y d S t
          $ r&} dd l}| j        |j        |j        fv rn‚ Y d } ~ d S d } ~ ww xY w)Nr   )	rv   Ústdoutrœ   rw   Ú
ValueErrorrQ   rf   ÚEINVALrô   )rp   rf   s     r   Ú_flush_stdout_stderrr  )  s£   € ðÝŒ
×ÒÑÔÐÝŒ
×ÒÑÔÐÐÐøÝð ð ð ð 	ˆˆÝð ð ð ØˆˆˆØŒ7�u”| U¤[Ð1Ð1Ð1Øàð ˆDˆDˆDˆDˆDøøøøðøøøs   ‚<A  Á 
A<Á	A<ÁA7Á7A<c                  óJ   — t           rt                                ¦   «          d S d S r   )r/   rœ   r+   r   r   Ú_flush_tracer  :  s.   € õ ð Ý×ÒÑÔÐÐÐðð r   c                   ó&   — e Zd ZdZdd„Zd„ Zd„ ZdS )	rŒ   aw  Robustly write logging events to a stream using the specified encoding

    Messages are expected to be formatted to unicode, but UTF-8 byte strings
    are also accepted. An error during formatting or a str message in another
    encoding will be quitely noted as an error in the Bazaar log file.

    The stream is not closed so sys.stdout or sys.stderr may be passed.
    NÚstrictr   c                 ó–   — t           j                             | |¦  «         || _        |€t	          |dd¦  «        }|| _        || _        d S )NÚencodingr#   )r€   ÚHandlerÚ__init__r}   r0   r  r   )r!   r}   r  r   rŠ   s        r   r  zEncodedStreamHandler.__init__K  sJ   € ÝŒ× Ò   uÑ-Ô-Ð-ØˆŒØÐÝ˜v z°7Ñ;Ô;ˆHØ ˆŒØˆŒˆˆr   c                 óN   — t          | j        dd ¦  «        }|� |¦   «          d S d S )Nrœ   )r0   r}   )r!   rœ   s     r   rœ   zEncodedStreamHandler.flushS  s2   € Ý˜œ W¨dÑ3Ô3ˆØÐØˆE‰GŒGˆGˆGˆGð Ðr   c                 óN  — 	 t          |j        t          ¦  «        s!|j                             d¦  «        }||_        |                      |¦  «        }t          |t          ¦  «        s|                     d¦  «        }| j                             |                     | j        | j	        ¦  «        dz   ¦  «         d S # t          $ ra t          ¦   «          dx}}	 t          |j        ¦  «        }t          |j        ¦  «        }n# t          $ r Y nw xY wt          d||¦  «         Y d S w xY w)Nr.   rr   z<Unformattable>z&Logging record unformattable: %s %% %s)r1   Úmsgr   r%   r4   r}   r6   r7   r  r   Ú	Exceptionr£   Úreprr   r;   )r!   Úrecordr  rÎ   r   s        r   ÚemitzEncodedStreamHandler.emitX  s7  € ð	HÝ˜fœj­#Ñ.Ô.ð !Ø”j×'Ò'¨Ñ0Ô0�Ø �”
Ø—;’;˜vÑ&Ô&ˆDÝ˜d¥CÑ(Ô(ð ,Ø—{’{ 7Ñ+Ô+�ØŒK×Ò˜dŸkšk¨$¬-¸¼ÑEÔEÈÑMÑNÔNÐNÐNÐNøÝð 	Hð 	Hð 	HÝ!Ñ#Ô#Ð#à*Ð*ˆC�$ðÝ˜6œ:Ñ&Ô&�Ý˜FœKÑ(Ô(��øÝð ð ð Ø�ðøøøõ Ð;¸SÀ$ÑGÔGÐGÐGÐGÐGð	Høøøs6   ‚B5B9 Â9D$Ã(C?Ã>D$Ã?
DÄ	D$ÄDÄD$Ä#D$)Nr	  r   )r'   r(   r)   r*   r  rœ   r  r+   r   r   rŒ   rŒ   A  sU   € € € € € ðð ðð ð ð ðð ð ð
Hð Hð Hð Hð Hr   rŒ   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚConfiga  Configuration of message tracing in breezy.

    This implements the context manager protocol and should manage any global
    variables still used. The default config used is DefaultConfig, but
    embedded uses of breezy may wish to use a custom manager.
    c                 ó   — | S r   r+   r    s    r   Ú	__enter__zConfig.__enter__w  s   € Øˆr   c                 ó   — dS ©NFr+   ©r!   rø   Úexc_valrú   s       r   Ú__exit__zConfig.__exit__z  s   € Øˆur   N©r'   r(   r)   r*   r  r  r+   r   r   r  r  o  s<   € € € € € ðð ðð ð ðð ð ð ð r   r  c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚDefaultConfigzrA default configuration for tracing of messages in breezy.

    This implements the context manager protocol.
    c                 óD   — t           | _        t          ¦   «         | _        | S r   )rt   Ú_original_filenamer‡   Ú_original_stater    s    r   r  zDefaultConfig.__enter__„  s   € Ý"3ˆÔÝ5Ñ7Ô7ˆÔØˆr   c                 ó<   — t          | j        ¦  «         | j        adS r  )r    r#  r"  rt   r  s       r   r  zDefaultConfig.__exit__‰  s!   € Ý�TÔ)Ñ*Ô*Ð*à Ô3ÐØˆur   Nr  r+   r   r   r   r   ~  s<   € € € € € ðð ð
ð ð ð
ð ð ð ð r   r   )NN)T)r¸   T)Fr   )7r*   rf   Úior   r€   rM   rv   r3   r¿   r   Úglobalsr¸   r   r¥   r/   rt   Ú_start_timer5   r‚   r   r   r   r   r   r   r;   rJ   rU   r^   ry   r‡   r   r    r£   r¨   r«   r§   r¦   r´   r·   rÂ   rÊ   rÁ   rß   rè   rû   rî   rò   rõ   r  r  r  rŒ   r  r   r+   r   r   ú<module>r(     sw  ðð"ð ðP €€€Ø Ð Ð Ð Ð Ð Ø €€€Ø 	€	€	€	Ø 
€
€
€
Ø €€€à €€€à $Ð $Ð $Ð $Ð $Ð $Ø €ˆGˆG‰IŒIð ñ ô ð ðð ð ð ð ð ð Ð ð €ð Ð ð Ô(Ð ð  ˆgÔ Ñ&Ô&€ð&ð &ð &ð)ð )ð )ð
'ð 'ð 'ð/ð /ð /ð /ð /ˆSñ /ô /ð /ð+ð +ð +ð,Eð Eð Eð(	ð 	ð 	ð	8ð 	8ð 	8ð>ð >ð >ðBð ð ð:Oð Oð Oð OðDð ð ð(#ð #ð #ð&ð &ð &ðð ð ðð ð ð ð+ð +ð +ð +ð ð  ð  ð
 ð  ð  ð
9ð 9ð 9ð 9ð .€ðð ð ð ð*ð ð ð,3ð 3ð 3ð 3ð**ð **ð **ðZKð Kð Kð(ð (ð (ð (ð#ð #ð #ðð ð ð"ð ð ð+Hð +Hð +Hð +Hð +H˜7œ?ñ +Hô +Hð +Hð\ð ð ð ð ñ ô ð ðð ð ð ð �Fñ ô ð ð ð r   