Modify

Opened 14 years ago

Closed 3 years ago

#7301 closed defect (wontfix)

Plugin does not work with not-integer revisons (Mercurial, Git and so on)

Reported by: coxx@… Owned by: Mikael Relbe
Priority: normal Component: TracTicketChangesetsPlugin
Severity: blocker Keywords:
Cc: Jochen Ulrich, Ivanelson Nunes Trac Release: 0.12

Description

The problem is that the plugin relies on integer IDs of revisions (like in SVN). But in reality the revision numbers can be strings like 6ec8cfe21421c253f1c68aa06cec613188f427d1.

Attachments (4)

7301.patch (1.3 KB) - added by ciibin@… 13 years ago.
Patch for non-integer revisions
patch (4.9 KB) - added by Mathieu Pillard 12 years ago.
Patch to make Mercurial (possibly Git) work
fix-t7301-youngest-rev-handling.diff (1.1 KB) - added by Mathieu Pillard 12 years ago.
fix-t7301-changeset-ticket-displaying.diff (4.0 KB) - added by Jochen Ulrich 12 years ago.
Patch to correctly display the changesets affecting a ticket.

Download all attachments as: .zip

Change History (30)

comment:1 Changed 14 years ago by Mikael Relbe

Status: newassigned

I've never myself used Trac with Git or alike. So a revision reference is then stated as [6ec8cfe21421c253f1c68aa06cec613188f427d1] I presume? I'll make an effort in trying to make the plugin compatible with non-SVN repos. That will however take a while due to summer vacation, during which my family bans me from computers :)

comment:2 in reply to:  1 Changed 13 years ago by pcw

Replying to mrelbe:

I've never myself used Trac with Git or alike. So a revision reference is then stated as [6ec8cfe21421c253f1c68aa06cec613188f427d1] I presume? I'll make an effort in trying to make the plugin compatible with non-SVN repos. That will however take a while due to summer vacation, during which my family bans me from computers :)

Any updates on this feature? It would be very helpful if this plugin supports HG or Git.

comment:3 Changed 13 years ago by Mikael Relbe

#7984 reported a problem using Mercurial and was closed as a duplicate of this ticket.

comment:4 Changed 13 years ago by anonymous

Any update about this ?

comment:5 Changed 13 years ago by Mikael Relbe

Sorry but no update on this, yet. Reason: current work load. New Years promise will be to fix this ASAP. (Other reason: I'm switching computer gear right now...)

I will make a major effort taking care of both this ticket and all others as well. Please be patient.

comment:6 Changed 13 years ago by anonymous

Sorry for re-asking, this plugin should be wonderful for me, but I user git almost exclusively. Do you have any kind of expected date for this?

comment:7 in reply to:  6 Changed 13 years ago by Mikael Relbe

Replying to anonymous:

Sorry for re-asking /.../

Don't be sorry, this plugin should have been fixed a long time ago.

Do you have any kind of expected date for this?

Due to my current assignment I am overloaded with work (I'm currently working 50% more than normal). I've stated Feb-11 for other tasks at Trac as well, so I guess this goes for this plugin too.

I am sorry for this (but happy for the current and sudden R&D boom in the Swedish export industry, which I am deeply involved in...)

comment:8 Changed 13 years ago by anonymous

We're using Mercurial. With the day passing by I seriously (re)consider assigning this task to a developer here :)

comment:9 Changed 13 years ago by anonymous

Sorry, I meant "days"...

comment:10 Changed 13 years ago by anonymous

Hei,

we are already in March, so Fabruary is gone... I don't want to hurry anybody, just that fixing this bug would be greatful..... :)

Changed 13 years ago by ciibin@…

Attachment: 7301.patch added

Patch for non-integer revisions

comment:11 Changed 13 years ago by ciibin@…

Added a patch to fix the crash caused by non integer revisions. However this doesn't really work as it crashes in

Most recent call last:

File "build/bdist.macosx-10.5-i386/egg/trac/web/main.py", line 517, in _dispatch_request
  dispatcher.dispatch(req)
File "build/bdist.macosx-10.5-i386/egg/trac/web/main.py", line 259, in dispatch
  content_type)
File "build/bdist.macosx-10.5-i386/egg/trac/web/chrome.py", line 838, in render_template
  stream |= self._filter_stream(req, method, filename, stream, data)
File "/Users/cibin/trac/virtual/lib/python2.6/site-packages/Genshi-0.6-py2.6.egg/genshi/core.py", line 132, in __or__
  return Stream(_ensure(function(self)), serializer=self.serializer)
File "build/bdist.macosx-10.5-i386/egg/trac/web/chrome.py", line 989, in inner
  data)
