Piston::Commands::Diff

Public Class Methods

detailed_help() click to toggle source
# File lib/piston/commands/diff.rb, line 43
def self.detailed_help
  usage: diff [DIR [...]]  This operation has the effect of producing a diff between the pristine upstream  (at the last updated revision) and your local version.  In other words, it  gives you the changes you have made in your repository that have not been  incorporated upstream.
end
help() click to toggle source
# File lib/piston/commands/diff.rb, line 39
def self.help
  "Shows the differences between the local repository and the pristine upstream"
end

Public Instance Methods

diff(dir) click to toggle source
# File lib/piston/commands/diff.rb, line 14
def diff(dir)
  return unless File.directory?(dir)
  logging_stream.puts "Processing '#{dir}'..."
  repos = svn(:propget, Piston::ROOT, dir).chomp
  uuid = svn(:propget, Piston::UUID, dir).chomp
  remote_revision = svn(:propget, Piston::REMOTE_REV, dir).chomp.to_i

  logging_stream.puts "  Fetching remote repository's latest revision and UUID"
  info = YAML::load(svn(:info, repos))
  return skip(dir, "Repository UUID changed\n  Expected #{uuid}\n  Found    #{info['Repository UUID']}\n  Repository: #{repos}") unless uuid == info['Repository UUID']

  logging_stream.puts "  Checking out repository at revision #{remote_revision}"
  svn :checkout, '--ignore-externals', '--quiet', '--revision', remote_revision, repos, dir.tmp

  puts run_diff(dir.tmp, dir)

  logging_stream.puts "  Removing temporary files / folders"
  FileUtils.rm_rf dir.tmp

end
run() click to toggle source
# File lib/piston/commands/diff.rb, line 8
def run
  (args.empty? ? find_targets : args).each do |dir|
    diff dir
  end
end
run_diff(dir1, dir2) click to toggle source
# File lib/piston/commands/diff.rb, line 35
def run_diff(dir1, dir2)
  `diff -urN --exclude=.svn #{dir1} #{dir2}`
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.