##// END OF EJS Templates
Refactor: Extract method to create a Change from a Changeset....
Eric Davis -
r3246:39c585740d45
parent child
Show More
@@ -149,6 +149,15 class Changeset < ActiveRecord::Base
149 149 to_utf8(str.to_s.strip)
150 150 end
151 151
152 # Creates a new Change from it's common parameters
153 def create_change(change)
154 Change.create(:changeset => self,
155 :action => change[:action],
156 :path => change[:path],
157 :from_path => change[:from_path],
158 :from_revision => change[:from_revision])
159 end
160
152 161 private
153 162
154 163 # Finds issues that can be referenced by the commit message
@@ -85,11 +85,7 class Repository::Darcs < Repository
85 85 :comments => revision.message)
86 86
87 87 revision.paths.each do |change|
88 Change.create(:changeset => changeset,
89 :action => change[:action],
90 :path => change[:path],
91 :from_path => change[:from_path],
92 :from_revision => change[:from_revision])
88 changeset.create_change(change)
93 89 end
94 90 next_rev += 1
95 91 end if revisions
@@ -78,11 +78,7 class Repository::Mercurial < Repository
78 78 :comments => revision.message)
79 79
80 80 revision.paths.each do |change|
81 Change.create(:changeset => changeset,
82 :action => change[:action],
83 :path => change[:path],
84 :from_path => change[:from_path],
85 :from_revision => change[:from_revision])
81 changeset.create_change(change)
86 82 end
87 83 end
88 84 end unless revisions.nil?
@@ -63,11 +63,7 class Repository::Subversion < Repository
63 63 :comments => revision.message)
64 64
65 65 revision.paths.each do |change|
66 Change.create(:changeset => changeset,
67 :action => change[:action],
68 :path => change[:path],
69 :from_path => change[:from_path],
70 :from_revision => change[:from_revision])
66 changeset.create_change(change)
71 67 end unless changeset.new_record?
72 68 end
73 69 end unless revisions.nil?
General Comments 0
You need to be logged in to leave comments. Login now