update_branches revision 514f6f14245f42c96f3d5e90462ce2ebe0597d2e
a6a23642eaf383add7a0be045c01e7dd8278ccafAndreas Gustafsson# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# Permission to use, copy, modify, and distribute this software for any
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# purpose with or without fee is hereby granted, provided that the above
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# copyright notice and this permission notice appear in all copies.
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# PERFORMANCE OF THIS SOFTWARE.
bcf15a19ae0efa72a22cdfb50666a3c6ce39eb9fTinderbox User# $Id: update_branches,v 1.19 2007/01/30 06:00:00 marka Exp $
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# Track which branches are still open or not in the bind9 cvs repository.
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# This is done so that work that is "in progress" (active) doesn't get
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# so easily forgotten about.
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# This script updates doc/private/branches by adding new branches and moving
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# closed branches to the end of the file. New branches are found by walking
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# the cvs repository and extracting the new branches from the header fields
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# of the files there.
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# doc/private/branches has one line per branch in the following field order:
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# name, status, to whom the branch belongs and comments. Comments are
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# in '(',')'. The first three field are single words.
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# Note: this is intended to be run on the machine hosting the CVS repository.
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews%history = ();
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# Make sure we have a up to date copy. If the previous ran failed for
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews# any reason remove it (-C).
2895f101b5585a19015ac2c2c1e1812ac467fa12Automatic Updater!system("cvs", "-d", $repository, "update", "-C", "doc/private/branches") || die "cannot update doc/private/branches: $!";
67adc03ef81fb610f8df093b17f55275ee816754Evan Hunt# load existing content
67adc03ef81fb610f8df093b17f55275ee816754Evan Huntopen(BRANCHES, "<doc/private/branches") || die "can't open util/branches: $!";
22f0b13f28a7df3b348b18848d0ccd745ea88c3cAndreas Gustafsson# T 1999-03-15 21:15 +0000 vixie bind [ietf44:A]
a3edcadfffbe617a419cdbe1bebb95f68a0eda1eMark Andrewsopen(HISTORY, "cvs history -T -a 2> /dev/null |") || die("can't get history");
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews s/:[^ \t]+$//;
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews ($tag, $date, $time, $tz, $who, $mod, $branch) = split;
afb33f777af856f8c3382604a7a8ffdfe2b512c5Automatic Updater# Search repository for new branches.
22f0b13f28a7df3b348b18848d0ccd745ea88c3cAndreas Gustafsson# New branches have the following format "name:<revision>.0.#"
a3edcadfffbe617a419cdbe1bebb95f68a0eda1eMark Andrews# where # is the number of potential branches from this the revision.
a3edcadfffbe617a419cdbe1bebb95f68a0eda1eMark Andrewsopen(FILES, "find $repository/$module -type f -name *,v -print |") || die "can't start find: $!";
089c63b69cdf6803aa8901aae3f2fbae58969511Automatic Updater open(FILE, "cvs -d $repository rlog -h $_|") || die "can't start cvs rlog -h $_: $!";
36da16fa31fa2a582afe67010ba449a57177fd2fAutomatic Updater next unless m/^symbolic names:$/; # skip until we find the tags
9ce6056d520aaf5241560fab6ab096c0d4e87b36Automatic Updater last if (m/^locks;/); # we are past the tags
ebabe300b615154d08f5577822cfd8726d2643c8Automatic Updater last if (m/^keyword/); # we are past the tags
3a32ac2a720653083c7a22cb654b86c398f6d4c8Tinderbox User chomp while (<FILE>); # let cvs rlog exit normally.
22f0b13f28a7df3b348b18848d0ccd745ea88c3cAndreas Gustafsson# Write out updated version.
428dc9698871ecfeda63eab31cd3523dd4befb31Mark Andrewsopen(BRANCHES, ">doc/private/newbranches") || die "can't open doc/private/branches: $!";
97bb3725292d3f74bcb0a32be6a76b2da34ba494Andreas Gustafssonprint BRANCHES "\nBranch\t\t\t\tStatus\tWhom\t// Comments\n";
c978c6cb6e0c38d8378b6cd1f6b5aac3cf91e36aAutomatic Updaterprint BRANCHES "-----------------------------------------------------------\n\n";
22f0b13f28a7df3b348b18848d0ccd745ea88c3cAndreas Gustafssonprint BRANCHES "\t\t\t\tnew\t\tnot yet classified\n";
a3edcadfffbe617a419cdbe1bebb95f68a0eda1eMark Andrewsprint BRANCHES "\t\t\t\topen\t\tdevelopement branch\n";
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrewsprint BRANCHES "\t\t\t\tactive\t\tnot a development branch\n";
a3edcadfffbe617a419cdbe1bebb95f68a0eda1eMark Andrewsprint BRANCHES "\t\t\t\treview\t\tready for review\n";
67adc03ef81fb610f8df093b17f55275ee816754Evan Huntprint BRANCHES "\t\t\t\tprivate\t\tprivate branch\n";
67adc03ef81fb610f8df093b17f55275ee816754Evan Huntprint BRANCHES "\t\t\t\tclosed\t\tfinished with\n";
848dcebe28e032abfc66e7f10686e1b04a8516feMark Andrews print BRANCHES "\t// $comments{$key}" if ($comments{$key} ne "");
a3edcadfffbe617a419cdbe1bebb95f68a0eda1eMark Andrews print BRANCHES "\t\t// $comments{$key}" if ($comments{$key} ne "");
c7f299247ca4460807f44b43f84ba19719646cc9Tinderbox User# Update if changed.
c7f299247ca4460807f44b43f84ba19719646cc9Tinderbox Userif (system("cmp", "-s", "doc/private/newbranches", "doc/private/branches")) {
c7f299247ca4460807f44b43f84ba19719646cc9Tinderbox User rename("doc/private/newbranches", "doc/private/branches") || die "Cannot rename: doc/private/newbranches -> doc/private/branches: $!";
d0d1dbab0fe2b940ffb4354dcadb30885f160770Tinderbox User !system("cvs", "-d", $repository, "commit", "-m", "auto update", "doc/private/branches") || die "cvs commit failed: $!";