Commit Graph

70 Commits

Author SHA1 Message Date
Augie Fackler
41137de614 tests: update test-patchbomb to pass our import checker 2017-08-22 16:59:06 -04:00
Augie Fackler
e5d7bd82c5 cleanup: use $PYTHON to run python in many more tests
Spotted one of these, then wrote a check-code rule that caught them
all. It will be the next change.
2017-06-20 09:45:02 -04:00
Matt Harbison
d2accba631 test-patchbomb: disable sendmail tests on Windows
These tests were failing, and there isn't a trivial way to execute a script on
Windows [1].

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-April/096497.html
2017-04-10 21:12:54 -04:00
Yuya Nishihara
21edd5907a patchbomb: use modern pager to display -n/--test result (BC)
This should provide more consistent UX, but is a BC because the pager will
no longer be fired up for each message.
2017-02-25 17:27:48 +09:00
Yuya Nishihara
5fab4a9d55 patchbomb: add config knob to generate flags by template (issue5354)
This can be used to flag patches by branch or topic automatically. Flags
optionally given by --flag option are exported as {flags} template keyword,
so you can add --flag V2.
2017-02-25 18:41:00 +09:00
Pierre-Yves David
667d10975b changegroup: skip delta when the underlying revlog do not use them
Revlog can now be configured to store full snapshot only. This is used on the
changelog. However, the changegroup packing was still recomputing deltas to be
sent over the wire.

We now just reuse the full snapshot directly in this case, skipping delta
computation. This provides use with a large speed up(-30%):

# perfchangegroupchangelog on mercurial
! wall 2.010326 comb 2.020000 user 2.000000 sys 0.020000 (best of 5)
! wall 1.382039 comb 1.380000 user 1.370000 sys 0.010000 (best of 8)

# perfchangegroupchangelog on pypy
! wall 5.792589 comb 5.780000 user 5.780000 sys 0.000000 (best of 3)
! wall 3.911158 comb 3.920000 user 3.900000 sys 0.020000 (best of 3)

# perfchangegroupchangelog on mozilla central
! wall 20.683727 comb 20.680000 user 20.630000 sys 0.050000 (best of 3)
! wall 14.190204 comb 14.190000 user 14.150000 sys 0.040000 (best of 3)

Many tests have to be updated because of the change in bundle content. All
theses update have been verified.  Because diffing changelog was not very
valuable, the resulting bundle have similar size (often a bit smaller):

# full bundle of mozilla central
with delta:    1142740533B
without delta: 1142173300B

So this is a win all over the board.
2016-10-14 01:31:11 +02:00
Gábor Stefanik
9fbfde0b09 mail: take --encoding and HGENCODING into account
Fall back to our encoding strategy for sending MIME text
that's neither ASCII nor UTF-8.
2016-10-05 13:45:22 +02:00
Gregory Szorc
4ad5f2e492 bundle2: store changeset count when creating file bundles
The bundle2 changegroup part has an advisory param saying how many
changesets are in the part. Before this patch, we were setting
this part when generating bundle2 parts via the wire protocol but
not when generating local bundle2 files.

A side effect of not setting the changeset count part is that progress
bars don't work when applying changesets. As the tests show, this
impacted clone bundles, shelve, backup bundles, `hg unbundle`, and
anything touching bundle2 files.

This patch adds a backdoor to allow us to pass state from
changegroup generation into the unbundler. We store the number
of changesets in the changegroup in this state and use it to
populate the aforementioned advisory part parameter when generating
the bundle2 bundle.

I concede that I'm not thrilled by how state is being passed in
changegroup.py (it feels a bit hacky). I would love to overhaul the
rather confusing set of functions in changegroup.py with something that
passes rich objects around instead of e.g. low-level generators.
However, given the code freeze for 3.9 is imminent, I'd rather not
undertake this endeavor right now. This feels like the easiest way
to get the parameter added to the changegroup part.
2016-07-17 15:13:51 -07:00
timeless
85999ce49e patchbomb: use single quotes around command hint
Windows command lines use double quotes to quote arguments with spaces.
This change is in a series to unify around using single quotes around
commands, and double quotes around interior arguments.

This changeset is taken on stable for consistency with similar update done
before the freeze.
See dc90bb772edc, 675a0be03493, 518b94d8f911 and 149a699cfd98.
2016-04-14 15:15:49 +00:00
timeless
2778e2894f patchbomb: fix public-is-missing hint
Without this, there is no space between a hash and the -r preceding the next
line in the use hg push hint
2016-04-14 14:26:37 +00:00
timeless
d34aba084e tests: clarify patchbomb repo is public not remote 2016-04-14 14:36:52 +00:00
Sébastien Brissaud
9f1189b63a test-patchbomb: ensure hg email write to stdout
With -n/--test and if the PAGER environment variable is set, 'hg email' send its
output to the user defined pager.

