Ë õ„™¥ ܤãóº—dZddlmZddlmZddlZddlZddl Z ddl Z ddl m Z ddl mZmZmZmZmZmZmZmZmZddlmZmZdZiZej8e«Zeddd¬ «edd d¬ «edd d ¬ «edd d¬ «eddd¬ «eddd¬ «eddd¬ «eddd¬ «eddd¬ «eddd¬ «eddd¬ «eddd ¬ «eddd¬ «eddd¬ «eddd¬ «eddd¬ «eddd¬ «edd d¬ «edd!d¬ «edd"d ¬ «d#j;«Zd$ZdeiZ Gd%„d&«Z!d)d'„Z"d(„Z#y)*a«hooks for sending email push notifications This extension implements hooks to send email notifications when changesets are sent from or received by the local repository. First, enable the extension as explained in :hg:`help extensions`, and register the hook you want to run. ``incoming`` and ``changegroup`` hooks are run when changesets are received, while ``outgoing`` hooks are for changesets sent to another repository:: [hooks] # one email for each incoming changeset incoming.notify = python:hgext.notify.hook # one email for all incoming changesets changegroup.notify = python:hgext.notify.hook # one email for all outgoing changesets outgoing.notify = python:hgext.notify.hook This registers the hooks. To enable notification, subscribers must be assigned to repositories. The ``[usersubs]`` section maps multiple repositories to a given recipient. The ``[reposubs]`` section maps multiple recipients to a single repository:: [usersubs] # key is subscriber email, value is a comma-separated list of repo patterns user@host = pattern [reposubs] # key is repo pattern, value is a comma-separated list of subscriber emails pattern = user@host A ``pattern`` is a ``glob`` matching the absolute path to a repository, optionally combined with a revset expression. A revset expression, if present, is separated from the glob by a hash. Example:: [reposubs] */widgets#branch(release) = qa-team@example.com This sends to ``qa-team@example.com`` whenever a changeset on the ``release`` branch triggers a notification in any repository ending in ``widgets``. In order to place them under direct user management, ``[usersubs]`` and ``[reposubs]`` sections may be placed in a separate ``hgrc`` file and incorporated by reference:: [notify] config = /path/to/subscriptionsfile Notifications will not be sent until the ``notify.test`` value is set to ``False``; see below. Notifications content can be tweaked with the following configuration entries: notify.test If ``True``, print messages to stdout instead of sending them. Default: True. notify.sources Space-separated list of change sources. Notifications are activated only when a changeset's source is in this list. Sources may be: :``serve``: changesets received via http or ssh :``pull``: changesets received via ``hg pull`` :``unbundle``: changesets received via ``hg unbundle`` :``push``: changesets sent or received via ``hg push`` :``bundle``: changesets sent via ``hg unbundle`` Default: serve. notify.strip Number of leading slashes to strip from url paths. By default, notifications reference repositories with their absolute path. ``notify.strip`` lets you turn them into relative paths. For example, ``notify.strip=3`` will change ``/long/path/repository`` into ``repository``. Default: 0. notify.domain Default email domain for sender or recipients with no explicit domain. It is also used for the domain part of the ``Message-Id`` when using ``notify.messageidseed``. notify.messageidseed Create deterministic ``Message-Id`` headers for the mails based on the seed and the revision identifier of the first commit in the changeset. notify.style Style file to use when formatting emails. notify.template Template to use when formatting emails. notify.incoming Template to use when run as an incoming hook, overriding ``notify.template``. notify.outgoing Template to use when run as an outgoing hook, overriding ``notify.template``. notify.changegroup Template to use when running as a changegroup hook, overriding ``notify.template``. notify.maxdiff Maximum number of diff lines to include in notification email. Set to 0 to disable the diff, or -1 to include all of it. Default: 300. notify.maxdiffstat Maximum number of diffstat lines to include in notification email. Set to -1 to include all of it. Default: -1. notify.maxsubject Maximum number of characters in email's subject line. Default: 67. notify.diffstat Set to True to include a diffstat before diff content. Default: True. notify.showfunc If set, override ``diff.showfunc`` for the diff content. Default: None. notify.merge If True, send notifications for merge changesets. Default: True. notify.mbox If set, append mails to this mbox file instead of sending. Default: None. notify.fromauthor If set, use the committer of the first changeset in a changegroup for the "From" field of the notification mail. If not set, take the user from the pushing repo. Default: False. notify.reply-to-predecessor (EXPERIMENTAL) If set and the changeset has a predecessor in the repository, try to thread the notification mail with the predecessor. This adds the "In-Reply-To" header to the notification mail with a reference to the predecessor with the smallest revision number. Mail threads can still be torn, especially when changesets are folded. This option must be used in combination with ``notify.messageidseed``. If set, the following entries will also be used to customize the notifications: email.from Email ``From`` address to use if none can be found in the generated email content. web.baseurl Root repository URL to combine with repository paths when making references. See also ``notify.strip``. éN)Ú_) ÚencodingÚerrorÚ logcmdutilÚmailÚobsutilÚpatchÚpycompatÚ registrarÚutil)ÚdateutilÚ stringutilsships-with-hg-coreónotifyó changegroup)ÚdefaultóconfigódiffstatTódomainó messageidseedó fromauthorsincomingómaxdiffi,ó maxdiffstatéÿÿÿÿó maxsubjectéCómboxómergeóoutgoingóreply-to-predecessorFósourcessserveóshowfuncóstripóstyleótemplateótestsË Subject: changeset in {webroot}: {desc|firstline|strip} From: {author} changeset {node|short} in {root} details: {baseurl}{webroot}?cmd=changeset;node={node|short} description: {desc|tabindent|strip} sx changeset {node|short} in {root} details: {baseurl}{webroot}?cmd=changeset;node={node|short} summary: {desc|firstline} cóB—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z d„Z d d „Z y ) Únotifierzemail notification class.cóÊ—||_|jjdd«}|r|jj|ddg¬«||_t |jjdd««|_|j |jj«|_|jjdd«|_|jjdd«|_ |jjdd «|_ tj|j«|_|j«|_|jjdd «|_|jjdd «|_|jjdd «|_|jjdd «|_|j(r*|j&st+j,t/d««‚|j$€!|jjdd «|_d}|jjd|«xs|jjdd«}|s|jjdd«}|s|st0j3|«xst4}t7j8||«}t7j:|j|j|«|_y)Nrróusersubsóreposubs)Úsectionsr"rrr%rr!rrs=notify.reply-to-predecessor used without notify.messageidseedsdiffr$r#)ÚuiÚconfigÚ readconfigÚrepoÚintÚ stripcountÚstripÚrootÚdomainÚmboxÚ configboolÚtestrÚ _charsetsÚcharsetsÚ subscribersÚsubsÚmergeÚshowfuncÚ messageidseedÚreplyrÚAbortrÚ deftemplatesÚgetÚsingle_templaterÚ templatespecÚchangesettemplaterÚt)Úselfr,r/ÚhooktypeÚcfgÚmapfileÚtemplateÚspecs ú0usr/lib/python3.12/site-packages/hgext/notify.pyÚ__init__znotifier.__init__@s%€ØˆŒØ�g‰g�n‰n˜Y¨ Ó2ˆÙ Ø �G‰G× Ñ ˜s¨k¸;Ð-GÐ Ô H؈Œ ܘdŸg™gŸn™n¨Y¸ÓAÓBˆŒØ—J‘J˜tŸy™yŸ~™~Ó.ˆŒ Ø—g‘g—n‘n Y° Ó:ˆŒ Ø—G‘G—N‘N 9¨gÓ6ˆŒ Ø—G‘G×&Ñ& y°'Ó:ˆŒ ÜŸ™ t§w¡wÓ/ˆŒ Ø×$Ñ$Ó&ˆŒ Ø—W‘W×'Ñ'¨ °8Ó<ˆŒ ØŸ™×*Ñ*¨9°kÓBˆŒ Ø!ŸW™WŸ^™^¨IÐ7GÓHˆÔØ—W‘W×'Ñ'¨ Ð3JÓKˆŒ à �:Š:˜d×0Ò0Ü—+‘+Üð,óóð ð �=‰=Ð Ø ŸG™G×.Ñ.¨w¸ ÓDˆDŒMàˆØ—7‘7—>‘> )¨XÓ6ò ¸$¿'¹'¿.¹.Ø �{ó; ˆñØ—g‘g—n‘n Y°Ó9ˆGÙ™xÜ#×'Ñ'¨Ó1ÒD´_ˆHÜ×&Ñ& x°Ó9ˆÜ×.Ñ.¨t¯w©w¸¿ ¹ À4ÓHˆ�ócóª—tj|«}|j}|dkDr,|jd«}|dk(r |S||dzd}|dz}|dkDrŒ,|S)z?strip leading slashes from local path, turn into web-safe path.ró/réN)r Úpconvertr1Úfind)rGÚpathÚcountÚcs rMr2znotifier.striphsj€ô�}‰}˜TÓ"ˆØ—‘ˆØ�aŠiØ— ‘ ˜$“ˆAØ�BŠwØðˆ ð˜˜A™˜�=ˆDØ �Q‰JˆEð �a‹ið ˆ rOcóÆ—tj|j««}|jr1|j d«}|dk7r|d|}d|vr|dz|jzS|S)z try to clean up email addresses.ó @localhostrNó@)rÚemailr2r4rT)rGÚaddrÚas rMÚfixmailznotifier.fixmailusa€ô×Ñ § ¡ £ Ó-ˆØ �;Š;Ø— ‘ ˜-Ó(ˆAØ�BŠwؘB˜Q�x�ؘ4ÑØ˜d‘{ T§[¡[Ñ0Ð0؈ rOc ón—t«}|jjd«D]’\}}|jd«D]y}d|vr|jdd«\}}nd}t j|j j |j««sŒX|j|j|«|f«Œ{Œ”|jjd«D]„\}}d|vr|jdd«\}}nd}t j|j j |«sŒM|jd«D]$}|j|j|«|f«Œ&Œ†t|«D��cgc]=\}}tj|j||j|j«|f‘Œ?c}}Scc}}w)z;return list of email addresses of subscribers to this repo.r)ó,ó#rRNr*)Úsetr,Ú configitemsÚsplitÚfnmatchr/r3r2Úaddr^ÚsortedrÚ addressencoder9r7) rGr;ÚuserÚpatsÚpatÚrevsÚusersÚsÚrs rMr:znotifier.subscribers�sb€ä‹uˆØŸ'™'×-Ñ-¨kÖ:‰JˆD�$Ø—z‘z $Ö'�ؘ3‘;Ø #§ ¡ ¨$°Ó 2‘I�C™à�DÜ—?‘? 4§9¡9§>¡>°3·9±9³;Õ?Ø—H‘H˜dŸl™l¨4Ó0°$Ð7Õ8ñ (ð;ðŸ'™'×-Ñ-¨kÖ:‰JˆC�Ø�s‰{ØŸI™I d¨AÓ.‘ �‘Tà�Ü�‰˜tŸy™yŸ~™~¨sÕ3Ø!ŸK™K¨Ö-�DØ—H‘H˜dŸl™l¨4Ó0°$Ð7Õ8ñ.ð ;ô˜tœ ô á$‘��1ô× Ñ  §¡¨¨D¯M©M¸4¿9¹9Ó EÀqÒ IØ$ò ð ùó sÅ+AF1c ó&—|jst|j««dkDry|jj|f|j «|j jdd«|jj|jdœ|¤Žy)z6format one changeset, unless it is a suppressed merge.rRFswebsbaseurl)ÚchangesÚbaseurlr3ÚwebrootT) r<ÚlenÚparentsrFÚshowÚ changesetr,r-r/r3)rGÚctxÚpropss rMÚnodez notifier.node™st€à�zŠzœc #§+¡+£-Ó0°1Ò4ØØˆ�‰� ‰ Ø ð à—M‘M“OØ—G‘G—N‘N 6¨:Ó6Ø—‘—‘Ø—I‘Iñ  ð ò  ðrOcó^—|jjdd«j«}||vS)zznotifier.send.. s €¸¿¹¼rO)Úkeyz In-Reply-Toz, ÚTos*notify: sending %d subscribers %d changes )r5)Arbr;rfr/rlrˆrÚRepoLookupErrorrtr,ÚdebugrÚ parsebytesÚ emailerrorsÚMessageParseErrorr@rÚ forcebytestrÚ headdecodeÚ is_multipartÚitemsÚ get_payloadÚ mimeencoder9r7rÚ strfromlocalr Údatestrrr3Ú descriptionÚlstriprdÚrstripr0r-ÚellipsisÚ headencodeÚusernamer^rhÚ messageidr4r>r?Ú unfilteredÚ changelogÚindexÚhas_noderÚallpredecessorsÚobsstorerzÚminÚjoinrgÚas_bytesÚwriteÚendswithÚstatusÚsendmailÚ emailutilsÚ parseaddrr5)rGrxrVÚdatar;ÚsubrLrlÚmsgÚinstÚsenderÚsubjectÚheadersÚpayloadÚkÚvrnÚ maxsubjectÚunfir£Úctx2Ú predecessorsÚpredÚmsgtexts rMÚsendz notifier.send¬sš€ô‹uˆØŸœ‰IˆC�؈|Ø—‘˜” Øð Ø—y‘y—~‘~ m°T¸3¿7¹7»9ÓE�ô�4�yØ—‘˜” Øð#ô ˆt‹9˜Š>Ø �G‰G�M‰MØGô ð ð =Ü—/‘/ $Ó'ˆCð �V‘ˆØ�i‘.ˆØ Ð Ü—_‘_ VÓ,ˆFØ Ð Ü—o‘o gÓ.ˆGØ �ˆK˜˜Y˜à×ÑÔ!ð—i‘i“kˆGØ—o‘o¨T�oÓ2ˆGä—/‘/ $§'¡'¨7°D·M±MÀ4Ç9Á9ÓMˆCã‘��1Ø��A’ð ô×+Ñ+Ü × Ñ Ð$AÔ Bó ˆˆF‰ ñ Ø�qŠyÜÐ4Ó5¸¿¹ÀEÐ8JÑJ‘à—O‘OÓ%×,Ñ,Ó.×4Ñ4°U¸AÓ>¸qÑA×HÑHÓJ�Ø# t§y¡y°! nÑ4�ܘŸ™Ÿ™¨ °=ÓAÓBˆ Ù Ü ×)Ñ)¨'°:Ó>ˆGÜŸ™Ø �G‰G�W˜dŸm™m¨T¯Y©Yó ˆˆI‰ñ Ø—W‘W—^‘^ H¨gÓ6ÒL¸$¿'¹'×:JÑ:JÓ:LˆFØ �vÑ  °&Ñ!8Ø—\‘\ &Ó)ˆFÜ×(Ñ(Ø �G‰G�V˜TŸ]™]¨D¯I©Ió ˆˆF‰ ð$2°CÑ#7ˆÐ Ñ Ø�<Ò Ü )¨#¨t¯{©{¸D×à �aŠ<Ø Ø �qŠ[œS ›^¨gÒ5ÜÐCÓDˆCØ �G‰G�M‰M˜#¤ Y£°Ð 9Ñ9Ô :Ø! ( 7Ð+‰IÙ Ø �G‰G�M‰Mœ!Ð6Ó7¼#¸i».ÑHÔ Ià �‰� ‰ �e—j‘j Ó+Õ,rOr‡) Ú__name__Ú __module__Ú __qualname__Ú__doc__rNr2r^r:rzr~r¿rÆ©rOrMr'r'=s1„Ù#ò&IòP ò ò ò0 ò(ò sôj#-rOr'c óž—t|||«}|j«|}|js|jd|jz«y|j |«r|jd|z«y|j «d}d} d} |dk(s|dk(rÍ|jj|j«¬«D]ˆ} |j|| «r| d z } | rŒ|| j«} Œ3||j«z }|jtd «| || j«dd fz«|j «ŒŠ| r°|j!||d «nš|j«|vrˆ|j|«sO|j«|jtd «|j«|j«dd fz«y| d z } |j!|«| s|j«} ||j«z }|j#d d«} | r| rdj%d| z|g«}| r|j'|| |«yy)z®send email notifications to interested subscribers. if used as changegroup hook, send one email for all changesets in changegroup. else send one email per changeset.s(notify: no subscribers to repository %s Ns,notify: changes have source "%s" - skipping rOrrr)ÚstartrRs1notify: suppressing notification for merge %d:%s é stiprrr…sFrom: %s)r'r r;r�r3r~Ú pushbufferr¡rlrˆrzriÚ popbufferÚnoterÚhexrÆr-r§r¿) r,r/rHrzr|ÚkwargsÚnrxr¯rVÚauthorrˆÚ fromauthors rMÚhookràGs€ô ��T˜8Ó$€AØ �/‰/Ó ˜DÑ !€Cà �6Š6Ø �‰Ð=ÀÇÁÑFÔGØØ‡|�|�FÔØ �‰ÐAÀFÑJÔKØà‡M�M„OØ €DØ €EØ €FØ�>Ò! X°Ò%<Ø—>‘>×&Ñ&¨S¯W©W«YÐ&Ö7ˆCØ�v‰v�d˜3‘iÔ Ø˜‘ �ÚØ! #™YŸ^™^Ó-‘Fà˜Ÿ ™ ›Ñ&�Ø—‘ÜÐKÓLؘD ™IŸM™M›O¨C¨RÐ0Ð1ñ2ôð— ‘ •ð8ñ Ø �F‰F�3˜˜V™ Õ %Ø �‰‹�dÑ Ø�v‰v�cŒ{Ø �L‰LŒNØ �G‰GÜÐGÓHØ—7‘7“9˜cŸg™g›i¨¨˜nÐ-ñ.ô ð Ø �‰ ˆØ �‰ˆsŒ ÙØ—X‘X“ZˆFàˆB�L‰L‹NÑ€DØ—‘˜9 mÓ4€JÙ ‘*Ø�z‰z˜;¨Ñ/°Ð6Ó7ˆá Ø �‰ˆs�E˜4Õ ð rOcóº—|r|r|}n'tjtj««}|rRt j |j «|z«}dtj|j«dd«|fz}nEd|ttj««t|j«j«|fz}tj|«S)Ns é@s)rÚ strtolocalÚsocketÚgetfqdnÚhashlibÚsha512rÛr ÚsysbytesÚ hexdigestr0ÚtimeÚhashr/r3r—)rxr4r>ÚhostÚ messagehashrŸs rMrŸrŸ€s¹€Ù ‘-؉ä×"Ñ"¤6§>¡>Ó#3Ó4ˆÙÜ—n‘n S§W¡W£Y°Ñ%>Ó?ˆ Ø!Ü × Ñ ˜k×3Ñ3Ó5°c°rÐ:Ó ;Ø ð% ñ ‰ ð (Ø Ü ”— ‘ “ Ó Ü �—‘“—‘Ó !Ø ð + ñ ˆ ô × Ñ  Ó +Ð+rO)NN)$rÓÚ email.errorsÚerrorsr�Ú email.utilsÚutilsr­rerærärêÚmercurial.i18nrÚ mercurialrrrrrr r r r Úmercurial.utilsr rÚ testedwithÚ configtableÚ configitemršrCÚmultiple_templaterAr'ràrŸrÔrOrMÚrùsðñTõl#Ý ÛÛÛ Û å÷ ÷ õ ÷ð#€ à€ Ø !ˆY× !Ñ ! +Ó .€ á Ø ØØ õñ  Ø Ø Ø õñ  Ø ØØ õñ  Ø Ø Ø õñ  Ø ØØ õñ  Ø ØØ õñ  Ø ØØ õñ  Ø ØØ õñ  Ø ØØ õñ  Ø ØØ õñ  Ø Ø Ø õñ  Ø Ø Ø õñ  Ø ØØ õñ  Ø ØØ õñ  Ø ØØ õñ  Ø ØØ õñ  Ø Ø Ø õñ  Ø Ø Ø õñ  Ø ØØ õñ  Ø Ø Ø õð÷ �FƒHððÐðÐ%ð€ ÷ G-ñG-óT6!ór,rO