Skip to content

Instantly share code, notes, and snippets.

@suer
Created June 2, 2011 09:55
Show Gist options
  • Save suer/1004195 to your computer and use it in GitHub Desktop.
Save suer/1004195 to your computer and use it in GitHub Desktop.
a patch for redmine_code_review_plugin (0.4.0) on redmine 1.2.0
diff -r -u haru_iida-redmine_code_review-9ec75c963e55/app/controllers/code_review_controller.rb redmine_code_review/app/controllers/code_review_controller.rb
--- haru_iida-redmine_code_review-9ec75c963e55/app/controllers/code_review_controller.rb 2011-02-22 00:27:10.000000000 +0900
+++ redmine_code_review/app/controllers/code_review_controller.rb 2011-06-04 16:39:21.000000000 +0900
@@ -310,7 +310,9 @@
def forward_to_revision
path = params[:path]
- entry = @project.repository.entry(path)
+ patharray = path.split('/')
+ entries = @project.repository.scm.entries(patharray[1..-2].join('/'), nil, {:report_last_commit => true})
+ entry = entries ? entries.detect {|e| e.name == patharray[-1]} : nil
lastrev = entry.lastrev
identifier = lastrev.identifier
redirect_to url_for(:controller => 'repositories', :action => 'entry', :id => @project) + path + '?rev=' + identifier.to_s
diff -r -u haru_iida-redmine_code_review-9ec75c963e55/app/views/code_review/_change_entry_norevision_view.rhtml redmine_code_review/app/views/code_review/_change_entry_norevision_view.rhtml
--- haru_iida-redmine_code_review-9ec75c963e55/app/views/code_review/_change_entry_norevision_view.rhtml 2011-02-22 00:27:10.000000000 +0900
+++ redmine_code_review/app/views/code_review/_change_entry_norevision_view.rhtml 2011-06-04 16:39:21.000000000 +0900
@@ -22,26 +22,24 @@
unless patharray.blank? or patharray.empty?
path = ''
patharray.each{|el| path << '/' + el}
- entry = project.repository.entry(path)
+ entries = project.repository.scm.entries(patharray[0..-2].join('/'), nil, {:report_last_commit => true})
+ entry = entries ? entries.detect {|e| e.name == patharray[-1]} : nil
lastrev = entry.lastrev if entry
if lastrev and lastrev.identifier
changeset = Changeset.find(:first, :conditions =>['revision = ? and repository_id = (?)', lastrev.identifier, project.repository.id])
change = nil
-
changeset.changes.each {|c|
relative_path = c.relative_path
change = c if relative_path == path
change = c if '/' + relative_path == path
} if changeset
-
if change
link = link_to(l(:label_add_review), {:controller => 'code_review',
:action => 'forward_to_revision', :id => project, :path => path}, :class => 'icon icon-edit')
%>
-
<script type="text/javascript">
make_addreview_link('<%=project.name%>', '<%=link%>');
</script>
<% end %>
<% end %>
-<% end %>
¥ No newline at end of file
+<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment