Modify

Opened 4 years ago

Closed 4 years ago

#7984 closed defect (duplicate)

Traceback while synchronizing the ticket references from Mercurial changesets

Reported by: letezo Owned by: mrelbe
Priority: high Component: TracTicketChangesetsPlugin
Severity: major Keywords: ticket changeset resync mercurial
Cc: Trac Release: 0.12

Description

Environment:

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/console.py", line 107, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib/python2.6/cmd.py", 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/console.py", 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/api.py", line 123, in execute_command
    return f(*fargs)
  File "/usr/local/lib/python2.6/dist-packages/TracTicketChangesets-1.0dev_r8135-py2.6.egg/ticketchangesets/admin.py", line 152, in resync
    ticket_changesets.add(tkt_id, repos.id, rev)
  File "/usr/local/lib/python2.6/dist-packages/TracTicketChangesets-1.0dev_r8135-py2.6.egg/ticketchangesets/api.py", 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 4 years ago by letezo

Put extra logging before api.py#75 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 4 years ago by mrelbe

  • Resolution set to duplicate
  • Status changed from new to closed

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...)

Add Comment

Modify Ticket

Action
as closed The owner will remain mrelbe.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.