X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=lib%2FClearcase%2FView.pm;h=7a59cd2191bc9ed9b9aed0cc9ed5ef1174074a8f;hb=e907bf835bb61d8888f2fcd59c90bd071e841cf7;hp=77cfc6a9f5a156e14c7bf4e0de3e95ba1530eb48;hpb=1140ca8d56832ae529db0f353112ac192cdf9432;p=clearscm.git diff --git a/lib/Clearcase/View.pm b/lib/Clearcase/View.pm index 77cfc6a..7a59cd2 100644 --- a/lib/Clearcase/View.pm +++ b/lib/Clearcase/View.pm @@ -127,8 +127,8 @@ use warnings; use Clearcase; use Display; -sub new ($) { - my ($class, $tag) = @_; +sub new ($;$) { + my ($class, $tag, $region) = @_; =pod @@ -172,7 +172,7 @@ Returns: my $self = bless { tag => $tag }, $class; - $self->updateViewInfo; + $self->updateViewInfo ($region); return $self; } # new @@ -1170,11 +1170,6 @@ Returns: return $self->{tag}; } # tag -# Alias name to tag -sub name() { - goto &tag; -} # name - sub text_mode () { my ($self) = @_; @@ -1368,7 +1363,7 @@ Returns: } # exists sub create (;$$$) { - my ($self, $host, $vws, $opts) = @_; + my ($self, $host, $vws, $region) = @_; =pod @@ -1414,37 +1409,34 @@ Ouput from cleartool =cut + $region ||= $Clearcase::CC->region; + if ($self->exists) { - $self->updateViewInfo; + $self->updateViewInfo ($region); return (0, ()) } # if my ($status, @output); - $opts ||= ''; - if ($host && $vws) { - ($status, @output) = $Clearcase::CC->execute( - "mkview -tag $self->{tag} $opts " . - "-host $host -hpath $vws -gpath $vws $vws" - ); + ($status, @output) = + $Clearcase::CC->execute ("mkview -tag $self->{tag} -region $region " + . "-host $host -hpath $vws -gpath $vws $vws"); } else { # Note this requires that -stgloc's work and that using -auto is not a # problem. - ($status, @output) = $Clearcase::CC->execute( - "mkview -tag $self->{tag} $opts -stgloc -auto" - ); + ($status, @output) = + $Clearcase::CC->execute ("mkview -tag $self->{tag} -stgloc -auto"); } # if - $self->updateViewInfo; + $self->updateViewInfo ($region); return ($status, @output); } # create -# TODO Is this used? sub createUCM ($$) { - my ($self, $stream, $pvob) = @_; + my ($self, $stream, $pvob, $region) = @_; =pod @@ -1490,10 +1482,14 @@ Array of output =cut - return (0, ()) if $self->exists; + $region ||= $Clearcase::CC->region; + + return (0, ()) + if $self->exists; # Update object members - $self->{pvob} = $pvob; + $self->{stream} = $stream; + $self->{pvob} = $pvob; # Need to create the view my ($status, @output) = @@ -1503,7 +1499,7 @@ Array of output return ($status, @output) if $status; - $self->updateViewInfo; + $self->updateViewInfo ($region); return ($status, @output); } # createUCM @@ -1549,13 +1545,12 @@ Ouput from cleartool =cut - return (0, ()) unless $self->exists; + return (0, ()) + unless $self->exists; my ($status, @output); if ($self->dynamic) { - $self->stop; - ($status, @output) = $Clearcase::CC->execute ( "rmview -force -tag $self->{tag}" ); @@ -1749,11 +1744,13 @@ Ouput from cleartool return ($status, @output); } # set -sub updateViewInfo () { - my ($self) = @_; +sub updateViewInfo ($$) { + my ($self, $region) = @_; + + $region ||= $Clearcase::CC->region; my ($status, @output) = $Clearcase::CC->execute ( - "lsview -long -properties -full $self->{tag}" + "lsview -region $region -long -properties -full $self->{tag}" ); # Assuming this view is an empty shell of an object that the user may possibly