#!/usr/bonsaitools/bin/mysqltcl # -*- Mode: tcl; indent-tabs-mode: nil -*- # # The contents of this file are subject to the Netscape Public License # Version 1.0 (the "License"); you may not use this file except in # compliance with the License. You may obtain a copy of the License at # http://www.mozilla.org/NPL/ # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the # License for the specific language governing rights and limitations # under the License. # # The Original Code is the Bonsai CVS tool. # # The Initial Developer of the Original Code is Netscape Communications # Corporation. Portions created by Netscape are Copyright (C) 1998 # Netscape Communications Corporation. All Rights Reserved. source CGI.tcl Lock LoadCheckins LoadTreeConfig Unlock # Stupid hack to make an empty array: set peoplearray(zzz) 1 unset peoplearray(zzz) set versioninfo "" proc BreakBig {str} { set result {} while {[clength $str] > 20} { set head [crange $str 0 19] set w [string last "/" $head] if {$w < 0} { set w 19 } append result "[crange $str 0 $w]
" incr w set str [crange $str $w end] } append result $str } set tweak [info exists FORM(tweak)] set delta_size 1 ;#[info exists FORM(delta_size)] puts "Content-type: text/html" if {[info exists FORM(sort)]} { puts "Set-Cookie: SORT=$FORM(sort)" } elseif {[info exists COOKIE(SORT)]} { set FORM(sort) $COOKIE(SORT) } else { set FORM(sort) date } puts " " if {[info exists FORM(person)]} { puts "Checkins for $FORM(person)" puts "

Checkins for $FORM(person)

" set list {} foreach i $checkinlist { upvar #0 $i info if {[cequal $info(person) $FORM(person)]} { lappend list $i } } } elseif {[info exists FORM(mindate)] || [info exists FORM(maxdate)]} { set str "Checkins" set min 0 set max [expr 1<<30] if {[info exists FORM(mindate)]} { set min $FORM(mindate) append str " since [fmtclock $min "%m/%d %H:%M"]" if {[info exists FORM(maxdate)]} { append str " and" } } if {[info exists FORM(maxdate)]} { set max $FORM(maxdate) append str " before [fmtclock $max "%m/%d %H:%M"]" } puts "$str" puts "

$str

" set list {} foreach i $checkinlist { upvar #0 $i info if {$info(date) >= $min && $info(date) <= $max} { lappend list $i } } } else { puts "All checkins" puts "

All Checkins

" set list $checkinlist } if {$readonly} { puts "

Be aware that you are looking at an old hook!

" } puts "(Current sort is by $FORM(sort); click on a column header to sort by that column.)" # Oh, boy, is this ever gross. Dynamically write some code to be the sort # comparison routine, so that we know that the sort code will run fast. set fields [split $FORM(sort) ","] set w [lsearch $fields "date"] if {$w >= 0} { set fields [lrange $fields 0 [expr $w - 1]] } set body { upvar #0 $n1 a $n2 b } foreach i $fields { append body "set delta \[string compare \$a($i) \$b($i)\]" append body "\n" append body {if {$delta != 0} {return $delta}} append body "\n" } append body {return [expr $b(date) - $a(date)]} eval [list proc Compare {n1 n2} $body] set total_added 0 set total_removed 0 # # Calculate delta information # if {$delta_size} { foreach i $list { upvar #0 $i info set info(added) 0 set info(removed) 0 # # Loop through the checkins, grab the filename and stickyflags # if {[info exists info(fullinfo)]} { foreach fu $info(fullinfo) { set fn [lindex $fu 0] set sticky [lindex $fu 4] # # if the file is binary, don't show the delta information # if { ![string match {*.gif} $fn] && ![string match {*.bmp} $fn] && ![string match {-kb} $sticky]} { scan [lindex $fu 2] {%d} file_added scan [lindex $fu 3] {%d} file_removed if {[info exists file_added] && [info exists file_removed]} { incr info(added) $file_added incr info(removed) $file_removed } } } } set info(lines_changed) [format "%7d" [expr 1000000 - ($info(added) - $info(removed))]] incr total_added $info(added) incr total_removed $info(removed) } } set list [lsort -command Compare $list] regsub -all {[&?]sort=[^&]*} $buffer {} otherparams proc NewSort {key} { global otherparams FORM set list [split $FORM(sort) ","] set w [lsearch $list $key] if {$w >= 0} { set list [lreplace $list $w $w] } set list [linsert $list 0 $key] return "[set otherparams]&sort=[join $list ,]" } if {$tweak} { puts "
" } puts " " if {$tweak} { puts "" } puts " " set count 0 set maxcount 100 set branchpart {} if {![cequal $treeinfo($treeid,branch) {}]} { set branchpart "&branch=$treeinfo($treeid,branch)" } foreach i $list { upvar #0 $i info incr count if {$count >= $maxcount} { set count 0 # Don't make tables too big, or toy computers will break. puts "
When Tree state Who Directory Files" if {$delta_size} { puts "+/-" } puts " Description
" } puts "" if {$tweak} { puts "" } puts "" puts "" set peoplearray($info(person)) 1 puts "" puts "" puts "" if {$delta_size} { puts "" } if {[info exists info(fullinfo)]} { foreach f $info(fullinfo) { lassign $f file version append versioninfo "$info(person)|$info(dir)|$file|$version," } } puts "" puts "" } puts "
" puts "[fmtclock $info(date) "%m/%d %H:%M"]" if {$info(treeopen)} { puts "open" } else { puts "CLOSED" } if {[info exists info(notes)]} { if {![cequal $info(notes) ""]} { puts "
$info(notes)" } } puts "
$info(person)[BreakBig $info(dir)]" foreach f $info(files) { puts "$f" } puts "" if {$info(removed) < 0} { set str_removed $info(removed) } else { set str_removed "-0" } puts "+$info(added)
$str_removed" puts "
$info(log)
" if {$delta_size} { set deltastr "     Lines changed ($total_added/$total_removed)." } else { set deltastr "" } puts "[llength $list] checkins listed. $deltastr" if {$tweak} { puts "
Check the checkins you wish to affect. Then select one of the below options. And type the magic word. Then click on submit.

Delete these checkins.
Set the tree state on these checkins to be Open.
Set the tree state on these checkins to be Closed.
Move these checkins over to this tree:

Password:

" } else { puts "          " puts "Tweak some of these checkins." puts "

" puts "
" puts "" puts "" puts "
" } if {[info exists FORM(ltabbhack)]} { puts "" puts "" } PutsTrailer