
    	^c|                     *   d Z ddlmZ ddlmc mZ ddlmc m	Z
 ddlmZ ddlZddlZddlmZ ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ ddl%m&Z&m'Z' e$j(        Z(i Z) e!j*        e)          Z*i Z+ e!j,        e+          Z, e,dd	d
            e,ddd
            e,ddd
            e,ddd
            e,ddd
            e,ddd
            e,ddd
            e,ddd
            e,ddd
            e,ddd
           dZ-d Z.d Z/d Z0dsdZ1d Z2d Z3d Z4	 dtdZ5d  Z6d! Z7d" Z8d# Z9d$ Z:dtd%Z;d& Z<d' Z=d(d)d ed*          fd+d,d ed-          fd.d/d ed0          fd(dg  ed1           ed2          fd3dg  ed4           ed2          fd(dd ed5          fd6d7d ed8          fd(d9d( ed:           ed;          fd(d<d( ed=           ed>          fd?dd( ed@           ed2          fdAdBd edC          fdDdEd( edF           ed>          fd(dg  edG           ed2          fdHdId( edJ           edK          fd(dLd( edM           edN          fd(dOg  edP           edQ          fdRdg  edS           ed2          fgZ> e*dTdUdVd edW          fd(dXd edY          fdZd[d ed\          fd]d^d ed_          fd`dad( edb           edc          fd(ddd^ ede           edf          fdgdhg  edi           edj          fd(dkd edl          fd(dmg  edn           edj          fd(dd edo          fg
e>z   ej?        z    edp          e*j@        q          dr             ZAdS )uas	  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.
    N)_)open)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                 x    |                                 }|j                            dd          }|rd|||fz  S dS )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(      sQ    88::D |\::I 
BF
 
 	

 4    c                 l    t           j                            d           t          t           j        d<   d S )Ns   pullurl)r   extraexportappendr(   extraexportmap)r"   s    r'   uisetupr.      s,    z***)7G:&&&r)   c                 f    |                                 sd S |j                            d           d S )N   last-email.txt)local_wlockfreeprefixadd)r"   r!   s     r'   	reposetupr4      s5    ::<< /00000r)      :c                 H    |r|d|z  z  }|                      ||z   |          S )Ns    [%s])prompt)r"   r7   r   rests       r'   r7   r7      s1     %(W$$99Vd]G,,,r)   c                 d   |                      dd          }|                    d          s|                    d          rd}nl|dk    rd}nc|dk    rd}nZ|dk    r|d	k    }nM|                     t          d
          |z             |                     t          d                     |d	k    }|S )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'   introwantedrB      s    ))L(33Kxx TXXg.. 			!	!		 	 			

>??+M	
 	
 	
 	QBCCDDD
Lr)   c           	         |                      dd          }|sd                    |          S t          j                    }t	          j        t          j        |                    }t	          j        | |di |          5 }|	                                 |
                    ||                    |                    dd|                    |d	                     d
d
d
           n# 1 swxY w Y   |                                S )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'   _formatflagsrW      s,   99\?33D  yy
-//C))*A$*G*GHHD		$R.>D	I	I FR



tCy
!!!
5"--G-"D"DEEEF F F F F F F F F F F F F F F <<>>s   ?AC((C,/C,c                 x    t          | |||          }|rd|z   }|sd|z  S t          d|z            }d||||fz  S )zbuild prefix to patch subjectrD   s	   [PATCH%s]   %ds   [PATCH %0*d of %d%s])rW   len)	r"   r!   rQ   rR   idxtotalnumberedflagtlens	            r'   _formatprefixr`      s_    D#u--D d{ Bd""55=!!&$UD)AAAr)   c
           
      	   g }
d }d}|D ]}|                     d          r0|                     d          r|                                d         }G|                     d          s|                     d          r n|
                    |           |	s	|st          |                    d          rK|                    d          s6d	                    |
d
d                                                    pd}|dz  }|                    d          r|rM|d                              d          r2|                    d           |r|d                              d          2|r|                    d           |rK|d                                         s1|                    d           |r|d                                         1t          j	        |          }|                    d          r||dz   z  }|                    d          p|                    d          }|r|                    d          r|d	                    |          z  }|rUt          j                    }|r=|                    t          j        | |||                    d                               t          j        d	                    |          d|                    d                    }t!          |          }|	sjd |                    |          D             }|r	|d         }	n@|d
k    rt%          j        ||         d||          }	nt%          j        ||         d          }	d}|                    d          rd}|dz   t)          j        |	          z   |d<   |                    |           n)t          j        ||                    d                    }t-          | |||                    d          |||          }|
d                                                             d          }|s-d                     ||                    d!          p|g          }nd                     ||g          }t          j        | |||                    d                    |d"<   t3          j        |          |d#<   d$|z  |d%<   d$|z  |d&<   |||fS )'Nr)      #s	   # Node IDs   diff -rs
   diff --git   attach   body   
r;   s"   Patch subject is complete summary.s   


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

   inline   testzx-patchc                 f    g | ].}|                     d           s|                     d          ,|/S )s   .patchs   .diff)endswith).0ts     r'   
<listcomp>zmakepatch.<locals>.<listcomp>:  sP       ::i(( -.JJx,@,@  r)   s   %b-%n.patch)seqnor\   s   %b.patchinline
attachmentz; filename=Content-Disposition)displayrE   s   . rD      subjectSubjectX-Mercurial-Nodez%izX-Mercurial-Series-IndexzX-Mercurial-Series-Total)
startswithsplitr,   
ValueErrorr<   rG   strippopr   diffstatemimemultipartMIMEMultipartattachr   
mimeencodemimetextpatchr   nodetagsr   makefilenamer   strfromlocalr`   rstrip
headencoder   sysstr)r"   r!   rQ   
patchlinesr>   	_charsetsr[   r\   r]   	patchnamedescnodebodylinedsaddattachmentmsgpbinnode	patchtagsdispositionprefixsubjs                          r'   	makepatchr      s    DDD  ??4   	|,, (zz||B'??:&& 	$//-*H*H 	ED T xx	 488G#4#4 JJtABBx  &&(( 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-- '

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

  	

1 txx/@/@AAA
D#txx((#uh F 7==??!!%((D )yy&$((:"6"6">$?@@yy&$((_Ry$((7:K:KLLC	N&od33C&*SjC"#&*UlC"#b=r)   c              +     K   | j         }| d                                         }|D ]}||k    rV| d                                         s| d                                         r"|                    t          d                     t                      }t          j        | |g|t          j
        ||d                     |                                                    d          V  dS )zlreturn 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>   rf   )r"   rQ   filesdeletedwarnr   rH   r   
exportfiler   difffeatureoptsrP   ry   )r!   revsr>   r"   prevroutputs          r'   _getpatchesr   `  s      
 
B:>>D - -99$t***,,9T
0B0B0D0D9GGAMNNOOO1#vE$9"d$M$M$M	
 	
 	
 	
 oo%%e,,,,,,- -r)   c                    | j         }t          j        d          }t          j                            |d          }|                    dd          }|r||d<   	 g }|r|g}t          j        || |g|R i | t          j
        |          	 t          j        |           n# t          $ r Y nw xY wt          j        |           S # 	 t          j        |           n# t          $ r Y nw xY wt          j        |           w xY w)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pathrG   r#   r   bundler   readfileunlinkOSErrorrmdir)r!   destr>   r"   tmpdirtmpfnbtypedestss           r'   
_getbundler   q  s<    
B%8999FGLL++EIIlM22E V 	FED%8%8884888}U##	Ie 	 	 	D	
		Ie 	 	 	D	
