diff lib/redmine/scm/adapters/abstract_adapter.rb @ 3:7c48bad7d85d yuya

* Import Mercurial overhaul patches from Yuya Nishihara (see http://www.redmine.org/issues/4455)
author Chris Cannam
date Wed, 28 Jul 2010 12:40:01 +0100
parents 513646585e45
children b859cc0c4fa1
line wrap: on
line diff
--- a/lib/redmine/scm/adapters/abstract_adapter.rb	Wed Jul 28 12:12:43 2010 +0100
+++ b/lib/redmine/scm/adapters/abstract_adapter.rb	Wed Jul 28 12:40:01 2010 +0100
@@ -271,7 +271,8 @@
       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,12 @@
           self.branch = attributes[:branch]
         end
 
+        # Returns the identifier of this revision.
+        # e.g. revision number for centralized system; hash id for DVCS
+        def identifier
+          @identifier || scmid || revision
+        end
+
         def save(repo)
           Changeset.transaction do
             changeset = Changeset.new(