Sha256: 072b21a29ccae6c618c9d43673206b53aa09aa4fedfa95f9fdcfc4d17aecdd71
Contents?: true
Size: 1.9 KB
Versions: 6
Compression:
Stored size: 1.9 KB
Contents
require 'vclog/adapters/abstract' module VCLog module Adapters # Darcs SCM adapter. # # FIXME: This needs to be fixed!!!!!!! # class Darcs < Abstract # def initialize(*) raise "Darcs is not yet supported. Please help us fix that!" end # Is a darcs repository? def repository? File.directory?('_darcs') end # This is also a module function. module_function :repository? # Cached Changelog. def changelog @changelog ||= generate_changelog end # Generate Changelog object. 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 # Retrieve the "revision number" from the darcs tree. 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 # TODO def tag(ref, label, msg) `darcs tag #{label}` end end end end
Version data entries
6 entries across 6 versions & 2 rubygems