File "build/bdist.macosx-10.5-i386/egg/ticketchangesets/web_ui.py", line 93, in filter_stream
  exists))
File "build/bdist.macosx-10.5-i386/egg/ticketchangesets/web_ui.py", line 101, in _render
  tag.div(message, id='changelog'),
File "/Users/cibin/trac/virtual/lib/python2.6/site-packages/Genshi-0.6-py2.6.egg/genshi/builder.py", line 261, in __call__
  Fragment.__call__(self, *args)
File "/Users/cibin/trac/virtual/lib/python2.6/site-packages/Genshi-0.6-py2.6.egg/genshi/builder.py", line 97, in __call__
  self.append(arg)
File "/Users/cibin/trac/virtual/lib/python2.6/site-packages/Genshi-0.6-py2.6.egg/genshi/builder.py", line 129, in append
  for child in node:
File "build/bdist.macosx-10.5-i386/egg/ticketchangesets/web_ui.py", line 147, in format
  shorten=False),
File "build/bdist.macosx-10.5-i386/egg/trac/wiki/formatter.py", line 1505, in format_to_oneliner
  return InlineHtmlFormatter(env, context, wikidom).generate(shorten)
File "build/bdist.macosx-10.5-i386/egg/trac/wiki/formatter.py", line 1481, in generate
  shorten)
File "build/bdist.macosx-10.5-i386/egg/trac/wiki/formatter.py", line 1342, in format
  result = re.sub(self.wikiparser.rules, self.replace, result)
File "/Users/cibin/trac/virtual/lib/python2.6/re.py", line 151, in sub
  return _compile(pattern, 0).sub(repl, string, count)
File "build/bdist.macosx-10.5-i386/egg/trac/wiki/formatter.py", line 1158, in replace
  replacement = self.handle_match(fullmatch)
File "build/bdist.macosx-10.5-i386/egg/trac/wiki/formatter.py", line 1154, in handle_match
  return internal_handler(match, fullmatch)
File "build/bdist.macosx-10.5-i386/egg/trac/wiki/formatter.py", line 540, in _lhref_formatter
  return self._make_lhref_link(match, fullmatch, rel, ns, target, label)
File "build/bdist.macosx-10.5-i386/egg/trac/wiki/formatter.py", line 581, in _make_lhref_link
  fullmatch)
File "build/bdist.macosx-10.5-i386/egg/trac/wiki/formatter.py", line 590, in _make_link
  fullmatch)
File "build/bdist.macosx-10.5-i386/egg/trac/versioncontrol/web_ui/log.py", line 373, in _format_link
  revranges = self._normalize_ranges(repos, path, revs)
File "build/bdist.macosx-10.5-i386/egg/trac/versioncontrol/web_ui/log.py", line 416, in _normalize_ranges
  return Ranges(ranges)
File "build/bdist.macosx-10.5-i386/egg/trac/util/__init__.py", line 709, in __init__
  self.appendrange(r)
File "build/bdist.macosx-10.5-i386/egg/trac/util/__init__.py", line 727, in appendrange
  a, b = int(x), int(x)

This is trac 0.12.2 and trunk version of the plugin. I am not sure how to fix the new issue.

comment:12 Changed 13 years ago by dapetcu21@…

Anyone willing to fix this? I would really appreciate.... It's been 4 months

comment:13 Changed 13 years ago by Mikael Relbe

PatchWelcome, I have myself never used Trac with Mercial et.al. But if someone provides a rock-solid patch I will commit it without delay.

comment:14 in reply to:  13 Changed 13 years ago by Mikael Relbe

Replying to mrelbe:

/../ Mercial /../

See, I can't even spell it correctly ;)

comment:15 Changed 12 years ago by Mathieu Pillard

I have a working patch, but it's far from being rock-solid :) I'm attaching it. A few remarks:

  • I only tested it with Mercurial. I have no idea whether it works with git or even svn any more :)
  • I switched the code to resync the commit messages to use repos.get_changesets instead of the infinite loop it used, because just walking from a changeset to the next didn't yield the entire changesets in my repos. As a side effect, it uses changeset.rev to get the current rev, I'm not sure it's in the standard trac API, since it appears to be undocumented.
  • I used the changeset hash everywhere even though Mercurial exposes an integer if we really want it. This causes 2 problems:
    1. Compact mode doesn't work. I don't know if it's fixable.
    2. The "(Revision log)" link use log:@rev,rev syntax that doesn't seem to play nice with hashes. In order to work around that, I introduced a new setting, showrevlog, to de-activate that link.

To clarify: with my patch, you need showrevlog = false and compact = false in your settings to make mercurial support work.

This is very rough, but I don't have more time to work on this at the moment. If anyone wants to pick it up and improve it, feel free.

Changed 12 years ago by Mathieu Pillard

Attachment: patch added

Patch to make Mercurial (possibly Git) work

comment:16 in reply to:  15 ; Changed 12 years ago by Mikael Relbe

Replying to mat:

I have a working patch, but it's far from being rock-solid :) I'm attaching it.

Thanks!

I did promise to apply patches, so I therefore created a branch for this ticket:

source:tracticketchangesetsplugin/t7301-mercurial

The patch was applied in [10743]. Anyone: feel free to pick this up since I'm not able (currently) to work on this (since I've never used Mercurial with Trac and have no time to figure out how to set this up -- sorry).

comment:17 Changed 12 years ago by Mathieu Pillard

Well, I lied, I had more time to improve it :-)

I was having with the get_changesets method in admin.py : the date of the "youngest" revision is not always reliable, since 1) it comes from the clients 2) it could be in too far in the past if the latest revision is in a different branch.

I'm attaching a patch to fix this issue. Sadly, at least in mercurial, dates are timezone-aware, so I need pytz to get a reliable tzinfo for UTC to compare to. I hope it works with other version control systems, hopefully I'll have some time to test the branch and this patch with git and svn soon.

Changed 12 years ago by Mathieu Pillard

comment:18 Changed 12 years ago by anonymous

Hi, do you have an update for this?

Thank you very much.

comment:19 in reply to:  16 ; Changed 12 years ago by Jochen Ulrich

Replying to mat:

I have a working patch, but it's far from being rock-solid :) I'm attaching it.

At least for git, the displaying of the changesets on the ticket is not working correctly. It shows something like

<generator object format at 0x9a4b3c>

I'm attaching a patch to fix this.

Replying to mrelbe:

The patch was applied in [10743].

Would be nice if you could apply my patch to the branch as well.

Changed 12 years ago by Jochen Ulrich

Patch to correctly display the changesets affecting a ticket.

comment:20 in reply to:  19 Changed 12 years ago by Jochen Ulrich

Cc: Jochen Ulrich added; anonymous removed

Replying to julrich:

Forgot to mention, that the patch changes some other things as well:

  • Revisions in the "Repository Changesets" section are formatted according to the version control plugin options (e.g. the revisions are abbreviated when the shortrev_len option is set).
  • The "Revision Log" link needed to be changed because Trac 0.12 cannot handle log links with multiple non-integer revisions. I changed the link to point to the revision log starting from the last revision in the list (this is not a solution but a workaround since a real solution would require to change the Trac sources).

comment:21 Changed 11 years ago by Ivanelson Nunes

Cc: Ivanelson Nunes added

I applied the patch, but the error continues. I'm using git. :(

2013-06-08 13:44:20,909 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/main.
py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/main.
py", line 233, in dispatch
    content_type)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/chrom
e.py", line 968, in render_template
    stream |= self._filter_stream(req, method, filename, stream, data)
  File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 132, in __or__
    return Stream(_ensure(function(self)), serializer=self.serializer)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/chrom
e.py", line 1147, in inner
    data)
  File "/usr/local/lib/python2.7/dist-packages/TracTicketChangesets-1.0dev_r0-py
2.7.egg/ticketchangesets/web_ui.py", line 93, in filter_stream
    exists))
  File "/usr/local/lib/python2.7/dist-packages/TracTicketChangesets-1.0dev_r0-py
2.7.egg/ticketchangesets/web_ui.py", line 101, in _render
    message.append(changeset)
  File "/usr/lib/python2.7/dist-packages/genshi/builder.py", line 261, in __call
