§
    cÌcƒ  ã                   óê  — d Z ddlmZ ddlmZ d„ Zd„ Zd„ Zd„ Z ej	        dd	d
¦  «          ej	        dd	d¦  «          ej	        dd	d¦  «          ej	        dd	d¦  «          ej	        dd	d¦  «          ej	        dd	d¦  «          ej	        dd	d¦  «          ej	        dd	d¦  «          ej	        dd	d¦  «          ej	        dd	d¦  «         ddl
mZ  eddd ed!¦  «          eddd"ed!¦  «         d#S )$a†	  Sending emails for commits and branch changes.

To have Breezy send an email you need to configure an address to send mail
to for that branch. To do this set the configuration option ``post_commit_to``
and the address to send the mail from is read from the configuration option
``post_commit_sender`` (if not supplied defaults to the email address reported
by ``brz whoami``).

By default, the diff for the commit will be included in the email if the
length is less than 1000 lines. This limit can be changed by setting the
configuration option 'post_commit_difflimit' to the number of lines you wish
it to be limited to. Set it to 0 to unconditionally disable sending of diffs.

By default emails are sent only when a commit occurs, not when a push or
pull operation occurs. To email on push or pull set post_commit_push_pull=True
in the configuration.

The URL of the branch is determined from the following checks (in order):
 - If the configuration value 'post_commit_url' is set, it is used.
 - If the configuration value 'public_branch' is set, it is used.
 - The URL of the branch itself.

Setting public_branch is highly recommended if you commit via a protocol which
has a private address (e.g. bzr+ssh but anonymous access might be bzr:// or
http://).

How emails are sent is determined by the value of the configuration option
'post_commit_mailer':
 - Unset: use ``/usr/bin/mail``.
 - ``smtplib``: Use python's smtplib to send the mail. If you use 'smtplib' you
   can also configure the settings "smtp_server=host[:port]",
   "smtp_username=userid", "smtp_password". If "smtp_username" is set but
   "smtp_password" is not, you will be prompted for a password.

   Also, if using 'smtplib', the messages will be sent as a UTF-8 text message,
   with a 8-bit text diff attached (rather than all-as-one). Work has also been
   done to make sure usernames do not have to be ascii.
 - Any other value: Run the value expecting it to behave like ``/usr/bin/mail``
   - in particular supporting the -s and -a options.

When using smtplib, you can specify additional headers to be included in the
mail by setting the 'revision_mail_headers' configuration option - something
like::

  revision_mail_headers=X-Cheese: to the rescue!

Other supported options (use ``brz help <option>`` for more information)
are: post_commit_body, post_commit_subject, post_commit_log_format,
post_commit_diffoptions, post_commit_sender, post_commit_to.
é   )Úversion_info)Úoption_registryc                 óˆ   — ddl m} |                     | ||                      ¦   «         ¦  «                             ¦   «          dS )z>This is the post_commit hook that should get run after commit.é   ©ÚemailerN©Ú r   ÚEmailSenderÚget_config_stackÚ
send_maybe)ÚbranchÚrevision_idr   s      ú?/usr/lib/python3/dist-packages/breezy/plugins/email/__init__.pyÚpost_commitr   G   sI   € àÐÐÐÐÐØ×Ò˜ Ø×/Ò/Ñ1Ô1ñ3ô 3ß3=²:±<´<°<°<°<ó    c                 óŒ   — ddl m} |                     |||                     ¦   «         | ¬¦  «                             ¦   «          dS )z4This is the post_commit hook that runs after commit.r   r   )Úlocal_branchNr	   )ÚlocalÚmasterÚ	old_revnoÚ	old_revidÚ	new_revnoÚ	new_revidr   s          r   Úbranch_commit_hookr   N   sP   € àÐÐÐÐÐØ×Ò˜ 	¨6×+BÒ+BÑ+DÔ+DØ%*ð ñ ,ô ,ß,6ªJ©L¬L¨L¨L¨Lr   c                 ó¬   — ddl m} |                     | j        | j        | j                             ¦   «         dd¬¦  «                             ¦   «          dS )z(This is the post_change_branch_tip hook.r   r   NÚchange)r   Úop)r
   r   r   r   r   r   r   )Úparamsr   s     r   Úbranch_post_change_hookr    U   sd   € ð ÐÐÐÐÐØ×Ò˜œ vÔ'7Øœ×6Ò6Ñ8Ô8ÀtÐPXð ñ Zô ZßZdÒZdÑZfÔZfÐZfÐZfÐZfr   c                  ól   — ddl m}  ddlm}  | ¦   «         }|                      |¦   «         ¦  «         |S )Né    )Ú	TestSuiter   )Ú
test_suite)Úunittestr#   Útestsr$   ÚaddTest)r#   r$   Úresults      r   r$   r$   ]   sN   € Ø"Ð"Ð"Ð"Ð"Ð"Ø!Ð!Ð!Ð!Ð!Ð!ØˆY‰[Œ[€FØ
‡N‚N�:�:‘<”<Ñ Ô Ð Ø€Mr   Úpost_commit_bodyzbreezy.plugins.email.emailerÚopt_post_commit_bodyÚpost_commit_subjectÚopt_post_commit_subjectÚpost_commit_log_formatÚopt_post_commit_log_formatÚpost_commit_difflimitÚopt_post_commit_difflimitÚpost_commit_push_pullÚopt_post_commit_push_pullÚpost_commit_diffoptionsÚopt_post_commit_diffoptionsÚpost_commit_senderÚopt_post_commit_senderÚpost_commit_toÚopt_post_commit_toÚpost_commit_mailerÚopt_post_commit_mailerÚrevision_mail_headersÚopt_revision_mail_headers)Úinstall_lazy_named_hookzbreezy.branchzBranch.hooksr   ÚemailÚpost_change_branch_tipN)Ú__doc__r
   r   Úconfigr   r   r   r    r$   Úregister_lazyÚhooksr=   © r   r   ú<module>rE      s<  ðð 1ð 1ðf Ð Ð Ð Ð Ð Ø %Ð %Ð %Ð %Ð %Ð %ð@ð @ð @ð9ð 9ð 9ðgð gð gðð ð ð €Ô Ð0Ø<Ð>TñVô Vð Và €Ô Ð3Ø<Ð>WñYô Yð Yà €Ô Ð6Ø<Ð>Zñ\ô \ð \à €Ô Ð5Ø<Ð>Yñ[ô [ð [à €Ô Ð5Ø<Ð>Yñ[ô [ð [à €Ô Ð7Ø<Ð>[ñ]ô ]ð ]à €Ô Ð2Ø<Ð>VñXô Xð Xà €Ô Ð.Ø<Ð>RñTô Tð Tà €Ô Ð2Ø<Ð>VñXô Xð Xà €Ô Ð5Ø<Ð>Yñ[ô [ð [ð -Ð ,Ð ,Ð ,Ð ,Ð ,Ø Ð ˜¨¸Ø*¨Gñ5ô 5ð 5à Ð ˜¨Ø0Ð2IÈ7ñTô Tð Tð Tð Tr   