Opened 2 years ago
Closed 7 months ago
#13493 closed defect (fixed)
Make compatible with Python 3, Mercurial 6.2+ and Trac 1.5.3+
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | plugin/mercurial | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Mercurial 6.2 has been released on 2022-07-11. The release supports only Python 3.6+ but mercurial plugin doesn't support Python 3 neither Trac 1.5.3+.
Attachments (3)
Change History (8)
by , 2 years ago
Attachment: | mercurial-plugin-py3.diff added |
---|
comment:1 by , 2 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:2 by , 14 months ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed in [88e113589f72/mercurial-plugin].
comment:3 by , 9 months ago
Thanks for updating TracMercurial support for the most recent stable Trac-1.6 release.
I'm sorry if this is the wrong place to report additional issues, but I believe get_properties
in MercurialNode
still needs a similar python3 adjustment.
Namely, it appears to consistently fail because it tests for a (unicode) str in what turns out to be a bytes instance in the line:
if self.isfile and 'x' in self.manifest.flags(self.str_path):
After redeploying our site on Rocky 9.3 with the default python-3.9.18 and Mercurial-6.1.4 we installed trac-1.6 and the latest upstream version of the mercurial-plugin with
pip3 install trac hg clone https://hg.edgewall.org/trac/mercurial-plugin && \ pip3 install ./mercurial-plugin
in order to obtain the python3 fixes mentioned in this ticket.
Both our existing and new Trac deployments appear functional again, but opening any file in Browse Source consistently fails with:
Trac detected an internal error: TypeError: a bytes-like object is required, not 'str'
from that particular line.
Forcing the comparison to use the explicit bytes equivalent b'x'
instead fixes the crash here. Other conversions using helper functions should work as well.
comment:4 by , 9 months ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Thanks for the feedback! I'll try to fix it and add unit tests.
by , 9 months ago
Attachment: | mercurial-plugin.py3-get_properties-fix.patch added |
---|
A simple fix and a matching one-line unit test for the issue reported yesterday. Feel free to use it or reimplement at your leisure.
by , 9 months ago
Attachment: | mercurial-plugin.py3-get_properties-fix.2.patch added |
---|
Retry with proper format and line termination to make pathc apply without errors. A simple fix and a matching one-line unit test for the issue reported yesterday. Feel free to use it or reimplement at your leisure.
comment:5 by , 7 months ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Fixed in [5771db2fd852/mercurial-plugin] and released pypi:TracMercurial/1.0.0.11.
Proposed changes mercurial-plugin-py3.diff, unit tests pass with: