class OhlohScm::Diff
A Diff
represents a change to a single file. It can represent the addition or deletion of a file, or it can represent a modification of the file contents.
OpenHub does not track filename changes. If a file is renamed, OpenHub treats this as the deletion of one file and the creation of another.
OpenHub does not track directories, only the files within directories.
Don’t confuse our use of the word “Diff” with a patch file or the output of the console tool ‘diff’. This object doesn’t have anything to do the actual contents of the file; it’s better to think of this object as representing a single line item from a source control log.
Attributes
An action code describing the type of change made to the file. Action codes are copied directly from the Git
standard. The action code can be…
'A' added 'M' modified 'D' deleted
For Subversion only, a path may be reported as copied from another location. These attributes store the path and revision number of the source of the copy.
For Subversion only, a path may be reported as copied from another location. These attributes store the path and revision number of the source of the copy.
The SHA1 hash of the file contents both before and after the change. These must be computed using the same method as Git
.
The filename of the changed file, relative to the root of the repository.
Public Class Methods
Source
# File lib/ohloh_scm/diff.rb, line 36 def initialize(params = {}) params.each { |k, v| send(k.to_s + '=', v) if respond_to?(k.to_s + '=') } end
Public Instance Methods
Source
# File lib/ohloh_scm/diff.rb, line 41 def eql?(other) @action.eql?(other.action) && @path.eql?(other.path) && @sha1.eql?(other.sha1) && @parent_sha1.eql?(other.parent_sha1) end
eql?() and hash() are implemented so that [].uniq() will work on an array of Diffs.
Source
# File lib/ohloh_scm/diff.rb, line 46 def hash "#{action}|#{path}|#{sha1}|#{parent_sha1}".hash end