3 =head1 NAME $RCSfile: Baseline.pm,v $
5 Object oriented interface to UCM Streams
13 Andrew DeFaria <Andrew@ClearSCM.com>
21 Fri May 14 18:16:16 PDT 2010
25 $Date: 2011/11/15 01:59:07 $
31 Provides access to information about Clearcase Elements.
33 my $stream= new Clearcase::UCM::Stream ($name, $pvob);
37 This module implements a UCM Stream object
41 The following routines are exported:
45 package Clearcase::UCM::Baseline;
53 my ($self, %opts) = @_;
58 if ($_ eq 'cq' or $_ eq 'cqe' or $_ eq 'force' or $_ eq 'nc') {
60 } elsif ($_ eq 'c' or $_ eq 'cfile') {
61 $opts .= "-$_ $opts{$_}";
69 my ($class, $baseline, $pvob) = @_;
75 Construct a new Clearcase Stream object.
79 =for html <blockquote>
89 =for html </blockquote>
93 =for html <blockquote>
97 =item Clearcase Stream object
101 =for html </blockquote>
120 Returns the name of the stream
124 =for html <blockquote>
132 =for html </blockquote>
136 =for html <blockquote>
144 =for html </blockquote>
148 return $self->{name};
158 Returns the pvob of the stream
162 =for html <blockquote>
170 =for html </blockquote>
174 =for html <blockquote>
182 =for html </blockquote>
186 return $self->{pvob};
190 my ($self, $view, $comment, $opts) = @_;
196 Creates a new UCM Baseline Object
200 =for html <blockquote>
206 Options: Additional options to use
210 =for html </blockquote>
214 =for html <blockquote>
220 Status from cleartool
228 =for html </blockquote>
234 $comment = Clearcase::_setComment $comment;
236 return $Clearcase::CC->execute(
237 "mkbl $comment $opts -view " . $view->tag . ' ' . $self->{name}
242 my ($self, $opts) = @_;
252 =for html <blockquote>
260 Options: Additional options to use (e.g. -c, -force, etc.)
264 =for html </blockquote>
268 =for html <blockquote>
274 Remember to check status method for error, and/or output method for output.
278 =for html </blockquote>
284 return $Clearcase::CC->execute(
285 "rmbl $opts -force " . $self->{name} . '@' . $self->{pvob}->name
296 Returns a hash of the attributes associated with a baseline
300 =for html <blockquote>
308 =for html </blockquote>
312 =for html <blockquote>
318 Hash of attributes for this baseline
322 =for html </blockquote>
326 return $self->Clearcase::attributes(
328 "$self->{name}\@" . $self->{pvob}->name
333 my ($self, $type, $baseline, %opts) = @_;
339 Returns a hash of information regarding the difference between two baselines or
340 a baseline and the stream (AKA "top of stream").
344 =for html <blockquote>
348 =item [activities|versions|baselines]
350 Must specify one of [activities|versions|baselines]. Information will be
351 returned based on this parameter.
353 =item $baseline or $stream
355 Specify the baseline or stream to compare to. If not specified a -predeccsor
356 diffbl will be done. If a stream use "stream:<stream>" otherwise use
357 "baseline:<baseline>" or simply "<baseline>".
365 =for html </blockquote>
369 =for html <blockquote>
375 Depending on whether activites, versions or baselines were specified, the
376 returned hash will be constructed with the key being the activity, version
377 string or baseline name as the key with additional information specified as the
382 =for html </blockquote>
386 unless ($type =~ /^activities$/i or
387 $type =~ /^versions$/i or
388 $type =~ /^baselines$/i) {
389 croak "Type must be one of activities, versions or baselines in "
390 . "Clearcase::UCM::Baseline::diff - not $type";
393 my $myBaseline = "$self->{name}\@$self->{pvob}";
395 my $cmd = "diffbl -$type";
398 if ($baseline =~ /(\S+):/) {
399 unless ($1 eq 'baseline' or $1 eq 'stream') {
400 croak "Baseline should be baseline:<baseline> or stream:<stream> or "
405 $baseline .= "\@$self->{pvob}" unless $baseline =~ /\@/;
407 $cmd .= " $myBaseline $baseline";
409 $cmd .= " -predeccsor";
412 $Clearcase::CC->execute($cmd);
414 return if $Clearcase::CC->status;
416 my @output = $Clearcase::CC->output;
421 next unless /^(\>\>|\<\<)/;
423 if (/(\>\>|\<\<)\s+(\S+)\@/) {
424 $info{$2} = Clearcase::UCM::Activity->new($2, $self->{pvob});
435 =head2 ClearSCM Perl Modules
437 =for html <p><a href="/php/scm_man.php?file=lib/Clearcase.pm">Clearcase</a></p>
439 =head1 INCOMPATABILITIES
443 =head1 BUGS AND LIMITATIONS
445 There are no known bugs in this module.
447 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
449 =head1 LICENSE AND COPYRIGHT
451 Copyright (c) 2007, ClearSCM, Inc. All rights reserved.