summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-23 15:57:33 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-23 15:57:33 +0000
commit720070c89d2ddc9a055f1846b35082bd85fadaae (patch)
tree4b860cddff927d5c8040d3cca275091cda762631
parent6d1504a783831e98d505b1cae74014b5714e825d (diff)
downloadATCD-720070c89d2ddc9a055f1846b35082bd85fadaae.tar.gz
ChangeLogTag: Mon Aug 23 10:56:40 1999 David L. Levine <levine@cs.wustl.edu>
-rw-r--r--ChangeLog-99b6
-rwxr-xr-xbin/cvslog164
2 files changed, 170 insertions, 0 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b
index c890fb9f9ff..be340d494ac 100644
--- a/ChangeLog-99b
+++ b/ChangeLog-99b
@@ -1,3 +1,9 @@
+Mon Aug 23 10:56:40 1999 David L. Levine <levine@cs.wustl.edu>
+
+ * bin/cvslog: added this wrapper around cvs log. It
+ expands ChangeLogTags to their ChangeLog entries.
+ Thanks to Luther for helping greatly with it.
+
Mon Aug 23 08:46:37 1999 David L. Levine <levine@cs.wustl.edu>
* ace/Object_Manager.{h,cpp}: replaced the use of
diff --git a/bin/cvslog b/bin/cvslog
new file mode 100755
index 00000000000..52c043daafc
--- /dev/null
+++ b/bin/cvslog
@@ -0,0 +1,164 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+#
+# Wraps cvs log, and substitutes messages of form "ChangeLogTag"
+# with their corresponding ChangeLog entries.
+#
+# Authors: Luther J. Baker and David L. Levine
+
+####
+#### global
+####
+use strict;
+my $dir_sep = $^O eq 'MSWin32' ? '\\' : '/';
+my $cvs_log_options = '';
+my @changelogs = ();
+my %changelog_hash = ();
+
+
+####
+#### main (I do this for reading clarity)
+####
+{
+ ####
+ #### Save any command line options (beginning with -), to pass to cvs log.
+ ####
+ while ($#ARGV >= $[ && $ARGV[0] =~ /^-/) {
+ $cvs_log_options .= $cvs_log_options ? " " . shift : shift;
+ }
+
+ ####
+ #### Build up the array of ChangeLog files to search,
+ ####
+ &find_changelogs($ARGV[0]);
+
+ ####
+ #### Build the hash table of key=tags value=entry
+ ####
+ &build_changelog_hash();
+
+
+ ####
+ #### Print the cvs log for each filename argument.
+ #### Inserting expanded entries after ChangeLog tags
+ ####
+ foreach my $arg (@ARGV) {
+ &print_log ($arg);
+ }
+}
+
+
+####
+#### Function surrounding cvs log
+####
+sub print_log () {
+ my $file = shift;
+
+ open (CVSLOG, "cvs log $cvs_log_options $file |") ||
+ die "$0: unable to open cvs log\n";
+
+ while (<CVSLOG>) {
+
+ if (/ChangeLog(Tag)?: *(.*)/i ||
+ /ChangeLog( *Entry)?: *(.*)/i) {
+
+ chomp;
+ print "$_:\n";
+
+ # An array reference HAS to be defined, the following will NOT work
+ # print "$changelog_hash{$2})" || "ChangeLogTag NOT FOUND!!!!\n";
+
+ if (defined $changelog_hash{$2}) {
+ print "@{$changelog_hash{$2}}";
+ } else {
+ warn "\n\tChangeLogTag \"$2\" NOT FOUND!!!!\n\n";
+ }
+
+ } else {
+ print;
+ }
+ }
+
+ close CVSLOG;
+}
+
+
+####
+#### Build the hash
+####
+sub build_changelog_hash () {
+ my $key = 0;
+ my @entry = ();
+
+ foreach my $changelog_file (@changelogs) {
+
+ open (CHANGELOG, $changelog_file) ||
+ die "$0: unable to open '$changelog_file'\n";
+
+ while (<CHANGELOG>) {
+ if (/^\w/) {
+ if ($key) {
+ if (defined $changelog_hash{$key}) {
+ #### Deal with multiple identical ChangeLogTags.
+ push @{$changelog_hash{$key}}, @entry;
+ } else {
+ $changelog_hash{$key} = [ @entry ];
+ }
+ }
+ @entry = ();
+ chomp;
+ $key = $_;
+ }
+ else {
+ push @entry, $_;
+ }
+ }
+
+ close CHANGELOG;
+ }
+}
+
+
+####
+#### Find the ChangeLog(s) associated with the file.
+####
+sub find_changelogs () {
+ my $file = shift;
+
+ if ($#changelogs >= 0) {
+ @changelogs;
+ } else {
+ my $pwd = &basename ($file) || '.';
+
+ #### The [C] ensures that the glob will actually look for the file.
+ while (! (@changelogs =
+ glob ("$pwd/[C]hangeLog " .
+ "$pwd/[C]hangeLog-97 " . #### ACE_wrappers/TAO
+ "$pwd/[C]hangeLog-97b " . #### ACE_wrappers
+ "$pwd/ChangeLog-9[89]* " .
+ "$pwd/ChangeLog-0*"))) {
+ if ($pwd !~ m%^${dir_sep}%) {
+ $pwd = `pwd`;
+ }
+ $pwd = &basename ($pwd);
+ if ($pwd eq '') {
+ warn "$0: ChangeLog NOT FOUND for '$file'!!!!\n";
+ return ();
+ }
+ }
+ }
+}
+
+
+####
+#### Return directory component of a filename, without trailing $dir_sep.
+#### Return '' if there is no directory component.
+####
+sub basename () {
+ my $filename = shift;
+
+ $filename =~ s%[${dir_sep}][^${dir_sep}]+$%% ? $filename : '';
+}