summaryrefslogtreecommitdiffstats
path: root/app/models/changeset.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-09 09:30:50 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-09 09:30:50 +0000
commitb9ce061319133748c48c255bf6bd17b7dfe5ed9d (patch)
treefbb0f68a1e11192b4ee6d9a144bce1ffcd3731cc /app/models/changeset.rb
parentc12453ec4e33347af3e5dc95513ab32d9aaffcaf (diff)
downloadredmine-b9ce061319133748c48c255bf6bd17b7dfe5ed9d.tar.gz
redmine-b9ce061319133748c48c255bf6bd17b7dfe5ed9d.zip
scm: code clean up app/models/changeset.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5372 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/changeset.rb')
-rw-r--r--app/models/changeset.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/app/models/changeset.rb b/app/models/changeset.rb
index 9248cfeee..9c0dc68de 100644
--- a/app/models/changeset.rb
+++ b/app/models/changeset.rb
@@ -74,21 +74,22 @@ class Changeset < ActiveRecord::Base
def project
repository.project
end
-
+
def author
user || committer.to_s.split('<').first
end
-
+
def before_create
self.committer = self.class.to_utf8(self.committer, repository.repo_log_encoding)
- self.comments = self.class.normalize_comments(self.comments, repository.repo_log_encoding)
+ self.comments = self.class.normalize_comments(
+ self.comments, repository.repo_log_encoding)
self.user = repository.find_committer_user(self.committer)
end
def after_create
scan_comment_for_issue_ids
end
-
+
TIMELOG_RE = /
(
((\d+)(h|hours?))((\d+)(m|min)?)?
@@ -174,7 +175,9 @@ class Changeset < ActiveRecord::Base
return nil if id.blank?
issue = Issue.find_by_id(id.to_i, :include => :project)
if issue
- unless issue.project && (project == issue.project || project.is_ancestor_of?(issue.project) || project.is_descendant_of?(issue.project))
+ unless issue.project &&
+ (project == issue.project || project.is_ancestor_of?(issue.project) ||
+ project.is_descendant_of?(issue.project))
issue = nil
end
end
@@ -205,14 +208,15 @@ class Changeset < ActiveRecord::Base
end
issue
end
-
+
def log_time(issue, hours)
time_entry = TimeEntry.new(
:user => user,
:hours => hours,
:issue => issue,
:spent_on => commit_date,
- :comments => l(:text_time_logged_by_changeset, :value => text_tag, :locale => Setting.default_language)
+ :comments => l(:text_time_logged_by_changeset, :value => text_tag,
+ :locale => Setting.default_language)
)
time_entry.activity = log_time_activity unless log_time_activity.nil?
@@ -221,13 +225,13 @@ class Changeset < ActiveRecord::Base
end
time_entry
end
-
+
def log_time_activity
if Setting.commit_logtime_activity_id.to_i > 0
TimeEntryActivity.find_by_id(Setting.commit_logtime_activity_id.to_i)
end
end
-
+
def split_comments
comments =~ /\A(.+?)\r?\n(.*)$/m
@short_comments = $1 || comments