a —+«bÒã@s¾dZddlmZddlmZddlmZddl m Z ddl m Z m Z mZmZmZmZmZddlmZddlmZiZe e¡Zed d dd ed d dd ed d dd dd„Zddd„ZdS)awchangeset_published is a hook to send a mail when an existing draft changeset is moved to the public phase. Correct message threading requires the same messageidseed to be used for both the original notification and the new mail. Usage: [notify] messageidseed = myseed [hooks] txnclose-phase.changeset_published = python:hgext.hooklib.changeset_published.hook é)Úabsolute_importN)Ú_)ÚencodingÚerrorÚ formatterÚ logcmdutilÚmailÚpycompatÚ registrar)Údateutilé)Únotifyónotify_publishedódomain)Údefaultó messageidseedótemplatesASubject: changeset published This changeset has been published. c Csn| dd¡p| dd¡}| dd¡p.| dd¡}| dd¡}t |¡}t |||¡}| ¡t ||d¡}tƒ} |j D]B\} }|dur’|   | ¡qv|  d||  ¡¡} t | ƒrv|   | ¡qvqvt | ƒdkrÔ| d ¡dS|j|| ¡| d d ¡|j|jd | ¡} zt | ¡} Wn2tjy@}zt |¡‚WYd}~n d}~00t |||¡| d <t |||d¡| d<t tjdd¡| d<| dsÖ| dd¡pž| ¡}d|vs´d|vr¾| |¡}t  |||j!|j"¡| d<d #t$| ƒ¡| d<t%j&rø|  '¡n|  (¡}| )dd¡r0| *|¡| +d¡sj| *d¡n:| ,t-dƒ|  ¡¡tj.|t/ 0| d¡d| ||j1ddS)Nrrsnotifyrrsincomings %r and %d:rs=notify_published: no subscribers to selected repo and revset swebsbaseurl)ZchangesZbaseurlÚrootZwebrootz In-reply-tos -publishedz Message-Ids%a, %d %b %Y %H:%M:%S %1%2)ÚformatZDateZFromsemailsfromó@s @localhostz, ZTostestó s&notify_published: sending mail for %d é)Úmbox)2ZconfigrZliteral_templatespecrZchangesettemplaterZ pushbufferr ZnotifierÚsetÚsubsÚaddÚrevsZrevÚlenÚdebugZshowZ changesetrZ popbufferrZ parsebytesÚ emailerrorsZMessageParseErrorrÚAbortZ messageidrZ strfromlocalr ZdatestrÚusernameZfixmailZ addressencodeZcharsetsÚtestÚjoinÚsortedr Zispy3Zas_bytesZ as_stringZ configboolÚwriteÚendswithÚstatusrZsendmailÚ emailutilsZ parseaddrr)ÚuiÚrepoÚctxÚdomainZ messageidseedÚtemplateÚspecZ templaterÚnrÚsubrÚdataÚmsgÚinstZsenderZmsgtext©r4úG/usr/lib64/python3.9/site-packages/hgext/hooklib/changeset_published.pyÚ_report_commit=szÿÿ þ     ÿ û  ÿ ÿ     ÿr6cKsT|dkr t tdƒt |¡¡‚| ¡|}|ddkrP|ddkrPt|||ƒdS)Nstxnclose-phasesUnsupported hook type %rZoldphasesdraftZphasespublic)rr rr ZbytestrZ unfilteredr6)r)r*ZhooktypeZnodeÚkwargsr+r4r4r5Úhooksÿ r8)N)Ú__doc__Z __future__rZ email.errorsÚerrorsrZ email.utilsZutilsr(Zmercurial.i18nrZ mercurialrrrrrr r Zmercurial.utilsr Úr Z configtableZ configitemr6r8r4r4r4r5Ús4    $   ýýý D