Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

#9724 closed defect (fixed)

TracMercurial passes unicode key to the mercurial package

Reported by: viktor@… Owned by:
Priority: normal Milestone: plugin - mercurial
Component: plugin/mercurial Version: 0.12.1
Severity: major Keywords: unicode key mercurial warning str
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

See the details here: http://mercurial.selenic.com/bts/issue2458

The issue does not cause a traceback, only a warning and maybe incorrect behavior.

I managed to get a stack trace and the wrong (unicode) value passed, while the mercurial package expects only str:

File
"/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py",
line 511, in _dispatch_request
  dispatcher.dispatch(req)
File
"/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py",
line 237, in dispatch
  resp = chosen_handler.process_request(req)
File
"/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/versioncontrol/web_ui/browser.py",
line 390, in process_request
  dir_data = self._render_dir(req, repos, node, rev, order, desc)
File
"/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/versioncontrol/web_ui/browser.py",
line 551, in _render_dir
  changes = get_changes(repos, [i.rev for i in entries], self.log)
File
"/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/versioncontrol/web_ui/util.py",
line 34, in get_changes
  changeset = repos.get_changeset(rev)
File
"/usr/local/lib/python2.6/dist-packages/TracMercurial-0.12.0.23dev_r9953-py2.6.egg/tracext/hg/backend.py",
line 513, in get_changeset
  return MercurialChangeset(self, self.hg_node(unicode(rev)))
File
"/usr/local/lib/python2.6/dist-packages/TracMercurial-0.12.0.23dev_r9953-py2.6.egg/tracext/hg/backend.py",
line 411, in hg_node
  return self.repo.lookup(rev)
File "/usr/lib/pymodules/python2.6/mercurial/localrepo.py", line 435, in lookup
  ...

The value of the rev variable at line 411 of backend.py is:

u'f972428f5a0408e74c7c1aa98b867a8245585e79'

It is passed as the "key" parameter to the lookup method, which expects only str values.

Since the key can only contain ASCII characters (hexadecimal), the following fix would work:

  return self.repo.lookup(str(rev))

Attachments (0)

Change History (4)

comment:1 by Remy Blank, 14 years ago

Milestone: 0.12.2plugin - mercurial

comment:2 by Christian Boos, 14 years ago

Severity: normalmajor

Yes, I've also noticed this for paths.

comment:3 by Christian Boos, 14 years ago

#8927 was closed as duplicate.

comment:4 by Christian Boos, 14 years ago

Resolution: fixed
Status: newclosed

Should be fixed in r10496.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) 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.