sB   1C B""
B/.B/D	CD
C+(D*C++Dc                    | j         }|                    d          r5t          |                    d                                                    }n|                    t          d                     |                    ||| j        d          }|                     dd          }|                    |           |	                                 |S )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   wb)
r"   r<   r   readrN   r   editr   vfsclose)r!   defaultbodysenderr>   r"   r   msgfiles          r'   _getdescriptionr     s     
Bxx DHHV$$%%**,,
KLL	
 	
 	
 ww$)<L  
 
 ((,e44dKr)   c           
         | j         }t          j        |          }|                    d          pt	          |dd          }t          | d|fi |}t          j                    }|r=|                    t          j	        ||||                    d                               t          j        dd          }	|	                    |           d|                    d	d
          z  }
|	                    ddt          j        |
                     t!          j        |	           |                    |	           t          j        ||||                    d                    |d<   ||dfgS )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   rs   rr   )filenamerv   N)r"   r   r   r<   r7   r   r~   r   r   r   	emimebaseMIMEBaseset_payload
add_headerr   r   emailencodersencode_base64r   )r!   r   r   r>   r"   r   r   r   r   datapartr   s              r'   _getbundlemsgsr     sn    
Br""I88I &
K8# #D 4f5555D

&
(
(C K

4?2tY8H8HIIJJJ!-1EFFH   DHH\9===J&z22    
 )))JJx_Ry$((6:J:JKKC	N$r)   c           
         | j         }t          j        |          }t          || |                                |                    d          dt          |          d          }|                    d          pt          |d|d          }|sd	S |d
z   |z   }d}	|                    d          r(t          j	        t          |g                     }
d|
z   }	nd	}
t          | |	|fi |}	t          j        ||	||                    d                    }t          j        ||||                    d                    |d<   |||
fS )zmake 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)   )r8   r   NrD   r}   rf   r   rv   )r"   r   r   r`   lastr<   rZ   r7   r   r}   sumr   r   r   )r!   r   r   patchesr>   r"   r   r   r   r   r}   r   s               r'   
_makeintror     sX    
Br""I 
D$))++txx//CLL4  F 88I &
#&## # #D  tD=4DDxx
 >#gr"2"233x4v6666D
/"dItxx/?/?
@
@C_Ry$((6:J:JKKC	Nx  r)   c                    t          j        |          }| j        }t          j        |          }t          t          | |fi |          }g }	|                    t          d          t          |          z             t          ||t          |                    r't          | |||fi |}
|
r|	                    |
           t          |	          t          |          z   dk    }d}t          |          t          |          k    sJ t          t          ||                    D ]O\  }\  }}|r||         }t          || |||||dz   t          |          ||
  
        }
|	                    |
           P|	S )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   byteskwargsr"   r   r   listr   rN   r   rZ   rB   r   r,   	enumeratezipr   )r!   r   r   
patchnamesr>   	bytesoptsr"   r   r   msgsr   r]   rF   ir   r   s                   r'   _getpatchmsgsr     s    $T**I	Br""I;tT22T2233GDHHQ?@@3w<<OPPP 2y#g,,// vtW==== 	KK 4yy3w<<'!+H Dt99G$$$$s41122  	6Aq 	!a=DELL
 
 	CKr)   c                    | j         }t          j        | ||r|gnd          }d |D             }|                    t	          d          d                    |          z             d |D             }|s| j                                        g}|                     d|pd|          }|s"|                    t	          d                     |S )	z4Return the revisions present locally but not in destNc                 @    g | ]}t          j        |j                  S  )r   hidepasswordrawloc)rm   r   s     r'   ro   z _getoutgoing.<locals>.<listcomp>  s%    @@@Q'&qx00@@@r)   s   comparing with %s
   ,c                     g | ]
}|d k    |S )r   r   rm   r   s     r'   ro   z _getoutgoing.<locals>.<listcomp>  s    &&&!qAvvAvvvr)   s   outgoing(%s) and ::%ldr)   s   no changes found
)	r"   r   get_push_pathsstatusr   rG   	changelogtiprevr   )r!   r   r   r"   paths
safe_pathss         r'   _getoutgoingr     s    	B"4t-EdVVFFE@@%@@@JIIa&''$))J*?*??@@@&&t&&&D )%%''(99.TBBD ,
		!)**+++Kr)   c                     	 t          j        t           j        d                   }n## t          $ r t	          j                    }Y nw xY wd| ||fz  S )Ns
   HGHOSTNAMEz