__
    Fragment.__call__(self, *args)
  File "/usr/lib/python2.7/dist-packages/genshi/builder.py", line 97, in __call_
_
    self.append(arg)
  File "/usr/lib/python2.7/dist-packages/genshi/builder.py", line 129, in append
    for child in node:
  File "/usr/local/lib/python2.7/dist-packages/TracTicketChangesets-1.0dev_r0-py
2.7.egg/ticketchangesets/web_ui.py", line 143, in format
    yield tag.h3(_("Default Repository"), class_='change')
  File "/usr/local/lib/python2.7/dist-packages/TracTicketChangesets-1.0dev_r0-py
2.7.egg/ticketchangesets/api.py", line 164, in wiki_revs
    r = self.revs
  File "/usr/local/lib/python2.7/dist-packages/TracTicketChangesets-1.0dev_r0-py
2.7.egg/ticketchangesets/api.py", line 129, in get_compact
    i = 1
IndexError: list index out of range

comment:22 in reply to:  21 ; Changed 11 years ago by Ivanelson Nunes

Replying to ivanelson:

I applied the patch, but the error continues. I'm using git. :(

2013-06-08 13:44:20,909 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/main.
py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/main.
py", line 233, in dispatch
    content_type)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/chrom
e.py", line 968, in render_template
    stream |= self._filter_stream(req, method, filename, stream, data)
  File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 132, in __or__
    return Stream(_ensure(function(self)), serializer=self.serializer)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/chrom
e.py", line 1147, in inner
    data)
  File "/usr/local/lib/python2.7/dist-packages/TracTicketChangesets-1.0dev_r0-py
2.7.egg/ticketchangesets/web_ui.py", line 93, in filter_stream
    exists))
  File "/usr/local/lib/python2.7/dist-packages/TracTicketChangesets-1.0dev_r0-py
2.7.egg/ticketchangesets/web_ui.py", line 101, in _render
    message.append(changeset)
  File "/usr/lib/python2.7/dist-packages/genshi/builder.py", line 261, in __call
__
    Fragment.__call__(self, *args)
  File "/usr/lib/python2.7/dist-packages/genshi/builder.py", line 97, in __call_
_
    self.append(arg)
  File "/usr/lib/python2.7/dist-packages/genshi/builder.py", line 129, in append
    for child in node:
  File "/usr/local/lib/python2.7/dist-packages/TracTicketChangesets-1.0dev_r0-py
2.7.egg/ticketchangesets/web_ui.py", line 143, in format
    yield tag.h3(_("Default Repository"), class_='change')
  File "/usr/local/lib/python2.7/dist-packages/TracTicketChangesets-1.0dev_r0-py
2.7.egg/ticketchangesets/api.py", line 164, in wiki_revs
    r = self.revs
  File "/usr/local/lib/python2.7/dist-packages/TracTicketChangesets-1.0dev_r0-py
2.7.egg/ticketchangesets/api.py", line 129, in get_compact
    i = 1
IndexError: list index out of range

Disregard the above error. I applied the wrong patch. I installed again the branch 7301 and now the error is:

<generator object format at 0x7fbb438dfb40>

comment:23 in reply to:  22 ; Changed 11 years ago by Jochen Ulrich

Replying to ivanelson:

I installed again the branch 7301 and now the error is:

<generator object format at 0x7fbb438dfb40>

Did you also apply the patch attachment:fix-t7301-changeset-ticket-displaying.diff​ since the error sounds similar to my comment:19?

comment:24 in reply to:  23 Changed 11 years ago by Ivanelson Nunes

Replying to julrich:

Replying to ivanelson:

I installed again the branch 7301 and now the error is:

<generator object format at 0x7fbb438dfb40>

Did you also apply the patch attachment:fix-t7301-changeset-ticket-displaying.diff​ since the error sounds similar to my comment:19?

It's bad because this error is not getting in trac.log.

comment:25 Changed 11 years ago by anonymous

I also got this error. A long time. In git1.7

comment:26 Changed 3 years ago by Ryan J Ollos

Resolution: wontfix
Status: assignedclosed

This plugin is deprecated in Trac 1.2 and later.

Please use TracTicketChangelogPlugin and request any missing features as enhancements for that plugin.

Modify Ticket

Change Properties
Set your email in Preferences
Action
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.