
    6hV|                       S r SSKJr  SSKJr  SSKJs  Jr	  SSK
Js  Jr  SSKJr  SSKrSSKrSSKJr  SSKJr  SSKJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$  SSK%J&r&J'r'  \$RP                  r(0 r)\!RT                  " \)5      r*0 r+\!RX                  " \+5      r,\," SS	SS
9  \," SSSS
9  \," SSSS
9  \," SSSS
9  \," SSSS
9  \," SSSS
9  \," SSSS
9  \," SSSS
9  \," SSSS
9  \," SSSS
9  Sr-S r.S r/S r0SrS jr1S r2S r3S r4 SsS jr5S r6S  r7S! r8S" r9S# r:SsS$ jr;S% r<S& r=S'S(S\" S)5      4S*S+S\" S,5      4S-S.S\" S/5      4S'S/ \" S05      \" S15      4S2S/ \" S35      \" S15      4S'SS\" S45      4S5S6S\" S75      4S'S8S'\" S95      \" S:5      4S'S;S'\" S<5      \" S=5      4S>SS'\" S?5      \" S15      4S@SAS\" SB5      4SCSDS'\" SE5      \" S=5      4S'S/ \" SF5      \" S15      4SGSHS'\" SI5      \" SJ5      4S'SKS'\" SL5      \" SM5      4S'SN/ \" SO5      \" SP5      4SQS/ \" SR5      \" S15      4/r>\*" SSSTSUS\" SV5      4S'SWS\" SX5      4SYSZS\" S[5      4S\S]S\" S^5      4S_S`S'\" Sa5      \" Sb5      4S'ScS]\" Sd5      \" Se5      4SfSg/ \" Sh5      \" Si5      4S'SjS\" Sk5      4S'Sl/ \" Sm5      \" Si5      4S'SS\" Sn5      4/
\>-   \R~                  -   \" So5      \*R                  Sp9Sq 5       rAg)tas	  command to send changesets as (a series of) patch emails

The series is started off with a "[PATCH 0 of N]" introduction, which
describes the series as a whole.

Each patch email has a Subject line of "[PATCH M of N] ...", using the
first line of the changeset description as the subject text. The
message contains two or three body parts:

- The changeset description.
- [Optional] The result of running diffstat on the patch.
- The patch itself, as generated by :hg:`export`.

Each message refers to the first in the series using the In-Reply-To
and References headers, so they will show up as a sequence in threaded
mail and news readers, and in mail archives.

To configure other defaults, add a section like this to your
configuration file::

  [email]
  from = My Name <my@email>
  to = recipient1, recipient2, ...
  cc = cc1, cc2, ...
  bcc = bcc1, bcc2, ...
  reply-to = address1, address2, ...

Use ``[patchbomb]`` as configuration section name if you need to
override global ``[email]`` address settings.

Then you can use the :hg:`email` command to mail a series of
changesets as a patchbomb.

You can also either configure the method option in the email section
to be a sendmail compatible mailer or fill out the [smtp] section so
that the patchbomb extension can automatically send patchbombs
directly from the commandline. See the [email] and [smtp] sections in
hgrc(5) for details.

By default, :hg:`email` will prompt for a ``To`` or ``CC`` header if
you do not supply one via configuration or the command line.  You can
override this to never prompt by configuring an empty value::

  [email]
  cc =

You can control the default inclusion of an introduction message with the
``patchbomb.intro`` configuration option. The configuration is always
overwritten by command line flags like --intro and --desc::

  [patchbomb]
  intro=auto   # include introduction message if more than 1 patch (default)
  intro=never  # never include an introduction message
  intro=always # always include an introduction message

You can specify a template for flags to be added in subject prefixes. Flags
specified by --flag option are exported as ``{flags}`` keyword::

  [patchbomb]
  flagtemplate = "{separate(' ',
                            ifeq(branch, 'default', '', branch|upper),
                            flags)}"

You can set patchbomb to always ask for confirmation by setting
``patchbomb.confirm`` to true.
    )annotationsN)_)bin)cmdutilcommandsencodingerror	formatterhg
logcmdutilmailpatchpycompat	registrarscmutil	templaterutil)dateutilurlutil	   patchbomb
   bundletypedefaults   bccs   cc   confirmF   flagtemplate   from   intro   auto	   publicurls   reply-tos   tos   ships-with-hg-corec                z    UR                  5       nUR                  R                  SS5      nU(       a  SUUU4-  $ g)zFAdd a header pointing to a public URL where the changeset is availabler   r   s/   Available At %s
#              hg pull %s -r %sN)repouiconfig)seqctxr!   	publicurls       1/usr/lib/python3/dist-packages/hgext/patchbomb.py_addpullheaderr(      sG    88:D |\:IBF
 
 	

     c                p    [         R                  R                  S5        [        [         R                  S'   g )Ns   pullurl)r   extraexportappendr(   extraexportmap)r"   s    r'   uisetupr.      s&    z*)7G:&r)   c                f    UR                  5       (       d  g UR                  R                  S5        g )N   last-email.txt)local_wlockfreeprefixadd)r"   r!   s     r'   	reposetupr4      s%    ::<</0r)   c                H    U(       a  USU-  -  nU R                  X-   U5      $ )Ns    [%s])prompt)r"   r6   r   rests       r'   r6   r6      s'    (W$$99V]G,,r)   c                D   U R                  SS5      nUR                  S5      (       d  UR                  S5      (       a  SnU$ US:X  a  SnU$ US:X  a  SnU$ US:X  a  US	:  nU$ U R                  [        S
5      U-  5        U R                  [        S5      5        US	:  nU$ )z-is an introductory message apparently wanted?r   r      descTs   alwayss   neverFr      s,   warning: invalid patchbomb.intro value "%s"
s'   (should be one of always, never, auto)
)r#   get	write_errr   )r"   optsnumberintroconfigintros        r'   introwantedrA      s    ))L(3KxxTXXg.. L 
		! L 
	  L 
	
 L 	>?+M	
 	QBCD
Lr)   c           
        U R                  SS5      nU(       d  SR                  U5      $ [        R                  " 5       n[        R
                  " [        R                  " U5      5      n[        R                  " XS0 U5       nUR                  5         UR                  X   S9  UR                  SSUR                  USS	95        S
S
S
5        UR                  5       $ ! , (       d  f       UR                  5       $ = f)z(build flag string optionally by templater   r       s   patchbombflag)r%   s   flagss   %s   flag)nameN)r#   joinr   stringior
   literal_templatespecr   unquotestringtemplateformatter	startitemcontextwrite
formatlistgetvalue)r"   r!   revflagstmploutspecfms           r'   _formatflagsrV      s    99\?3Dyy
--/C)))*A*A$*GHD		$	$R.>D	IR