<%s.%d@%s>)r   r   environKeyErrorsocketgetfqdn)r   	timestamphostnames      r'   _msgidr   $  s_    $()9-)HII $ $ $>##$4H555s   $' AAr)   re   s-   send patches as inline message text (default)   ard   s   send patches as attachments   iri   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   drh   s   add diffstat output to messages   dates&   use the given date as the sending dates   DATEr:   s,   use the given file as the series descriptions   FILE   fs   email address of sender   nrj   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   sru   s0   subject of first message (intro or single patch)s   TEXTs   in-reply-tos   message identifier to reply tos   MSGIDrE   s    flags to add in subject prefixess   FLAG   ts   email addresses of recipients   email   gs   gits   use git extended diff formatrg   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                    /01 t          j                  t          j                   /                    d          }                    d          }                    d          }                    d          }                    d          }                    d          }	                    d          s|st          j                    |s)|s'|s%|s#|	s!t          j        t          d                    |r#|r!t          j        t          d	                    t          j
        dd           |s|rCt          |          d
k    r!t          j        t          d                    |r	|d         }
nd}
g }|r&|r!t          j        t          d                    |}nD|	rB|	j        vr$t          j        t          d          |	z            t          j        |	          }t          j        |          }|rt#          |
|          }|rd |D             d<   j                            dd          }|rʉj                            d           	 t+          j        i |          }n># t          j        $ r, j                            t          d          |z              w xY w|                    d          sj                            d           n)fd|D             }|                    d |D                       }g }t7          |          D ]"\  }}||         s|                    |           #|rt          |          d
k    r.t          d          }|||d         t          |          d
z
  fz  }nt          d          }|||d         fz  }d |D             }d                    d                     d|          D                       }t          d           ||fz  }t          j        ||!          |rt?          j         |          1nt?          j!                    11fd"}                    d#          pN                     d$d#          p8                     dd#          p"tE           d% #                                          }|r\t          j$                  }tK          |
fi |}|&                                }|'                    d&d           tQ          ||fi |}n!tS          ||fi t          j$                  }g 0d]/0 fd(	} |d)d*+          }|s!t          j        t          d,                     |d-d*d./          } |d0          } |d1          }  *                    dd2          }!|!tW                              d3          p                    d2                    z  }!|!r ,                    t          d4          d56            ,                    d7|z  d86           0D ]}" ,                    d9|"z  d:6           |D ]9\  }#}$}% ,                    d;|$z  d<6           |%r ,                    |%d=6           : ,                    d>            -                    t          d?                    r!t          j        t          d@                     ,                    d>                               dA          pd}&|&Ht]          j/        |&          }&|&0                    dB          sdB|&z   }&|&1                    dC          s|&dCz  }&te          j3        t]          j/        |                    d
         }'t          j4         |/                    d                    }d}(d}) 5                    t          dD          t          dE          t          |          F          }*t7          |          D ]\  }+\  }#}$}%	  ||#dG                   |#dH<   |)s|#dH         })|)|#dI<   n# tl          $ r  |dJ          |#dH<   Y nw xY w|&r
