Commit Graph

213 Commits

Author SHA1 Message Date
Augie Fackler
67877b90cc python2.4: fix imports of sub-packages of the email package
These all have an obvious comment so if/when we finally ditch Python
2.4 we can eradicate them easily.
2013-09-24 15:10:32 -04:00
Augie Fackler
5621af34e7 patchbomb: correct import of email module 2013-09-20 10:16:35 -04:00
Matt Mackall
13d2a13ea6 ui: merge prompt text components into a singe string
This will help avoid problems with partial or mismatched translation
of the components.
2013-05-22 17:31:43 -05:00
FUJIWARA Katsunori
3a3aca3c72 smtp: verify the certificate of the SMTP server for STARTTLS/SMTPS
Before this patch, the certificate of the SMTP server for STARTTLS or
SMTPS isn't verified.

This may cause man-in-the-middle security problem (stealing
authentication information), even though SMTP channel itself is
encrypted by SSL.

When "[smtp] tls" is configured as "smtps" or "starttls", this patch:

  - uses classes introduced by preceding patches instead of "SMTP" or
    "SMTP_SSL" of smtplib, and

  - verifies the certificate of the SMTP server, if "[smtp]
    verifycert" is configured as other than False

"[smtp] verifycert" can be configured in 3 levels:

  - "strict":

    This verifies peer certificate, and aborts if:

      - peer certification is not valid, or
      - no configuration in "[hostfingerprints]" and "[web] cacerts"

    This is default value of "[smtp] verifycert" for security.

  - "loose":

    This verifies peer certificate, and aborts if peer certification is
    not valid.

    This just shows warning message ("certificate not verified"), if
    there is no configuration in "[hostfingerprints]" and "[web]
    cacerts".

    This is as same as verification for HTTPS connection.

  - False(no verification):

    Peer certificate is not verified.

    This is as same as the behavior before this patch series.

"hg email --insecure" uses "loose" level, and ignores "[web] cacerts"
as same as push/pull/etc... with --insecure.

Ignoring "[web] cacerts" configuration for "hg email --insecure" is
already done in "dispatch._dispatch()" by looking "insecure" up in the
table of command options.
2013-03-26 02:28:10 +09:00
Matt Mackall
fd58e8703f i18n: wrap false positives for translation detection 2012-11-25 13:53:47 -06:00
Julian Cowley
af02d686b4 patchbomb: -c is not an alias for the --confirm option
The help text shows "-c/--confirm", which implies that -c is an alias
for --confirm.  Actually, it is an alias for --cc.  Correct the text
by removing -c.
2012-10-28 05:44:50 -10:00
Thomas Arendsen Hein
bf24be2a41 patchbomb: respect --in-reply-to for all mails if no intro message is sent
Before this change, the thread hierarchy looked like this:

PARENT
  PATCH1/x
    PATCH2/x
    PATCH3/x
    ...

Now it is:

PARENT
  PATCH1/x
  PATCH2/x
  PATCH3/x
  ...

With an introductory message the behaviour is unchanged:

PARENT
  INTRO
    PATCH1/x
    PATCH2/x
    PATCH3/x
    ...
2012-10-24 09:53:10 +02:00
Patrick Mezard
f1c5b9a95f patchbomb: rewrite getoutgoing() with revsets
Another version could have returned a revset expression from
getoutgoing(), but we do not know how many times it will be resolved, so
better do it once explicitely.
2012-06-24 18:11:52 +02:00
Patrick Mezard
3743817d12 patchbomb: support --outgoing and revsets
With --outgoing, input revisions were passed to getoutgoing() before
being resolved.
2012-06-24 17:39:27 +02:00
Patrick Mezard
10fef3c556 patchbomb: make --outgoing ignore secret changesets
getoutgoing() is just rewritten almost like revset.outgoing(), a
follow-up will make it use revsets after the tests are adjusted.
2012-07-14 19:21:31 +02:00
Martin Geisler
cae2421779 patchbomb: lowercase status messages 2012-06-12 14:18:18 +02:00
Augie Fackler
96d44b39f7 hgext: mark all first-party extensions as such 2012-05-15 14:37:49 -05:00
Brodie Rao
c577fac135 cleanup: replace naked excepts with more specific ones 2012-05-12 16:02:45 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Angel Ezquerra
2da9b90b7f patchbomb: add --body flag to send patches as inline message body text
There is currently no way to make patchbomb include patches both as attachments
and as inline text. This would be quite convenient when sending patches to
people who use web email clients (e.g. gmail) which often mangle the patches,
making them hard to apply.

The default behavior of the email command is unchanged. However it is now
possible to use the --body flag _in addition_ to the -i or -a flags, in which
case the patchbomb emails will contain the patch as inline body text and as an
attachment.

