class Mercurial::ChangedFile

Attributes

initial_name[R]
mode_letter[RW]
name[R]

Public Class Methods

new(opts={}) click to toggle source
# File lib/mercurial-ruby/changed_file.rb, line 8
def initialize(opts={})
  @initial_name = opts[:initial_name]
  @name         = enforce_unicode(opts[:name])
  @mode_letter  = opts[:mode]
end

Public Instance Methods

added?() click to toggle source
# File lib/mercurial-ruby/changed_file.rb, line 26
def added?
  mode == :add
end
copied?() click to toggle source
# File lib/mercurial-ruby/changed_file.rb, line 18
def copied?
  mode == :copy
end
deleted?() click to toggle source
# File lib/mercurial-ruby/changed_file.rb, line 22
def deleted?
  mode == :delete
end
mode() click to toggle source
# File lib/mercurial-ruby/changed_file.rb, line 34
def mode
  case mode_letter
  when 'A'
    :add
  when 'D'
    :delete
  when 'C'
    :copy
  when 'R'
    :move
  else
    :edit
  end
end
modified?() click to toggle source
# File lib/mercurial-ruby/changed_file.rb, line 30
def modified?
  mode == :edit
end
moved?() click to toggle source
# File lib/mercurial-ruby/changed_file.rb, line 14
def moved?
  mode == :move
end

Private Instance Methods

enforce_unicode(str) click to toggle source
# File lib/mercurial-ruby/changed_file.rb, line 51
def enforce_unicode(str)
  str.encode('utf-8', {:invalid => :replace, :undef => :replace, :replace => '?'})
end