diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-03-12 20:28:49 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-03-12 20:28:49 +0000 |
commit | 3a9b0988c7515371531e47f9eef9f8e60ce352aa (patch) | |
tree | 2a2deaedbd321dcf838c631dfed357f3c1110dbe /app/models/changeset.rb | |
parent | 6fcc512cb77a0851ab8c3c693fd178b564a600dd (diff) | |
download | redmine-3a9b0988c7515371531e47f9eef9f8e60ce352aa.tar.gz redmine-3a9b0988c7515371531e47f9eef9f8e60ce352aa.zip |
Merged Git support branch (r1200 to r1226).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1236 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/changeset.rb')
-rw-r--r-- | app/models/changeset.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/models/changeset.rb b/app/models/changeset.rb index dbe06935d..ce9ea28ca 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -32,7 +32,6 @@ class Changeset < ActiveRecord::Base :date_column => 'committed_on' validates_presence_of :repository_id, :revision, :committed_on, :commit_date - validates_numericality_of :revision, :only_integer => true validates_uniqueness_of :revision, :scope => :repository_id validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true @@ -89,7 +88,11 @@ class Changeset < ActiveRecord::Base # don't change the status is the issue is closed next if issue.status.is_closed? user = committer_user || User.anonymous - journal = issue.init_journal(user, l(:text_status_changed_by_changeset, "r#{self.revision}")) + csettext = "r#{self.revision}" + if self.scmid && (! (csettext =~ /^r[0-9]+$/)) + csettext = "commit:\"#{self.scmid}\"" + end + journal = issue.init_journal(user, l(:text_status_changed_by_changeset, csettext)) issue.status = fix_status issue.done_ratio = done_ratio if done_ratio issue.save @@ -114,11 +117,11 @@ class Changeset < ActiveRecord::Base # Returns the previous changeset def previous - @previous ||= Changeset.find(:first, :conditions => ['revision < ? AND repository_id = ?', self.revision, self.repository_id], :order => 'revision DESC') + @previous ||= Changeset.find(:first, :conditions => ['id < ? AND repository_id = ?', self.id, self.repository_id], :order => 'id DESC') end # Returns the next changeset def next - @next ||= Changeset.find(:first, :conditions => ['revision > ? AND repository_id = ?', self.revision, self.repository_id], :order => 'revision ASC') + @next ||= Changeset.find(:first, :conditions => ['id > ? AND repository_id = ?', self.id, self.repository_id], :order => 'id ASC') end end |