Sha256: 2fdf1b846512810b3322695fd964da62b7e525fb34a2212b4ca434495b8f5a23
Contents?: true
Size: 1.13 KB
Versions: 5
Compression:
Stored size: 1.13 KB
Contents
require 'rscm/changes' require 'rscm/logging' require 'damagecontrol/directories' module DamageControl module Visitor # Visitor that persists unified diffs to disk. # class DiffPersister # Creates a new Differ that will persist diffs to file. # def initialize(scm, project_name) @scm, @project_name = scm, project_name end def visit_changesets(changesets) end def visit_changeset(changeset) @changeset = changeset Log.info "Writing diffs for #{@project_name} changeset #{changeset.identifier}" end def visit_change(change) diff_file = Directories.diff_file(@project_name, @changeset, change) Log.info " Writing diff for #{change.path} -> #{diff_file}" checkout_dir = Directories.checkout_dir(@project_name) @scm.diff(checkout_dir, change) do |diff_io| FileUtils.mkdir_p(File.dirname(diff_file)) File.open(diff_file, "w") do |io| diff_io.each_line do |line| io.write(line) end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems