info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

log_accum and spaces in directory names (was Re: loginfo %s question)


From: Emile Snyder
Subject: log_accum and spaces in directory names (was Re: loginfo %s question)
Date: Tue, 20 Nov 2001 15:37:29 -0800 (PST)

Thanks for the pointers.  I tried a different tack, which is a fairly
minimal change to the log_accum script.  log_accum was doing:

@files = split (/ /, $arg);
@path = split ('/', $files[0]);
$dir = join('/', @path);
$dir .= "/";

I do a little more work, and just check to see if the supposed directory
exists, pulling elements off the @files array and sticking them to the
directory path until I find a legal directory, or run out of parts. ie:

@files = split(/ /, $arg);
@path = split('/', $files[0]);
$dir = join('/', @path);
$f0 = shift (@files);
while (!(-e "$cvsroot/$dir" && -d "$cvsroot/$dir") && scalar(@files)) {
    $tmp = " " . shift (@files);
    $dir .= $tmp;
    $f0 .= $tmp;
}
unshift (@files, $f0);
@path = split ('/', $dir);
$dir = $dir . "/";

This fixes the space-in-dir-name issue, and should handle all sorts of
funny characters in directory names as far as I can tell.  Any glaring
problems anyone sees?

This doesn't get the actual names of the files right, but they don't
really get used for anything important anyway.  Getting the directory
right at least lets us match the stored "lastdirectory" and decide to send
the email.

Thanks everyone for feedback,
-emile

On Tue, 20 Nov 2001, Jerry Nairn wrote:

> 
> > From: Jerry Nairn [mailto:address@hidden
> > Sent: Tuesday, November 20, 2001 1:42 PM
> 
> > Maybe directory names with spaces were still a problem. It 
> > seems to me they
> > would be. I don't remember a solution to that problem.
> 
> As it turns out, everything represented by %(Vsv) on the loginfo command
> line is one argument, including the repository directory name at the start.
> So as long as you don't have directory names of the form:
> "1.0.6.0,jlkjl sfd,1.2.3"
> you should be all right.
> I'll send my copy of the scripts.
> Jerry
> 
> #After parsing out everything else, the last thin on the line is
> #the repository directory and the file list. set $filelist to this
> # The way I did this, directories cannot have commas in them.
> # This is an artificial limitation. It could be parsed better.
> 
> undef $special;
> if ($filelist =~ s/^([^\,]+)\s\-\s(New director.*|Imported sources)/$2/) {
>     $repodir = $1;
>     $special = $filelist;
> } else {
>     $filelist =~ s/^([^\,]+)\s(([0-9]+\.[0-9\.]*|NONE)\,.*)$/$2/;
>     $repodir = $1;
> }
> 
> if ($special) {
> ....
> }
> 
> while ($filelist) {
>     $filelist =~
> s/^\s?([0-9]+\.[0-9\.]*|NONE)\,([^\,]+)\,([0-9]+\.[0-9\.]*|NONE)(\s.*)?
> $/$4/;
>     $filename = $2;
>     $versions{$filename} = [$1, $3];
> ....
> }
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]