Skip to content

Commit

Permalink
Refactor: Extract method to create a Change from a Changeset.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3360 e93f8b46-1217-0410-a6f0-8f06a7374b81
  • Loading branch information
edavis10 committed Feb 2, 2010
1 parent 358e319 commit 39c5857
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
9 changes: 9 additions & 0 deletions app/models/changeset.rb
Expand Up @@ -148,6 +148,15 @@ def next
def self.normalize_comments(str)
to_utf8(str.to_s.strip)
end

# Creates a new Change from it's common parameters

This comment has been minimized.

Copy link
@splattael

splattael Feb 2, 2010

It should read its common.

def create_change(change)
Change.create(:changeset => self,
:action => change[:action],
:path => change[:path],
:from_path => change[:from_path],
:from_revision => change[:from_revision])
end

private

Expand Down
6 changes: 1 addition & 5 deletions app/models/repository/darcs.rb
Expand Up @@ -85,11 +85,7 @@ def fetch_changesets
:comments => revision.message)

revision.paths.each do |change|
Change.create(:changeset => changeset,
:action => change[:action],
:path => change[:path],
:from_path => change[:from_path],
:from_revision => change[:from_revision])
changeset.create_change(change)
end
next_rev += 1
end if revisions
Expand Down
6 changes: 1 addition & 5 deletions app/models/repository/mercurial.rb
Expand Up @@ -78,11 +78,7 @@ def fetch_changesets
:comments => revision.message)

revision.paths.each do |change|
Change.create(:changeset => changeset,
:action => change[:action],
:path => change[:path],
:from_path => change[:from_path],
:from_revision => change[:from_revision])
changeset.create_change(change)
end
end
end unless revisions.nil?
Expand Down
6 changes: 1 addition & 5 deletions app/models/repository/subversion.rb
Expand Up @@ -63,11 +63,7 @@ def fetch_changesets
:comments => revision.message)

revision.paths.each do |change|
Change.create(:changeset => changeset,
:action => change[:action],
:path => change[:path],
:from_path => change[:from_path],
:from_revision => change[:from_revision])
changeset.create_change(change)
end unless changeset.new_record?
end
end unless revisions.nil?
Expand Down

0 comments on commit 39c5857

Please sign in to comment.