Patch #7959 ยป revision-update-1.1.0.patch
| redmine-1.1.0-revision-update/app/controllers/repositories_controller.rb 2011-03-22 12:01:56.115467800 -0600 | ||
|---|---|---|
|
show_error_not_found
|
||
|
end
|
||
|
|
||
|
def update #revision
|
||
|
@changeset = @repository.find_changeset_by_name(@rev)
|
||
|
raise ChangesetNotFound unless @changeset
|
||
|
|
||
|
# update revision properties from repository
|
||
|
revision = @repository.scm.revision(@rev)
|
||
|
@changeset.committer = revision.author
|
||
|
@changeset.committed_on = revision.time
|
||
|
@changeset.comments = revision.message
|
||
|
|
||
|
# report success or errors
|
||
|
if @changeset.save
|
||
|
flash[:notice] = l(:notice_successful_update)
|
||
|
# on success, rescan new comments for related issue ids
|
||
|
@changeset.scan_comment_for_issue_ids
|
||
|
else
|
||
|
# can't seem to bring in the helper method 'error_messages_for'
|
||
|
# and injecting it into show.rhtml doesn't seem to work, since
|
||
|
# the @changeset loses the errors on redirect (due to changeset reload)
|
||
|
flash[:error] = "<ul>" + @changeset.errors.full_messages.map {|msg| "<li>" + ERB::Util.html_escape(msg) + "</li>"}.join + "</ul>"
|
||
|
end
|
||
|
|
||
|
respond_to do |format|
|
||
|
format.html { redirect_to :action => 'revision', :id => @project, :rev => @rev }
|
||
|
format.api { render_validation_errors(@changeset) }
|
||
|
end
|
||
|
|
||
|
rescue ChangesetNotFound
|
||
|
show_error_not_found
|
||
|
end
|
||
|
|
||
|
def diff
|
||
|
if params[:format] == 'diff'
|
||
|
@diff = @repository.diff(@path, @rev, @rev_to)
|
||
| redmine-1.1.0-revision-update/app/models/changeset.rb 2011-03-22 12:03:22.319144500 -0600 | ||
|---|---|---|
|
issue, hours = find_referenced_issue_by_id(m[0].to_i), m[2]
|
||
|
if issue
|
||
|
referenced_issues << issue
|
||
|
fix_issue(issue) if fix_keywords.include?(action.to_s.downcase)
|
||
|
log_time(issue, hours) if hours && Setting.commit_logtime_enabled?
|
||
|
# don't update the issue if a relation already exists
|
||
|
if !self.issues.include?(issue)
|
||
|
fix_issue(issue) if fix_keywords.include?(action.to_s.downcase)
|
||
|
log_time(issue, hours) if hours && Setting.commit_logtime_enabled?
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| redmine-1.1.0-revision-update/app/views/repositories/revision.rhtml 2011-03-22 12:01:56.146718000 -0600 | ||
|---|---|---|
|
<% end %>
|
||
|
</div>
|
||
|
|
||
|
<h2><%= l(:label_revision) %> <%= format_revision(@changeset) %></h2>
|
||
|
<h2>
|
||
|
<%= l(:label_revision) %> <%= format_revision(@changeset) %>
|
||
|
<%= link_to(image_tag('reload.png'), {:controller => 'repositories', :action => 'update', :id => @project, :rev => @rev}, :method => :get, :title => l(:button_update)) %>
|
||
|
</h2>
|
||
|
|
||
|
<p><% if @changeset.scmid %>ID: <%= @changeset.scmid %><br /><% end %>
|
||
|
<span class="author"><%= authoring(@changeset.committed_on, @changeset.author) %></span></p>
|
||
| ... | ... | |
|
<li class="change change-D"><%= l(:label_deleted) %></li>
|
||
|
</ul>
|
||
|
|
||
|
<p><%= link_to(l(:label_view_diff), :action => 'diff', :id => @project, :path => "", :rev => @changeset.identifier) if @changeset.changes.any? %></p>
|
||
|
<p><%= link_to(l(:label_view_diff), :action => 'diff', :id => @project, :path => "", :rev => @rev) if @changeset.changes.any? %></p>
|
||
|
|
||
|
<div class="changeset-changes">
|
||
|
<%= render_changeset_changes %>
|
||
| redmine-1.1.0-revision-update/lib/redmine/scm/adapters/abstract_adapter.rb 2011-03-22 12:01:56.146718000 -0600 | ||
|---|---|---|
|
return nil
|
||
|
end
|
||
|
|
||
|
def revision(identifier)
|
||
|
revisions = revisions(nil, identifier, identifier, {})
|
||
|
return nil unless revisions
|
||
|
return revisions.first
|
||
|
end
|
||
|
|
||
|
def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
|
||
|
return nil
|
||
|
end
|
||
| redmine-1.1.0-revision-update/lib/redmine.rb 2011-03-22 12:01:56.162343100 -0600 | ||
|---|---|---|
|
end
|
||
|
|
||
|
map.project_module :repository do |map|
|
||
|
map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member
|
||
|
map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy, :update]}, :require => :member
|
||
|
map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph]
|
||
|
map.permission :view_changesets, :repositories => [:show, :revisions, :revision]
|
||
|
map.permission :commit_access, {}
|
||