Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
2.9 KiB

  1. ($infile, $prfile, $outfile) = split( " ", $ARGV[0] );
  2. ($infile && $prfile) || die "Usage: SSReport.pl <SourceSafe Report Filename> <Notes Agent Filename> [Output Filename]\n";
  3. open (INFILE, "$infile") || die "Error opening $infile: $!\n";
  4. $i = 0;
  5. $isValidEntry = 0;
  6. while (<INFILE>)
  7. {
  8. if ( /\*{5,}\s{2}(.*)\s{2}\*{5,}/ )
  9. {
  10. if ( $isValidEntry )
  11. {
  12. $i++;
  13. }
  14. else
  15. {
  16. $isValidEntry = 1;
  17. }
  18. $Entry[$i] = "\tProject or File: $1\n";
  19. }
  20. elsif ( $isValidEntry )
  21. {
  22. if ( /\s*(\w{1,}\d*_\d{1,})\s*/ )
  23. {
  24. $prnumber = $1;
  25. if ( $PR[$i] ne "" )
  26. {
  27. if ( ! ($PR[$i] =~ /$prnumber/) )
  28. {
  29. $PR[$i] = "$PR[$i],$prnumber";
  30. }
  31. }
  32. else
  33. {
  34. $PR[$i] = $prnumber;
  35. }
  36. }
  37. $Entry[$i] = "$Entry[$i]\t$_";
  38. }
  39. }
  40. close INFILE;
  41. for ( $i = 0; $i < @Entry; $i++ )
  42. {
  43. if ( $PR[$i] ne "" )
  44. {
  45. @PrList = split( ",", $PR[$i] );
  46. for ( $j = 0; $j < @PrList; $j++ )
  47. {
  48. if ( $PrEntry{$PrList[$j]} ne "" )
  49. {
  50. $PrEntry{$PrList[$j]} = "$PrEntry{$PrList[$j]},$i";
  51. }
  52. else
  53. {
  54. $PrEntry{$PrList[$j]} = $i;
  55. }
  56. }
  57. }
  58. else
  59. {
  60. if ( $NoPrEntries ne "" )
  61. {
  62. $NoPrEntries = "$NoPrEntries,$i";
  63. }
  64. else
  65. {
  66. $NoPrEntries = $i;
  67. }
  68. }
  69. }
  70. if ( $prfile )
  71. {
  72. open (PRFILE, "$prfile") || die "Error opening $prfile: $!\n";
  73. while (<PRFILE>)
  74. {
  75. $line = "";
  76. /^\"(.*)\"$/ && ($line = $1);
  77. if ( $line ne "" )
  78. {
  79. $col1 = $col2 = $col3 = $col4 = "";
  80. ($col1, $col2, $col3, $col4 ) = split( "\",\"", $line );
  81. if ( $col1 ne "" )
  82. {
  83. $PrSubject{$col1} = $col2;
  84. $PrDevStatus{$col1} = $col3;
  85. $PrDocStatus{$col1} = $col4;
  86. }
  87. }
  88. }
  89. }
  90. if ( $outfile )
  91. {
  92. if ( -f "$outfile.bak" )
  93. {
  94. system ("del /f $outfile.bak");
  95. }
  96. if ( -f "$outfile" )
  97. {
  98. rename ("$outfile", "$outfile.bak") ||
  99. die "Error renaming $outfile to $outfile.bak: $!.\n";
  100. }
  101. open (OUTFILE, ">$outfile") || die "Error opening $outfile: $!\n";
  102. $outfile = OUTFILE;
  103. }
  104. else
  105. {
  106. $outfile = STDOUT;
  107. }
  108. foreach $PrNumber ( sort keys %PrEntry )
  109. {
  110. if ( $PrSubject{$PrNumber} ne "" )
  111. {
  112. print $outfile "PR: $PrNumber - $PrSubject{$PrNumber}\n";
  113. print $outfile "\tDev Status: $PrDevStatus{$PrNumber}\n";
  114. print $outfile "\tDoc Status: $PrDocStatus{$PrNumber}\n\n";
  115. @EntryList = split( ",", $PrEntry{$PrNumber} );
  116. for ( $i = 0; $i < @EntryList; $i++ )
  117. {
  118. print $outfile $Entry[$EntryList[$i]];
  119. }
  120. }
  121. }
  122. print $outfile "No PR's:\n";
  123. @EntryList = split( ",", $NoPrEntries );
  124. for ( $i = 0; $i < @EntryList; $i++ )
  125. {
  126. $ref = $i + 1;
  127. print $outfile "\tRef #: $ref\n";
  128. print $outfile $Entry[$EntryList[$i]];
  129. }
  130. exit 0;