Commit Graph

45 Commits

Author SHA1 Message Date
Mads Kiilerich
29285eb86d ui: show prompt choice if input is not a tty but is forced to be interactive
The tests often set ui.interactive to control normally interactive prompts from
stdin. That gave an output where it was non-obvious what prompts got which
which response, and the output lacked the newline users would see after input.

Instead, if the input not is a tty, write the selection and a newline.
2014-10-01 01:04:18 +02:00
Augie Fackler
4cfa282888 test-patchbomb.t: work around Python change d579866d6419 (issue4188)
Python 2.7.7 and later (as well as some ubuntu/debian packages of
2.7.6) include a fix that makes the email module more pedantically
correct for MIME boundaries, but this breaks our tests. We work around
this by filtering the output of any 'hg email' invocations in the test
that produce MIME messages.
2014-08-07 11:39:19 -04:00
Augie Fackler
f2d5956439 patchbomb: reorder header insertions to clarify code
This is done as its own change to make the changes to test-patchbomb.t
easier to review.
2014-06-07 11:32:37 -04:00
Augie Fackler
b8c9c1134c patchbomb: always use message-id of first patch for series-id
This currently has the side effect that the 0 of N message has no
series-id. This won't matter for Mercurial's own use, but may be
undesirable for other projects depending on their workflow.

The way the header is inserted is intentionally a little funny to make
the test expectation diff easier to review.
2014-06-07 11:06:15 -04:00
Augie Fackler
4dd5b69683 test-patchbomb: normalize glob lines and record their construction
This makes it significantly less painful to use --interactive on
run-tests, as you can now use the recorded regular expression
substitutions to fix up the glob lines and produce zero diffs.

This also tightens the expectations of a few of the lines for the MIME
boundaries - it just seemed like the thing to do while in here and
causing some changes.
2014-06-07 11:30:06 -04:00
Pierre-Yves David
1437d7ae17 patchbomb: includes a unique series ID in email header
Now that we have patch index and series size information, having a unique series
identifier will helps tool to glue all email back together without any
additional logic.
2014-05-05 22:51:20 -07:00
Pierre-Yves David
02a943dbb1 patchbomb: includes series information in the header
We includes information about the series being patch bombed in all email. Two
new headers are added:

* X-Mercurial-Series-Index: index of the patches in the series (starts at 1)
* X-Mercurial-Series-Total: The total number of patches in the series

This information is available in the email subject line, but having them
formalized in the header will helps automated tools to process patches send with
modern mercurial.
2014-05-05 22:47:14 -07:00
Mads Kiilerich
6c7f6f30ff patchbomb: warn when emailing a dirty working directory parent 2014-04-07 23:10:20 +02:00
Martin Geisler
7316194bdf tests: don't load unnecessary graphlog extension
Since graphlog is in core, we can use 'hg log -G' instead.
2013-11-22 19:14:17 +01:00
Mads Kiilerich
ef317883c7 export: show 'Date' header in a format that also is readable for humans
'export' is the official export format and used by patchbomb, but it would only
show date as a timestamp that most humans might find it hard to relate to. It
would be very convenient when reviewing a patch to be able to see what
timestamp the patch will end up with.

Mercurial has always used util.parsedate for parsing these headers. It can
handle 'all' date formats, so we could just as well use a readable one.

