[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bitkeeper-users
Subject:    Re: [Bitkeeper-users] Tracking projects: "bk export" confusion, merging upstream changes, multiple l
From:       Thomas Glanzmann <sithglan () stud ! uni-erlangen ! de>
Date:       2004-10-04 9:28:26
Message-ID: 20041004092826.GI23683 () cip ! informatik ! uni-erlangen ! de
[Download RAW message or body]

Hello,
the ugly script.

	Thomas


#!/usr/bin/perl -w

use strict;
use Term::ReadKey;
use warnings FATAL => 'all';

my $basereleasepath = '/home/cip/adm/sithglan/.www/mutt/';
my $webtree         = '/home/cip/adm/sithglan/work/www/';
my $interdiff       = undef;
my $latestversion   = '1.5.6';
my $hr_alter        = 0;


my @branches = (
	{
		'branch' => '/proj/h7queen/mutt-hc',
		'name'   => 'mutt-cvs-header-cache.'
	},
	{
		'branch' => '/home/cip/adm/sithglan/work/mutt/mutt-hc-1.5.6',
		'name'   => 'patch-1.5.6.tg.hcache.'
	},
	{
		'branch' => '/home/cip/adm/sithglan/work/mutt/mutt-color-status',
		'name'   => 'patch-HEAD.tg.cstatus.'
	},
);

my @yes        = ( "\n", 'y', 'Y', 'j', 'J', 'z', 'Z', ' ' );

if (`uname` ne "Linux\n") {
	die ("ONLY RUN THIS ON *LINUX* POOL PCs");
}

sub
find_next_release_version
{
	my $r             = shift;
	my $next          = 0;

	do {
		$next++;
	} while (-f "${basereleasepath}/$r->{'name'}${next}");

	my $current = $next - 1;

	return ($current, $next);
}

sub
onechar
{
        my $key = '';

        open(TTY, "</dev/tty");
        ReadMode "raw";
        $key = ReadKey 0, *TTY;
        ReadMode "normal";
        close(TTY);

        return $key;
}

sub
ask
{
        my $key = '';

        print $_[0];

        $key = onechar();

        print "\n";

        if (grep($_ eq $key, @yes)) {
                return 1;

        } else {
                return undef;
        }
}

sub
hr
{
	if ($hr_alter == 1) {
		print "|" . "-" x 80 . "|\n";
		$hr_alter = 2;

	} elsif ($hr_alter == 2) {
		print "\\" . "-" x 80 . "/\n\n";
		$hr_alter = 0;

	} else {
		print "/" . "-" x 80 . "\\\n";
		$hr_alter = 1;
	}

}

sub
release_branch
{
	my $r = shift;

	if (! defined($r->{'branch'})) {
		die("fatal branch not defined.");
	}

	if (! defined($r->{'name'})) {
		die("fatal name not defined.");
	}

	hr();
	print "branch: $r->{'branch'} $r->{'name'}\n";
	hr();

	my ($current, $next) = find_next_release_version($r);
	my $tmppatch         = "/tmp/release-mutt.$$"; 

	chdir($r->{'branch'});

	# FIXME broken bk
	system("(/home/cip/adm/sithglan/work/mutt/add-PATCHES $r->{'name'}${next}; bk rset \
-hr`bk repogca`,+ | grep -v '^BitKeeper' | bk gnupatch -du -e -h -T) > ${tmppatch}");

	$interdiff = `/bin/bash -c "interdiff -d \\\*PATCHES <(filterdiff -x \\\*PATCHES \
${basereleasepath}/$r->{'name'}${current}) <(filterdiff -x \\\*PATCHES \
${tmppatch})"`;

	if ($interdiff eq "") {
		unlink($tmppatch);
		print STDERR "No diffs found. Aborting.\n";
		hr();
		return;
	}

	print $interdiff;

	if (! ask("Continue? ")) {
		hr();
		return;
	}

	system("bk tag $r->{'name'}${next}");

	`mv ${tmppatch} ${basereleasepath}/$r->{'name'}${next}`;

	chdir($webtree);

	system("bk co -l mutt/index.html");
	system("perl -p -i -e 's/$r->{'name'}${current}/$r->{'name'}${next}/g;' \
mutt/index.html");  system("bk ci -y'update from $r->{'name'}${current} to \
$r->{'name'}${next}' mutt/index.html");  system("vim mutt/index.html");
	system("bk commit");
	system("make");

	print "http://wwwcip.informatik.uni-erlangen.de/~sithglan/mutt/$r->{'name'}${next}\n";
  hr();
}

foreach my $r (@branches) {
	release_branch($r);
}


_______________________________________________
Bitkeeper-users mailing list
Bitkeeper-users@bitmover.com
http://bitmover.com/mailman/listinfo/bitkeeper-users
To unsubscribe from this list, go to the above URL, follow instruction at the bottom of the web page.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic