diff app/helpers/application_helper.rb @ 3:7c48bad7d85d yuya

* Import Mercurial overhaul patches from Yuya Nishihara (see http://www.redmine.org/issues/4455)
author Chris Cannam
date Wed, 28 Jul 2010 12:40:01 +0100
parents 513646585e45
children 9c6c72729d91
line wrap: on
line diff
--- a/app/helpers/application_helper.rb	Wed Jul 28 12:12:43 2010 +0100
+++ b/app/helpers/application_helper.rb	Wed Jul 28 12:40:01 2010 +0100
@@ -99,8 +99,10 @@
   # * :text - Link text (default to the formatted revision)
   def link_to_revision(revision, project, options={})
     text = options.delete(:text) || format_revision(revision)
+    rev = revision.respond_to?(:identifier) ? revision.identifier : revision
 
-    link_to(text, {:controller => 'repositories', :action => 'revision', :id => project, :rev => revision}, :title => l(:label_revision_id, revision))
+    link_to(text, {:controller => 'repositories', :action => 'revision', :id => project, :rev => rev},
+            :title => l(:label_revision_id, format_revision(revision)))
   end
 
   def toggle_link(name, id, options={})
@@ -612,7 +614,7 @@
             end
           when 'commit'
             if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"]))
-              link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision},
+              link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.identifier},
                                            :class => 'changeset',
                                            :title => truncate_single_line(changeset.comments, :length => 100)
             end