Re: CVS - setup reserved checkout

2001-10-29 Thread David Gravereaux

[EMAIL PROTECTED] (Kaz Kylheku) wrote:

Tell the manager to shed his or her superstitions, and work with
the facts. The facts are:

- Concurrent development works just fine.
- Your team already likes it.
- Strict locking does not prevent concurrency, it only reduces
  it to a coarse granularity: coarse enough to interfere with
  productivity, but not coarse enough to eradicate conflicts.
  To eliminate conflicts, you have to lock the entire repository
  so that only one developer at a time can do anything on the
  software base as a whole.

Well said.  May I add, Concurrency works best with good communication among the
developers.  Responsibility of certain sections of code is usually divvied among
just a few people.  Strict locking might hurt the need for good communication
among a group.
--
David Gravereaux [EMAIL PROTECTED]

$ make war
make: *** No rule to make target `war'.  Stop.  Try `love' instead.
___
Info-cvs mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/info-cvs



Re: How to generate a ChangeLog file from CVS?

2000-04-11 Thread David Gravereaux

Mark Derricutt [EMAIL PROTECTED] wrote:

On Mon, 10 Apr 2000, Ronald Henderson wrote:

 http://www.red-bean.com/~kfogel/cvs2cl.shtml

I was wondering if there's a ChangeLog script available that works under
NT/95 against a pserver?

Mark

Mark,

Here's one I wrote for WinCVS.  It isn't as complete as cvs2cl.pl, but like
everything, it'll grow over time.
--
* David Gravereaux *
Tomahawk Software Group

If knowlege is power, how come the more I learn, the more I realize how much I don't 
know?
That isn't very empowering.


#!CVSGUI1.0 --selection --name "Build ChangeLog"

# this will be a WinCVS macro for generating a ChangeLog
# It isn't finished at this time.  A work in progress...
#
# Please send diffs to David Gravereaux [EMAIL PROTECTED]
# if you can improve this :)
#
# RCS: @(#) $Id: cvs2cl.tcl,v 1.4 2000/03/06 02:32:45 davygrvy Exp $


namespace eval ::Cvs2CL {
  variable db  ;# our database array
  array set db [list]
  variable usermap ;# user translations from $CVSROOT/CVSROOT/users
  array set usermap [list]
  variable outputList [list]   ;# the "structure" we write output from
  variable sorter [list]   ;# the pre-sort helper list
  variable CLog_fname "ChangeLog"  ;# the output filename we want to use
  variable rawLog  ;# All the log in one string before parsing
  variable major [lindex [split $::tcl_version .] 0]
  variable minor [lindex [split $::tcl_version .] 1]
}


proc ::Cvs2CL::Init {} {
  variable CLog_fname
  variable rawLog
  variable usermap

  if {[regexp {^(.*)wincvs.exe$} [info nameofexecutable]]} {
set cvsCmd [list cvs -Q log]

# uncomment this stuff when the replace works in [Cvs2CL::ReWriteIt]
#
#if {![catch {set fOldLog [open $CLog_fname r]}]} {
#  cvsout "Checking date range of current $CLog_fname...\n"
#  # the first "word" of the first line is a date string.
#  # we ask cvs for logs greater than this old date
#  lappend cvsCmd -d "[join [split [lindex [split [gets $fOldLog] { }] 0] /] -]"
#  close $fOldLog
#}

cvsout "Downloading the log...\n"
set rawLog [eval $cvsCmd]

# TODO: fill the usermap array here

  } else {

# debugging under tclsh82

puts "Checking date range..."
set cvsCmd [list cvs -Q log]
#if {![catch {set fOldLog [open $CLog_fname r]}]} {
#  # the first "word" of the first line is a date string.
#  lappend cvsCmd -d "[lindex [split [gets $fOldLog] { }] 0]"
#  close $fOldLog
#}
#puts $cvsCmd

set flog [open c:/dev/logItcl.txt r]
fconfigure $flog -encoding ascii -translation auto

# bring the file into Tcl in one big SLAM!
# this of-course assumes one character==one byte
seek $flog 0 end
set theEnd [tell $flog]
seek $flog 0 start
fconfigure $flog -buffersize $theEnd
puts "Downloading the log..."
set rawLog [read $flog $theEnd]
close $flog

proc ::cvsout {text} {puts -nonewline $text}
  }
}


