Class: PVN::RevisionRegexpOption

Inherits:
RevisionOption show all
Defined in:
lib/pvn/revision/revision_regexp_option.rb

Overview

A revision that is also set by -N and +N.

Direct Known Subclasses

MultipleRevisionsRegexpOption

Constant Summary collapse

TAG_RE =
Regexp.new '^(?:([\-\+]\d+)|(-r(.+)))$'
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

BaseOption::NO_CMDLINE_OPTION

Instance Attribute Summary

Attributes inherited from RevisionOption

#fromdate, #todate

Attributes inherited from BaseOption

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

Instance Method Summary collapse

Methods inherited from RevisionOption

#to_svn_revision_date, #value

Methods inherited from BaseRevisionOption

#entry, #head?, #relative_to_absolute, #run_log_command

Methods inherited from BaseOption

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

Constructor Details

#initialize(revargs = Hash.new) ⇒ RevisionRegexpOption

Returns a new instance of RevisionRegexpOption.



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

def initialize revargs = Hash.new
  revargs[:regexp] = TAG_RE
  super
end

Instance Method Details

#resolve_value(optset, unprocessed) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/pvn/revision/revision_regexp_option.rb', line 23

def resolve_value optset, unprocessed
  val = value
  md  = TAG_RE.match val

  if md && md[3]
    @value = md[3]
  end
  
  super
end