'export' will now use the format used by 'log' - which is the format described
as 'Unix date format' in the templating help. We assume that all parsers of '#
HG changeset patch'es can handle that.
2013-02-08 22:54:17 +01: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
Mads Kiilerich
13cd04eefb tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup 2012-10-10 01:37:54 +02:00
timeless@mozdev.org
b3951d5e4d spelling: multiple 2012-08-17 13:58:18 -07: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
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Mads Kiilerich
d733986c74 tests: consistently use a HGEDITOR pattern that works with msys on windows
Removing the need for an executable sh script that can be run from a native
windows application enables some tests for running on windows.
2012-06-10 14:41:14 +02:00
Thomas Arendsen Hein
a076708e7b merge with stable 2012-04-03 21:02:00 +02:00
Thomas Arendsen Hein
21bb7c4cdc tests: make tests work if directory contains special characters
With this quoting tests will work e.g. in "/tmp/foo bar/mercurial/".
2012-04-03 19:06:35 +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
Matt Mackall
a968007692 merge with stable 2011-12-08 16:01:44 -06:00
Matt Mackall
a69962e18c branch: warn on branching 2011-12-08 14:32:44 -06: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
Mads Kiilerich
b9221232de tests: test-patchbomb.t cleanup
Let commit messages and file names describe the facts without making incorrect
guess of the actual handling of it.
2011-11-22 01:37:26 +01:00
Mads Kiilerich
ec9ee31267 tests: show actual output in test-patchbomb.t
Drop fixheader and decode base64 encoded content and show non-ascii content.
2011-11-22 01:37:26 +01:00
Mads Kiilerich
d648884b09 tests: add 'hghave system-sh' to skip tests on windows 2011-11-16 03:45:14 +01: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
Augie Fackler
f360f9d092 test-patchbomb.t: clean up progress tests 2011-04-30 12:02:09 -05:00
Mads Kiilerich
e4660104cf util: flush stdout before calling external processes
stdout could have content in its buffer while a subprocess ran and emitted
output.

Flushing stdout ensures that output now comes in the right order.
2011-02-18 03:35:01 +01:00
Nicolas Dumazet
97f5e1fd2a patchbomb: save introductory message in .hg/last-email.txt 2010-12-21 19:44:28 +09:00
Mads Kiilerich
635406bf76 tests: use (esc) for all non-ASCII test output 2010-11-08 01:41:41 +01:00
Mads Kiilerich
82954d10d1 tests: use (esc) markup for string-escape
This makes test output less ambiguous.

Failing test output will be escaped and marked up if necessary. A Python
string-escape compatible encoding is used, but not everything is encoded -
especially not \n and \t and '.
2010-11-08 01:35:41 +01:00
Yuya Nishihara
93e1a12bf9 test-patchbomb: add test for progress support (ca12f6ae8d9d) 2010-10-25 01:11:52 +09:00
Brodie Rao
b5fe0d906e tests: add glob matching for unified tests
This adds a " (glob)" marker that works like a simpler version of
(re): "*" is converted to ".*", and "?" is converted to ".".

Both special characters can be escaped using "\", and the backslash
itself can be escaped as well.

Other glob-style syntax, like "**", "[chars]", or "[!chars]", isn't
supported.
2010-09-22 16:06:02 -05:00
Brodie Rao
7d7d96bd74 tests: require regexes in unified tests to be marked with " (re)"
Consider this test:

  $ hg glog --template '{rev}:{node|short} "{desc}"\n'
  @  2:20c4f79fd7ac "3"
  |
  | o  1:38f24201dcab "2"
  |/
  o  0:2a18120dc1c9 "1"

Because each line beginning with "|" can be compiled as a regular
expression (equivalent to ".*|"), they will match any output.

Similarly:

  $ echo foo


The blank output line can be compiled as a regular expression and will
also match any output.

With this patch, none of the above output lines will be matched as
regular expressions. A line must end in " (re)" in order to be matched
as one.

Lines are still matched literally first, so the following will pass:

  $ echo 'foo (re)'
  foo (re)
2010-09-22 16:06:00 -05:00
Brodie Rao
3ed54dfa3d tests: improve regexes in unified tests 2010-09-22 16:05:58 -05:00
Matt Mackall
08439e0f2d tests: add exit codes to unified tests 2010-09-16 17:51:32 -05: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
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
Andreas Freimuth
ccfa11f997 tests: unify test-patchbomb 2010-08-16 20:44:33 +02:00