Opened 12 years ago

Closed 12 years ago

#7984 closed defect (duplicate)

Traceback while synchronizing the ticket references from Mercurial changesets

Reported by: Viktor Ferenczi Owned by: Mikael Relbe
Priority: high Component: TracTicketChangesetsPlugin
Severity: major Keywords: ticket changeset resync mercurial
Cc: Trac Release: 0.12



The failing command was:

trac-admin project_dir ticket_changesets resync

I got the following traceback:

2010-11-03 18:38:27,986 Trac[console] ERROR: Exception in trac-admin command: 
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/admin/", line 107, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib/python2.6/", line 218, in onecmd
    return self.default(line)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/admin/", line 266, in default
    return cmd_mgr.execute_command(*args)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/admin/", line 123, in execute_command
    return f(*fargs)
  File "/usr/local/lib/python2.6/dist-packages/TracTicketChangesets-1.0dev_r8135-py2.6.egg/ticketchangesets/", line 152, in resync
    ticket_changesets.add(tkt_id,, rev)
  File "/usr/local/lib/python2.6/dist-packages/TracTicketChangesets-1.0dev_r8135-py2.6.egg/ticketchangesets/", line 75, in add
    (rev, tkt_id))
TypeError: %d format: a number is required, not str

It might be caused by the revision hash returned by Mercurial, but I need to prove it. It worked with Trac instances with an SVN repo and failed only for this single one with Mercurial.

Attachments (0)

Change History (2)

comment:1 Changed 12 years ago by Viktor Ferenczi

Put extra logging before and extracted the value of the rev variable there. It is indeed a Mercurial hash, which is used instead of the revision numbers: 2208ec8b15454ae7b35b1c42138ab66aa09dc141

So this plugin is not compatible with Mercurial in its current form. I guess it would not require huge changes to make it compatible. I tried to fix this, but it is not enough to turn those two %d format specifiers to %s in those two debug calls, unfortunately. It also keeps track of the rev numbers in numeric form in the revs list and converts the revision number to integer explicitly: int(rev).

It would also be useful to display the Mercurial revision numbers instead of the hashes in the output, so I guess the fix would be to acquire that integer revision number here instead of the revision hash in this case.

Any ideas?

comment:2 Changed 12 years ago by Mikael Relbe

Resolution: duplicate
Status: newclosed

You are corrent in that Mercurial is not (yet) supported.

I thank you for the feedback, but this ticket is a duplicate of #7301 and therefore closed.

(And I will soon have to fix this, I know...)

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Mikael Relbe.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.