update_branches revision b08e3be5dbfba22719ae9c428bd6853ac6f09798
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# Permission to use, copy, modify, and distribute this software for any
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# purpose with or without fee is hereby granted, provided that the above
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# copyright notice and this permission notice appear in all copies.
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# PERFORMANCE OF THIS SOFTWARE.
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrews# $Id: update_branches,v 1.13 2005/05/17 03:31:44 marka Exp $
95317501208f3bf5b159e6a40801b7069f68c486Mark Andrews# Track which branches are still open or not in the bind9 cvs repository.
95317501208f3bf5b159e6a40801b7069f68c486Mark Andrews# This is done so that work that is "in progress" (active) doesn't get
95317501208f3bf5b159e6a40801b7069f68c486Mark Andrews# so easily forgotten about.
95317501208f3bf5b159e6a40801b7069f68c486Mark Andrews# This script updates doc/private/branches by adding new branches and moving
95317501208f3bf5b159e6a40801b7069f68c486Mark Andrews# closed branches to the end of the file. New branches are found by walking
95317501208f3bf5b159e6a40801b7069f68c486Mark Andrews# the cvs repository and extracting the new branches from the header fields
95317501208f3bf5b159e6a40801b7069f68c486Mark Andrews# of the files there.
95317501208f3bf5b159e6a40801b7069f68c486Mark Andrews# doc/private/branches has one line per branch in the following field order:
95317501208f3bf5b159e6a40801b7069f68c486Mark Andrews# name, status, to whom the branch belongs and comments. Comments are
95317501208f3bf5b159e6a40801b7069f68c486Mark Andrews# in '(',')'. The first three field are single words.
01163d188b89911c3a23fe1125a4cab6764a408cMark Andrews# Make sure we have a up to date copy. If the previous ran failed for
01163d188b89911c3a23fe1125a4cab6764a408cMark Andrews# any reason remove it (-C).
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrews!system("cvs", "-d", $repository, "update", "-C", "doc/private/branches") || die "cannot update doc/private/branches: $!";
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# load existing content
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrewsopen(BRANCHES, "<doc/private/branches") || die "can't open util/branches: $!";
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# Search repository for new branches.
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrewsopen(FILES, "find $repository/$module -type f -name *,v -print |") || die "can't start find: $!";
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrews open(FILE, "cvs -d $repository rlog -h $_|") || die "can't start cvs rlog -h $_: $!";
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews next unless m/^symbols$/; # skip until we find the tags
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews next unless m/\.0\.\d$/; # skip if not a branch
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrews chomp while (<FILE>); # let cvs rlog exit normally.
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# Write out updated version.
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrewsopen(BRANCHES, ">doc/private/newbranches") || die "can't open doc/private/branches: $!";
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrewsprint BRANCHES "\nBranch\t\t\t\tStatus\tWhom\t// Comments\n";
c6313caa6cd9d011ac075048d2b62fd3410162dfMark Andrewsprint BRANCHES "----------------------------------------------------------\n\n";
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrewsprint BRANCHES "//\t\t\t\tnew\tnot yet clasified\n";
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrewsprint BRANCHES "//\t\t\t\topen\tdevelopement branch\n";
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrewsprint BRANCHES "//\t\t\t\tactive\tnot a development branch\n";
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrewsprint BRANCHES "//\t\t\t\treview\tready for review\n";
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrewsprint BRANCHES "//\t\t\t\tprivate\tprivate branch\n";
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrewsprint BRANCHES "//\t\t\t\tclosed\tfinished with\n";
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrews print BRANCHES "\t// $comments{$key}" if ($comments{$key} ne "");
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrews print BRANCHES "\t\t// $comments{$key}" if ($comments{$key} ne "");
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews# Update if changed.
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrewsif (system("cmp", "-s", "doc/private/newbranches", "doc/private/branches")) {
d9b4174233b951f25cd53a2787b9f14314258c2fMark Andrews rename("doc/private/newbranches", "doc/private/branches") || die "Cannot rename: doc/private/newbranches -> doc/private/branches: $!";
b08e3be5dbfba22719ae9c428bd6853ac6f09798Mark Andrews !system("cvs", "-d", $repository, "commit", "-m", "auto update", "doc/private/branches") || die "cvs commit failed: $!";