proc ::Cvs2CL::cmpTime {a b} {
  variable major
  variable minor

  if {$major = 8  $minor  3} {
# ISO8601 date formats can't be scanned by tcl8.2, bummer...
# works in 8.3, though...
#
# clock scan wants mm/dd/, so convert it from -mm-dd.
#
set al [split $a -]
set a [lreplace $a 0 0 [list "[lindex $al 1]/[lindex $al 2]/[lindex $al 0]"]]
set bl [split $b -]
set b [lreplace $b 0 0 [list "[lindex $bl 1]/[lindex $bl 2]/[lindex $bl 0]"]]
  }
  return [expr {[clock scan $a -gmt 1] - [clock scan $b -gmt 1]}]
}


proc ::Cvs2CL::cmpTI {a b} {
  if {[set sort [cmpTime [lindex $a 0] [lindex $b 0]]] == 0} {
return [expr {[lindex $b 1] - [lindex $b 1]}]
  }
  return $sort
}


proc ::Cvs2CL::cmpDA {a b} {
  set dateA [lindex [split $a ,] 0]
  set dateB [lindex [split $b ,] 0]
  return [cmpTime $dateA $dateB]
}


proc ::Cvs2CL::cmpInt {a b} {
  return [expr {$a - $b}]
}


proc ::Cvs2CL::ParseIt {} {
  variable db
  variable sorter
  variable rawLog
  variable CLog_fname

  array set db {}
  set sorter {}
  set id 0

  #  make each line a list element
  set rawLogList [split $rawLog \n]

  # count the number of lines
  set lines [llength $rawLogList]

  for {set a 0} {$a  $lines} {incr a} {
set line [lindex $rawLogList $a]

# The log for a certain file and version starts with
#Working file: filename
# The is our tag for a new entry into our database. First we just
# store filename in fname
if {[regexp {^Working file: ([^,]+)} $line null fname]} {

  # we don't care about ourselves
  if {![string compare $CLog_fname $fname]} {
# skip all the way forward to the next
while {$a  $lines} {
  if {[regexp {^==} [lindex $rawLogList $a]]} {break} {incr a}
}
  }
  continue
}

# A line like
#   date: date time ...
# follows so

Re: WinCVS: proper method of submitting diffs with new files?

2000-04-06 Thread David Gravereaux

David Gravereaux [EMAIL PROTECTED] wrote:

I can't seem to get the right combination with the following scenario:

  1) I only have read access to the repository.
  2) I want to create a diff that will contain the new files along with
 diffs against the modified ones to email to the maintainer.

never mind.  I figured it out.  Here's the macro to do it.
--
* David Gravereaux *
Tomahawk Software Group

If knowlege is power, how come the more I learn, the more I realize how much I don't 
know?
That isn't very empowering.


#!CVSGUI1.0 --selection  --name "Prepare patch from [pwd]"
# 
#  prep_patch.tcl  --
#
#  A macro for WinCVS to generate error-free(tm) diffs all set to
#  email the maintainer of the module.
#
#  New files are diff'ed against a nul target to make a pure add
#  difference with an external diff program.  Modified repository
#  files are diff'd with CVS.  Paths are modified in the patchfile
#  to ensure patch.exe understands what goes where without error.
#
#  The directory patch.txt is written to coresponds (exactly) to the
#  directory patch.exe should be run by the maintainer and will only
#  require 2 switches:
#
#C:\Some\Path\To\A\CVSWorkingCopy\ patch.exe -c  patch.txt
#  or   "   patch.exe -c -i patch.txt
#
#  you may even drop -c if you want.
#
#  UNIX users of patch.txt may need to correct for EOL or add
#  --ignore-whitespace to the patch commandline.
#
#  author: David Gravereaux [EMAIL PROTECTED]  3:36 PM 4/6/2000
#
#  RCS: @(#) $Id: prep_patch.tcl,v 1.4 2000/04/07 02:49:27 davygrvy Exp $
# 

