Sha256: f540983e0a19f417c06cdc7749885e44dd2089ed9f2c7623f3ad806531051dd1

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

# Author:: Nicolas Pouillard  <ertai@lrde.epita.fr>.
# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
# License:: GNU General Public License (GPL).

# $LastChangedBy: ertai $
# $Id: header 98 2004-09-29 12:07:43Z ertai $

require 'vcs'
require 'changelog'

class Vcs
  def diffw ( *args )
    diff(*args)
  end
end

class Svn
  def diffw ( *args )
    diff('--diff-cmd', 'diff', '-x', '-NPbuw', *args)
  end
end

class Vcs

  @@message = Pathname.new(',message')

  def print_body ( file, options )
    LOG.warn "Creating a new `#{file}' file"
    file.open('w') do |f|
      f.puts options.to_yaml
      f.puts '---'
      f.puts
      f.print message.read
    end
  end
  private :print_body

  def message ( *args )
    error_handling :message_failed

    unless @@message.exist?
      cl = mkchangelog(*args)
      @@message.open('w') do |f|
        f.puts 'Index: ChangeLog'
        f.print cl.read.sub(/^\d+-\d+-\d+/, 'from')
        f.puts
        f.print diffstat(*args).read
        f.puts
        diffw_from_status(*args).each { |line| f.print line if line !~ /^=+$/ }
      end
    end
    @@message.open('r')
  end

  alias_command :msg, :message

  def message_failed
    if @@message.exist?
      LOG.info "#{@@message}: Contains the generated message"
      LOG.info '              (the ChangeLog entry, the diffstat, the diff)'
    end
  end

end # class Vcs

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vcs-0.2.148 src/message.rb