Class: Perforce2Svn::Perforce::PerforceCommit

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/perforce2svn/perforce/commit_builder.rb

Overview

The standard commit message

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

configure, log, #log

Constructor Details

#initialize(revision, author, message, time, files) ⇒ PerforceCommit

Returns a new instance of PerforceCommit.



15
16
17
18
19
20
21
# File 'lib/perforce2svn/perforce/commit_builder.rb', line 15

def initialize(revision, author, message, time, files)
  @author = author
  @revision = revision
  @message = message
  @time = time
  @files = files
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



13
14
15
# File 'lib/perforce2svn/perforce/commit_builder.rb', line 13

def author
  @author
end

#filesObject (readonly)

Returns the value of attribute files.



13
14
15
# File 'lib/perforce2svn/perforce/commit_builder.rb', line 13

def files
  @files
end

#messageObject (readonly)

Returns the value of attribute message.



13
14
15
# File 'lib/perforce2svn/perforce/commit_builder.rb', line 13

def message
  @message
end

#revisionObject (readonly)

Returns the value of attribute revision.



13
14
15
# File 'lib/perforce2svn/perforce/commit_builder.rb', line 13

def revision
  @revision
end

#timeObject (readonly)

Returns the value of attribute time.



13
14
15
# File 'lib/perforce2svn/perforce/commit_builder.rb', line 13

def time
  @time
end

Instance Method Details

#log!Object



23
24
25
26
27
# File 'lib/perforce2svn/perforce/commit_builder.rb', line 23

def log!
  to_s.each_line do |line|
    log.info line.chomp
  end
end

#to_sObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/perforce2svn/perforce/commit_builder.rb', line 29

def to_s
  header = <<EOF
================================================================
Perforce Revision: #{revision}
Time: #{time}
User: #{author}
Message:
EOF
  @message.each_line do |line|
    header << "    #{line}"
  end

  header << "\nTotal Files: #{@files.length}\n"
  @files.each do |file|
    header << "    #{file}\n"
  end

  header
end