Skip to content

Instantly share code, notes, and snippets.

@miau
Created August 29, 2016 08:53
Show Gist options
  • Save miau/cfff48fd8fc650ade9f1001a4846600f to your computer and use it in GitHub Desktop.
Save miau/cfff48fd8fc650ade9f1001a4846600f to your computer and use it in GitHub Desktop.
Patch to add a action to resync revprop-change of subversion
diff -ur redmine_org/app/controllers/sys_controller.rb redmine/app/controllers/sys_controller.rb
--- redmine_org/app/controllers/sys_controller.rb 2014-10-22 00:42:48.000000000 +0530
+++ redmine/app/controllers/sys_controller.rb 2016-08-29 14:08:22.718880800 +0530
@@ -68,6 +68,29 @@
render :nothing => true, :status => 404
end
+ def update_changeset_comment
+ scope = Project.active.has_module(:repository)
+ project = nil
+ if params[:id].to_s =~ /^\d*$/
+ project = scope.find(params[:id])
+ else
+ project = scope.find_by_identifier(params[:id])
+ end
+ raise ActiveRecord::RecordNotFound unless project
+
+ repository = project.repository
+ rev = params[:rev]
+ revisions = repository.scm.revisions(nil, rev, rev)
+
+ changeset = repository.changesets.find_by_revision(rev)
+ changeset.update_attribute("comments", revisions.first.message)
+ changeset.scan_comment_for_issue_ids
+
+ render :nothing => true, :status => 200
+ rescue ActiveRecord::RecordNotFound
+ render :nothing => true, :status => 404
+ end
+
protected
def check_enabled
diff -ur redmine_org/config/routes.rb redmine/config/routes.rb
--- redmine_org/config/routes.rb 2014-10-22 00:42:51.000000000 +0530
+++ redmine/config/routes.rb 2016-08-29 13:45:54.388880800 +0530
@@ -337,6 +337,7 @@
match 'sys/projects', :to => 'sys#projects', :via => :get
match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get
+ match 'sys/update_changeset_comment', :to => 'sys#update_changeset_comment', :via => :get
match 'uploads', :to => 'attachments#upload', :via => :post
@miau
Copy link
Author

miau commented Aug 29, 2016

It's for Redmine 2.5.3. See http://d.hatena.ne.jp/miau/20110530/1306764424 for details (in Japanese).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment