Class: PVN::BaseRevisionOption

Inherits:
Option show all
Defined in:
lib/pvn/revision/base_option.rb

Direct Known Subclasses

Diff::ChangeOption, RevisionOption

Constant Summary collapse

REVISION_DESCRIPTION =
[ "revision to apply.",
  "ARG can be relative, of the form:",
  "    +N : N revisions from the BASE",
  "    -N : N revisions from the HEAD,",
  "         when -1 is the previous revision" ,
]

Constants inherited from BaseOption

PVN::BaseOption::NO_CMDLINE_OPTION

Instance Attribute Summary

Attributes inherited from BaseOption

#default, #description, #name, #negate, #regexp, #tag

Instance Method Summary collapse

Methods inherited from BaseOption

#exact_match?, #initialize, #negative_match?, #next_argument, #post_process, #process, #regexp_match?, #set_value, #takes_value?, #to_command_line, #to_doc, #to_s, #unset, #value

Constructor Details

This class inherits a constructor from PVN::BaseOption

Instance Method Details

#entryObject



45
46
# File 'lib/pvn/revision/base_option.rb', line 45

def entry
end

#head?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/pvn/revision/base_option.rb', line 18

def head?
  value.nil? || value == 'HEAD'
end

#relative_to_absolute(rel, path) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/pvn/revision/base_option.rb', line 29

def relative_to_absolute rel, path
  limit = rel[0, 1] == '-' ? rel.to_i.abs : nil
  xmllines = run_log_command limit, path

  # This is Argument, not Range, because we're getting the value
  reventry = PVN::Revision::Argument.new rel, xmllines
  revval   = reventry.value.to_s
  revval
end

#resolve_value(optset, unprocessed) ⇒ Object



22
23
24
25
26
27
# File 'lib/pvn/revision/base_option.rb', line 22

def resolve_value optset, unprocessed
  val = value
  if PVN::Revision::RELATIVE_REVISION_RE.match val
    @value = relative_to_absolute val, unprocessed[0]
  end
end

#run_log_command(limit, path) ⇒ Object



39
40
41
42
43
# File 'lib/pvn/revision/base_option.rb', line 39

def run_log_command limit, path
  cmdargs = SVNx::LogCommandArgs.new :limit => limit, :path => path, :use_cache => false
  cmd = SVNx::LogCommand.new cmdargs
  cmd.execute
end