You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by da...@apache.org on 2002/06/18 02:10:58 UTC
cvs commit: tcl-rivet cvsversion.tcl ChangeLog
davidw 2002/06/17 17:10:58
Modified: . ChangeLog
Added: . cvsversion.tcl
Log:
* cvsversion.tcl: Added tool to manage version numbers based on CVS
changes.
Revision Changes Path
1.59 +5 -0 tcl-rivet/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /home/cvs/tcl-rivet/ChangeLog,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- ChangeLog 17 Jun 2002 21:19:43 -0000 1.58
+++ ChangeLog 18 Jun 2002 00:10:58 -0000 1.59
@@ -1,3 +1,8 @@
+2002-06-18 David N. Welton <da...@dedasys.com>
+
+ * cvsversion.tcl: Added tool to manage version numbers based on
+ CVS changes.
+
2002-06-17 David N. Welton <da...@dedasys.com>
* src/make.tcl: Updated build scripts to build the HTML
1.1 tcl-rivet/cvsversion.tcl
Index: cvsversion.tcl
===================================================================
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
# By David N. Welton <da...@dedasys.com>
# $Id: cvsversion.tcl,v 1.1 2002/06/18 00:10:58 davidw Exp $
# This is to generate new versions based on CVS information.
set newversionvar 0
proc newversion { } {
global newversionvar
puts stderr "New version"
set newversionvar 1
}
proc diffentries { {dir .} } {
global newversionvar
set CVSEntries [file join . CVS Entries]
set OldEntries [file join . .OLDEntries]
puts stderr "Diffentries for $dir"
set currentdir [pwd]
cd $dir
if { ! [file exists $CVSEntries] } {
puts stderr "You must be in a directory with a path to ./CVS/Entries."
}
if { ! [file exists $OldEntries] } {
puts stderr "No OLDEntries file. It will be created."
set fl [open $OldEntries w]
close $fl
}
set entries [open $CVSEntries]
set blob ""
while { [gets $entries ln] != -1 } {
lappend blob $ln
}
close $entries
set oldentries [open $OldEntries]
set blob2 ""
while { [gets $oldentries ln] != -1 } {
lappend blob2 $ln
}
close $oldentries
if { $blob != $blob2 } {
newversion
}
foreach ln $blob {
# the regexp below scans for directories in CVS Entries files
if { [regexp {^D/(.*)////$} "$ln" match dir] } {
diffentries $dir
}
}
file copy -force $CVSEntries $OldEntries
cd $currentdir
}
proc main {} {
global newversionvar
diffentries
if { $newversionvar == 0 } {
puts stderr "No changes, exiting."
} else {
if { [file exists VERSION] } {
set versionfile [open VERSION "r"]
gets $versionfile versionstring
close $versionfile
} else {
set versionstring "0.0.0"
}
if { ! [regexp {([0-9]+)\.([0-9]+)\.([0-9]+)} $versionstring match major minor point] } {
puts stderr "Problem with versionstring '$versionstring', exiting"
exit 1
}
set versionfile [ open VERSION "w" ]
while { 1 } {
puts -nonewline stderr "Current version: $major.$minor.$point. "
puts -nonewline stderr {Increment [M]ajor, m[I]nor, [P]oint release, or [A]bort? >>> }
gets stdin answer
switch [string tolower $answer] {
m {
incr major
set minor 0
set point 0
break
}
i {
incr minor
set point 0
break
}
p {
incr point
break
}
a {
puts stderr "Aborted"
break
}
}
}
puts $versionfile "$major.$minor.$point"
close $versionfile
puts stderr "Done, version is $major.$minor.$point"
}
}
main
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org