A new test has been added to test-patchbomb.t ("test attach for single
patch"), based on the existing test called "test attach for single patch" test.
2012-03-21 06:45:07 +01:00
Matt Mackall
bd8479209b patchbomb: add (optional) note to 0 of 0 prompt 2012-03-08 15:59:41 -06:00
Mads Kiilerich
c30004d07d mail: mbox handling as a part of mail handling, refactored from patchbomb 2011-11-23 02:11:24 +01:00
Mads Kiilerich
6127ae9b6d patchbomb: minor refactoring of mbox functionality, preparing for move
This allows reuse of the mbox functionality but causes minor changes in the
patchbomb console output when writing to a mbox.
2011-11-23 02:09:38 +01:00
Matt Mackall
bd2e2796ed patchbomb: drop loop in prompt
There are no longer any prompts that insist on being answered, so the
loop is no longer needed, nor is most of the other logic.
2011-09-28 14:49:00 -05:00
Matt Mackall
46b745f857 patchbomb: use prompt even in non-interactive mode
This matches our pre-existing behavior from:

changeset:   12197:0a3b85866451
user:        Christian Ebert <blacktrash@gmx.net>
files:       hgext/patchbomb.py tests/test-patchbomb.t
description:
patchbomb: show prompt and selection in non-interactive mode
changeset:   8940:023d1310d8a4
user:        Mads Kiilerich <mads@kiilerich.com>
date:        Sun Jun 21 03:13:38 2009 +0200
files:       mercurial/ui.py tests/test-merge-prompt.out tests/test-merge-tools.out
description:
ui.prompt: Show prompt and selection in non-interactive mode
2010-09-08 08:31:07 +02:00
Greg Ward
d81f53276c patchbomb: make it easy for the user to decline sending an intro message.
- prompt(): respect interactive mode; clarify logic a bit
- rename introneeded() to introwanted() and give it only one caller
- add 'numbered' arg to makepatch() so it does not need to call
  introwanted()
- factor makeintro() out of getpatchmsgs(), so it's easier to skip the
  intro message based on the user's behaviour

Unexpected but perfectly reasonable side effect: in non-interactive
mode, we don't show unanswerable "Cc" or "From" prompts anymore, so
remove those from the test expectations.
2011-09-27 22:38:47 -04:00
Greg Ward
ffd34f8c0b patchbomb: simplify some contorted logic and odd variable names. 2011-09-26 21:29:13 -04:00
Matt Mackall
efecb99535 hg: change various repository() users to use peer() where appropriate
This gets all the easy cases (peers that aren't also used as repositories).
2011-06-10 11:43:38 -05:00
Idan Kamara
10ac959d0b patchbomb: pass --git argument to diffstat 2011-05-20 21:04:45 +03:00
Matt Mackall
cf07129983 scmutil: move revsingle/pair/range from cmdutil
This allows users at levels below the command layer to avoid import loops.
2011-05-13 14:06:28 -05:00
Adrian Buehlmann
8200df2be6 patchbomb: use cmdutil.command decorator 2011-05-12 18:27:05 +02:00
Matt Mackall
cf2d9729ae cmdutil: make_filename -> makefilename 2011-05-10 16:08:46 -05:00
Brodie Rao
b7f0d2a103 url: move URL parsing functions into util to improve startup time
The introduction of the new URL parsing code has created a startup
time regression. This is mainly due to the use of url.hasscheme() in
the ui class. It ends up importing many libraries that the url module
requires.

This fix helps marginally, but if we can get rid of the urllib import
in the URL parser all together, startup time will go back to normal.

perfstartup time before the URL refactoring (707e4b1e8064):

! wall 0.050692 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)

current startup time (9ad1dce9e7f4):

! wall 0.070685 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)

after this change:

! wall 0.064667 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)
2011-04-30 09:43:20 -07:00
Peter Arrenbrecht
b867e650e6 discovery: drop findoutgoing and simplify findcommonincoming's api
This is a long desired cleanup and paves the way for new discovery.
To specify subsets for bundling changes, all code should use the heads
of the desired subset ("heads") and the heads of the common subset
("common") to be excluded from the bundled set. These can be used
revlog.findmissing instead of revlog.nodesbetween.

