Changing revision label and identifier at SCM adapter level (#3724, #6092)

Contributed by Yuya Nishihara.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4613 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2011-01-02 09:45:05 +00:00
parent 2ae2d3ef83
commit 2e1bcb2abf
16 changed files with 161 additions and 24 deletions

View File

@@ -271,7 +271,8 @@ module Redmine
end
class Revision
attr_accessor :identifier, :scmid, :name, :author, :time, :message, :paths, :revision, :branch
attr_accessor :scmid, :name, :author, :time, :message, :paths, :revision, :branch
attr_writer :identifier
def initialize(attributes={})
self.identifier = attributes[:identifier]
@@ -285,6 +286,16 @@ module Redmine
self.branch = attributes[:branch]
end
# Returns the identifier of this revision; see also Changeset model
def identifier
(@identifier || revision).to_s
end
# Returns the readable identifier.
def format_identifier
identifier
end
def save(repo)
Changeset.transaction do
changeset = Changeset.new(

View File

@@ -264,6 +264,13 @@ module Redmine
return nil if $? && $?.exitstatus != 0
cat
end
class Revision < Redmine::Scm::Adapters::Revision
# Returns the readable identifier
def format_identifier
identifier[0,8]
end
end
end
end
end