Hi,
This patch adds a '--delta' flag to cvs2cl - this is a simplistic
implementation that determines the last seen time for the two tags you
give it and trims the ChangeLog output based on those dates.
There's a possibility that this could yield too much or not enough log
info if a subset of the tags have been moved. (Or, conceivably, if you
hit the inherent race condition in a date-based algorithm, but thinking
about that makes my head hurt. ;)
One could write a dissertation on the problems with cvs' tagging scheme
- files that were deleted at a specific revision just aren't tagged, so
it's impossible to get complete information on the state of the
repository at the time of any given release. For files that are missing
one or both tags, you can only guess at the proper state based on the
latest tagged date. This implementation uses that date as the criteria
for *all* files, though.
Nonetheless, it should work for 90/99% of cases...
--- /usr/local/bin/cvs2cl Mon Feb 4 14:40:06 2002
+++ cvs2cl Mon Feb 4 22:09:11 2002
@@ -176,8 +176,17 @@
# What to put at the front of [each] ChangeLog.
my $ChangeLog_Header = "";
+# Whether to enable 'delta' mode, and for what start/end tags.
+my $Delta_Mode = 0;
+my $Delta_From = "";
+my $Delta_To = "";
+
## end vars set by options.
+# latest observed times for the start/end tags in delta mode
+my $Delta_StartTime = 0;
+my $Delta_EndTime = 0;
+
# In 'cvs log' output, one long unbroken line of equal signs separates
# files:
my $file_separator = "======================================="
@@ -584,8 +593,9 @@
# This may someday be used in a more sophisticated calculation
# of what other files are involved in this commit. For now, we
- # don't use it, because the common-commit-detection algorithm is
- # hypothesized to be "good enough" as it stands.
+ # don't use it much except for delta mode, because the
+ # common-commit-detection algorithm is hypothesized to be
+ # "good enough" as it stands.
$qunk{'time'} = $time;
# We might be including revision numbers and/or tags and/or
@@ -615,6 +625,25 @@
if (defined ($symbolic_names{$revision})) {
$qunk{'tags'} = $symbolic_names{$revision};
delete $symbolic_names{$revision};
+
+ # If we're in 'delta' mode, update the latest observed
+ # times for the beginning and ending tags, and
+ # when we get around to printing output, we will simply restrict
+ # ourselves to that timeframe...
+
+ if ($Delta_Mode) {
+ if (($time > $Delta_StartTime) &&
+ (grep { $_ eq $Delta_From } @{$qunk{'tags'}}))
+ {
+ $Delta_StartTime = $time;
+ }
+
+ if (($time > $Delta_EndTime) &&
+ (grep { $_ eq $Delta_To } @{$qunk{'tags'}}))
+ {
+ $Delta_EndTime = $time;
+ }
+ }
}
# Add this file to the list
@@ -719,6 +748,10 @@
foreach my $time (sort {$main::b <=> $main::a} (keys %changelog))
{
+ next if ($Delta_Mode &&
+ (($time <= $Delta_StartTime) ||
+ ($time > $Delta_EndTime && $Delta_EndTime)));
+
my $authorhash = $changelog{$time};
while (my ($author,$mesghash) = each %$authorhash)
{
@@ -1505,6 +1538,16 @@
{
if ($arg =~ /^-h$|^-help$|^--help$|^--usage$|^-?$/) {
$Print_Usage = 1;
+ }
+ elsif ($arg =~ /^--delta$/) {
+ my $narg = shift(@ARGV) || die "$arg needs argument.\n";
+ if ($narg =~ /^([A-Za-z][A-Za-z0-9_\-]*):([A-Za-z][A-Za-z0-9_\-]*)$/) {
+ $Delta_From = $1;
+ $Delta_To = $2;
+ $Delta_Mode = 1;
+ } else {
+ die "--delta FROM_TAG:TO_TAG is what you meant to say.\n";
+ }
}
elsif ($arg =~ /^--debug$/) { # unadvertised option, heh
$Debug = 1;
Received on Thu May 23 08:33:40 2002
This archive was generated by hypermail 2.1.8 : Wed Jan 21 2004 - 16:25:33 GMT