#
# Copyright (C) 2005, 2007, 2012, 2016 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# $Id$
#
# Track which branches are still open or not in the bind9 cvs repository.
# This is done so that work that is "in progress" (active) doesn't get
# so easily forgotten about.
#
# closed branches to the end of the file. New branches are found by walking
# the cvs repository and extracting the new branches from the header fields
# of the files there.
#
# name, status, to whom the branch belongs and comments. Comments are
# in '(',')'. The first three field are single words.
#
# Note: this is intended to be run on the machine hosting the CVS repository.
#
%branches = ();
%whom = ();
%comments = ();
%history = ();
%dates = ();
$repository = "/proj/cvs/prod";
$module = "bind9";
#
# Make sure we have a up to date copy. If the previous ran failed for
# any reason remove it (-C).
#
!system("cvs", "-d", $repository, "update", "-C", "doc/private/branches") || die "cannot update doc/private/branches: $!";
#
# load existing content
#
while (<BRANCHES>) {
my $branch;
my $status;
my $who;
next if (/^-/);
next if (/^\s/);
$c = "";
if (m://.*:) {
$c = $_;
$c =~ s:.*?//\s*(.*)$:$1:;
s:(.*?)//.*:$1:;
} else {
#
# look for old style comment
#
if (m/\(.*\)/) {
$c = $_;
$c =~ s/.*\((.*)\).*$/$1/;
s/\(.*\)//;
}
}
s/\s*$//;
next if (/^\s*$/);
}
# T 1999-03-15 21:15 +0000 vixie bind [ietf44:A]
while (<HISTORY>) {
my $tag;
my $date;
my $time;
my $tz;
my $who;
my $mod;
my $branch;
s/[][]//g;
s/:[^ \t]+$//;
s/\s+/ /g;
# print "$_\n";
}
#
# Search repository for new branches.
#
# New branches have the following format "name:<revision>.0.#"
# where # is the number of potential branches from this the revision.
#
while (<FILES>) {
# print "file: $_\n"; # debug
# $file = $_; # save for branch debug below.
s:^$repository/::;
s:,v$::;
#
# use cvs so that the file is locked.
#
#print "cvs -d $repository rlog -h $_\n";
next unless m/\.0\.\d+$/; # skip if not a branch
s/\s(.*):.*/$1/; # extract label
} else {
}
# print "branch: $_ $file\n"; # debug
}
}
}
}
#
# Write out updated version.
#
print BRANCHES "\nBranch\t\t\t\tStatus\tWhom\t// Comments\n";
print BRANCHES "-----------------------------------------------------------\n\n";
print BRANCHES "\t\t\t\tnew\t\tnot yet classified\n";
print BRANCHES "\t\t\t\topen\t\tdevelopement branch\n";
print BRANCHES "\t\t\t\tactive\t\tnot a development branch\n";
print BRANCHES "\t\t\t\treview\t\tready for review\n";
print BRANCHES "\t\t\t\tprivate\t\tprivate branch\n";
print BRANCHES "\t\t\t\tclosed\t\tfinished with\n";
print BRANCHES "\n";
$tabs = 1;
} else {
$tabs++;
}
}
}
}
print BRANCHES "\n\n";
$tabs = 1;
} else {
$tabs++;
}
}
}
}
#
# Update if changed.
#
rename("doc/private/newbranches", "doc/private/branches") || die "Cannot rename: doc/private/newbranches -> doc/private/branches: $!";
!system("cvs", "-d", $repository, "commit", "-m", "auto update", "doc/private/branches") || die "cvs commit failed: $!";
} else {
}