Sha256: 3811042064d6e86657f4af626ce55c559147417a71f529bcd0f3ca89e161092e

Contents?: true

Size: 1011 Bytes

Versions: 2

Compression:

Stored size: 1011 Bytes

Contents

module Mercurial

  #
  # The class represents Mercurial diff. Obtained by running an +hg diff+ command.
  #
  # The class represents Diff object itself, {Mercurial::DiffFactory DiffFactory} is responsible
  # for assembling instances of Diff. For the list of all possible diff-related operations 
  # check {Mercurial::DiffFactory DiffFactory}.
  #
  class Diff
    
    # SHA1 hash of version a of the file.
    attr_reader :hash_a
    
    # SHA1 hash of version b of the file.
    attr_reader :hash_b
    
    # Version a of the file name.
    attr_reader :file_a
    
    # Version b of the file name.
    attr_reader :file_b
    
    # Diff body.
    attr_reader :body
    
    def initialize(opts={})
      @hash_a = opts[:hash_a]
      @hash_b = opts[:hash_b]
      @file_a = opts[:file_a]
      @file_b = opts[:file_b]
      @body   = opts[:body]
      @binary = opts[:binary]
    end
    
    def file_name
      file_b || file_a
    end
    
    def binary?
      !! @binary
    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mercurial-ruby-0.7.8 lib/mercurial-ruby/diff.rb
mercurial-ruby-0.7.7 lib/mercurial-ruby/diff.rb