|&|#dK<   |&|#dL<   |&rdG|#vr|#dH         }&dMto          j8                    9                                z  |#dN<   te          j:        1d         d*O          |#dP<   1d         d
z   1d
         f1||#dQ<   dR                    |          |#dS<   |rdR                    |          |#dT<   |rdR                    |          |#dU<   | rdR                    |           |#dV<                       d          r ;                    t          dW          |$dX            <                    d$           t          j=         d'Y          },	 |,>                    |#d'            ,                    d>           # t~          $ r Y w xY w|(st          j@         |Z          }( ;                    t          d[          |$dX           |*A                    |+|$\           |s|#dU= t                      }-t          j=        |-d'Y          },|,>                    |#d'           ||z   |z   }. |(|'|.|-C                                           |*D                                 dS )^aQ  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  rj   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 foundc                     g | ]}d |z  S )rY   r   r   s     r'   ro   zemail.<locals>.<listcomp>2  s    111q111r)   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                      g | ]
}|         S r   r   )rm   r   r!   s     r'   ro   zemail.<locals>.<listcomp>B  s    )))q47)))r)   c              3   >   K   | ]}|                                 V  d S N)r   rm   hs     r'   	<genexpr>zemail.<locals>.<genexpr>C  s*      $;$;!QVVXX$;$;$;$;$;$;r)   s'   public "%s" is missing %s and %i otherss   public url %s is missing %sc                 6    g | ]}|                                 S r   )rQ   )rm   r%   s     r'   ro   zemail.<locals>.<listcomp>O  s     <<<Sswwyy<<<r)   rD   c              3       K   | ]	}d |z  V  
dS )s   -r %sNr   r  s     r'   r  zemail.<locals>.<genexpr>P  s7       $ $%&HqL$ $ $ $ $ $r)   s
   heads(%ld)s   use 'hg push %s %s')hintc                 Z    t          | d d         t          d                             S )N   r   )r   int)id
start_times    r'   genmsgidzemail.<locals>.genmsgid\  s'    b"gs:a=11222r)   r   r  s   Fromr   Fc                 $   |                                  }|                     dd                                           }	                    |          }|rW
                    d| d                    |          fz             t          j        |	                    d                    S                     d|          p                    d|          }|sB                    d|          p                    d|          }|s|rt          | |          }|rE
                    d| |fz             t          j        |g	                    d                    S |r+t          j        |g	                    d                    S g S )	N   -   _s   %s: %ss   , rj   r  r   r   )
lowerreplacer<   r,   rG   r   addrlistencoder#   	hasconfigr7   )headeraskr   	configkeyoptaddrsaddr	specifiedr   r>   	showaddrsr"   s           r'   getaddrszemail.<locals>.getaddrsr  s   LLNN	nnT4((..00 	PY&%**U2C2C)DDEEE&r5)TXXg=N=NOOO yy9-- 
)2
 2
  	;Xy99 R\\i> >I  ; ;b&'::: 	Y&$7888&rD69dhhw>O>OPPP 	&WIy$((7*;*;   	r)   s   ToT)r%  s   no recipient addresses provideds   Ccr)   )r%  r   s   Bccs   Reply-Tor   rh   s   
Final summary:

