Changeset 209
- Timestamp:
- Jul 2, 2007, 6:01:28 PM (17 years ago)
- Location:
- trunk/dasscm
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dasscm/dasscm
r208 r209 8 8 qw($DASSCM_PROD $DASSCM_REPO $USER $DASSCM_USERNAME $DASSCM_USER $DASSCM_PASSWORD); 9 9 use Cwd; 10 use POSIX qw/getpgrp tcgetpgrp/; 10 11 use Term::ReadKey; 11 12 use File::Basename; 13 use File::Compare; 14 use File::Copy; 15 use File::Find; 12 16 use File::stat; 13 17 use File::Path; 14 use File::Copy;15 18 use Getopt::Long; 16 19 … … 46 49 47 50 my $verbose = 0; 51 52 # stores result from status (cvscheck) 53 my %status_removedfiles = (); 54 my %status_changedfiles = (); 48 55 49 56 ##################################################################### … … 179 186 } 180 187 188 # 189 # used by status 190 # checks for differences between PROD and (local) REPO 191 # 192 sub cvscheck 193 { 194 return unless -f; # keine Directories 195 return if $File::Find::dir =~ /\/CVS$/; # ignoriere CVS-Verzeichnisse 196 return 197 if $File::Find::dir =~ 198 /\/\.svn/; # ignoriere Subversion Verzeichnisse (inkl. Unterverzeichnisse) 199 my $cvsworkfile = "$File::Find::dir/$_"; 200 201 # Ursprungspfad ermitteln 202 # TODO: get_filename ? 203 $cvsworkfile =~ /${DASSCM_REPO}\/(.+)/; 204 my $realfile = "/" . $1; 205 206 # relativer Pfad zur CVS-Arbeitsdatei 207 my $relcvsworkfile = $1; 208 209 if ( !-r $realfile ) { 210 $status_removedfiles{"$realfile"} = $cvsworkfile; 211 } else { 212 ( -r "$cvsworkfile" ) || die("Fehler: $cvsworkfile ist nicht lesbar"); 213 if ( compare( $cvsworkfile, $realfile ) != 0 ) { 214 215 # Dateien unterscheiden sich 216 #(-w $cvsworkfile) || die("failed: no Fehler: kein Schreibrecht auf $cvsworkfile"); 217 # Arbeitskopie durch Kopie ersetzen 218 #copy($realfile,$cvsworkfile) || die("Fehler beim kopieren $realfile --> $cvsworkfile"); 219 $status_changedfiles{"$realfile"} = $cvsworkfile; 220 } 221 } 222 } 223 181 224 sub run_command 182 225 { … … 290 333 $ENV{'DASSCM_PASSWORD'} = $input_password; 291 334 292 # TODO: print environment 293 294 exec("bash") or die "can't login"; 335 print "subversion access okay\n\n", "DASSCM_USERNAME: $input_username\n", 336 "DASSCM_PASSWORD: (hidden)\n", "DASSCM_PROD: $DASSCM_PROD\n", 337 "DASSCM_REPO: $DASSCM_REPO\n", 338 "Server Repository: $DASSCM_SVN_REPOSITORY\n", "\n", "[dasscm shell]\n\n"; 339 340 exec("bash") or die "failed to start new shell"; 295 341 } 296 342 … … 404 450 run_command("diff $filename_repo $filename_prod"); 405 451 print @diff; 452 } 453 454 sub status(@) 455 { 456 check_parameter( @_, 1 ); 457 check_env(); 458 459 # 460 # update local repository 461 # 462 svn_update(); 463 464 # TODO: start at subdirectories ? 465 my $cvsworkdir = $DASSCM_REPO; 466 467 File::Find::find( \&cvscheck, $cvsworkdir ); 468 469 # Liste der geänderten Files ausgeben, falls nicht leer 470 # Anzahl Elemente im Hash??? 471 my @changedfiles = keys %status_changedfiles; 472 473 if ( %status_changedfiles or %status_removedfiles ) { 474 if (%status_removedfiles) { 475 print "deleted files:\n"; 476 foreach my $key ( values %status_removedfiles ) { 477 print "$key\n"; 478 } 479 print "\n"; 480 } 481 482 if (%status_changedfiles) { 483 print "modified files:\n"; 484 foreach my $key ( keys %status_changedfiles ) { 485 print "$key\n"; 486 } 487 } 488 } else { 489 print "no modified files found in $cvsworkdir\n"; 490 } 491 print "\n"; 492 406 493 } 407 494 … … 472 559 $command = "diff"; 473 560 diff(@ARGV); 561 } elsif (m/status/i) { 562 $command = "status"; 563 status(@ARGV); 474 564 } elsif (m/activate/i) { 475 565 ## TODO … … 480 570 } 481 571 482 # login483 572 # up 573 # cleanup (svn-commit.tmp) 484 574 # commitall 485 575 # revert
Note:
See TracChangeset
for help on using the changeset viewer.