Class: Piston::Commands::Diff
Instance Attribute Summary
#args, #dry_run, #force, #lock, #logging_stream, #quiet, #recursive, #revision, #show_updates, #verbose
Class Method Summary
collapse
Instance Method Summary
collapse
#find_targets, #initialize, #skip, #svn
Class Method Details
.detailed_help ⇒ Object
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/piston/commands/diff.rb', line 43
def self.detailed_help
<<EOF
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.
EOF
end
|
.help ⇒ Object
39
40
41
|
# File 'lib/piston/commands/diff.rb', line 39
def self.help
"Shows the differences between the local repository and the pristine upstream"
end
|
Instance Method Details
#diff(dir) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# 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 ⇒ Object
8
9
10
11
12
|
# 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) ⇒ Object
35
36
37
|
# File 'lib/piston/commands/diff.rb', line 35
def run_diff(dir1, dir2)
`diff -urN --exclude=.svn #{dir1} #{dir2}`
end
|