s   patchbomb.finalsummary)labels	   From: %s
s   patchbomb.froms   %s
s   patchbomb.tos   Subject: %s
s   patchbomb.subjects   patchbomb.diffstatsrf   s1   are you sure you want to send (yn)?$$ &Yes $$ &Nos   patchbomb canceleds   in_reply_to<>s   sendings   emails)unitr\   rw   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)Er   r   r   r   r<   validateconfigr	   Abortr   r   check_at_most_one_argrZ   
_bookmarksr   bookmarkrevsr   revranger   r"   r#   debugr   peer	RepoErrorr=   capableknownr   r,   rG   setr   	parsedatemakedater7   username	strkwargsr   copyr|   r   r   
configboolboolrN   promptchoicer   r   rx   rl   eutil	parseaddraddressencodemakeprogress	TypeErrorr   versiondecode
formatdater   pager	GeneratorflattenBrokenPipeErrorconnectupdaterH   rP   complete)2r"   r!   r   r>   r   dater:  outgoingrQ   bookmarkr   r&   
publicpeerrT   rF  missingr[   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  s2   `` `                                           @@@r'   emailrw  k  s   h %%Dr""IXXi  F88GD88GDxx$$H
((6

Cxx$$HHHW    B 
C 
8 
v 
 
kABB
 
 	
  
F 
k1 
 
 	
 !$<<< 6 t99q==+a 899::: 	7DDD
 4 	O+a LMMNNN	 44?**+a :;;hFGGG#D(33tT**D .D$-- 211D111W |\::I 2JKKK	r955JJ 	 	 	G7889D   		
 !!(++ 	2GMMMNNNN))))D)))C$$$;$;s$;$;$;;;EG#C.. & &QSz &NN1%%% 2w<<!##FGGCIwqz3w<<!3CDDCC:;;CIwqz22C<<G<<<)) $ $*.((=+*N*N$ $ $   /00Iw3GGk#D1111  )'--

&((
3 3 3 3 3
 	 	.99Xw''	.99\7++	. "gr{{}}--	   M$T**d66g66
\\^^
x&&&dFJEE*EET64LL83Ed3K3KLLI        6 
%T	"	"	"B Ak!>??@@@	%T3	/	/	/B
(6

Ch{##GmmL*55GtDHH[))ATXXj-A-ABBBG 8
*++3LMMM
-&(1BCCC 	< 	<DHHWt^?H;;;; 	; 	;KAtRHH&-6JHKKK ;#9:::
??BCC
 
 	8 +a 566777HHUOOOXXn%%-F&v..  %% 	"6\Fs## 	cMF/("7"?"?@@CKFItxx7H7HIIFHJ	*AiLLD		   H &dOO /; /;=AtR	4&hq);'<==AlO -|_
)3A%&& 	4 	4 	4&h{33AlOOO	4 	%%Am$AlO 	%+144|_F2T\^^5J5J5L5LL,$Z]dCCC&	 ma'A7
&	))B--$ 	$iimmAdG 	&yy~~AeH 	/ IIg..AjM88G 	;IIa''y999HHXr>>>I!!!U+++"     7<666IIanndI666OOADO))) eHBr>>>Ia'''Cx"}HH[(BKKMM::::s0   #I: :;J5/#``.-`.8+f%%
f32f3)Nr5   r  )B__doc__email.encodersencodersr   email.mime.basemimebaser   email.mime.multipart	multipartr~   email.utilsutilsrP  r   r   mercurial.i18nr   mercurial.pycompatr   mercurial.noder   	mercurialr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   mercurial.utilsr   r   rH   cmdtablecommandconfigtable
configitem
testedwithr(   r.   r4   r7   rB   rW   r`   r   r   r   r   r   r   r   r   r   	emailopts
remoteoptsCATEGORY_IMPORT_EXPORTrw  r   r)   r'   <module>r     s3  A AF ' & & & & & # # # # # # # # # - - - - - - - - -       				        # # # # # #                                             
 =
)
H
%
%!Y!+..
 

   
 

   
 
	   
 
   
 
   
 
   
 
   
 
   
 
   
 
	    #
   8 8 8
1 1 1- - - -  (  
B 
B 
B. a a a aH- - -"  8  2  <! ! !B, , , ,^   6 6 6 	'4KLLM	9dAA<==>	9dAACDDE
	
<==	( 
5"aa=>>(L*dAADEEF	;aa BCCD	
344	'

 		
9::	'

 
7C566(D	7D!!@AAB	
@AA	'

 	
	
677	( 		
=>>	'

 		
+,,	( 	'2qq<==qqzzJ	5"aa89911X;;Gw<	~ 		vtQQ>??@	haa 7889A@AA		
 A>??		
 A>??AkNN	
 A344AgJJ	
 
vr11233QQvYY?A& 		
 A&  AfII		
 A>??		
c7p q8r s9t A'((/{> > >~@ @> >~@ @ @r)   