Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Sep 1999 11:46:38 -0700
From:      Darryl Okahata <darrylo@sr.hp.com>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Poul-Henning Kamp <phk@critter.freebsd.dk>, freebsd-current@FreeBSD.ORG
Subject:   Re: ccd build failure 
Message-ID:  <199909231846.LAA04038@mina.sr.hp.com>

next in thread | raw e-mail | index | archive | help
--Multipart_Thu_Sep_23_11:46:38_1999-1
Content-Type: text/plain; charset=US-ASCII

     In the interests of peace and harmony (;-), I'd like to submit the
attached perl script, which lists the status of cvs-controlled files.
In particular, it's very useful for determining which files have been
modified but not committed, like:

i386/linux/linux_file.c                            Locally Modified
kern/imgact_elf.c                                  Locally Modified

CVS is severely lacking in many areas (it is all we have, though), and
one thing it is missing is an easy way of showing concise file status.
As a result, it's easy to forget about locally-modified files.  This
perl script will list all files, in the current directory and below,
that do not have a status of "Up-to-date", such as those which have been
locally modified or which need updating.

     To use this script, just cd to some directory that contains cvs-
controlled files and run the script.  A list of non-up-to-date files in
the current directory and below will be listed.  Note that this script
isn't particularly fast, as it has to execute a cvs command in each and
every directory (due to cvs deficiencies).  As examples, the script
takes around 3 minutes to run under /usr/src/sys, and around 30 minutes
for /usr/src (checked out via "cvs checkout src").

[ My (local, mirrored via cvsup) repository is accessed via pserver
  over 128K ISDN, and so there's a good chance that many people will see
  better performance.  ]

--
	Darryl Okahata
	darrylo@sr.hp.com

DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion, or policy of Hewlett-Packard, or of the
little green men that have been following him all day.


--Multipart_Thu_Sep_23_11:46:38_1999-1
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: attachment; filename="cvsinfo"
Content-Transfer-Encoding: quoted-printable

#! /usr/bin/perl
#########################################################################=
######
#
# File:         cvsinfo
# RCS:          $Header: $
# Description:  =

# Author:       Darryl Okahata
# Created:      Wed Jul 15 14:52:01 1998
# Modified:     Thu Sep 23 11:35:35 1999 (Darryl Okahata) darrylo@sr.hp.c=
om
# Language:     CPerl
# Package:      N/A
#
# (C) Copyright 1998, Hewlett-Packard, all rights reserved.
#
#########################################################################=
######

$listfile =3D ".changed-files";

#########################################################################=
######

require 'getopts.pl';
&Getopts('ac');
$all_status =3D 1 if ($opt_a);
$update_changed_file =3D 1 if ($opt_c);

require "pwd.pl";
&initpwd;

$top_dir =3D $ENV{'PWD'};

#########################################################################=
######

open(DIRS, "find . -type d | sort |") || die "$!";

while ($dir =3D <DIRS>) {
    chdir($top_dir);		# make sure we're in a known location
    chop($dir);
    $dir =3D~ s|^\./||;
    $dir =3D '.' if ($dir eq '');
#    print "$dir\n";
    next if (!-d "$dir/CVS");
    &process_dir($dir);
}

close(DIRS);

if ($update_changed_file) {
    unlink($listfile);
    open(OUT, ">$listfile") || die "$listfile: $!";
    if ($#update_files >=3D 0) {
	foreach $file (sort @update_files) {
	    print OUT "$file\n";
	}
    }
    close(OUT);
}

exit 0;

#########################################################################=
######

sub process_dir
{
    local($dir) =3D @_;
    local($file, $status, $cmd);

#    print "$dir\n";
    chdir($dir);
    $cmd =3D "cvs status -l";
    open(IN, "$cmd 2>&1 |") || die "$!";
    while (<IN>) {
	if (/^File:\s+([^\s]+)\s+Status:\s+(.+)$/i){
	    $file =3D $1;
	    $status =3D $2;
	    if ($all_status || $status ne 'Up-to-date') {
		if ($status eq 'Needs Patch') {
		    $status =3D 'Needs Updating';
		}
		printf("%-50s %s\n", ($dir eq '.') ? $file : "$dir/$file",
		       $status);
		if ($status =3D~ /Locally Modified/) {
		    push(@update_files, $file);
		}
	    }
	} elsif (/\[status\s+aborted\]/) {
	    die "$_\n";
	}
#	print;
    }
    close(IN);
}

--Multipart_Thu_Sep_23_11:46:38_1999-1--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909231846.LAA04038>