revision / changeset links

Added by Andy Bolstridge about 9 years ago

Hi all.
I have a problem that I'd like to know whether its in core redmine or in my slightly customised verson.

I view a changeset, #1405, which refers to revision 313456. I can see the changeset files, but the previous/next links at the top have a tooltip of the prevous revision number, but the link itself goes to the changeset number. And when I click this link, I get a 'revision not found' error.

Looking through code, it seems the link_to_revision method works if you pass a revision number to it, but doesn't if you pass a changeset. I think the problem is that the code here that gets a changeset if the passed-in object is a changeset, shouldn't do that. I think it should get the revision number if the passed in object is a changeset. (ie, on trunk, line 107 of application_helper.rb should read:
rev = revision.respond_to?(:identifier) ? revision.revision : revision

what do people think? I think the method is poorly named, either a revision should be passed in, not changeset, or a new method created to accept changesets. I'm not as experienced with Redmin or ruby dev to say otherwise though, hence this question.

thanks.

Replies (4)

RE: revision / changeset links - Added by Toshi MARUYAMA about 9 years ago

This code passes not only changesets objects but also annotate revisions object.
Changesets object is generated by database.
But, annotate revisions object is generated by "svn/hg/git blame/annotate".
Mercurial has revision number and hash id.
Mercurial revision numbers are far too brittle (#3724, #6681).

RE: revision / changeset links - Added by Andy Bolstridge about 9 years ago

ok, but still - I have urls like:
http://myserver.com/redmine/projects/project1/repository/revisions/1414 - which is a changeset id (I can see it in the DB, the data in the revision column is correct), but when I click it - it tries to show me 1414 as if it was a revision number.

Looking at the redmine.org repo, I see changeset http://www.redmine.org/projects/redmine/repository/revisions/5857 which points to revision 5857, so everything gets shown fine, even though that's probably an error.

Obviously my redmine install is not like others - in that my changeset ids are not the same as revision ids. It could be due to my patch, but also this would occur if multiple projects were used with different repositories - as the changeset number in the DB would soon not match the revision number. So: for the places where we have a changeset, do you think it would be best to pass in changeset.revision instead of changeset:
eg
<td class="id"><%= link_to_revision(changeset, project) ></td>
becomes
<td class="id"><
= link_to_revision(changeset.revision, project) %></td>

thanks, Andy

RE: revision / changeset links - Added by Toshi MARUYAMA about 9 years ago

Andy Bolstridge wrote:

eg
<td class="id"><%= link_to_revision(changeset, project) ></td>
becomes
<td class="id"><
= link_to_revision(changeset.revision, project) %></td>

As I described at #6681 description, Mercurial revision number is not reliable.
1:505aa36abc94 and 1:9d5b5b004199 are same revision number 1, but different hash id.
Subversion has UUID. So, Redmine might be storing UUID in database.

RE: revision / changeset links - Added by Andy Bolstridge about 9 years ago

I get you now. I've upgraded to 1.1.3, manually applied the patches I have, and it's working corerectly now - the issues and repo links to revisions now point to the subversion revnums (ie the number of the revision, not the changeset.id in the DB).

thanks.

(1-4/4)