If the pager capture the output, the test is unable verify it.

Unsetting the PAGER environment variable force 'hg email' to write to stdout.
2016-02-07 09:36:09 +01:00
Bryan O'Sullivan
9fc5431d91 patchbomb: treat empty address list as no addresses
Previously it wasn't possible to use configuration to avoid
being prompted for e.g. a CC list when using patchbomb to send
emails.

We now make it possible to supply an empty value.
2016-01-07 20:02:47 -08:00
Bryan O'Sullivan
7f600f89a5 test-patchbomb.t: drop a number of now-redundant uses of "-n" 2016-01-04 21:54:46 -08:00
Bryan O'Sullivan
2eaad4da6b test-patchbomb.t: test use of sendmail program 2016-01-04 21:54:46 -08:00
Pierre-Yves David
0341332573 test: use generaldelta in 'test-bundle-type.t'
Generaldelta changes some of the default targets for 'hg bundle'. All cases are
already properly tested but some ambiguous specifications are affected.
2015-10-20 11:48:49 +02:00
Pierre-Yves David
4a2ed14f46 test: use generaldelta in 'test-patchbomb.t'
Using generaldelta changes the default type of bombed bundle.
2015-10-20 10:46:59 +02:00
Pierre-Yves David
53ed633b94 patchbomb: check that targets exist at the publicurl
Advertising that the patch are available to be pulled requires that to be true.
So we check revision availability on the remote before sending any email.
2015-10-11 22:13:03 -07:00
Pierre-Yves David
70ea75bfe7 patchbomb: add a 'bundletype' config under 'patchbomb'
patchbomb relies on the 'hg bundle' command to generate an attached bundle using
--bundle. However, while 'hg bundle' has a --type option, patchbomb did not.
This is becoming very relevant since we are about to issue bundle2 for
general-delta repository.

This was tracked as issue4863
2015-10-01 23:13:57 -07:00
Pierre-Yves David
6554509d00 patchbomb: add experimental config of a "pullurl" and export it
This config allows to specify a public location where your changeset can be
found. It then include a dedicated patch header show a command to be used to
retrieve the change. See the test for example.

This is flagged as experimental because this feature is not safe until we have
more logic to test that:
- changeset actually exists on destination
- changeset is draft on destination.

As all this is experimental, bike shedding can happily happens before we remove
the experimental flag.
2015-10-06 01:49:04 -07:00
Pierre-Yves David
77d8baf9e3 progress: stop double-wrapping of ui class
We were wrapping the ui class again and again (uisetup, reposetup,
subrepo setup, remote repo setup, etc). We now avoid that. This has
impact on tests that were double-printing data because of this.
2015-06-07 18:11:23 -07:00
Pierre-Yves David
9b6b5b5d44 patchbomb: introduce a 'patchbomb.confirm' option
When set to true, this option will make patchbomb always ask for confirmation
before sending the email. Confirmation is a powerful way to prevent stupid
mistakes when the sending patches.

This should let me get rid of my global alias adding
--confirm to hg email.

I know that some people may get bitten when moving from a machine with confirm
configured to a machine where it is not, but I think it is worth the risk.
2014-12-02 17:35:21 -08:00
Pierre-Yves David
d7f199fab2 patchbomb: add a 'patchbomb.intro' option
This option allows the user to control the default behavior for
including an introduction message. This avoids having to tirelessly
skip the intro for people contributing to Mercurial.

The three possibles values are:
- always,
- auto (default, current behavior),
- never.

I was thinking of ("true", "false", "") (empty value being auto) but I ruled it
out as too confusing.

This new config option reuses the pre-existing 'patchbomb' section.
2014-12-02 17:24:52 -08:00
Siddharth Agarwal
1c8311a9c0 patchbomb: don't honor whitespace and format-changing diffopts (BC)
The whitespace diffopts break lossless transmission, and the format-changing
ones make import harder. We expect parsers to be able to read git-style diffs,
though.
2014-11-18 17:36:24 -08:00
Augie Fackler
a5ddb1dcfe tests: use $PYTHON instead of hardcoding python
This makes running the testsuite with pypy possible.
2014-10-15 15:35:59 -04:00
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