ctdelta 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/local/bin/perl
  2. if ($#ARGV < 0) {
  3. exit print "Usage: ctdelta element-name [...]\n" ;
  4. }
  5. $tool = $ENV{"DTOOL"} ;
  6. if ( $tool eq "" ) {
  7. die "not configured for using ct-tools\n" ;
  8. }
  9. require "$tool/include/ctutils.pl" ;
  10. require "$tool/include/ctvspec.pl" ;
  11. require "$tool/include/ctquery.pl" ;
  12. require "$tool/include/ctproj.pl" ;
  13. require "$tool/include/ctcm.pl" ;
  14. $comment = "" ;
  15. $skip = 0 ;
  16. @files = () ;
  17. foreach $item ( @ARGV ) {
  18. if ( $skip == 0 ) {
  19. if ( $item eq "-nc" ) {
  20. &CTUDebug( "-nc processed\n" ) ;
  21. } elsif ( $item eq "-c" ) {
  22. $skip = 1 ;
  23. } else {
  24. push( @files, $item ) ;
  25. &CTUDebug( "added '" . $item . "' to files to be processed\n" ) ;
  26. }
  27. } elsif ( $skip == 1 ) {
  28. $comment = $item ;
  29. &CTUDebug( "setting comment to '" . $comment . "'\n" ) ;
  30. $skip = 0 ;
  31. } else {
  32. &CTUDebug( "got to unknown skip value! (" . $skip . ")\n" ) ;
  33. $skip = 0 ;
  34. }
  35. }
  36. $projname = &CTProj ;
  37. $projname =~ tr/A-Z/a-z/ ;
  38. $flav = &CTQueryProj( $projname ) ;
  39. $spec = &CTResolveSpec( $projname, $flav ) ;
  40. foreach $item ( @files ) {
  41. if ( -e $item ) {
  42. &CTCMCheckin( $item, $projname, $spec ) ;
  43. if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
  44. print STDERR "Could not delta '$item'\n" ;
  45. }
  46. } else {
  47. print STDERR "No such file '$item'.\n" ;
  48. }
  49. }