On Wed, 12 Mar 2003, John Levon wrote:

> On Wed, Mar 12, 2003 at 09:10:11AM +0000, Jos?  Matos wrote:
> 
> >   Are you implying that Lars doesn't scales up? ;-)
> 
> :)
> 
> > I think that all your critics are subversive (related with subversion) ;-)
> 
> Even that doesn't seem to do local repositories :(

Then have a look at BitKeeper, http://www.bitkeeper.com/   ifrc, it likes 
local repositories.. 

Or use the attached a script for changing CVS/Root btw, no guarantees 
of course 

>:->   (that's an "Evil Grin" btw)

/Christian

-- 
Christian Ridderström                           http://www.md.kth.se/~chr
#!/usr/local/bin/tcsh
#
set S=$0; set S0=$S:t
if("$1" == "" || "$1" == "-h" || "$1" == "--help") then
    cat <<EOF

Ex:     >$S0 -r "^/afs/md.kth.se/md/prj/cas/cvsroot" 
:ext:cvs:/afs/md.kth.se/md/prj/cas/cvsroot

        Does a 'find' for Root-files from the current directory and
        then executes this script on those files with the remaining
        arguments.

        For each of those Root-files, the text:
                ^/afs/md.kth.se/md/prj/cas/cvsroot
        is replaced with:
                :ext:cvs:/afs/md.kth.se/md/prj/cas/cvsroot

EOF
    exit
endif

if("$1" == "-d") set verbose=1;
while("$1" != "")
    switch("$1")
        case "-r":
            set recurse=1; shift; breaksw;
        case "-d":
            set verbose=1; set Verbose = 1; shift; breaksw;
        case "-v":
            set Verbose=1; shift; breaksw;
        case "-n":
            set noAction=1; shift; breaksw;
        default:
            break
    endsw
end

if($?recurse) then
    if($?Verbose) printf "Searching for files named Root\n"
    set rootFiles = ( `find . -type f -name Root` )
    if($?Verbose) printf "Found %d files named Root\n" $#rootFiles
    if($#rootFiles == 0) exit;

    if($# != 2) then
        printf "Error, illegal n:o of arguments!\n"
        exit -1
    endif
    set oldStr="$1"
    set newStr="$2"
else
    set rootFiles = ( $1 );
    if($# != 3) then
        printf "Error, illegal n:o of arguments!\n"
        exit -1
    endif
    set oldStr="$2"
    set newStr="$3"
endif

set TMPFIL=/tmp/cvsRoot$$
if($?Verbose) printf "Temporary file name is: '%s'\n" $TMPFIL
if($?Verbose) printf "Searching for '%s' to replace with '%s'\n" $oldStr $newStr
foreach f ( $rootFiles )
    if("$f:t" != "Root") then
        printf "Error, first argument must be path to a Root-file\n"
        printf "Instead it is: '%s'\n" "$f"
        exit -1
    endif
    if($?Verbose) printf 'Executing: grep -c "%s" %s\n' "$oldStr" "$f"
    set check = `grep -c "$oldStr" $f`
    if($?Verbose) printf "Result: %s\n" "$check"
    if("$check") then
        if($?Verbose) printf "Modifying '%s'\n" $f
        if(! $?noAction) then
            if($?Verbose) printf 'Executing: cat %s | sed "  s§%s§%s§" > %s\n' "$f" 
"$oldStr" "$newStr" "$TMPFIL"
            cat $f | sed "  s|${oldStr}|${newStr}|" > $TMPFIL
            mv $TMPFIL $f
        endif
    else
        if($?Verbose) printf "No match for '%s'\n" $f
    endif
end

Reply via email to