Edgewall Software
Modify

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)

mercurial-plugin-py3.diff (29.8 KB ) - added by Jun Omae 2 years ago.
mercurial-plugin.py3-get_properties-fix.patch (1.2 KB ) - added by bardino@… 9 months ago.
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.
mercurial-plugin.py3-get_properties-fix.2.patch (1.3 KB ) - added by bardino@… 9 months ago.
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.

Download all attachments as: .zip

Change History (8)

by Jun Omae, 2 years ago

Attachment: mercurial-plugin-py3.diff added

comment:1 by Jun Omae, 2 years ago

Owner: set to Jun Omae
Status: newassigned

Proposed changes mercurial-plugin-py3.diff, unit tests pass with:

  • Mercurial 6.2.2 x Trac 1.5.3 x Python (3.6, 3.10)
  • Mercurial (2.6 - 6.1.x) x Trac (1.0, 1.2, 1.4)

comment:2 by Jun Omae, 14 months ago

Resolution: fixed
Status: assignedclosed

comment:3 by bardino@…, 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 Jun Omae, 9 months ago

Resolution: fixed
Status: closedreopened

Thanks for the feedback! I'll try to fix it and add unit tests.

by bardino@…, 9 months ago

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 bardino@…, 9 months ago

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 Jun Omae, 7 months ago

Resolution: fixed
Status: reopenedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.