enumerable method
# File lib/git/status.rb, line 44
44: def [](file)
45: @files[file]
46: end
# File lib/git/status.rb, line 15
15: def added
16: @files.select { |k, f| f.type == 'A' }
17: end
# File lib/git/status.rb, line 11
11: def changed
12: @files.select { |k, f| f.type == 'M' }
13: end
# File lib/git/status.rb, line 19
19: def deleted
20: @files.select { |k, f| f.type == 'D' }
21: end
# File lib/git/status.rb, line 48
48: def each(&block)
49: @files.values.each(&block)
50: end
# File lib/git/status.rb, line 27
27: def pretty
28: out = ''
29: self.each do |file|
30: out << file.path
31: out << "\n\tsha(r) " + file.sha_repo.to_s + ' ' + file.mode_repo.to_s
32: out << "\n\tsha(i) " + file.sha_index.to_s + ' ' + file.mode_index.to_s
33: out << "\n\ttype " + file.type.to_s
34: out << "\n\tstage " + file.stage.to_s
35: out << "\n\tuntrac " + file.untracked.to_s
36: out << "\n"
37: end
38: out << "\n"
39: out
40: end
# File lib/git/status.rb, line 82
82: def construct_status
83: @files = @base.lib.ls_files
84: ignore = @base.lib.ignored_files
85:
86: # find untracked in working dir
87: Dir.chdir(@base.dir.path) do
88: Dir.glob('**/*') do |file|
89: @files[file] = {:path => file, :untracked => true} unless @files[file] || File.directory?(file) || ignore.include?(file)
90: end
91: end
92:
93: # find modified in tree
94: @base.lib.diff_files.each do |path, data|
95: @files[path] ? @files[path].merge!(data) : @files[path] = data
96: end
97:
98: # find added but not committed - new files
99: @base.lib.diff_index('HEAD').each do |path, data|
100: @files[path] ? @files[path].merge!(data) : @files[path] = data
101: end
102:
103: @files.each do |k, file_hash|
104: @files[k] = StatusFile.new(@base, file_hash)
105: end
106: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.