Class: Redmine::Scm::Adapters::Revision

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine/scm/adapters/abstract_adapter.rb

Instance Attribute Summary

Instance Method Summary

Constructor Details

- (Revision) initialize(attributes = {})

A new instance of Revision



276
277
278
279
280
281
282
283
284
285
286
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 276

def initialize(attributes={})
  self.identifier = attributes[:identifier]
  self.scmid = attributes[:scmid]
  self.name = attributes[:name] || self.identifier
  self.author = attributes[:author]
  self.time = attributes[:time]
  self.message = attributes[:message] || ""
  self.paths = attributes[:paths]
  self.revision = attributes[:revision]
  self.branch = attributes[:branch]
end

Instance Attribute Details

- (Object) author

Returns the value of attribute author



274
275
276
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 274

def author
  @author
end

- (Object) branch

Returns the value of attribute branch



274
275
276
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 274

def branch
  @branch
end

- (Object) identifier

Returns the value of attribute identifier



274
275
276
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 274

def identifier
  @identifier
end

- (Object) message

Returns the value of attribute message



274
275
276
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 274

def message
  @message
end

- (Object) name

Returns the value of attribute name



274
275
276
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 274

def name
  @name
end

- (Object) paths

Returns the value of attribute paths



274
275
276
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 274

def paths
  @paths
end

- (Object) revision

Returns the value of attribute revision



274
275
276
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 274

def revision
  @revision
end

- (Object) scmid

Returns the value of attribute scmid



274
275
276
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 274

def scmid
  @scmid
end

- (Object) time

Returns the value of attribute time



274
275
276
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 274

def time
  @time
end

Instance Method Details

- (Object) save(repo)



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/redmine/scm/adapters/abstract_adapter.rb', line 288

def save(repo)
  Changeset.transaction do
    changeset = Changeset.new(
      :repository => repo,
      :revision => identifier,
      :scmid => scmid,
      :committer => author, 
      :committed_on => time,
      :comments => message)
    
    if changeset.save
      paths.each do |file|
        Change.create(
          :changeset => changeset,
          :action => file[:action],
          :path => file[:path])
      end
    end
  end
end