Class: Rosette::Core::Commands::DiffBaseCommand

Inherits:
GitCommand show all
Includes:
WithSnapshots
Defined in:
lib/rosette/core/commands/git/diff_base_command.rb

Overview

The base class for commands that need to calculate diffs.

Direct Known Subclasses

DiffCommand, ShowCommand

Instance Attribute Summary collapse

Attributes inherited from Command

#configuration

Instance Method Summary collapse

Methods included from WithSnapshots

#take_snapshot

Methods inherited from GitCommand

#valid?

Methods inherited from Command

#messages, #valid?, validate, validators

Constructor Details

#initialize(*args) ⇒ DiffBaseCommand

Returns a new instance of DiffBaseCommand


12
13
14
15
# File 'lib/rosette/core/commands/git/diff_base_command.rb', line 12

def initialize(*args)
  super
  @strict = true
end

Instance Attribute Details

#strictObject (readonly) Also known as: strict?

Returns the value of attribute strict


9
10
11
# File 'lib/rosette/core/commands/git/diff_base_command.rb', line 9

def strict
  @strict
end

Instance Method Details

#set_strict(strict) ⇒ self

Sets a boolean value that determines if the diff should be made against true parents of the given commit or the most recently processed parents. If set to true, the diff will be computed between the given commit and its actual (true) parents, and an error will be raised if any of the parents have not been processed by Rosette (i.e. don't exist in the commit log). If set to false, the diff will be computed between the given commit and the most recent parents that have been processed. For each parent of the given commit, ShowCommand will traverse the commit history looking for a processed commit and use it in place of the true parent (assuming the true parent hasn't been processed yet). It's worth noting that setting strict to false may potentially produce results that contain phrases that were not introduced exclusively in the given commit. Since such behavior is different from what git clients return, and therefore possibly unexpected, strictness is enabled (set to true) by default.

Parameters:

  • strict (Boolean)

Returns:

  • (self)

36
37
38
39
# File 'lib/rosette/core/commands/git/diff_base_command.rb', line 36

def set_strict(strict)
  @strict = strict
  self
end