summaryrefslogtreecommitdiff
path: root/scripts/mkchlog
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mkchlog')
-rwxr-xr-xscripts/mkchlog102
1 files changed, 97 insertions, 5 deletions
diff --git a/scripts/mkchlog b/scripts/mkchlog
index 082b01b..b62b971 100755
--- a/scripts/mkchlog
+++ b/scripts/mkchlog
@@ -6,8 +6,93 @@
# for any purpose.
%logmsgs = (); # Index by date, time, and author
+%fileversions = ();
$skipme = 0;
+@cvsdirs=`find . -type d -name CVS -print`;
+map { chomp; s,^\./,, } @cvsdirs;
+foreach $d (@cvsdirs) {
+ if (open ENTRIES, "$d/Entries") {
+ local ($rootdir) = $d;
+ $rootdir =~ s/CVS$//;
+ while (<ENTRIES>) {
+ local ($type, $file, $version, @junk) = split /\//;
+ if ($type eq "") {
+ $file = "$rootdir$file";
+ $fileversions{$file} = $version;
+ }
+ }
+ close ENTRIES;
+ }
+}
+
+sub compare_versions
+{
+ # vw: version of the working file
+ # vl: version from the log
+ # The idea is that we want versions on the current branch, on branches
+ # leading to the current branch, and on the root prior to the current
+ # branch.
+ #
+ # Example: the current file is 1.5.12.2.4.3
+ #
+ # We want versions:
+ # 1.1
+ # 1.2
+ # 1.3
+ # 1.4
+ # 1.5
+ # 1.5.12.1
+ # 1.5.12.2
+ # 1.5.12.2.4.1
+ # 1.5.12.2.4.2
+ # 1.5.12.2.4.3
+ #
+ # We look at the numbers in pairs. The first number in each pair is
+ # the branch number; the second number is the version on the branch.
+ # The pairs are of the form (B, V).
+ #
+ # If the number of components in the log version is greater than the
+ # number of components in the working version, we aren't interested.
+ # This file cannot be a predecessor of the working version; it is
+ # either a branch off the working version, or it is an entirely different
+ # branch.
+ #
+ # We next iterate over all pairs in the log version. The following must
+ # be true for all pairs:
+ #
+ # Bw = Bl
+ # Vw >= Vl
+ #
+ # Note that there's no problem if the number of components in the
+ # working version exceeds the number of components in the log version.
+ #
+ # There is a special case: If the working version doesn't exist at all,
+ # we return true if the log version is on the mainline. This lets us
+ # see log messages from files that have been deleted.
+
+ my ($vw, $vl) = @_;
+ if ($vw eq "") {
+ return 2;
+ }
+ my (@vvw) = split /\./, $vw;
+ my (@vvl) = split /\./, $vl;
+ if ($#vvl > $#vvw) {
+ return 0;
+ }
+ my ($i);
+ for ($i = 0; $i < $#vvl; $i += 2) {
+ my ($bl) = $vvl[$i];
+ my ($vl) = $vvl[$i + 1];
+ my ($bw) = $vvw[$i];
+ my ($vw) = $vvw[$i + 1];
+ if ($bw != $bl || $vw < $vl) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
while (<>) {
if (/^Working file: /) {
chomp;
@@ -22,11 +107,18 @@ while (<>) {
next;
} elsif (/^revision /) {
($ignore, $revision) = split;
- @junk = split(/\./, $revision);
- if ($#junk > 2) {
- $skipme = 1;
- } else {
+ my ($check) =&compare_versions($fileversions{$currentfile}, $revision);
+ #
+ # Special case -- if a file is not in the current sandbox, but is
+ # at top level, log it; otherwise if it is not in the current
+ # sandbox, don't log it.
+ #
+ if (($check == 2 && !($currentfile =~ /\//) &&
+ ($currentfile =~ /\.[chly]$/)) ||
+ $check == 1) {
$skipme = 0;
+ } else {
+ $skipme = 1;
}
} elsif (/^date: /) {
($ignore, $date, $time, $ignore, $author, $ignore, $ignore,
@@ -51,7 +143,7 @@ while (<>) {
if ($skipme == 0) {
if ($logmsgs{$datetimeauthor}) {
$stuff = $logmsgs{$datetimeauthor};
- $stuff =~ s/\n/\n\t$currentfile ($revision) ($plus $minus)\n/;
+ $stuff =~ s/\n\n/\n\t$currentfile ($revision) ($plus $minus)\n\n/;
$logmsgs{$datetimeauthor} = $stuff;
} else {
$logmsgs{$datetimeauthor} = "Files:\t$currentfile ($revision) ($plus $minus)\n\n$body"