class VCLog::Adapters::Darcs

Darcs SCM adapter.

FIXME: This needs to be fixed!!!!!!!

Public Class Methods

new(*) click to toggle source
# File lib/vclog/adapters/darcs.rb, line 14
def initialize(*)
  raise "Darcs is not yet supported. Please help us fix that!"
end
repository?() click to toggle source

Is a darcs repository?

# File lib/vclog/adapters/darcs.rb, line 19
def repository?
  File.directory?('_darcs')
end

Public Instance Methods

calculate_version() click to toggle source

Retrieve the “revision number” from the darcs tree.

# File lib/vclog/adapters/darcs.rb, line 56
def calculate_version
  raise "not a darcs repository" unless repository?

  status = info.status

  changes = `darcs changes`
  count   = 0
  tag     = "0.0"

  changes.each("\n\n") do |change|
    head, title, desc = change.split("\n", 3)
    if title =~ /^  \*/
      # Normal change.
      count += 1
    elsif title =~ /tagged (.*)/
      # Tag.  We look for these.
      tag = $1
      break
    else
      warn "Unparsable change: #{change}"
    end
  end
  ver = "#{tag}.#{count.to_s}"

  return ver
  #format_version_stamp(ver, status) # ,released)
end
changelog() click to toggle source

Cached Changelog.

# File lib/vclog/adapters/darcs.rb, line 27
def changelog
  @changelog ||= generate_changelog
end
generate_changelog() click to toggle source

Generate Changelog object.

# File lib/vclog/adapters/darcs.rb, line 32
def generate_changelog
  raise "not a darcs repository" unless repository?

  log = Changelog.new

  txt = `darcs changes` #--repo=#{@repository}`

  txt.each_line do |line|
    case line
    when /^\s*$/
    when /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)/
    when /^\s*tagged/
      log << $'
      log << "\n"
    else
      log << line
      log << "\n"
    end
  end

  return log
end
tag(ref, label, msg) click to toggle source

TODO

# File lib/vclog/adapters/darcs.rb, line 85
def tag(ref, label, msg)
  `darcs tag #{label}`
end

Private Instance Methods

repository?() click to toggle source

Is a darcs repository?

# File lib/vclog/adapters/darcs.rb, line 19
def repository?
  File.directory?('_darcs')
end