| 1 | # | ||||||||||
| 2 | # Copyright (c) 2003,2004,2005 Alexander Taler (dissent@0--0.org) | ||||||||||
| 3 | # | ||||||||||
| 4 | # All rights reserved. This program is free software; you can redistribute it | ||||||||||
| 5 | # and/or modify it under the same terms as Perl itself. | ||||||||||
| 6 | # | ||||||||||
| 7 | |||||||||||
| 8 | package VCS::LibCVS::Datum::TagSpec; | ||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | =head1 NAME | ||||||||||
| 14 | |||||||||||
| 15 | VCS::LibCVS::Datum::TagSpec - A CVS datum for a tag specification | ||||||||||
| 16 | |||||||||||
| 17 | =head1 SYNOPSIS | ||||||||||
| 18 | |||||||||||
| 19 | $string = VCS::LibCVS::Datum::TagSpec->new("Trelease_1_01"); | ||||||||||
| 20 | |||||||||||
| 21 | =head1 DESCRIPTION | ||||||||||
| 22 | |||||||||||
| 23 | The concatentation of a tag type and value, like: | ||||||||||
| 24 | |||||||||||
| 25 | Trelease_1_01 | ||||||||||
| 26 | D2002.11.18.05.00.00 | ||||||||||
| 27 | |||||||||||
| 28 | These are the tag types for LibCVS: | ||||||||||
| 29 | |||||||||||
| 30 | VCS::LibCVS::Datum::TagSpec::TYPE_BRANCH (T) | ||||||||||
| 31 | VCS::LibCVS::Datum::TagSpec::TYPE_DATE (D) | ||||||||||
| 32 | VCS::LibCVS::Datum::TagSpec::TYPE_NONBRANCH (N) | ||||||||||
| 33 | VCS::LibCVS::Datum::TagSpec::TYPE_REVISION (R) | ||||||||||
| 34 | |||||||||||
| 35 | This usage deviates from that in CVS, which is: | ||||||||||
| 36 | (This should be validated for accuracy.) | ||||||||||
| 37 | |||||||||||
| 38 | D A date tag | ||||||||||
| 39 | T In an entry line is any named symbolic or revision tag | ||||||||||
| 40 | In a directory (CVS/Tag) indicates a branch tag | ||||||||||
| 41 | N In a directory (CVS/Tag) indicates a non-branch tag | ||||||||||
| 42 | |||||||||||
| 43 | =head1 SUPERCLASS | ||||||||||
| 44 | |||||||||||
| 45 | VCS::LibCVS::Datum | ||||||||||
| 46 | |||||||||||
| 47 | =cut | ||||||||||
| 48 | |||||||||||
| 49 | ############################################################################### | ||||||||||
| 50 | # Class constants | ||||||||||
| 51 | ############################################################################### | ||||||||||
| 52 | |||||||||||
| 53 | 1 | ▶ | use constant REVISION => '$Header: /cvsroot/libcvs-perl/libcvs-perl/VCS/LibCVS/Datum/TagSpec.pm,v 1.11 2005/10/10 12:52:12 dissent Exp $ '; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 54 | |||||||||||
| 55 | 1 | ▶ | use vars ('@ISA'); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 56 | 1 | @ISA = ("VCS::LibCVS::Datum"); | |||||||||
| 57 | |||||||||||
| 58 | # TYPE_* constants are documented in the class description above | ||||||||||
| 59 | 1 | ▶ | use constant TYPE_BRANCH => "T"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 60 | 1 | ▶ | use constant TYPE_DATE => "D"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 61 | 1 | ▶ | use constant TYPE_NONBRANCH => "N"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 62 | 1 | ▶ | use constant TYPE_REVISION => "R"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 63 | |||||||||||
| 64 | ############################################################################### | ||||||||||
| 65 | # Class variables | ||||||||||
| 66 | ############################################################################### | ||||||||||
| 67 | |||||||||||
| 68 | ############################################################################### | ||||||||||
| 69 | # Private variables | ||||||||||
| 70 | ############################################################################### | ||||||||||
| 71 | |||||||||||
| 72 | # $self->{Type} The type of tag, one of TYPE_* constants | ||||||||||
| 73 | # $self->{Name} The tag as a scalar string | ||||||||||
| 74 | # $self->{TagSpec} The tag spec as understood by CVS, unchanged | ||||||||||
| 75 | |||||||||||
| 76 | ############################################################################### | ||||||||||
| 77 | # Class routines | ||||||||||
| 78 | ############################################################################### | ||||||||||
| 79 | |||||||||||
| 80 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 81 | 0 | my $class = shift; | |||||||||
| 82 | |||||||||||
| 83 | 0 | my $that = $class->SUPER::new(@_); | |||||||||
| 84 | |||||||||||
| 85 | 0 | ($that->{Type}, $that->{Name}) = ($that->{TagSpec} =~ /(.)(.*)/); | |||||||||
| 86 | |||||||||||
| 87 | # A tag which starts with an alpha is a revision tag, so update Type | ||||||||||
| 88 | 0 | ▶ | if ($that->{Name} =~ /^[0-9]/) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 89 | 0 | $that->{Type} = TYPE_REVISION; | |||||||||
| 90 | } | ||||||||||
| 91 | |||||||||||
| 92 | 0 | return $that; | |||||||||
| 93 | } | ||||||||||
| 94 | |||||||||||
| 95 | ############################################################################### | ||||||||||
| 96 | # Instance routines | ||||||||||
| 97 | ############################################################################### | ||||||||||
| 98 | |||||||||||
| 99 | =head1 INSTANCE ROUTINES | ||||||||||
| 100 | |||||||||||
| 101 | =head2 B<get_name()> | ||||||||||
| 102 | |||||||||||
| 103 | $tag_string = $tagspec->get_name() | ||||||||||
| 104 | |||||||||||
| 105 | =over 4 | ||||||||||
| 106 | |||||||||||
| 107 | =item return type: scalar string | ||||||||||
| 108 | |||||||||||
| 109 | =back | ||||||||||
| 110 | |||||||||||
| 111 | Returns the name of the tagspec as a string | ||||||||||
| 112 | |||||||||||
| 113 | =cut | ||||||||||
| 114 | |||||||||||
| 115 | 0 | ▶ | sub get_name { | ||||||||
|
Subroutine
get_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 116 | 0 | my $self = shift; | |||||||||
| 117 | 0 | return $self->{Name}; | |||||||||
| 118 | } | ||||||||||
| 119 | |||||||||||
| 120 | =head2 B<get_type()> | ||||||||||
| 121 | |||||||||||
| 122 | $tag_type = $tagspec->get_type() | ||||||||||
| 123 | |||||||||||
| 124 | =over 4 | ||||||||||
| 125 | |||||||||||
| 126 | =item return type: scalar string | ||||||||||
| 127 | |||||||||||
| 128 | one of VCS::LibCVS::Datum::TagSpec::TYPE_* | ||||||||||
| 129 | |||||||||||
| 130 | =back | ||||||||||
| 131 | |||||||||||
| 132 | Returns the type of the tagspec | ||||||||||
| 133 | |||||||||||
| 134 | =cut | ||||||||||
| 135 | |||||||||||
| 136 | 0 | ▶ | sub get_type { | ||||||||
|
Subroutine
get_type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 137 | 0 | my $self = shift; | |||||||||
| 138 | 0 | return $self->{Type}; | |||||||||
| 139 | } | ||||||||||
| 140 | |||||||||||
| 141 | ############################################################################### | ||||||||||
| 142 | # Private routines | ||||||||||
| 143 | ############################################################################### | ||||||||||
| 144 | |||||||||||
| 145 | 0 | ▶ | sub _data_names { return ("TagSpec"); } | ||||||||
|
Subroutine
_data_names: not called CC=1 SCAR=6.9
| |||||||||||
| 146 | |||||||||||
| 147 | =head1 SEE ALSO | ||||||||||
| 148 | |||||||||||
| 149 | VCS::LibCVS::Datum | ||||||||||
| 150 | |||||||||||
| 151 | =cut | ||||||||||
| 152 | |||||||||||
| 153 | 1 | 1; | |||||||||