ty
!
5"--G-"DE 
J <<>	 
J	I <<>s   AC
C;c                t    [        XX#5      nU(       a  SU-   nU(       d  SU-  $ [        SU-  5      nSXXW4-  $ )zbuild prefix to patch subjectrC   s	   [PATCH%s]   %ds   [PATCH %0*d of %d%s])rV   len)	r"   r!   rP   rQ   idxtotalnumberedflagtlens	            r'   _formatprefixr_      sF    #-Dd{d""55=!&$U)AAAr)   c
           
     	   / n
S nSnU H  nUR                  S5      (       a+  UR                  S5      (       a  UR                  5       S   nMD  UR                  S5      (       d  UR                  S5      (       a    OU
R                  U5        M     U	(       d  U(       d  [        eUR	                  S5      (       aF  UR	                  S5      (       d0  S	R                  U
S
S  5      R                  5       =(       d    SnUS-  nUR	                  S5      (       a  U(       aL  US   R                  S5      (       a3  UR                  S5        U(       a  US   R                  S5      (       a  M3  U(       a  UR                  S5        U(       aJ  US   R                  5       (       d2  UR                  S5        U(       a  US   R                  5       (       d  M2  [        R                  " U5      nUR	                  S5      (       a  XS-   -  nUR	                  S5      =(       d    UR	                  S5      nU(       a  UR	                  S5      (       a  US	R                  U5      -  nU(       Gax  [        R                  " 5       nU(       a5  UR                  [        R                  " XXTR	                  S5      5      5        [        R                  " S	R                  U5      SUR	                  S5      5      n[!        U5      nU	(       d  UR#                  U5       Vs/ s H3  nUR%                  S5      (       d  UR%                  S5      (       d  M1  UPM5     nnU(       a  US   n	O8US
:  a  [&        R(                  " X   SXgS9n	O[&        R(                  " X   S5      n	SnUR	                  S5      (       a  SnUS-   [*        R,                  " U	5      -   US'   UR                  U5        O#[        R                  " XR	                  S5      S9n[/        XX$R	                  S5      XgU5      nU
S   R                  5       R1                  S 5      nU(       d,  S!R                  UUR	                  S"5      =(       d    U/5      nOS!R                  UU/5      n[        R2                  " U UXTR	                  S5      5      US#'   [4        R6                  " U5      US$'   S%U-  US&'   S%U-  US''   UUU4$ s  snf )(Nr)      #s	   # Node IDs   diff -rs
   diff --git   attach   body   
r:   s"   Patch subject is complete summary.s   


   plainr   s   #    diffstats   

   inline   testzx-patchs   .patchs   .diffs   %b-%n.patch)seqnor[   s   %b.patchinline
attachmentz; filename=Content-Disposition)displayrD   s   . rC      subjectSubjectX-Mercurial-Nodez%izX-Mercurial-Series-IndexzX-Mercurial-Series-Total)
startswithsplitr,   
ValueErrorr;   rF   strippopr   diffstatemimemultipartMIMEMultipartattachr   
mimeencodemimetextpatchr   nodetagsendswithr   makefilenamer   strfromlocalr_   rstrip
headencoder   sysstr)r"   r!   rP   
patchlinesr=   	_charsetsrZ   r[   r\   	patchnamedescnodebodylinedsaddattachmentmsgpbinnodet	patchtagsdispositionprefixsubjs                           r'   	makepatchr      s    DDD??4  |,,zz|B'??:&&$//-*H*HD  Txx	488G#4#4JJtABx &&( 54 	 		xxZ]55e<<NN1 Z]55e<<NN1A!4!4!6!6NN1 A!4!4!6!6 

	#BxxWHHY'>488I+>MDHHW--

:&&**,JJtrHHW<MNOJJz"Itxx/@
 d) w//A::i((AJJx,@ /  
 %aL	#00Jc	 $00[I	88I'K-'(*?*?	*JJ 	

  	

1  xx/@A
#xx(#hF 7==?!!%(Dyy&$((:"6">$?@yy&$(__Ry((7:KLC	N&ood3C&*SjC"#&*UlC"#b=Gs   0SSc              +    #    U R                   nU S   R                  5       nU H  nXT:X  aJ  U S   R                  5       (       d  U S   R                  5       (       a  UR	                  [        S5      5        [        5       n[        R                  " U U/U[        R                  " U[        R                  " U5      SS9S9  UR                  5       R                  S5      v   M     g7f)zdreturn a list of patches for a list of revisions

Each patch in the list is itself a list of lines.
   .Ns3   warning: working directory has uncommitted changes
T)git)r=   re   )r"   rP   filesdeletedwarnr   rG   r   
exportfiler   difffeatureoptsr   byteskwargsrO   rs   )r!   revsr=   r"   prevroutputs          r'   _getpatchesr   `  s     
 
B:>>D9$t***,,T
0B0B0D0DGGAMNOC&&H((.D		
 oo%%e,, s   C$C&c                8   U R                   n[        R                  " SS9n[        R                  R                  US5      nUR                  SS5      nU(       a  XbS'    / nU(       a  U/n[        R                  " X0U/UQ70 UD6  [        R                  " U5       [        R                  " U5        [        R                  " U5        $ ! [         a     N#f = f!  [        R                  " U5        O! [         a     Of = f[        R                  " U5        f = f)zreturn a bundle containing changesets missing in "dest"

The `opts` keyword-arguments are the same as the one accepted by the
`bundle` command.

The bundle is a returned as a single in-memory binary blob.
s   hg-email-bundle-)r      bundler   r   type)r"   r   mkdtempospathrF   r#   r   bundler   readfileunlinkOSErrorrmdir)r!   destr=   r"   tmpdirtmpfnbtypedestss           r'   
_getbundler   v  s     
B%89FGGLL+EIIlM2EVFE%8%848}}U#	IIe 	  			IIe 		
sB   <C C		
CCDC21D2
C?<D>C??Dc                ~   U R                   nUR                  S5      (       a'  [        R                  " UR                  S5      5      nU$ UR	                  [        S5      5        UR                  XU R                  SS9nU R                  SS5       nUR	                  U5        SSS5        U$ ! , (       d  f       U$ = f)zobtain the body of the introduction message and return it

This is also used for the body of email with an attached bundle.

The body can be obtained either from the command line option or entered by
the user through the editor.
r   s7   
Write the introductory message for the patch series.

s   patchbombbody)repopathactionr0   s   wbN)	r"   r;   r   r   rM   r   editr   vfs)r!   defaultbodysenderr=   r"   r   msgfiles          r'   _getdescriptionr     s     
Bxx}}TXXf-. K 	KL	
 ww$))<L  

 XX'/7MM$ 0 K 0/ Ks   B--
B<c           
        U R                   n[        R                  " U5      nUR                  S5      =(       d    [	        USS5      n[        U SU40 UD6n[        R                  " 5       nU(       a5  UR                  [        R                  " XGXSR                  S5      5      5        [        R                  " SS5      n	U	R                  U5        SUR                  S	S
5      -  n
U	R                  SS[        R                  " U
5      S9  [         R"                  " U	5        UR                  U	5        [        R$                  " XFXSR                  S5      5      US'   XS4/$ )zGet the full email for sending a given bundle

This function returns a list of "email" tuples (subject, content, None).
The list is always one message long in that case.
subjects   Subject:s   A bundle for your repositoryr)   testapplicationzx-mercurial-bundles   %s.hg
bundlenamer   rm   rl   )filenamerp   N)r"   r   r   r;   r6   r   rx   ry   rz   r{   	emimebaseMIMEBaseset_payload
add_headerr   r   emailencodersencode_base64r   )r!   r   r   r=   r"   r   r   r   r   datapartr   s              r'   _getbundlemsgsr     s'    
Br"I88I &
K8#D 4f55D

&
&
(C

4??2Y8HIJ!!-1EFH DHH\9==J&&z2  
 )JJx__Ry((6:JKC	Nr)   c           
     V   U R                   n[        R                  " U5      n[        XPUR	                  5       UR                  S5      S[        U5      SS9nUR                  S5      =(       d    [        USUSS9nU(       d  g	US
-   U-   nSn	UR                  S5      (       a&  [        R                  " [        U/ 5      5      n
SU
-   n	OS	n
[        X	U40 UD6n	[        R                  " XYXdR                  S5      5      n[        R                  " XXXdR                  S5      5      US'   XU
4$ )z|make an introduction email, asking the user for content if needed

email is returned as (subject, body, cumulative-diffstat)r]   r   T)r\   r   s   (optional) Subject: r)   )r7   r   NrC   rw   re   r   rp   )r"   r   r   r_   lastr;   rY   r6   r   rw   sumr   r{   r   )r!   r   r   patchesr=   r"   r   r   r   r   rw   r   s               r'   
_makeintror     s    
Br"I 
$))+txx/CL4F 88I &
#&##D D=4DDxx
>>#gr"23x4v66D
//"Ixx/?
@C__Ry((6:JKC	Nx  r)   c                   [         R                  " U5      nU R                  n[        R                  " U5      n[        [        X40 UD65      n/ n	UR                  [        S5      [        U5      -  5        [        Xe[        U5      5      (       a%  [        XX(40 UD6n
U
(       a  U	R                  U
5        [        U	5      [        U5      -   S:  nSn[        U5      [        U5      :X  d   e[        [        X(5      5       HD  u  nu  pU(       a  X=   n[        UU UUUUUS-   [        U5      UU5
      n
U	R                  U
5        MF     U	$ )zreturn a list of emails from a list of patches

This involves introduction message creation if necessary.

This function returns a list of "email" tuples (subject, content, None).
s+   this patch series consists of %d patches.

r:   N)r   r   r"   r   r   listr   rM   r   rY   rA   r   r,   	enumeratezipr   )r!   r   r   
patchnamesr=   	bytesoptsr"   r   r   msgsr   r\   rE   ir   r   s                   r'   _getpatchmsgsr     s1    $$T*I	Br"I;t2T23GDHHQ?@3w<OP 2#g,//t==KK 4y3w<'!+H Dt9G$$$s412	6A=DEL
 	C 3" Kr)   c                   U R                   n[        R                  " XU(       a  U/OS5      nU Vs/ s H#  n[        R                  " UR                  5      PM%     nnUR                  [        S5      SR                  U5      -  5        U Vs/ s H  owS:  d  M
  UPM     nnU(       d  U R                  R                  5       /nU R                  SU=(       d    SU5      nU(       d  UR                  [        S5      5        U$ s  snf s  snf )z4Return the revisions present locally but not in destNs   comparing with %s
   ,r   s   outgoing(%s) and ::%ldr)   s   no changes found
)r"   r   get_push_pathshidepasswordrawlocstatusr   rF   	changelogtiprevr   )r!   r   r   r"   pathsr   
safe_pathsr   s           r'   _getoutgoingr     s    	B""4tdVFE:?@%Q'&&qxx0%J@IIa&'$))J*??@&t!AvAtD&%%'(99.TBD
		!)*+K A 's   *D	D	D	c                     [         R                  " [         R                  S   5      nSXU4-  $ ! [         a    [        R
                  " 5       n N(f = f)Ns
   HGHOSTNAMEz
<%s.%d@%s>)r   r   environKeyErrorsocketgetfqdn)r   	timestamphostnames      r'   _msgidr   *  sQ    $(()9)9-)HI 4H555  $>>#$s   '0 AAr)   rd   s-   send patches as inline message text (default)   arc   s   send patches as attachments   irh   s"   send patches as inline attachmentss/   email addresses of blind carbon copy recipientss   EMAIL   cs"   email addresses of copy recipientss#   ask for confirmation before sending   drg   s   add diffstat output to messages   dates&   use the given date as the sending dates   DATEr9   s,   use the given file as the series descriptions   FILE   fs   email address of sender   nri   s!   print messages that would be sent   m   mboxs3   write messages to mbox file instead of sending thems)   email addresses replies should be sent to   sro   s0   subject of first message (intro or single patch)s   TEXTs   in-reply-tos   message identifier to reply tos   MSGIDrD   s    flags to add in subject prefixess   FLAG   ts   email addresses of recipients   email   gs   gits   use git extended diff formatrf   s   omit hg patch header   o   outgoings/   send changes not found in the target repository   br   s-   send changes not in target as a binary bundle   B   bookmarks-   send changes only reachable by given bookmarks   BOOKMARKs
   bundlenames"   name of the bundle attachment files   NAME   r   revs   a revision to sends   REVs   forces?   run even when remote repository is unrelated (with -b/--bundle)s   basesG   a base changeset to specify instead of a destination (with -b/--bundle)s-   send an introduction email for a single patchs   hg email [OPTION]... [DEST]...)helpcategoryc                  ^ ^^1^2^3 [         R                  " T5      m[        R                  " T 5      m1TR	                  S5      nTR	                  S5      nTR	                  S5      nTR	                  S5      nTR	                  S5      nTR	                  S5      n	TR	                  S5      (       d  U(       d  [        R
                  " T 5        U(       d;  U(       d4  U(       d-  U(       d&  U	(       d  [        R                  " [        S5      5      eU(       a&  U(       a  [        R                  " [        S	5      5      e[        R                  " TSS5        U(       d  U(       a?  [        U5      S
:  a  [        R                  " [        S5      5      eU(       a  US   n
OSn
/ nU(       a)  U(       a  [        R                  " [        S5      5      eUnONU	(       aG  XR                  ;  a"  [        R                  " [        S5      U	-  5      e[        R                  " X5      n[        R                   " X5      nU(       a  [#        UW
U5      nU(       a  U Vs/ s H  nSU-  PM
     snTS'   UR$                  R'                  SS5      nU(       Ga  UR$                  R)                  S5         [*        R,                  " U0 U5      nUR3                  S5      (       d  UR$                  R)                  S5        GOU Vs/ s H  oU   PM	     nnUR5                  S U 5       5      n/ n[7        U5       H#  u  nnUU   (       a  M  UR9                  U5        M%     U(       a  [        U5      S
:  a#  [        S5      nUUUS   [        U5      S
-
  4-  nO[        S5      nUUUS   4-  nU Vs/ s H  nUR;                  5       PM     nnSR=                  S UR?                  SU5       5       5      n[        S5      UU4-  n[        R                  " UUS9eU(       a  [@        RB                  " U5      m3O[@        RD                  " 5       m3U34S  jnTR	                  S!5      =(       dM    T R'                  S"S!5      =(       d4    T R'                  SS!5      =(       d    [G        T S#T RI                  5       5      nU(       aT  [         RJ                  " T5      n[M        UW
40 UD6nURO                  5       nURQ                  S$S5        [S        UUU40 UD6nO"[U        UUU40 [         RJ                  " T5      D6n/ m2S[U1UU2U 4S& jjnU" S'S(S)9nU(       d  [        R                  " [        S*5      5      eU" S+S(S,S-9n U" S.5      n!U" S/5      n"T RW                  SS05      n#U#[Y        TR	                  S15      =(       d    TR	                  S05      5      -  n#U#(       a  T R[                  [        S25      S3S49  T R[                  S5U-  S6S49  T2 H  n$T R[                  S7U$-  S8S49  M     U H3  u  n%n&n'T R[                  S9U&-  S:S49  U'(       d  M#  T R[                  U'S;S49  M5     T R[                  S<5        T R]                  [        S=5      5      (       a  [        R                  " [        S>5      5      eT R[                  S<5        TR	                  S?5      =(       d    Sn(U(bL  [^        R`                  " U(5      n(U(Rc                  S@5      (       d  S@U(-   n(U(Re                  SA5      (       d  U(SA-  n([f        Rh                  " [^        R`                  " U5      5      S
   n)[        Rj                  " T UT1TR	                  S5      5      nSn*Sn+T Rm                  [        SB5      [        SC5      [        U5      SD9n,[7        U5       GH+  u  n-u  n%n&n' U" U%SE   5      U%SF'   U+(       d  U%SF   n+U+U%SG'   U((       a
  U(U%SI'   U(U%SJ'   U((       a  SEU%;  a  U%SF   n(SK[p        Rr                  " 5       Ru                  5       -  U%SL'   [f        Rv                  " T3S   S(SM9U%SN'   T3S   S
-   T3S
   4m3UU%SO'   SPR=                  U5      U%SQ'   U (       a  SPR=                  U 5      U%SR'   U!(       a  SPR=                  U!5      U%SS'   U"(       a  SPR=                  U"5      U%ST'   TR	                  S5      (       ai  T Ry                  [        SU5      U&SV5        T R{                  S"5        [        R|                  " T S%SW9n. U.R                  U%S%5        T R[                  S<5        GM  U*(       d  [        R                  " T USX9n*T Ry                  [        SY5      U&SV5        U,R                  U-U&SZ9  U(       d  U%SS	 [        5       n/[        R|                  " U/S%SW9n.U.R                  U%S%5        UU!-   U -   n0U*" U)U0U/R                  5       5        GM.     U,R                  5         gs  snf ! [        R.                   a)    UR$                  R1                  [        S5      U-  5        e f = fs  snf s  snf ! [n         a    U" SH5      U%SF'    GN}f = f! [         a     GM  f = f)\aU  send changesets by email

By default, diffs are sent in the format generated by
:hg:`export`, one per message. The series starts with a "[PATCH 0
of N]" introduction, which describes the series as a whole.

Each patch email has a Subject line of "[PATCH M of N] ...", using
the first line of the changeset description as the subject text.
The message contains two or three parts. First, the changeset
description.

With the -d/--diffstat option, if the diffstat program is
installed, the result of running diffstat on the patch is inserted.

Finally, the patch itself, as generated by :hg:`export`.

With the -d/--diffstat or --confirm options, you will be presented
with a final summary of all messages and asked for confirmation before
the messages are sent.

By default the patch is included as text in the email body for
easy reviewing. Using the -a/--attach option will instead create
an attachment for the patch. With -i/--inline an inline attachment
will be created. You can include a patch both as text in the email
body and as a regular or an inline attachment by combining the
-a/--attach or -i/--inline with the --body option.

With -B/--bookmark changesets reachable by the given bookmark are
selected.

With -o/--outgoing, emails will be generated for patches not found
in the destination repository (or only those which are ancestors
of the specified revisions if any are provided)

With -b/--bundle, changesets are selected as for --outgoing, but a
single email containing a binary Mercurial bundle as an attachment
will be sent. Use the ``patchbomb.bundletype`` config option to
control the bundle type as with :hg:`bundle --type`.

With -m/--mbox, instead of previewing each patchbomb message in a
pager or sending the messages directly, it will create a UNIX
mailbox file with the patch emails. This mailbox file can be
previewed with any mail user agent which supports UNIX mbox
files.

With -n/--test, all steps will run, but mail will not be sent.
You will be prompted for an email recipient address, a subject and
an introductory message describing the patches of your patchbomb.
Then when all is done, patchbomb messages are displayed.

In case email sending fails, you will find a backup of your series
introductory message in ``.hg/last-email.txt``.

The default behavior of this command can be customized through
configuration. (See :hg:`help patchbomb` for details)

Examples::

  hg email -r 3000          # send patch 3000 only
  hg email -r 3000 -r 3001  # send patches 3000 and 3001
  hg email -r 3000:3005     # send patches 3000 through 3005
  hg email 3000             # send patch 3000 (deprecated)

  hg email -o               # send all patches not in default
  hg email -o DEST          # send all patches not in DEST
  hg email -o -r 3000       # send all ancestors of 3000 not in default
  hg email -o -r 3000 DEST  # send all ancestors of 3000 not in DEST

  hg email -B feature       # send all ancestors of feature bookmark

  hg email -b               # send bundle of all patches not in default
  hg email -b DEST          # send bundle of all patches not in DEST
  hg email -b -r 3000       # bundle of all ancestors of 3000 not in default
  hg email -b -r 3000 DEST  # bundle of all ancestors of 3000 not in DEST

  hg email -o -m mbox &&    # generate an mbox file...
    mutt -R -f mbox         # ... and view it with mutt
  hg email -o -m mbox &&    # generate an mbox file ...
    formail -s sendmail \   # ... and use formail to send from the mbox
      -bm -t < mbox         # ... using sendmail

Before using this command, you will need to enable email in your
hgrc. See the [email] section in hgrc(5) for details.
r   r   r   r   r   r   ri   s0   specify at least one changeset with -B, -r or -osE   --outgoing mode always on with --bundle; do not re-specify --outgoingr:   s   too many destinationsr   Ns)   use only one form to specify the revisions   bookmark '%s' not foundrX   s   revsr   r   s0   checking that revision exist in the public repo
s!   unable to access public repo: %s
s   knowns/   skipping existence checks: public repo too old
c              3  @   #    U  H  oR                  5       v   M     g 7fN)r   .0hs     r'   	<genexpr>email.<locals>.<genexpr>I  s     $;s!VVXXss   s'   public "%s" is missing %s and %i otherss   public url %s is missing %srC   c              3  ,   #    U  H
  nS U-  v   M     g7f)s   -r %sN r  s     r'   r  r	  V  s      $*NQHqL*Ns   s
   heads(%ld)s   use 'hg push %s %s')hintc                :   > [        U S S [        TS   5      5      $ )N   r   )r   int)id
start_times    r'   genmsgidemail.<locals>.genmsgidb  s    b"gs:a=122r)   r   r   s   Fromr   Fc                  > U R                  5       nU R                  SS5      R                  5       nT	R                  U5      nU(       aM  T
R                  SU SR	                  U5      4-  5        [
        R                  " TUTT	R                  S5      5      $ TR                  SU5      =(       d    TR                  SU5      nU(       dC  TR                  SU5      =(       d    TR                  SU5      nU(       d  U(       a
  [        TXS9nU(       a>  T
R                  SX4-  5        [
        R                  " TU/TT	R                  S5      5      $ U(       a)  [
        R                  " TU/TT	R                  S5      5      $ / $ )	N   -   _s   %s: %ss   , ri   r   r   r   )
lowerreplacer;   r,   rF   r   addrlistencoder#   	hasconfigr6   )headeraskr   	configkeyoptaddrsaddr	specifiedr   r=   	showaddrsr"   s           r'   getaddrsemail.<locals>.getaddrsx  sG   LLN	nnT4(..0Y&%**U2C)DDE&&r5)TXXg=NOO yy9- 
)2
 Xy9 R\\i>I b&:Y&78&&rD69dhhw>OPP&&WIy$((7*;  	r)   s   ToT)r  s   no recipient addresses provideds   Ccr)   )r  r   s   Bccs   Reply-Tor   rg   s   
Final summary:

s   patchbomb.finalsummary)labels	   From: %s
s   patchbomb.froms   %s
s   patchbomb.tos   Subject: %s
s   patchbomb.subjects   patchbomb.diffstatsre   s1   are you sure you want to send (yn)?$$ &Yes $$ &Nos   patchbomb canceleds   in_reply_to<>s   sendings   emails)unitr[   rq   z
Message-IdzX-Mercurial-Series-Id	patchbombzIn-Reply-To
ReferenceszMercurial-patchbomb/%sz
User-Agent)	localtimeDateFromz, ToCcBcczReply-Tos   displaying s    ...
)mangle_from_)mboxs   sending )item)FN)Fr   r   r   r   r;   validateconfigr	   Abortr   r   check_at_most_one_argrY   
_bookmarksr   bookmarkrevsr   revranger   r"   r#   debugr   peer	RepoErrorr<   capableknownr   r,   rP   rF   setr   	parsedatemakedater6   username	strkwargsr   copyrv   r   r   
configboolboolrM   promptchoicer   r   rr   r~   eutil	parseaddraddressencodemakeprogress	TypeErrorr   versiondecode
formatdater   pager	GeneratorflattenBrokenPipeErrorconnectupdaterG   rO   complete)4r"   r!   r   r=   r   dater2  outgoingrP   bookmarkr   r   r&   
publicpeerrS   r>  missingrZ   r  r   r%   missingrevsrevhintr  r  r   stropts
bundledata
bundleoptsr   r#  toccbccreplytoconfirmr   mr   r   parentsender_addrsendmail
firstpatchprogressr   	generatorfpalldestsr   r"  r  s4   `  `                                             @@@r'   emailro  q  s   h %Dr"IXXi F88GD88GDxx$H
((6
Cxx$HHHWBC8vkkAB
 	
 Fkk1
 	
 !!$<6t9q=++a 89::7DD
++a LMNN	??*++a :;hFGG##D3t*DD$-,01DqD1W |\:IJK	r95J !!(++GGMMMN$()Dq7DC)$$$;s$;;EG#C.QSzzNN1% ) w<!#FGCIwqz3w<!3CDDC:;CIwqz22C4;<GSswwyG<)) $*.((=+*N$  /0Iw3GGkk#D11 ''-
&&(
3
 	 	.99Xw'	.99\7+	. "gr{{}-	  $$T*d6g6
\\^
x&dFJE*ET64L83E3Ed3KLI 6 
%T	"Bkk!>?@@	%T3	/B
6
C{#GmmL*5GtDHH[)ATXXj-ABBG
*+3LM
-&(1BCDHHWt^?H; KAtRHH&-6JHKr#9:   	??BC
 
 ++a 5677HHUOXXn%-F&&v.  %%6\Fs##cMF//("7"7"?@CKFItxx7HIFHJ	*AiLD	  H &dO=AtR	4&q);'<=AlO|_
)3A%& %Am$AlO+14|_F2T\\^5J5J5LL,$$Z]dC&	 ma'A7
&	))B-$iimAdGyy~AeH IIg.AjM88GIIa'y9HHXr>I!!!U+ <<6IIandI6OOADO)eHBr>Ia'Cx"}H[(BKKM:_ ,b q 2  	GG789D 		 * =`  	4&{3AlO	46 # sB   g#'g( 6h($h-.h2#i(=h%2i
i
ii)N   :r  )B__doc__
__future__r   email.encodersencodersr   email.mime.basemimebaser   email.mime.multipart	multipartrx   email.utilsutilsrH  r   r   mercurial.i18nr   mercurial.noder   	mercurialr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   mercurial.utilsr   r   rG   cmdtablecommandconfigtable
configitem
testedwithr(   r.   r4   r6   rA   rV   r_   r   r   r   r   r   r   r   r   r   	emailopts
remoteoptsCATEGORY_IMPORT_EXPORTro  r  r)   r'   <module>r     s  AF # & # # - -  	       
 ==


H
%!!+.
 

 

 	
 
 
 
 
 
 
 	 #
 8
1-(
B. `F-,84<!B,^ 6 	'4KLM	9dA<=>	9dACDE
	
<=	( 
5"a=>(L*dADEF	;a BCD	
34	'
 		
9:	'
 
7C56(D	7D!@AB	
@A	'
 	
	
67	( 		
=>	'
 		
+,	( 	'2q<=qzJ	5"a891X;Gw<	~ 		vtQ>?@	ha 789@A		
 >?		
 >?kN	
 34gJ	
 
vr123QvY?&		
 & fI		
 >?		
c7p q8r s9t '(//{>~@>~@r)   