ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Scram/ScramProjectDB.pm
(Generate patch)

Comparing COMP/SCRAM/src/Scram/ScramProjectDB.pm (file contents):
Revision 1.5 by sashby, Wed May 30 12:47:01 2001 UTC vs.
Revision 1.6 by sashby, Mon Jun 18 15:19:51 2001 UTC

# Line 159 | Line 159 | sub removearea
159     my $self=shift;
160     my $name=shift;
161     my $version=shift;
162 +   my $vfound=0;
163 +   my $nfound=0;
164 +  
165 +   print "\n","Going to remove $name $version from the current scram database.....","\n";
166 +   print "\n";
167  
168 <   print "DEBUG: ",$name," ",$version,"\n";
169 <   print "Not yet implemented\n";
168 >   for ( my $index=0; $index<=$#{$self->{projects}}; $index++ )
169 >      {
170 >      # Look for a project with name $name:
171 >      if  ( $self->{projects}[$index][0] eq $name )
172 >         {
173 >         $nfound=1;
174 >         # Check the version:
175 >         if ( $self->{projects}[$index][1] eq $version )
176 >            {
177 >            # We have a match for project name and version:
178 >            $vfound=1;
179 >            print "Project $name Version $version exists. Remove it? (y/n): ";
180 >            if ( ! (<STDIN>=~/y/i ) )
181 >               {
182 >               print "\n","Aborting project removal...bye.\n\n";
183 >               return 1;
184 >               }
185 >            else
186 >               {
187 >               # Remove the project:
188 >               print "\n";
189 >               print "Removing project:\t$name\t$version","\n\n";
190 >               splice(@{$self->{projects}},$index,1);
191 >               }
192 >            }
193 >         }
194 >      }
195 >  
196 >   if ( ! $nfound || ! $vfound )
197 >      {
198 >      # There was a problem finding either the
199 >      # named project or the desired version:
200 >      print "ERROR: Unable to find project $name with version $version in the database.","\n\n";
201 >      return 1;
202 >      }
203 >  
204 >   print "\n";  
205 >   # Save our new array:
206 >   $self->_save();
207 >   return 0;
208     }
209  
210   sub link {
# Line 176 | Line 219 | sub link {
219   sub unlink {
220          my $self=shift;
221          my $file=shift;
179
222          my $db;
223 +        
224          for (my $i=0; $i<=$#{$self->{linkeddbs}}; $i++ ) {
225             $db=${$self->{linkeddbs}}[$i];
226             if  ( $db->file() eq $file ) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines