httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <...@engelschall.com>
Subject Re: cvs commit: apache-2.0/src/main http_config.c
Date Sat, 20 May 2000 08:57:24 GMT

In article <200005191406.aa19552@gremlin-relay.ics.uci.edu> you wrote:

>>This was a mistake because I was talking to somebody while commiting, this
>>should have had Doug's name attached to it.  Is there anyway to add it
>>now?
> 
> Just for future reference, the best way to do it is to create your
> own sandbox repository on locus, like the one i used to have on hyperreal
> in my home directory, and copy the RCS file from the main repository
> to your own.  Then edit it (using some editor that doesn't automatically
> do silly things like reformat or modify tabs) and test the result on
> your own repository.  Finally, make sure that the version under the
> main repository hasn't changed and swap the modified file back in.
> The safest way to do that is to lock the directory under cvs first,
> but I don't know the command for that off-hand.

One can use Thomas Roessler <roessler@guug.de>'s cvslock
program for this purpose. It should be still available from
ftp://riemann.iam.uni-bonn.de/pub/users/roessler/cvslock/.

> Of course, someone could probably write a perl script for appending
> text to the changelog of a specific revision in an RCS file...

You don't have to (and should not ;) edit the RCS file manually. You
can use `cvs admin' for this task. I use the appended Perl program for
post-editing log messages which I've written some time ago. I always
run `cvs-logedit README:1.42' to edit the log message of revision 1.42
of file README. The program opens the editor for interactive adjustment
of the message and then replaces the log message via `cvs admin' if the
message really was changed.
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

#!/usr/bin/perl
##
##  cvs-logedit -- post-edit the log message of a CVS file's revision
##  Copyright (c) Ralf S. Engelschall <rse@engelschall.com> 
##

#   determine our environment
$CVS    = $ENV{CVS} || 'cvs';
$EDITOR = $ENV{EDITOR} || 'vi';
$TMPDIR = $ENV{TMP} || $ENV{TEMP} || $ENV{TMPDIR} || '/tmp';

#   fetch the CVS file and revision from the command line
(($file, $rev) = ($ARGV[0] =~ m|^(.+):([^:]+)$|))
    || die "Usage: $0 <file>:<rev>";

#   extract the old log message
$oldlog = `$CVS -f -Q -n -l log -r$rev $file`;
($oldlog =~ s|^.*?\nrevision $rev.+?date:.+?\n(.+\n)=====+.*$|$1|s) 
    || die 'CVS log output parsing error';
$oldlog = '' if ($oldlog =~ m|\*\*\* empty log message \*\*\*\n?|s);

#   now let the user interactively adjust the message
$dolog = $oldlog;
$dolog .= "CVS: -------------------------------------------------------\n" .
          "CVS: Edit the log message now. If no changes are made here,\n" .
          "CVS: nothing will be touched in the repository, of course.\n" .
          "CVS: -------------------------------------------------------\n";
$tmpfile = "$TMPDIR/$0.$$.log";
open(FP, ">$tmpfile") || die "cannot write tempfile";
print FP $dolog;
close(FP);
system("$EDITOR $tmpfile");

#   suck in the new message 
open(FP, "<$tmpfile") || die "cannot read tempfile";
$newlog = '';
$newlog .= $_ while (<FP>);
$newlog =~ s/^CVS: .+?$//mg;
$newlog =~ s/\n+$/\n/s;
$newlog =~ s/^\n+//s;
close(FP);

#   do nothing if message wasn't changed.
if ($oldlog eq $newlog) { 
    print STDERR "no changes made\n"; 
    exit(0);
}

#   finally replace the log message in the repository
#   (use of exec() instead of system() is intentionally here
#   because of newlines and other characters in $newlog!)
exec { "$CVS" } ('cvs', '-f', 'admin', '-m', "$rev:$newlog", $file);


Mime
View raw message