Opened 7 years ago

Closed 7 years ago

# Traceback while synchronizing the ticket references from Mercurial changesets

Reported by: Owned by: Viktor Ferenczi Mikael Relbe high TracTicketChangesetsPlugin major ticket changeset resync mercurial 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
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.

### comment:1 Changed 7 years ago by Viktor Ferenczi

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 7 years ago by Mikael Relbe

Resolution: → duplicate new → 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...)

### Modify Ticket

Change Properties