Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 16:34:43 +0200] rev 43329
py3: decode payload of notify email
This fixes one UnicodeEncodeError in test-notify.t:422 when testing the
notify hook with non-ascii content (there are more later). We only
decode on Python 3, since it's not safe for sure on Python 2.
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 15:50:15 +0200] rev 43328
py3: decode email headers with mail.headdecode() in notify extension
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 15:46:16 +0200] rev 43327
py3: use stdlib's parseaddr() to get sender header in notify extension
In Python 3, email headers are unicode string so using
stringutil.email() will not work as it compares with bytestring. So
let's use email.utils.parseaddr() from the stdlib which has a consistent
behavior across Python versions. The same is done in patchbomb
extension already.
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 15:28:00 +0200] rev 43326
py3: use a BytesParser in notify extension
This is the first step to make the "long line" case in test-notify.t
pass by fixing a UnicodeDecodeError on Python 3.
We alias a parsebytes() in mail module, similarly as we already have a
parse() function for Python 2 and Python 3 compatibility.
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 17:16:43 +0200] rev 43325
py3: fix headencode() with display=False
We previously called str() on a email.header.Header object. On Python 2,
this returns a bytestring and the __str__ method is actually an alias to
.encode() method. On Python 3, __str__ does not perform encoding (and
returns a unicode string). To keep a consistent behavior across Python
versions, we explicitly use .encode() and we wrap the result with
encoding.strtolocal() to get a bytestring in all cases. As a side effect
of forcing bytes conversion, we need to decode back in _addressencode().
This is to make test-notify.t pass on Python 3.
Also note that headers are now encoded in some patchbomb tests; this is
because the charset is not always "us-ascii" ("iso-8859-1" otherwise) on
Python 3.
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 14:31:24 +0200] rev 43324
mail: catch LookupError in headdecode()
We already catch this exception in _encode() (called by headencode()).
It gets raised when running test-notify.t with Python 3.
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 16:56:36 +0200] rev 43323
py3: account for extra line break in email headers in test-notify.t
Long headers appears to be wrapped with new lines. In test-notify.t, we
have a "filter.py" that replaces "\n" by " ", so we get an extra space
in a Message-Id with a long value.
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 10 Oct 2019 13:48:30 +0200] rev 43322
py3: use as_bytes() method of EmailMessage
In Python 3, as_bytes() corresponds to as_string() in Python 2.
Ian Moody <moz-ian@perix.co.uk> [Wed, 23 Oct 2019 23:00:58 +0100] rev 43321
py3: use %d instead of %s when formatting an int into a bytestring
The latter wasn't noticed before since no tests exercise --confirm at all, let
alone on an existing DREV.
The former is only hit during an intermittent network issue during amending at
the end of a phabsend, so doesn't seem testable.
Differential Revision: https://phab.mercurial-scm.org/D7153
Denis Laxalde <denis.laxalde@logilab.fr> [Wed, 23 Oct 2019 17:18:16 +0200] rev 43320
packaging: ship only a single binary Debian package
We merge the mercurial and mercurial-common binary packages into a
single mercurial package. This is essentially to ease installation (and
upgrade) using a simple "dpkg -i" command. This also simplifies
debian/rules by removing arch (in)dependent cleanups during
installation.
We have the mercurial binary Breaks: and Replaces: mercurial-common so
that the latter will be removed upon upgrade.
Also note the change from "override_dh_install" to
"override_dh_auto_install" in debian/rules: this is because we do not
want "make install" to be run automatically as we need the
--install-layout=deb of "setup.py install" (otherwise, files would end
up in $DESTDIR/usr/local).