Hi all,

I am looking for a Tcl script to check, if files are locked by somebody
(using strict locking)
I modified the SelectionTest.tcl script coming with WinCVS 1.1b14 to show
the $fileInfo(locked) files

Unfortunately the following statement seems always to return 1 (file locked)
even on unlocked files

        cvsout "--> Locked :       " $fileInfo(locked) "\n"   --> always 1, even
for not locked files

Is this a known bug or do I miss something obvious.

Here the script I am using:

#!CVSGUI1.0 --selection  --name "Lock sample"

global numFound
set numFound 0

proc iterate {dirName} {
        cvsentries $dirName browsit

        set selList [browsit get]
        set selSize [llength $selList]
        set toRecurse {}
        set printFlag 1

        for {set j 0} {$j < $selSize} {incr j} {
                set file [lindex $selList $j]
                browsit info $file fileInfo2

                if {[string compare $fileInfo2(kind) "file"] == 0} {
                        if {$fileInfo2(locked) == 1} {
                                if {$printFlag == 1} {
                                        cvsout "In $dirName :\n"
                                        set printFlag 0
                                }
                                cvserr "    $fileInfo2(name) is locked\n"
                                global numFound
                                incr numFound
                        }
                }

                if {[string compare $fileInfo2(kind) "folder"] == 0 && 
$fileInfo2(missing)
== 0 && $fileInfo2(unknown) == 0} {
                        lappend toRecurse $file
                }
        }

        set selRecurse [llength $toRecurse]
        for {set j 0} {$j < $selRecurse} {incr j} {
                set file [lindex $toRecurse $j]
                iterate $file
        }
}

set selList [cvsbrowser get]
set selSize [llength $selList]

cvsout "Looking for locked files...\n"
for {set i 0} {$i < $selSize} {incr i} {
        set file [lindex $selList $i]
        cvsbrowser info $file fileInfo

        if {[string compare $fileInfo(kind) "folder"] == 0 && $fileInfo(missing) ==
0 && $fileInfo(unknown) == 0} {
                iterate $file
        }
}


cvsout "Done !\n"
cvsout "$numFound file(s) locked !\n"


Thanks and best Regards,
Hans

Reply via email to