Class: PVN::BaseRevisionOption

Inherits:
Synoption::Option
  • Object
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" ,
]

Instance Method Summary collapse

Instance Method Details

#entryObject



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

def entry
end

#head?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/pvn/revision/base_option.rb', line 16

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

#relative_to_absolute(rel, path) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/pvn/revision/base_option.rb', line 27

def relative_to_absolute rel, path
  limit = rel[0, 1] == '-' ? rel.to_i.abs : nil
  entries = run_log_command limit, path
  
  # This is Argument, not Range, because we're getting the value
  reventry = SVNx::Revision::Argument.create rel, entries: entries
  reventry.value.to_s
end

#resolve_value(optset, unprocessed) ⇒ Object



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

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

#run_log_command(limit, path) ⇒ Object



36
37
38
39
# File 'lib/pvn/revision/base_option.rb', line 36

def run_log_command limit, path
  logexec = SVNx::LogExec.new path: path, limit: limit, revision: nil, verbose: false, use_cache: false
  logexec.entries
end