This fixes an actual bug exposed by the change in test-bundle-r.t
where we try to bundle a changeset while specifying that said changeset
is to be assumed already present in the target. This used to still
bundle the changeset. It no longer does. This is similar to the bugs
fixed by the recent switch to heads/common for incoming/pull.
2011-04-30 17:21:37 +02:00
Martin Geisler
9e82c0f40f patchbomb, help/hgweb: do not refer to config files as hgrc files 2011-04-01 12:14:42 +02:00
Dan Villiom Podlaski Christiansen
ec590d5cd4 explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
2010-12-24 15:23:01 +01:00
Nicolas Dumazet
97f5e1fd2a patchbomb: save introductory message in .hg/last-email.txt 2010-12-21 19:44:28 +09:00
Martin Geisler
69d03175ae patchbomb: fix stray backslash in docstring
While both '\ ' and '\\ ' parse the same in Python, the difference
trips up hggettext so that it cannot find the docstring in the source
file and thus cannot write the right line number to i18n/hg.pot.

While the line number is not essential, it can be used to lookup the
original message.
2010-10-23 18:33:57 +02:00
Benoit Boissinot
94fe6278fb merge with stable 2010-10-20 23:48:33 +02:00
Benoit Boissinot
c6403d4ac6 patchbomb: hide passwords potentially embedded in urls 2010-10-20 23:39:48 +02:00
timeless
73617c6e5a patchbomb: move command option help from the extension (patchbomb) to the command (email) 2010-10-17 14:00:01 +03:00
Yuya Nishihara
0c49a1c065 patchbomb: show progress when sending emails or writing mbox 2010-09-12 16:10:41 +09:00
Christian Ebert
47b2eb085f patchbomb: consistent code style in getaddrs() 2010-09-11 18:08:00 +02:00
Christian Ebert
57eed7cac3 patchbomb: add --confirm option to show series details and ask for confirmation
--confirm presents same prompt as --diffstat, but does not write
a diffstat to the messages' bodies.

A simple test simulating a negative response is included.
2010-09-10 15:32:22 +02:00
Christian Ebert
c4731e2be5 patchbomb: let diffstat prompt only once with complete summary
This changes the behaviour of --diffstat.
Before the user was asked for confirmation of each patch with its
description and diffstat, and a final summary.

Now there is only one prompt right before sending with a final
summary which does not include the patch descriptions, but the
message details and the diffstats:

  Final summary:

  From: sender
  To: recipient(s)
  Cc: (if present)
  Bcc: (if present)
  Reply-To: (if present)
  Subject: [patch 0 of x [flags]] intro (if present)
      a |  28 ++++++++++++++++++++++++++++
      b |  15 +++++++++++++++
  Subject: [patch 1 of x [flags]] subject
      a |  28 ++++++++++++++++++++++++++++
  [ ... ]

  are you sure you want to send (yn)?
2010-09-10 15:32:14 +02:00
Martin Geisler
5e2d304679 patchbomb: rename argument to avoid shadowing patch module 2010-09-10 15:56:13 +02:00
Christian Ebert
c71ec4c740 patchbomb: show prompt and selection in non-interactive mode
Akin to 023d1310d8a4 for the custom patchbomb prompt.
2010-09-08 08:31:07 +02:00
Christian Ebert
c44df41dfd patchbomb: use ui.promptchoice for diffstat to allow localization of choices
The extra check for ui.interacive from patchbomb's prompt function is not
needed here.

Format boolean prompt as in filemerge.py.
2010-09-08 08:31:07 +02:00
Christian Ebert
63a3341098 patchbomb: remove unneeded line continuation 2010-08-25 23:26:18 +01:00
Christian Ebert
60b4f2db95 patchbomb: reduce number of opts.get calls
Rename outgoing() function to getoutgoing() analogous to
getbundle() etc. to avoid name conflict.
2010-06-16 00:37:21 +02:00
FUJIWARA Katsunori
ce06b102df help: show value requirement and multiple occurrence of options
this helps users to know what kind of option is:

  - no value is required(flag option)
  - value is required
  - value is required, and multiple occurrences are allowed

each kinds are shown as below:

 -f --force              force push
 -e --ssh CMD            specify ssh command to use
 -b --branch BRANCH [+]  a specific branch you would like to push

if one or more 3rd type options are shown, explanation for '[+]' mark
is also shown as footnote.
2010-06-06 17:25:00 +09:00
Dirkjan Ochtman
cf1de649bd move discovery methods from localrepo into new discovery module 2010-06-07 18:35:54 +02:00
Matt Mackall
86ebd43d71 remoteui: move from cmdutil to hg 2010-06-01 11:18:57 -05:00
Martin Geisler
efb4a38a04 Use our custom hg reStructuredText role some more
I missed these occurrences on my first scan through the source.
2010-05-18 16:31:10 +02:00
Yuya Nishihara
1027c10b16 patchbomb: respect HGPLAIN when piping --test output to PAGER
It makes easy to use `hg email --test` from another tool.
2010-05-16 22:23:14 +09:00