set newFiles [list]
set cvsFiles [list]
set root [pwd]
set outFile [file join $root patch.txt]

# diff.exe included with WinCVS 1.1b12 is broken.
# It crashes with the -N switch and nul as target1.
# ex.  c:\ diff -c -N nul somefile.c  patchfile
#
# WinCVS's patch.exe is even more screwed, too.
#
set ourDiffApp "C:/cygnus/cygwin-b20/H-i586-cygwin32/bin/diff.exe"


proc iterate {dirName relativeDir {ignoreFile ""}} {
  global newFiles cvsFiles
  set toRecurse [list]

  cvsentries $dirName browsit

  foreach file [browsit get] {
browsit info $file fileInfo

# an odd form of mental logic tells me that if a .cvsignore
# file exists and is not under version control, we would not
# want to diff it with this script.
#
if {![string compare $fileInfo(kind) "file"] 
!$fileInfo(ignored)  
[string compare $ignoreFile $fileInfo(name)] != 0} {

  if {$fileInfo(modified)} {
lappend cvsFiles [file join $relativeDir $fileInfo(name)]
  } elseif {$fileInfo(unknown)  [string compare $fileInfo(name) ".cvsignore"] != 
0} {
lappend newFiles [file join $relativeDir $fileInfo(name)]
  }
}

if {![string compare $fileInfo(kind) "folder"] 
!$fileInfo(missing) 
!$fileInfo(ignored)} {
  lappend toRecurse [list $file [file join $relativeDir $fileInfo(name)]]
}
  }

  foreach dir $toRecurse {
set cmdline "iterate $dir"
eval $cmdline
  }
}


proc diffNEW {fileName} {
  global ourDiffApp out
  set lines [list]
  set diffPipe [open "|$ourDiffApp -c -N nul $fileName" r]
  fconfigure $diffPipe -buffering line
  while {![eof $diffPipe]} {
lappend lines [gets $diffPipe]
  }

  # diff.exe returns an errorcode.  Ignore it with catch.
  catch {close $diffPipe}

  if {[llength $lines] == 2} {
# must have been a binary file by accident...
return
  }

  cvsout "  Added: $fileName\n"
  set lines [lreplace $lines 0 0 "*** [lindex [lindex $lines 1] 1]\tWed Dec 31 
14:00:00 1969"]

  foreach line $lines {
puts $out $line
  }
  flush $out
}


proc diffCVS {fileName} {
  global out
  set lines [list]
  set diffPipe [open "|cvs.exe diff -c $fileName" r]
  fconfigure $diffPipe -buffering line
  while {![eof $diffPipe]} {
lappend lines [gets $diffPipe]
  }
  catch {close $diffPipe}

  cvsout "  Added: $fileName\n"

  # strip most of the header 'cause it's junk.
  set lines [lreplace $lines 0 4]

  # replace the filenames with the relative path one.
  # the form is: "*** filename\ttimestamp[\trevision]
  #
  set f_t_rList1 [split [lindex $lines 0] \t]
  set firstline  "*** [join [lreplace $f_t_rList1 0 0 $fileName] \t]"

  set f_t_rList2 [split [lindex $lines 1] \t]
  set secondline "--- [join [lreplace $f_t_rList2 0 0 $fileName] \t]"

  set lines [lreplace $lines 0 1 $firstline $secondline]

  # write it out.
  foreach line $lines {
puts $out $line
  }
  flush $out
}

cvsout "Iterating directories...\n"
iterate $root "" [file tail $outFile]

cd $root
set out [open $outFile w]

cvsout "Diff'ing new files locally...\n"
foreach newFile $newFiles {
  diffNEW $newFile
}

cvsout "Diff'ing modified files...\n"
foreach cvsFile $cvsFiles {
  diffCVS $cvsFile
}
close $out

cvsout "$outFile created. Done!\n"