update_branches revision 8f8634e66351e292925dde8ab6b0418a0141f86a
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# Permission to use, copy, modify, and distribute this software for any
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# purpose with or without fee is hereby granted, provided that the above
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# copyright notice and this permission notice appear in all copies.
d6fa26d0adaec6c910115be34fe7a5a5f402c14fMark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# PERFORMANCE OF THIS SOFTWARE.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# $Id: update_branches,v 1.17 2005/05/18 03:31:31 marka Exp $
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Track which branches are still open or not in the bind9 cvs repository.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# This is done so that work that is "in progress" (active) doesn't get
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# so easily forgotten about.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This script updates doc/private/branches by adding new branches and moving
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# closed branches to the end of the file. New branches are found by walking
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# the cvs repository and extracting the new branches from the header fields
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# of the files there.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User# doc/private/branches has one line per branch in the following field order:
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# name, status, to whom the branch belongs and comments. Comments are
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User# in '(',')'. The first three field are single words.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Note: this is intended to be run on the machine hosting the CVS repository.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Make sure we have a up to date copy. If the previous ran failed for
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User# any reason remove it (-C).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein!system("cvs", "-d", $repository, "update", "-C", "doc/private/branches") || die "cannot update doc/private/branches: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# load existing content
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Useropen(BRANCHES, "<doc/private/branches") || die "can't open util/branches: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Search repository for new branches.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# New branches have the following format "name:<revision>.0.#"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# where # is the number of potential branches from this the revision.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Useropen(FILES, "find $repository/$module -type f -name *,v -print |") || die "can't start find: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein open(FILE, "cvs -d $repository rlog -h $_|") || die "can't start cvs rlog -h $_: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein next unless m/^symbolic names:$/; # skip until we find the tags
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User last if (m/^keyword/); # we are past the tags
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User next unless m/\.0\.\d$/; # skip if not a branch
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User chomp while (<FILE>); # let cvs rlog exit normally.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# Write out updated version.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Useropen(BRANCHES, ">doc/private/newbranches") || die "can't open doc/private/branches: $!";
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userprint BRANCHES "\nBranch\t\t\t\tStatus\tWhom\t// Comments\n";
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userprint BRANCHES "-----------------------------------------------------------\n\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprint BRANCHES "\t\t\t\tnew\t\tnot yet classified\n";
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userprint BRANCHES "\t\t\t\topen\t\tdevelopement branch\n";
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userprint BRANCHES "\t\t\t\tactive\t\tnot a development branch\n";
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userprint BRANCHES "\t\t\t\treview\t\tready for review\n";
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userprint BRANCHES "\t\t\t\tprivate\t\tprivate branch\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprint BRANCHES "\t\t\t\tclosed\t\tfinished with\n";
$tabs = 1;
$tabs++;
$tabs = 1;
$tabs++;
rename("doc/private/newbranches", "doc/private/branches") || die "Cannot rename: doc/private/newbranches -> doc/private/branches: $!";