diff -NBr -x .svn -x tmp -x log -x files -x plugin_assets -x vendor -x extra -x schema.rb -x config /opt/redmine/app/controllers/changeset_relations_controller.rb redmine/app/controllers/changeset_relations_controller.rb
1,55d0
< class ChangesetRelationsController < ApplicationController
< 
< 
<   before_filter  :find_project, :authorize
<   
<   def new
<     @changeset = Changeset.find(:first, :conditions => {:revision => params[:changeset][:revision], :repository_id => @project.repository})
<     if  @changeset.nil?
<       @changeset = Changeset.new(:revision => params[:changeset][:revision])
<       @changeset.errors.add  l(:revision_not_found_error)
<     else
<       @changeset.issues << @issue
<       @changeset.save if request.post?
<     end
<     @issue.reload
<     respond_to do |format|
<       format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
<       format.js do
<         render :update do |page|
<           page.replace_html "changeset_list", :partial => 'issues/changeset_list', :locals => { :changesets => @issue.changesets}
<           page.replace_html "issue-changesets-list", :partial => 'issues/changesets', :locals => { :changesets => @issue.changesets}
<           if @changeset.errors.empty?
<             page << "$('changeset_revision').value = ''"
<           end
<         end
<       end
<     end
<   end
<   
<   def destroy
<     changeset = Changeset.find(params[:id])
<     if request.post? && ! changeset.nil? && changeset.issues.include?(@issue)
<       changeset.issues.delete(@issue)
<       @issue.reload
<     end
<     respond_to do |format|
<       format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
<       format.js do
<         render(:update) do |page|
<           page.replace_html "changeset_list", :partial => 'issues/changeset_list', :locals => { :changesets => @issue.changesets}
<           page.replace_html "issue-changesets-list", :partial => 'issues/changesets', :locals => { :changesets => @issue.changesets}
<         end
<       end
<     end
<   end
< 
< 
<   private
<   def find_project
<     @issue = Issue.find(params[:issue_id])
<     @project = @issue.project
<   rescue ActiveRecord::RecordNotFound
<     render_404
<   end
< end
diff -NBr -x .svn -x tmp -x log -x files -x plugin_assets -x vendor -x extra -x schema.rb -x config /opt/redmine/app/controllers/issues_controller.rb redmine/app/controllers/issues_controller.rb
101,102d100
<     @changesets = @issue.changesets
<     @changesets.reverse! if User.current.wants_comments_in_reverse_order?
diff -NBr -x .svn -x tmp -x log -x files -x plugin_assets -x vendor -x extra -x schema.rb -x config /opt/redmine/app/helpers/changeset_relations_helper.rb redmine/app/helpers/changeset_relations_helper.rb
1,2d0
< module ChangesetRelationsHelper
< end
diff -NBr -x .svn -x tmp -x log -x files -x plugin_assets -x vendor -x extra -x schema.rb -x config /opt/redmine/app/views/changeset_relations/_form.html.erb redmine/app/views/changeset_relations/_form.html.erb
1,8d0
< <%= error_messages_for 'changeset' %>
< 
< <p><%= l(:label_revision) %> <%= f.text_field :revision, :size => 6 %>
< <%= submit_tag l(:button_add) %>
< <%= toggle_link l(:button_cancel), 'new-changeset-form'%>
< </p>
< 
< <%= javascript_tag "setPredecessorFieldsVisibility();" %>
diff -NBr -x .svn -x tmp -x log -x files -x plugin_assets -x vendor -x extra -x schema.rb -x config /opt/redmine/app/views/issues/_changeset_list.rhtml redmine/app/views/issues/_changeset_list.rhtml
1,33d0
< <div class="contextual">
< <% if authorize_for('changeset_relations', 'new') %>
<     <%= toggle_link l(:button_add), 'new-changeset-form'%>
< <% end %>
< </div>
< 
< <p><strong><%=l(:label_associated_revisions)%></strong></p>
< 
< <% if changesets.any? %>
< <table style="width:100%">
< <% changesets.each do |changeset| %>
< <tr>
<   <td><%= link_to("#{l(:label_revision)} #{changeset.revision}",
<                 :controller => 'repositories', :action => 'revision', :id => changeset.project, :rev => changeset.revision) %>
<   </td>
<   <td><%= h changeset.author %></td>
<   <td><%= h truncate(changeset.comments.split("\n").first, 60) %></td>
<   <td><%= format_date(changeset.committed_on) %></td>
<   <td><%= link_to_remote(image_tag('delete.png'), { :url => {:controller => 'changeset_relations', :action => 'destroy', :issue_id => @issue, :id => changeset},
<                                                   :method => :post
<                                                 }, :title => l(:label_changeset_delete)) if authorize_for('changeset_relations', 'destroy') %>
<   </td>
< </tr>
< <% end %>
< </table>
< <% end %>
< 
< <% remote_form_for(:changeset, @changeset,
<                  :url => {:controller => 'changeset_relations', :action => 'new', :issue_id => @issue},
<                  :method => :post,
<                  :html => {:id => 'new-changeset-form', :style => (@changeset ? '' : 'display: none;')}) do |f| %>
< <%= render :partial => 'changeset_relations/form', :locals => {:f => f}%>
< <% end %>
diff -NBr -x .svn -x tmp -x log -x files -x plugin_assets -x vendor -x extra -x schema.rb -x config /opt/redmine/app/views/issues/show.rhtml redmine/app/views/issues/show.rhtml
81,87d80
< <% if !@project.repository.nil? && (authorize_for('changeset_relations', 'new') || @issue.changesets.relations.any?) %>
< <hr />
< <div id="changeset_list">
< <%= render :partial => 'changeset_list', :locals => { :changesets => @issue.changesets} %>
< </div>
< <% end %>
< 
101d93
< <div id="issue-changesets-list">
104d95
< </div>
diff -NBr -x .svn -x tmp -x log -x files -x plugin_assets -x vendor -x extra -x schema.rb -x config /opt/redmine/db/migrate/102_add_manage_changeset_relations_permission.rb redmine/db/migrate/102_add_manage_changeset_relations_permission.rb
1,13d0
< class AddManageChangesetRelationsPermission < ActiveRecord::Migration
<   def self.up
<     Role.find(:all).each do |r|
<       r.add_permission!(:manage_changeset_relations) if r.has_permission?(:manage_issue_relations)
<     end
<   end
< 
<   def self.down
<     Role.find(:all).each do |r|
<       r.remove_permission!(:manage_changeset_relations)
<     end
<   end
< end
diff -NBr -x .svn -x tmp -x log -x files -x plugin_assets -x vendor -x extra -x schema.rb -x config /opt/redmine/lang/en.yml redmine/lang/en.yml
705d704
< revision_not_found_error: Revision not found at project SCM
diff -NBr -x .svn -x tmp -x log -x files -x plugin_assets -x vendor -x extra -x schema.rb -x config /opt/redmine/lib/redmine.rb redmine/lib/redmine.rb
40d39
<     map.permission :manage_changeset_relations, {:changeset_relations => [:new, :destroy]}
diff -NBr -x .svn -x tmp -x log -x files -x plugin_assets -x vendor -x extra -x schema.rb -x config /opt/redmine/test/functional/changeset_relations_controller_test.rb redmine/test/functional/changeset_relations_controller_test.rb
1,8d0
< require 'test_helper'
< 
< class ChangesetRelationsControllerTest < ActionController::TestCase
<   # Replace this with your real tests.
<   test "the truth" do
<     assert true
<   end
< end
